fix a ton more errors in the interface code, including all the -Wreorder ones

This commit is contained in:
jacob1 2015-01-16 19:58:39 -05:00
parent 54d985f975
commit efd69b208d
50 changed files with 301 additions and 299 deletions

View File

@ -936,7 +936,7 @@ retry:
memset(map, 0, 62*sizeof(int)); memset(map, 0, 62*sizeof(int));
for (i=0; names[i]; i++) for (i=0; names[i]; i++)
{ {
for (unsigned int j=0; j<plens[i]-blen; j++) for (size_t j=0; j<plens[i]-blen; j++)
if (!blen || !memcmp(parts[i]+j, boundary, blen)) if (!blen || !memcmp(parts[i]+j, boundary, blen))
{ {
ch = parts[i][j+blen]; ch = parts[i][j+blen];

View File

@ -39,14 +39,14 @@ std::string ConsoleController::FormatCommand(std::string command)
void ConsoleController::NextCommand() void ConsoleController::NextCommand()
{ {
int cIndex = consoleModel->GetCurrentCommandIndex(); size_t cIndex = consoleModel->GetCurrentCommandIndex();
if(cIndex < consoleModel->GetPreviousCommands().size()) if (cIndex < consoleModel->GetPreviousCommands().size())
consoleModel->SetCurrentCommandIndex(cIndex+1); consoleModel->SetCurrentCommandIndex(cIndex+1);
} }
void ConsoleController::PreviousCommand() void ConsoleController::PreviousCommand()
{ {
int cIndex = consoleModel->GetCurrentCommandIndex(); size_t cIndex = consoleModel->GetCurrentCommandIndex();
if(cIndex > 0) if(cIndex > 0)
consoleModel->SetCurrentCommandIndex(cIndex-1); consoleModel->SetCurrentCommandIndex(cIndex-1);
} }

View File

@ -19,12 +19,12 @@ void ConsoleModel::AddObserver(ConsoleView * observer)
observer->NotifyPreviousCommandsChanged(this); observer->NotifyPreviousCommandsChanged(this);
} }
int ConsoleModel::GetCurrentCommandIndex() size_t ConsoleModel::GetCurrentCommandIndex()
{ {
return currentCommandIndex; return currentCommandIndex;
} }
void ConsoleModel::SetCurrentCommandIndex(int index) void ConsoleModel::SetCurrentCommandIndex(size_t index)
{ {
currentCommandIndex = index; currentCommandIndex = index;
notifyCurrentCommandChanged(); notifyCurrentCommandChanged();
@ -55,7 +55,7 @@ std::deque<ConsoleCommand> ConsoleModel::GetPreviousCommands()
void ConsoleModel::notifyPreviousCommandsChanged() void ConsoleModel::notifyPreviousCommandsChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyPreviousCommandsChanged(this); observers[i]->NotifyPreviousCommandsChanged(this);
} }
@ -63,7 +63,7 @@ void ConsoleModel::notifyPreviousCommandsChanged()
void ConsoleModel::notifyCurrentCommandChanged() void ConsoleModel::notifyCurrentCommandChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyCurrentCommandChanged(this); observers[i]->NotifyCurrentCommandChanged(this);
} }

View File

@ -8,14 +8,14 @@
class ConsoleView; class ConsoleView;
class ConsoleModel { class ConsoleModel {
int currentCommandIndex; size_t currentCommandIndex;
std::vector<ConsoleView*> observers; std::vector<ConsoleView*> observers;
std::deque<ConsoleCommand> previousCommands; std::deque<ConsoleCommand> previousCommands;
void notifyPreviousCommandsChanged(); void notifyPreviousCommandsChanged();
void notifyCurrentCommandChanged(); void notifyCurrentCommandChanged();
public: public:
int GetCurrentCommandIndex(); size_t GetCurrentCommandIndex();
void SetCurrentCommandIndex(int index); void SetCurrentCommandIndex(size_t index);
ConsoleCommand GetCurrentCommand(); ConsoleCommand GetCurrentCommand();
std::deque<ConsoleCommand> GetPreviousCommands(); std::deque<ConsoleCommand> GetPreviousCommands();

View File

@ -55,7 +55,7 @@ void ConsoleView::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, b
void ConsoleView::NotifyPreviousCommandsChanged(ConsoleModel * sender) void ConsoleView::NotifyPreviousCommandsChanged(ConsoleModel * sender)
{ {
for(int i = 0; i < commandList.size(); i++) for (size_t i = 0; i < commandList.size(); i++)
{ {
RemoveComponent(commandList[i]); RemoveComponent(commandList[i]);
delete commandList[i]; delete commandList[i];

View File

@ -23,9 +23,9 @@ public:
ElementSearchActivity::ElementSearchActivity(GameController * gameController, std::vector<Tool*> tools) : ElementSearchActivity::ElementSearchActivity(GameController * gameController, std::vector<Tool*> tools) :
WindowActivity(ui::Point(-1, -1), ui::Point(236, 302)), WindowActivity(ui::Point(-1, -1), ui::Point(236, 302)),
firstResult(NULL),
gameController(gameController), gameController(gameController),
tools(tools), tools(tools),
firstResult(NULL),
exit(false) exit(false)
{ {
ui::Label * title = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "Element Search"); ui::Label * title = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "Element Search");

View File

@ -204,19 +204,19 @@ void FileBrowserActivity::RenameSave(SaveFile * file)
void FileBrowserActivity::loadDirectory(std::string directory, std::string search) void FileBrowserActivity::loadDirectory(std::string directory, std::string search)
{ {
for(int i = 0; i < components.size(); i++) for (size_t i = 0; i < components.size(); i++)
{ {
RemoveComponent(components[i]); RemoveComponent(components[i]);
itemList->RemoveChild(components[i]); itemList->RemoveChild(components[i]);
} }
for(std::vector<ui::Component*>::iterator iter = componentsQueue.begin(), end = componentsQueue.end(); iter != end; ++iter) for (std::vector<ui::Component*>::iterator iter = componentsQueue.begin(), end = componentsQueue.end(); iter != end; ++iter)
{ {
delete *iter; delete *iter;
} }
componentsQueue.clear(); componentsQueue.clear();
for(std::vector<SaveFile*>::iterator iter = files.begin(), end = files.end(); iter != end; ++iter) for (std::vector<SaveFile*>::iterator iter = files.begin(), end = files.end(); iter != end; ++iter)
{ {
delete *iter; delete *iter;
} }
@ -239,12 +239,12 @@ void FileBrowserActivity::NotifyDone(Task * task)
totalFiles = files.size(); totalFiles = files.size();
delete loadFiles; delete loadFiles;
loadFiles = NULL; loadFiles = NULL;
if(!files.size()) if (!files.size())
{ {
progressBar->Visible = false; progressBar->Visible = false;
infoText->Visible = true; infoText->Visible = true;
} }
for(int i = 0; i < components.size(); i++) for (size_t i = 0; i < components.size(); i++)
{ {
delete components[i]; delete components[i];
} }
@ -253,7 +253,7 @@ void FileBrowserActivity::NotifyDone(Task * task)
void FileBrowserActivity::OnMouseDown(int x, int y, unsigned button) void FileBrowserActivity::OnMouseDown(int x, int y, unsigned button)
{ {
if(!(x > Position.X && y > Position.Y && y < Position.Y+Size.Y && x < Position.X+Size.X)) //Clicked outside window if (!(x > Position.X && y > Position.Y && y < Position.Y+Size.Y && x < Position.X+Size.X)) //Clicked outside window
Exit(); Exit();
} }

View File

@ -119,18 +119,18 @@ public:
}; };
GameController::GameController(): GameController::GameController():
firstTick(true),
foundSign(NULL),
activePreview(NULL),
search(NULL), search(NULL),
renderOptions(NULL), renderOptions(NULL),
loginWindow(NULL), loginWindow(NULL),
console(NULL), console(NULL),
tagsWindow(NULL), tagsWindow(NULL),
options(NULL),
activePreview(NULL),
localBrowser(NULL), localBrowser(NULL),
foundSign(NULL), options(NULL),
HasDone(false), debugFlags(0),
firstTick(true), HasDone(false)
debugFlags(0)
{ {
gameView = new GameView(); gameView = new GameView();
gameModel = new GameModel(); gameModel = new GameModel();
@ -583,7 +583,7 @@ bool GameController::MouseDown(int x, int y, unsigned button)
ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y)); ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y));
x = point.X; x = point.X;
y = point.Y; y = point.Y;
if (gameModel->GetActiveTool(0) && gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking if (!gameModel->GetActiveTool(0) || gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking
{ {
foundSign = GetSignAt(x, y); foundSign = GetSignAt(x, y);
if(foundSign && splitsign(foundSign->text.c_str())) if(foundSign && splitsign(foundSign->text.c_str()))
@ -601,7 +601,7 @@ bool GameController::MouseUp(int x, int y, unsigned button)
ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y)); ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y));
x = point.X; x = point.X;
y = point.Y; y = point.Y;
if (gameModel->GetActiveTool(0) && gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking if (!gameModel->GetActiveTool(0) || gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking
{ {
sign * foundSign = GetSignAt(x, y); sign * foundSign = GetSignAt(x, y);
if(foundSign) { if(foundSign) {
@ -1455,7 +1455,7 @@ void GameController::NotifyNewNotification(Client * sender, std::pair<std::strin
{ {
std::string link; std::string link;
public: public:
LinkNotification(std::string link_, std::string message) : link(link_), Notification(message) {} LinkNotification(std::string link_, std::string message) : Notification(message), link(link_) {}
virtual ~LinkNotification() {} virtual ~LinkNotification() {}
virtual void Action() virtual void Action()
@ -1485,7 +1485,7 @@ void GameController::NotifyUpdateAvailable(Client * sender)
{ {
GameController * c; GameController * c;
public: public:
UpdateNotification(GameController * c, std::string message) : c(c), Notification(message) {} UpdateNotification(GameController * c, std::string message) : Notification(message), c(c) {}
virtual ~UpdateNotification() {} virtual ~UpdateNotification() {}
virtual void Action() virtual void Action()

View File

@ -29,9 +29,7 @@ class ConsoleController;
class GameController: public ClientListener class GameController: public ClientListener
{ {
private: private:
//Simulation * sim;
bool firstTick; bool firstTick;
int screenshotIndex;
sign * foundSign; sign * foundSign;
PreviewController * activePreview; PreviewController * activePreview;

View File

@ -19,19 +19,17 @@
#include "Format.h" #include "Format.h"
GameModel::GameModel(): GameModel::GameModel():
sim(NULL),
ren(NULL),
currentBrush(0),
currentUser(0, ""),
currentSave(NULL),
currentFile(NULL),
colourSelector(false),
clipboard(NULL), clipboard(NULL),
placeSave(NULL), placeSave(NULL),
colour(255, 0, 0, 255),
toolStrength(1.0f),
activeColourPreset(-1),
activeMenu(-1), activeMenu(-1),
currentBrush(0),
currentSave(NULL),
currentFile(NULL),
currentUser(0, ""),
toolStrength(1.0f),
activeColourPreset(0),
colourSelector(false),
colour(255, 0, 0, 255),
edgeMode(0) edgeMode(0)
{ {
sim = new Simulation(); sim = new Simulation();
@ -104,7 +102,7 @@ GameModel::GameModel():
//Load more from brushes folder //Load more from brushes folder
std::vector<string> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb"); std::vector<string> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb");
for(int i = 0; i < brushFiles.size(); i++) for (size_t i = 0; i < brushFiles.size(); i++)
{ {
std::vector<unsigned char> brushData = Client::Ref().ReadFile(brushFiles[i]); std::vector<unsigned char> brushData = Client::Ref().ReadFile(brushFiles[i]);
if(!brushData.size()) if(!brushData.size())
@ -112,8 +110,8 @@ GameModel::GameModel():
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl; std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl;
continue; continue;
} }
int dimension = std::sqrt((float)brushData.size()); size_t dimension = std::sqrt((float)brushData.size());
if(dimension * dimension != brushData.size()) if (dimension * dimension != brushData.size())
{ {
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl; std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl;
continue; continue;
@ -164,15 +162,15 @@ GameModel::~GameModel()
Client::Ref().SetPref("Decoration.Blue", (int)colour.Blue); Client::Ref().SetPref("Decoration.Blue", (int)colour.Blue);
Client::Ref().SetPref("Decoration.Alpha", (int)colour.Alpha); Client::Ref().SetPref("Decoration.Alpha", (int)colour.Alpha);
for(int i = 0; i < menuList.size(); i++) for (size_t i = 0; i < menuList.size(); i++)
{ {
delete menuList[i]; delete menuList[i];
} }
for(std::vector<Tool*>::iterator iter = extraElementTools.begin(), end = extraElementTools.end(); iter != end; ++iter) for (std::vector<Tool*>::iterator iter = extraElementTools.begin(), end = extraElementTools.end(); iter != end; ++iter)
{ {
delete *iter; delete *iter;
} }
for(int i = 0; i < brushList.size(); i++) for (size_t i = 0; i < brushList.size(); i++)
{ {
delete brushList[i]; delete brushList[i];
} }
@ -306,7 +304,7 @@ void GameModel::BuildMenus()
} }
//Build menu for tools //Build menu for tools
for(int i = 0; i < sim->tools.size(); i++) for (size_t i = 0; i < sim->tools.size(); i++)
{ {
Tool * tempTool; Tool * tempTool;
tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour), sim->tools[i]->Identifier); tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour), sim->tools[i]->Identifier);
@ -752,10 +750,10 @@ int GameModel::GetZoomFactor()
return ren->ZFACTOR; return ren->ZFACTOR;
} }
void GameModel::SetActiveColourPreset(int preset) void GameModel::SetActiveColourPreset(size_t preset)
{ {
if (activeColourPreset != preset) if (activeColourPreset-1 != preset)
activeColourPreset = preset; activeColourPreset = preset+1;
else else
{ {
activeTools[0] = GetToolFromIdentifier("DEFAULT_DECOR_SET"); activeTools[0] = GetToolFromIdentifier("DEFAULT_DECOR_SET");
@ -764,16 +762,16 @@ void GameModel::SetActiveColourPreset(int preset)
notifyColourActivePresetChanged(); notifyColourActivePresetChanged();
} }
int GameModel::GetActiveColourPreset() size_t GameModel::GetActiveColourPreset()
{ {
return activeColourPreset; return activeColourPreset-1;
} }
void GameModel::SetPresetColour(ui::Colour colour) void GameModel::SetPresetColour(ui::Colour colour)
{ {
if(activeColourPreset >= 0 && activeColourPreset < colourPresets.size()) if (activeColourPreset > 0 && activeColourPreset <= colourPresets.size())
{ {
colourPresets[activeColourPreset] = colour; colourPresets[activeColourPreset-1] = colour;
notifyColourPresetsChanged(); notifyColourPresetsChanged();
} }
} }
@ -802,7 +800,7 @@ void GameModel::SetColourSelectorColour(ui::Colour colour_)
colour = colour_; colour = colour_;
vector<Tool*> tools = GetMenuList()[SC_DECO]->GetToolList(); vector<Tool*> tools = GetMenuList()[SC_DECO]->GetToolList();
for(int i = 0; i < tools.size(); i++) for (size_t i = 0; i < tools.size(); i++)
{ {
((DecorationTool*)tools[i])->Red = colour.Red; ((DecorationTool*)tools[i])->Red = colour.Red;
((DecorationTool*)tools[i])->Green = colour.Green; ((DecorationTool*)tools[i])->Green = colour.Green;
@ -999,7 +997,7 @@ std::string GameModel::GetInfoTip()
void GameModel::notifyNotificationsChanged() void GameModel::notifyNotificationsChanged()
{ {
for(std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter) for (std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter)
{ {
(*iter)->NotifyNotificationsChanged(this); (*iter)->NotifyNotificationsChanged(this);
} }
@ -1007,7 +1005,7 @@ void GameModel::notifyNotificationsChanged()
void GameModel::notifyColourPresetsChanged() void GameModel::notifyColourPresetsChanged()
{ {
for(std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter) for (std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter)
{ {
(*iter)->NotifyColourPresetsChanged(this); (*iter)->NotifyColourPresetsChanged(this);
} }
@ -1015,7 +1013,7 @@ void GameModel::notifyColourPresetsChanged()
void GameModel::notifyColourActivePresetChanged() void GameModel::notifyColourActivePresetChanged()
{ {
for(std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter) for (std::vector<GameView*>::iterator iter = observers.begin(); iter != observers.end(); ++iter)
{ {
(*iter)->NotifyColourActivePresetChanged(this); (*iter)->NotifyColourActivePresetChanged(this);
} }
@ -1023,7 +1021,7 @@ void GameModel::notifyColourActivePresetChanged()
void GameModel::notifyColourSelectorColourChanged() void GameModel::notifyColourSelectorColourChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyColourSelectorColourChanged(this); observers[i]->NotifyColourSelectorColourChanged(this);
} }
@ -1031,7 +1029,7 @@ void GameModel::notifyColourSelectorColourChanged()
void GameModel::notifyColourSelectorVisibilityChanged() void GameModel::notifyColourSelectorVisibilityChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyColourSelectorVisibilityChanged(this); observers[i]->NotifyColourSelectorVisibilityChanged(this);
} }
@ -1039,7 +1037,7 @@ void GameModel::notifyColourSelectorVisibilityChanged()
void GameModel::notifyRendererChanged() void GameModel::notifyRendererChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyRendererChanged(this); observers[i]->NotifyRendererChanged(this);
} }
@ -1047,7 +1045,7 @@ void GameModel::notifyRendererChanged()
void GameModel::notifySaveChanged() void GameModel::notifySaveChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifySaveChanged(this); observers[i]->NotifySaveChanged(this);
} }
@ -1055,7 +1053,7 @@ void GameModel::notifySaveChanged()
void GameModel::notifySimulationChanged() void GameModel::notifySimulationChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifySimulationChanged(this); observers[i]->NotifySimulationChanged(this);
} }
@ -1063,7 +1061,7 @@ void GameModel::notifySimulationChanged()
void GameModel::notifyPausedChanged() void GameModel::notifyPausedChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyPausedChanged(this); observers[i]->NotifyPausedChanged(this);
} }
@ -1071,7 +1069,7 @@ void GameModel::notifyPausedChanged()
void GameModel::notifyDecorationChanged() void GameModel::notifyDecorationChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
//observers[i]->NotifyPausedChanged(this); //observers[i]->NotifyPausedChanged(this);
} }
@ -1079,7 +1077,7 @@ void GameModel::notifyDecorationChanged()
void GameModel::notifyBrushChanged() void GameModel::notifyBrushChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyBrushChanged(this); observers[i]->NotifyBrushChanged(this);
} }
@ -1087,7 +1085,7 @@ void GameModel::notifyBrushChanged()
void GameModel::notifyMenuListChanged() void GameModel::notifyMenuListChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyMenuListChanged(this); observers[i]->NotifyMenuListChanged(this);
} }
@ -1095,7 +1093,7 @@ void GameModel::notifyMenuListChanged()
void GameModel::notifyToolListChanged() void GameModel::notifyToolListChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyToolListChanged(this); observers[i]->NotifyToolListChanged(this);
} }
@ -1103,7 +1101,7 @@ void GameModel::notifyToolListChanged()
void GameModel::notifyActiveToolsChanged() void GameModel::notifyActiveToolsChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyActiveToolsChanged(this); observers[i]->NotifyActiveToolsChanged(this);
} }
@ -1111,7 +1109,7 @@ void GameModel::notifyActiveToolsChanged()
void GameModel::notifyUserChanged() void GameModel::notifyUserChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyUserChanged(this); observers[i]->NotifyUserChanged(this);
} }
@ -1119,7 +1117,7 @@ void GameModel::notifyUserChanged()
void GameModel::notifyZoomChanged() void GameModel::notifyZoomChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyZoomChanged(this); observers[i]->NotifyZoomChanged(this);
} }
@ -1127,7 +1125,7 @@ void GameModel::notifyZoomChanged()
void GameModel::notifyPlaceSaveChanged() void GameModel::notifyPlaceSaveChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyPlaceSaveChanged(this); observers[i]->NotifyPlaceSaveChanged(this);
} }
@ -1135,7 +1133,7 @@ void GameModel::notifyPlaceSaveChanged()
void GameModel::notifyLogChanged(string entry) void GameModel::notifyLogChanged(string entry)
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyLogChanged(this, entry); observers[i]->NotifyLogChanged(this, entry);
} }
@ -1143,7 +1141,7 @@ void GameModel::notifyLogChanged(string entry)
void GameModel::notifyInfoTipChanged() void GameModel::notifyInfoTipChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyInfoTipChanged(this); observers[i]->NotifyInfoTipChanged(this);
} }
@ -1151,7 +1149,7 @@ void GameModel::notifyInfoTipChanged()
void GameModel::notifyToolTipChanged() void GameModel::notifyToolTipChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyToolTipChanged(this); observers[i]->NotifyToolTipChanged(this);
} }
@ -1159,7 +1157,7 @@ void GameModel::notifyToolTipChanged()
void GameModel::notifyQuickOptionsChanged() void GameModel::notifyQuickOptionsChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyQuickOptionsChanged(this); observers[i]->NotifyQuickOptionsChanged(this);
} }
@ -1167,7 +1165,7 @@ void GameModel::notifyQuickOptionsChanged()
void GameModel::notifyLastToolChanged() void GameModel::notifyLastToolChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifyLastToolChanged(this); observers[i]->NotifyLastToolChanged(this);
} }

View File

@ -49,6 +49,8 @@ private:
//Tools that are present in elementTools, but don't have an associated menu and need to be freed manually //Tools that are present in elementTools, but don't have an associated menu and need to be freed manually
vector<Tool*> extraElementTools; vector<Tool*> extraElementTools;
Simulation * sim;
Renderer * ren;
vector<Menu*> menuList; vector<Menu*> menuList;
vector<QuickOption*> quickOptions; vector<QuickOption*> quickOptions;
int activeMenu; int activeMenu;
@ -56,8 +58,6 @@ private:
vector<Brush *> brushList; vector<Brush *> brushList;
SaveInfo * currentSave; SaveInfo * currentSave;
SaveFile * currentFile; SaveFile * currentFile;
Simulation * sim;
Renderer * ren;
Tool * lastTool; Tool * lastTool;
Tool ** activeTools; Tool ** activeTools;
Tool * decoToolset[4]; Tool * decoToolset[4];
@ -66,7 +66,7 @@ private:
float toolStrength; float toolStrength;
std::deque<Snapshot*> history; std::deque<Snapshot*> history;
int activeColourPreset; size_t activeColourPreset;
std::vector<ui::Colour> colourPresets; std::vector<ui::Colour> colourPresets;
bool colourSelector; bool colourSelector;
ui::Colour colour; ui::Colour colour;
@ -106,8 +106,8 @@ public:
void SetEdgeMode(int edgeMode); void SetEdgeMode(int edgeMode);
int GetEdgeMode(); int GetEdgeMode();
void SetActiveColourPreset(int preset); void SetActiveColourPreset(size_t preset);
int GetActiveColourPreset(); size_t GetActiveColourPreset();
void SetPresetColour(ui::Colour colour); void SetPresetColour(ui::Colour colour);

View File

@ -41,10 +41,10 @@ private:
public: public:
SplitButton(ui::Point position, ui::Point size, std::string buttonText, std::string toolTip, std::string toolTip2, int split) : SplitButton(ui::Point position, ui::Point size, std::string buttonText, std::string toolTip, std::string toolTip2, int split) :
Button(position, size, buttonText, toolTip), Button(position, size, buttonText, toolTip),
toolTip2(toolTip2), showSplit(true),
splitPosition(split), splitPosition(split),
splitActionCallback(NULL), toolTip2(toolTip2),
showSplit(true) splitActionCallback(NULL)
{ {
} }
@ -150,51 +150,54 @@ public:
GameView::GameView(): GameView::GameView():
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
pointQueue(queue<ui::Point>()),
isMouseDown(false), isMouseDown(false),
ren(NULL),
activeBrush(NULL),
currentMouse(0, 0),
toolIndex(0),
zoomEnabled(false), zoomEnabled(false),
zoomCursorFixed(false), zoomCursorFixed(false),
mouseInZoom(false), mouseInZoom(false),
drawPoint1(0, 0),
drawPoint2(0, 0),
drawMode(DrawPoints),
drawModeReset(false),
selectMode(SelectNone),
selectPoint1(0, 0),
selectPoint2(0, 0),
placeSaveThumb(NULL),
mousePosition(0, 0),
lastOffset(0),
drawSnap(false), drawSnap(false),
toolTip(""),
infoTip(""),
infoTipPresence(0),
buttonTipShow(0),
isToolTipFadingIn(false),
isButtonTipFadingIn(false),
toolTipPosition(-1, -1),
saveSimulationButtonEnabled(false),
shiftBehaviour(false), shiftBehaviour(false),
ctrlBehaviour(false), ctrlBehaviour(false),
altBehaviour(false), altBehaviour(false),
showHud(true), showHud(true),
showDebug(false), showDebug(false),
introText(2048),
introTextMessage(introTextData),
wallBrush(false), wallBrush(false),
toolBrush(false), toolBrush(false),
windTool(false), windTool(false),
toolIndex(0),
currentSaveType(0),
lastMenu(-1),
toolTipPresence(0),
toolTip(""),
isToolTipFadingIn(false),
toolTipPosition(-1, -1),
infoTipPresence(0),
infoTip(""),
buttonTipShow(0),
buttonTip(""),
isButtonTipFadingIn(false),
introText(2048),
introTextMessage(introTextData),
doScreenshot(false), doScreenshot(false),
recording(false), recording(false),
screenshotIndex(0), screenshotIndex(0),
recordingIndex(0), recordingIndex(0),
toolTipPresence(0), pointQueue(queue<ui::Point>()),
currentSaveType(0), ren(NULL),
lastMenu(-1) activeBrush(NULL),
saveSimulationButtonEnabled(false),
drawMode(DrawPoints),
drawModeReset(false),
drawPoint1(0, 0),
drawPoint2(0, 0),
selectMode(SelectNone),
selectPoint1(0, 0),
selectPoint2(0, 0),
currentMouse(0, 0),
mousePosition(0, 0),
placeSaveThumb(NULL),
lastOffset(0)
{ {
int currentX = 1; int currentX = 1;
@ -513,6 +516,9 @@ public:
case QuickOption::Toggle: case QuickOption::Toggle:
button->SetTogglable(true); button->SetTogglable(true);
button->SetToggleState(option->GetToggle()); button->SetToggleState(option->GetToggle());
break;
default:
break;
} }
} }
}; };
@ -536,7 +542,7 @@ public:
void GameView::NotifyQuickOptionsChanged(GameModel * sender) void GameView::NotifyQuickOptionsChanged(GameModel * sender)
{ {
for(int i = 0; i < quickOptionButtons.size(); i++) for (size_t i = 0; i < quickOptionButtons.size(); i++)
{ {
RemoveComponent(quickOptionButtons[i]); RemoveComponent(quickOptionButtons[i]);
delete quickOptionButtons[i]; delete quickOptionButtons[i];
@ -562,20 +568,20 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender)
void GameView::NotifyMenuListChanged(GameModel * sender) void GameView::NotifyMenuListChanged(GameModel * sender)
{ {
int currentY = WINDOWH-48;//-(sender->GetMenuList().size()*16); int currentY = WINDOWH-48;//-(sender->GetMenuList().size()*16);
for(int i = 0; i < menuButtons.size(); i++) for (size_t i = 0; i < menuButtons.size(); i++)
{ {
RemoveComponent(menuButtons[i]); RemoveComponent(menuButtons[i]);
delete menuButtons[i]; delete menuButtons[i];
} }
menuButtons.clear(); menuButtons.clear();
for(int i = 0; i < toolButtons.size(); i++) for (size_t i = 0; i < toolButtons.size(); i++)
{ {
RemoveComponent(toolButtons[i]); RemoveComponent(toolButtons[i]);
delete toolButtons[i]; delete toolButtons[i];
} }
toolButtons.clear(); toolButtons.clear();
vector<Menu*> menuList = sender->GetMenuList(); vector<Menu*> menuList = sender->GetMenuList();
for (int i = menuList.size()-1; i >= 0; i--) for (int i = (int)menuList.size()-1; i >= 0; i--)
{ {
std::string tempString = ""; std::string tempString = "";
tempString += menuList[i]->GetIcon(); tempString += menuList[i]->GetIcon();
@ -633,7 +639,7 @@ bool GameView::GetPlacingZoom()
void GameView::NotifyActiveToolsChanged(GameModel * sender) void GameView::NotifyActiveToolsChanged(GameModel * sender)
{ {
for(int i = 0; i < toolButtons.size(); i++) for (size_t i = 0; i < toolButtons.size(); i++)
{ {
Tool * tool = ((ToolAction*)toolButtons[i]->GetActionCallback())->tool; Tool * tool = ((ToolAction*)toolButtons[i]->GetActionCallback())->tool;
if(sender->GetActiveTool(0) == tool) if(sender->GetActiveTool(0) == tool)
@ -685,9 +691,9 @@ void GameView::NotifyToolListChanged(GameModel * sender)
{ {
lastOffset = 0; lastOffset = 0;
int currentX = WINDOWW-56; int currentX = WINDOWW-56;
for(int i = 0; i < menuButtons.size(); i++) for (size_t i = 0; i < menuButtons.size(); i++)
{ {
if(((MenuAction*)menuButtons[i]->GetActionCallback())->menuID==sender->GetActiveMenu()) if (((MenuAction*)menuButtons[i]->GetActionCallback())->menuID==sender->GetActiveMenu())
{ {
menuButtons[i]->SetToggleState(true); menuButtons[i]->SetToggleState(true);
} }
@ -696,14 +702,14 @@ void GameView::NotifyToolListChanged(GameModel * sender)
menuButtons[i]->SetToggleState(false); menuButtons[i]->SetToggleState(false);
} }
} }
for(int i = 0; i < toolButtons.size(); i++) for (size_t i = 0; i < toolButtons.size(); i++)
{ {
RemoveComponent(toolButtons[i]); RemoveComponent(toolButtons[i]);
delete toolButtons[i]; delete toolButtons[i];
} }
toolButtons.clear(); toolButtons.clear();
vector<Tool*> toolList = sender->GetToolList(); vector<Tool*> toolList = sender->GetToolList();
for(int i = 0; i < toolList.size(); i++) for (size_t i = 0; i < toolList.size(); i++)
{ {
VideoBuffer * tempTexture = toolList[i]->GetTexture(26, 14); VideoBuffer * tempTexture = toolList[i]->GetTexture(26, 14);
ToolButton * tempButton; ToolButton * tempButton;
@ -823,9 +829,9 @@ void GameView::NotifyColourPresetsChanged(GameModel * sender)
void GameView::NotifyColourActivePresetChanged(GameModel * sender) void GameView::NotifyColourActivePresetChanged(GameModel * sender)
{ {
for(int i = 0; i < colourPresets.size(); i++) for (size_t i = 0; i < colourPresets.size(); i++)
{ {
if(sender->GetActiveColourPreset() == i) if (sender->GetActiveColourPreset() == i)
{ {
colourPresets[i]->SetSelectionState(0); //Primary colourPresets[i]->SetSelectionState(0); //Primary
} }

View File

@ -33,13 +33,6 @@ class GameModel;
class GameView: public ui::Window class GameView: public ui::Window
{ {
private: private:
DrawMode drawMode;
bool doScreenshot;
bool recording;
int screenshotIndex;
int recordingIndex;
bool isMouseDown; bool isMouseDown;
bool zoomEnabled; bool zoomEnabled;
bool zoomCursorFixed; bool zoomCursorFixed;
@ -53,8 +46,6 @@ private:
bool wallBrush; bool wallBrush;
bool toolBrush; bool toolBrush;
bool windTool; bool windTool;
int introText;
std::string introTextMessage;
int toolIndex; int toolIndex;
int currentSaveType; int currentSaveType;
int lastMenu; int lastMenu;
@ -68,6 +59,13 @@ private:
int buttonTipShow; int buttonTipShow;
std::string buttonTip; std::string buttonTip;
bool isButtonTipFadingIn; bool isButtonTipFadingIn;
int introText;
std::string introTextMessage;
bool doScreenshot;
bool recording;
int screenshotIndex;
int recordingIndex;
queue<ui::Point> pointQueue; queue<ui::Point> pointQueue;
GameController * c; GameController * c;
@ -92,11 +90,11 @@ private:
ui::Button * simulationOptionButton; ui::Button * simulationOptionButton;
ui::Button * displayModeButton; ui::Button * displayModeButton;
ui::Button * pauseButton; ui::Button * pauseButton;
ui::Point currentMouse;
ui::Button * colourPicker; ui::Button * colourPicker;
vector<ToolButton*> colourPresets; vector<ToolButton*> colourPresets;
DrawMode drawMode;
bool drawModeReset; bool drawModeReset;
ui::Point drawPoint1; ui::Point drawPoint1;
ui::Point drawPoint2; ui::Point drawPoint2;
@ -105,6 +103,7 @@ private:
ui::Point selectPoint1; ui::Point selectPoint1;
ui::Point selectPoint2; ui::Point selectPoint2;
ui::Point currentMouse;
ui::Point mousePosition; ui::Point mousePosition;
VideoBuffer * placeSaveThumb; VideoBuffer * placeSaveThumb;

View File

@ -76,7 +76,7 @@ sim(sim_)
property = new ui::DropDown(ui::Point(8, 25), ui::Point(Size.X-16, 17)); property = new ui::DropDown(ui::Point(8, 25), ui::Point(Size.X-16, 17));
property->SetActionCallback(new PropertyChanged(this)); property->SetActionCallback(new PropertyChanged(this));
AddComponent(property); AddComponent(property);
for(int i = 0; i < properties.size(); i++) for (size_t i = 0; i < properties.size(); i++)
{ {
property->AddOption(std::pair<std::string, int>(properties[i].Name, i)); property->AddOption(std::pair<std::string, int>(properties[i].Name, i));
} }

View File

@ -101,11 +101,11 @@ public:
SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_): SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_):
ui::Window(ui::Point(-1, -1), ui::Point(200, 87)), ui::Window(ui::Point(-1, -1), ui::Point(200, 87)),
tool(tool_), tool(tool_),
signID(signID_),
sim(sim_),
signPosition(position_),
movingSign(NULL), movingSign(NULL),
signMoving(false) signMoving(false),
sim(sim_),
signID(signID_),
signPosition(position_)
{ {
ui::Label * messageLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "New sign"); ui::Label * messageLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "New sign");
messageLabel->SetTextColour(style::Colour::InformationTitle); messageLabel->SetTextColour(style::Colour::InformationTitle);
@ -271,9 +271,10 @@ VideoBuffer * SignTool::GetIcon(int toolID, int width, int height)
void SignTool::Click(Simulation * sim, Brush * brush, ui::Point position) void SignTool::Click(Simulation * sim, Brush * brush, ui::Point position)
{ {
int signX, signY, signW, signH, signIndex = -1; int signX, signY, signW, signH, signIndex = -1;
for(int i = 0; i < sim->signs.size(); i++){ for (size_t i = 0; i < sim->signs.size(); i++)
{
sim->signs[i].pos(sim->signs[i].getText(sim), signX, signY, signW, signH); sim->signs[i].pos(sim->signs[i].getText(sim), signX, signY, signW, signH);
if(position.X > signX && position.X < signX+signW && position.Y > signY && position.Y < signY+signH) if (position.X > signX && position.X < signX+signW && position.Y > signY && position.Y < signY+signH)
{ {
signIndex = i; signIndex = i;
break; break;

View File

@ -7,16 +7,16 @@
using namespace std; using namespace std;
Tool::Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)): Tool::Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
textureGen(textureGen),
toolID(id), toolID(id),
toolName(name), toolName(name),
toolDescription(description), toolDescription(description),
colRed(r),
colGreen(g),
colBlue(b),
textureGen(textureGen),
strength(1.0f), strength(1.0f),
resolution(1), resolution(1),
identifier(identifier) identifier(identifier),
colRed(r),
colGreen(g),
colBlue(b)
{ {
} }

View File

@ -23,6 +23,8 @@ protected:
int resolution; int resolution;
std::string identifier; std::string identifier;
public: public:
int colRed, colGreen, colBlue;
Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL); Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
int GetToolID() { return toolID; } int GetToolID() { return toolID; }
string GetName(); string GetName();
@ -39,7 +41,6 @@ public:
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false); virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2); virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position); virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
int colRed, colBlue, colGreen;
}; };
class GameModel; class GameModel;

View File

@ -4,8 +4,10 @@
namespace ui namespace ui
{ {
Appearance::Appearance(): Appearance::Appearance():
HorizontalAlign(AlignCentre), texture(NULL),
VerticalAlign(AlignMiddle), VerticalAlign(AlignMiddle),
HorizontalAlign(AlignCentre),
BackgroundHover(20, 20, 20), BackgroundHover(20, 20, 20),
BackgroundInactive(0, 0, 0), BackgroundInactive(0, 0, 0),
@ -25,10 +27,8 @@ namespace ui
Margin(1, 4), Margin(1, 4),
Border(1), Border(1),
icon(NoIcon), icon(NoIcon)
{}
texture(NULL)
{};
VideoBuffer * Appearance::GetTexture() VideoBuffer * Appearance::GetTexture()
{ {

View File

@ -14,10 +14,10 @@ namespace ui {
AvatarButton::AvatarButton(Point position, Point size, std::string username): AvatarButton::AvatarButton(Point position, Point size, std::string username):
Component(position, size), Component(position, size),
name(username),
actionCallback(NULL),
avatar(NULL), avatar(NULL),
tried(false) name(username),
tried(false),
actionCallback(NULL)
{ {
} }

View File

@ -8,14 +8,14 @@ namespace ui {
Button::Button(Point position, Point size, std::string buttonText, std::string toolTip): Button::Button(Point position, Point size, std::string buttonText, std::string toolTip):
Component(position, size), Component(position, size),
Enabled(true),
ButtonText(buttonText), ButtonText(buttonText),
isMouseInside(false), toolTip(toolTip),
isButtonDown(false), isButtonDown(false),
isMouseInside(false),
isTogglable(false), isTogglable(false),
toggle(false), toggle(false),
actionCallback(NULL), actionCallback(NULL)
Enabled(true),
toolTip(toolTip)
{ {
TextPosition(); TextPosition();
} }

View File

@ -24,7 +24,6 @@ public:
Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = "", std::string toolTip = ""); Button(Point position = Point(0, 0), Point size = Point(0, 0), std::string buttonText = "", std::string toolTip = "");
virtual ~Button(); virtual ~Button();
bool Toggleable;
bool Enabled; bool Enabled;
virtual void OnMouseClick(int x, int y, unsigned int button); virtual void OnMouseClick(int x, int y, unsigned int button);
@ -53,9 +52,9 @@ public:
void SetToolTip(std::string newToolTip) { toolTip = newToolTip; } void SetToolTip(std::string newToolTip) { toolTip = newToolTip; }
protected: protected:
std::string ButtonText;
std::string toolTip; std::string toolTip;
std::string buttonDisplayText; std::string buttonDisplayText;
std::string ButtonText;
bool isButtonDown, isAltButtonDown, state, isMouseInside, isTogglable, toggle; bool isButtonDown, isAltButtonDown, state, isMouseInside, isTogglable, toggle;
ButtonAction * actionCallback; ButtonAction * actionCallback;

View File

@ -6,8 +6,8 @@ Checkbox::Checkbox(ui::Point position, ui::Point size, std::string text, std::st
Component(position, size), Component(position, size),
text(text), text(text),
toolTip(toolTip), toolTip(toolTip),
isMouseOver(false),
checked(false), checked(false),
isMouseOver(false),
actionCallback(NULL) actionCallback(NULL)
{ {

View File

@ -12,15 +12,15 @@ using namespace ui;
Component::Component(Window* parent_state): Component::Component(Window* parent_state):
parentstate_(parent_state), parentstate_(parent_state),
_parent(NULL), _parent(NULL),
Position(Point(0,0)), drawn(false),
Size(Point(0,0)),
Locked(false),
Visible(true),
textPosition(0, 0), textPosition(0, 0),
textSize(0, 0), textSize(0, 0),
iconPosition(0, 0), iconPosition(0, 0),
drawn(false), menu(NULL),
menu(NULL) Position(Point(0,0)),
Size(Point(0,0)),
Locked(false),
Visible(true)
{ {
} }
@ -28,15 +28,15 @@ Component::Component(Window* parent_state):
Component::Component(Point position, Point size): Component::Component(Point position, Point size):
parentstate_(0), parentstate_(0),
_parent(NULL), _parent(NULL),
Position(position), drawn(false),
Size(size),
Locked(false),
Visible(true),
textPosition(0, 0), textPosition(0, 0),
textSize(0, 0), textSize(0, 0),
iconPosition(0, 0), iconPosition(0, 0),
drawn(false), menu(NULL),
menu(NULL) Position(position),
Size(size),
Locked(false),
Visible(true)
{ {
} }
@ -44,15 +44,15 @@ Component::Component(Point position, Point size):
Component::Component(): Component::Component():
parentstate_(NULL), parentstate_(NULL),
_parent(NULL), _parent(NULL),
Position(Point(0,0)), drawn(false),
Size(Point(0,0)),
Locked(false),
Visible(true),
textPosition(0, 0), textPosition(0, 0),
textSize(0, 0), textSize(0, 0),
iconPosition(0, 0), iconPosition(0, 0),
drawn(false), menu(NULL),
menu(NULL) Position(Point(0,0)),
Size(Point(0,0)),
Locked(false),
Visible(true)
{ {
} }

View File

@ -16,8 +16,8 @@ public:
ContextMenu::ContextMenu(Component * source): ContextMenu::ContextMenu(Component * source):
Window(ui::Point(0, 0), ui::Point(0, 0)), Window(ui::Point(0, 0), ui::Point(0, 0)),
Appearance(source->Appearance), source(source),
source(source) Appearance(source->Appearance)
{ {
} }

View File

@ -14,7 +14,7 @@ public:
int ID; int ID;
std::string Text; std::string Text;
bool Enabled; bool Enabled;
ContextMenuItem(std::string text, int id, bool enabled) : Text(text), ID(id), Enabled(enabled) {} ContextMenuItem(std::string text, int id, bool enabled) : ID(id), Text(text), Enabled(enabled) {}
}; };
class ContextMenu: public ui::Window, public ButtonAction { class ContextMenu: public ui::Window, public ButtonAction {

View File

@ -8,8 +8,8 @@ namespace ui {
class ItemSelectedAction; class ItemSelectedAction;
class DropDownWindow: public ui::Window { class DropDownWindow: public ui::Window {
friend class ItemSelectedAction; friend class ItemSelectedAction;
Appearance appearance;
DropDown * dropDown; DropDown * dropDown;
Appearance appearance;
std::vector<Button> buttons; std::vector<Button> buttons;
bool isMouseInside; bool isMouseInside;
public: public:

View File

@ -13,26 +13,26 @@ using namespace ui;
using namespace std; using namespace std;
Engine::Engine(): Engine::Engine():
FpsLimit(60.0f),
Scale(1),
Fullscreen(false),
FrameIndex(0),
lastBuffer(NULL),
prevBuffers(stack<pixel*>()),
windows(stack<Window*>()),
mousePositions(stack<Point>()),
state_(NULL), state_(NULL),
maxWidth(0), windowTargetPosition(0, 0),
maxHeight(0), break_(false),
FastQuit(1),
lastTick(0),
mouseb_(0), mouseb_(0),
mousex_(0), mousex_(0),
mousey_(0), mousey_(0),
mousexp_(0), mousexp_(0),
mouseyp_(0), mouseyp_(0),
FpsLimit(60.0f), maxWidth(0),
windows(stack<Window*>()), maxHeight(0)
mousePositions(stack<Point>()),
lastBuffer(NULL),
prevBuffers(stack<pixel*>()),
windowTargetPosition(0, 0),
FrameIndex(0),
Fullscreen(false),
Scale(1),
FastQuit(1),
break_(false),
lastTick(0)
{ {
} }

View File

@ -17,8 +17,7 @@ Label::Label(Point position, Point size, std::string labelText):
selectionXH(-1), selectionXH(-1),
multiline(false), multiline(false),
selecting(false), selecting(false),
autoHeight(size.Y==-1?true:false), autoHeight(size.Y==-1?true:false)
caret(-1)
{ {
menu = new ContextMenu(this); menu = new ContextMenu(this);
menu->AddItem(ContextMenuItem("Copy", 0, true)); menu->AddItem(ContextMenuItem("Copy", 0, true));

View File

@ -19,7 +19,6 @@ namespace ui
std::string text; std::string text;
Colour textColour; Colour textColour;
int caret;
int selectionIndex0; int selectionIndex0;
int selectionIndex1; int selectionIndex1;

View File

@ -5,9 +5,9 @@ using namespace ui;
ProgressBar::ProgressBar(Point position, Point size, int startProgress, std::string startStatus): ProgressBar::ProgressBar(Point position, Point size, int startProgress, std::string startStatus):
Component(position, size), Component(position, size),
progress(0),
intermediatePos(0.0f), intermediatePos(0.0f),
progressStatus(""), progressStatus("")
progress(0)
{ {
SetStatus(startStatus); SetStatus(startStatus);
SetProgress(startProgress); SetProgress(startProgress);

View File

@ -18,15 +18,15 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
file(NULL), file(NULL),
save(save), save(save),
thumbnail(NULL), thumbnail(NULL),
isMouseInside(false),
isButtonDown(false),
actionCallback(NULL),
selectable(false),
selected(false),
waitingForThumb(false), waitingForThumb(false),
isMouseInsideAuthor(false), isMouseInsideAuthor(false),
isMouseInsideHistory(false), isMouseInsideHistory(false),
showVotes(false) showVotes(false),
isButtonDown(false),
isMouseInside(false),
selected(false),
selectable(false),
actionCallback(NULL)
{ {
if(save) if(save)
{ {
@ -88,19 +88,19 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
SaveButton::SaveButton(Point position, Point size, SaveFile * file): SaveButton::SaveButton(Point position, Point size, SaveFile * file):
Component(position, size), Component(position, size),
save(NULL),
file(file), file(file),
save(NULL),
thumbnail(NULL), thumbnail(NULL),
isMouseInside(false),
isButtonDown(false),
actionCallback(NULL),
selectable(false),
selected(false),
wantsDraw(false), wantsDraw(false),
waitingForThumb(false), waitingForThumb(false),
isMouseInsideAuthor(false), isMouseInsideAuthor(false),
isMouseInsideHistory(false), isMouseInsideHistory(false),
showVotes(false) showVotes(false),
isButtonDown(false),
isMouseInside(false),
selected(false),
selectable(false),
actionCallback(NULL)
{ {
if(file) if(file)
{ {

View File

@ -5,18 +5,18 @@ using namespace ui;
ScrollPanel::ScrollPanel(Point position, Point size): ScrollPanel::ScrollPanel(Point position, Point size):
Panel(position, size), Panel(position, size),
scrollBarWidth(0),
maxOffset(0, 0), maxOffset(0, 0),
offsetX(0), offsetX(0),
offsetY(0), offsetY(0),
yScrollVel(0.0f), yScrollVel(0.0f),
xScrollVel(0.0f), xScrollVel(0.0f),
scrollBarWidth(0),
isMouseInsideScrollbar(false), isMouseInsideScrollbar(false),
isMouseInsideScrollbarArea(false), isMouseInsideScrollbarArea(false),
scrollbarClickLocation(0),
scrollbarSelected(false), scrollbarSelected(false),
scrollbarInitialYOffset(0), scrollbarInitialYOffset(0),
scrollbarInitialYClick(0) scrollbarInitialYClick(0),
scrollbarClickLocation(0)
{ {
} }

View File

@ -12,15 +12,15 @@ using namespace ui;
Textbox::Textbox(Point position, Point size, std::string textboxText, std::string textboxPlaceholder): Textbox::Textbox(Point position, Point size, std::string textboxText, std::string textboxPlaceholder):
Label(position, size, ""), Label(position, size, ""),
actionCallback(NULL), ReadOnly(false),
masked(false),
border(true),
mouseDown(false),
limit(std::string::npos),
inputType(All), inputType(All),
limit(std::string::npos),
keyDown(0), keyDown(0),
characterDown(0), characterDown(0),
ReadOnly(false) mouseDown(false),
masked(false),
border(true),
actionCallback(NULL)
{ {
placeHolder = textboxPlaceholder; placeHolder = textboxPlaceholder;

View File

@ -10,16 +10,16 @@ using namespace ui;
Window::Window(Point _position, Point _size): Window::Window(Point _position, Point _size):
Position(_position), Position(_position),
Size(_size), Size(_size),
focusedComponent_(NULL),
AllowExclusiveDrawing(true), AllowExclusiveDrawing(true),
okayButton(NULL),
cancelButton(NULL),
focusedComponent_(NULL),
#ifdef DEBUG
debugMode(false),
#endif
halt(false), halt(false),
destruct(false), destruct(false),
stop(false), stop(false)
cancelButton(NULL),
okayButton(NULL)
#ifdef DEBUG
,debugMode(false)
#endif
{ {
} }

View File

@ -102,14 +102,14 @@ enum ChromeStyle
Component* focusedComponent_; Component* focusedComponent_;
ChromeStyle chrome; ChromeStyle chrome;
#ifdef DEBUG
bool debugMode;
#endif
//These controls allow a component to call the destruction of the Window inside an event (called by the Window) //These controls allow a component to call the destruction of the Window inside an event (called by the Window)
void finalise(); void finalise();
bool halt; bool halt;
bool destruct; bool destruct;
bool stop; bool stop;
#ifdef DEBUG
bool debugMode;
#endif
}; };

View File

@ -2,8 +2,8 @@
#include "gui/dialogues/ErrorMessage.h" #include "gui/dialogues/ErrorMessage.h"
OptionsController::OptionsController(GameModel * gModel_, ControllerCallback * callback_): OptionsController::OptionsController(GameModel * gModel_, ControllerCallback * callback_):
callback(callback_),
gModel(gModel_), gModel(gModel_),
callback(callback_),
HasExited(false) HasExited(false)
{ {
view = new OptionsView(); view = new OptionsView();

View File

@ -137,7 +137,7 @@ void OptionsModel::SetShowAvatars(bool state)
void OptionsModel::notifySettingsChanged() void OptionsModel::notifySettingsChanged()
{ {
for(int i = 0; i < observers.size(); i++) for (size_t i = 0; i < observers.size(); i++)
{ {
observers[i]->NotifySettingsChanged(this); observers[i]->NotifySettingsChanged(this);
} }

View File

@ -9,10 +9,10 @@
#include "Controller.h" #include "Controller.h"
PreviewController::PreviewController(int saveID, int saveDate, bool instant, ControllerCallback * callback): PreviewController::PreviewController(int saveID, int saveDate, bool instant, ControllerCallback * callback):
HasExited(false),
saveId(saveID), saveId(saveID),
saveDate(saveDate), saveDate(saveDate),
loginWindow(NULL) loginWindow(NULL),
HasExited(false)
{ {
previewModel = new PreviewModel(); previewModel = new PreviewModel();
previewView = new PreviewView(); previewView = new PreviewView();

View File

@ -19,7 +19,7 @@ class PreviewController: public ClientListener {
ControllerCallback * callback; ControllerCallback * callback;
public: public:
virtual void NotifyAuthUserChanged(Client * sender); virtual void NotifyAuthUserChanged(Client * sender);
inline int SaveID() { return saveId; }; inline int SaveID() { return saveId; }
bool HasExited; bool HasExited;
PreviewController(int saveID, bool instant, ControllerCallback * callback); PreviewController(int saveID, bool instant, ControllerCallback * callback);

View File

@ -65,12 +65,12 @@ public:
PreviewView::PreviewView(): PreviewView::PreviewView():
ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)), ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)),
savePreview(NULL), savePreview(NULL),
doOpen(false),
addCommentBox(NULL),
submitCommentButton(NULL), submitCommentButton(NULL),
commentBoxHeight(20), addCommentBox(NULL),
doOpen(false),
showAvatars(true), showAvatars(true),
prevPage(false) prevPage(false),
commentBoxHeight(20)
{ {
class FavAction: public ui::ButtonAction class FavAction: public ui::ButtonAction
{ {

View File

@ -78,10 +78,10 @@ public:
RenderView::RenderView(): RenderView::RenderView():
ui::Window(ui::Point(0, 0), ui::Point(XRES, WINDOWH)), ui::Window(ui::Point(0, 0), ui::Point(XRES, WINDOWH)),
ren(NULL),
toolTip(""), toolTip(""),
toolTipPresence(0), toolTipPresence(0),
isToolTipFadingIn(false), isToolTipFadingIn(false)
ren(NULL)
{ {
ui::Button * presetButton; ui::Button * presetButton;
int presetButtonOffset = 375; int presetButtonOffset = 375;

View File

@ -35,8 +35,8 @@ public:
LocalSaveActivity::LocalSaveActivity(SaveFile save, FileSavedCallback * callback) : LocalSaveActivity::LocalSaveActivity(SaveFile save, FileSavedCallback * callback) :
WindowActivity(ui::Point(-1, -1), ui::Point(220, 200)), WindowActivity(ui::Point(-1, -1), ui::Point(220, 200)),
thumbnail(NULL),
save(save), save(save),
thumbnail(NULL),
callback(callback) callback(callback)
{ {
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), "Save to computer:"); ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), "Save to computer:");

View File

@ -38,10 +38,10 @@ public:
virtual ~ServerSaveActivity(); virtual ~ServerSaveActivity();
protected: protected:
virtual void NotifyDone(Task * task); virtual void NotifyDone(Task * task);
Task * saveUploadTask;
SaveUploadedCallback * callback;
SaveInfo save;
VideoBuffer * thumbnail; VideoBuffer * thumbnail;
SaveInfo save;
SaveUploadedCallback * callback;
Task * saveUploadTask;
ui::Label * titleLabel; ui::Label * titleLabel;
ui::Textbox * nameField; ui::Textbox * nameField;
ui::Textbox * descriptionField; ui::Textbox * descriptionField;

View File

@ -4,18 +4,18 @@
#include "client/Client.h" #include "client/Client.h"
SearchModel::SearchModel(): SearchModel::SearchModel():
loadedSave(NULL),
currentSort("best"), currentSort("best"),
currentPage(1),
resultCount(0),
showOwn(false), showOwn(false),
showFavourite(false), showFavourite(false),
loadedSave(NULL), showTags(true),
saveListLoaded(false),
updateSaveListWorking(false), updateSaveListWorking(false),
updateSaveListFinished(false), updateSaveListFinished(false),
updateTagListWorking(false), updateTagListWorking(false),
updateTagListFinished(false), updateTagListFinished(false)
saveListLoaded(false),
currentPage(1),
resultCount(0),
showTags(true)
{ {
} }

View File

@ -14,9 +14,9 @@
SearchView::SearchView(): SearchView::SearchView():
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
c(NULL),
saveButtons(vector<ui::SaveButton*>()), saveButtons(vector<ui::SaveButton*>()),
errorLabel(NULL), errorLabel(NULL),
c(NULL),
changed(true), changed(true),
lastChanged(0), lastChanged(0),
pageCount(0), pageCount(0),

View File

@ -18,8 +18,8 @@ public:
void Resize(ui::Point newSize); void Resize(ui::Point newSize);
int ID, Datestamp; int ID, Datestamp;
ui::Point Size;
pixel * Data; pixel * Data;
ui::Point Size;
}; };
#endif // THUMBNAIL_H #endif // THUMBNAIL_H

View File

@ -13,7 +13,7 @@
class UpdateDownloadTask : public Task class UpdateDownloadTask : public Task
{ {
public: public:
UpdateDownloadTask(std::string updateName, UpdateActivity * a) : updateName(updateName), a(a) {}; UpdateDownloadTask(std::string updateName, UpdateActivity * a) : a(a), updateName(updateName) {}
private: private:
UpdateActivity * a; UpdateActivity * a;
std::string updateName; std::string updateName;

View File

@ -4,10 +4,10 @@
#include "Misc.h" #include "Misc.h"
sign::sign(std::string text_, int x_, int y_, Justification justification_): sign::sign(std::string text_, int x_, int y_, Justification justification_):
text(text_),
x(x_), x(x_),
y(y_), y(y_),
ju(justification_) ju(justification_),
text(text_)
{ {
} }

View File

@ -98,11 +98,11 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
} }
if (tempPart.type == PT_PIPE || tempPart.type == PT_PPIP) if (tempPart.type == PT_PIPE || tempPart.type == PT_PPIP)
{ {
tempPart.tmp = partMap[tempPart.tmp&0xFF] | tempPart.tmp&~0xFF; tempPart.tmp = partMap[tempPart.tmp&0xFF] | (tempPart.tmp&~0xFF);
} }
//Replace existing //Replace existing
if (r = pmap[y][x]) if ((r = pmap[y][x]))
{ {
elementCount[parts[r>>8].type]--; elementCount[parts[r>>8].type]--;
parts[r>>8] = tempPart; parts[r>>8] = tempPart;
@ -165,7 +165,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
parts_lastActiveIndex = NPART-1; parts_lastActiveIndex = NPART-1;
force_stacking_check = 1; force_stacking_check = 1;
Element_PPIP::ppip_changed = 1; Element_PPIP::ppip_changed = 1;
for(int i = 0; i < save->signs.size() && signs.size() < MAXSIGNS; i++) for (size_t i = 0; i < save->signs.size() && signs.size() < MAXSIGNS; i++)
{ {
if (save->signs[i].text[0]) if (save->signs[i].text[0])
{ {
@ -261,7 +261,7 @@ GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2)
} }
} }
for(int i = 0; i < MAXSIGNS && i < signs.size(); i++) for (size_t i = 0; i < MAXSIGNS && i < signs.size(); i++)
{ {
if(signs[i].text.length() && signs[i].x >= fullX && signs[i].y >= fullY && signs[i].x <= fullX2 && signs[i].y <= fullY2) if(signs[i].text.length() && signs[i].x >= fullX && signs[i].y >= fullY && signs[i].x <= fullX2 && signs[i].y <= fullY2)
{ {
@ -979,9 +979,9 @@ int Simulation::Tool(int x, int y, int tool, float strength)
{ {
Particle * cpart = NULL; Particle * cpart = NULL;
int r; int r;
if(r = pmap[y][x]) if ((r = pmap[y][x]))
cpart = &(parts[r>>8]); cpart = &(parts[r>>8]);
else if(r = photons[y][x]) else if ((r = photons[y][x]))
cpart = &(parts[r>>8]); cpart = &(parts[r>>8]);
return tools[tool]->Perform(this, cpart, x, y, strength); return tools[tool]->Perform(this, cpart, x, y, strength);
} }
@ -2226,7 +2226,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if ((bmap[y/CELL][x/CELL]==WL_EHOLE && !emap[y/CELL][x/CELL]) && !(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL])) if ((bmap[y/CELL][x/CELL]==WL_EHOLE && !emap[y/CELL][x/CELL]) && !(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL]))
return 0; return 0;
e = r >> 8; //e is now the particle number at r (pmap[ny][nx]) int ri = r >> 8; //ri is the particle number at r (pmap[ny][nx])
if (r)//the swap part, if we make it this far, swap if (r)//the swap part, if we make it this far, swap
{ {
if (parts[i].type==PT_NEUT) { if (parts[i].type==PT_NEUT) {
@ -2243,17 +2243,19 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
parts[s>>8].x = nx; parts[s>>8].x = nx;
parts[s>>8].y = ny; parts[s>>8].y = ny;
} }
else pmap[ny][nx] = 0; else
parts[e].x = x; pmap[ny][nx] = 0;
parts[e].y = y; parts[ri].x = x;
pmap[y][x] = (e<<8)|parts[e].type; parts[ri].y = y;
pmap[y][x] = (ri<<8)|parts[ri].type;
return 1; return 1;
} }
if ((pmap[ny][nx]>>8)==e) pmap[ny][nx] = 0; if ((pmap[ny][nx]>>8) == ri)
parts[e].x += x-nx; pmap[ny][nx] = 0;
parts[e].y += y-ny; parts[ri].x += x-nx;
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type; parts[ri].y += y-ny;
pmap[(int)(parts[ri].y+0.5f)][(int)(parts[ri].x+0.5f)] = (ri<<8)|parts[ri].type;
} }
return 1; return 1;
} }
@ -2314,7 +2316,7 @@ int Simulation::do_move(int i, int x, int y, float nxf, float nyf)
int Simulation::pn_junction_sprk(int x, int y, int pt) int Simulation::pn_junction_sprk(int x, int y, int pt)
{ {
unsigned r = pmap[y][x]; int r = pmap[y][x];
if ((r & 0xFF) != pt) if ((r & 0xFF) != pt)
return 0; return 0;
r >>= 8; r >>= 8;
@ -4854,26 +4856,26 @@ Simulation::~Simulation()
delete[] platent; delete[] platent;
delete grav; delete grav;
delete air; delete air;
for(int i = 0; i < tools.size(); i++) for (size_t i = 0; i < tools.size(); i++)
delete tools[i]; delete tools[i];
} }
Simulation::Simulation(): Simulation::Simulation():
replaceModeSelected(0),
replaceModeFlags(0),
ISWIRE(0),
force_stacking_check(0),
emp_decor(0),
gravWallChanged(false),
edgeMode(0),
gravityMode(0),
legacy_enable(0),
aheat_enable(0),
water_equal_test(0),
sys_pause(0), sys_pause(0),
framerender(0), framerender(0),
aheat_enable(0),
legacy_enable(0),
gravityMode(0),
edgeMode(0),
water_equal_test(0),
pretty_powder(0), pretty_powder(0),
sandcolour_frame(0), sandcolour_frame(0)
emp_decor(0),
force_stacking_check(0),
ISWIRE(0),
gravWallChanged(false),
replaceModeSelected(0),
replaceModeFlags(0)
{ {
int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1}; int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1};
int tportal_ry[] = {-1,-1,-1, 0, 1, 1, 1, 0}; int tportal_ry[] = {-1,-1,-1, 0, 1, 1, 1, 0};
@ -4928,7 +4930,7 @@ Simulation::Simulation():
DEFAULT_PT_NUM = elementList.size(); DEFAULT_PT_NUM = elementList.size();
for(int i = 0; i < PT_NUM; i++) for(int i = 0; i < PT_NUM; i++)
{ {
if(i < elementList.size()) if (i < (int)elementList.size())
elements[i] = elementList[i]; elements[i] = elementList[i];
else else
elements[i] = Element(); elements[i] = Element();

View File

@ -6,9 +6,9 @@
#include "Task.h" #include "Task.h"
TaskWindow::TaskWindow(std::string title_, Task * task_, bool closeOnDone): TaskWindow::TaskWindow(std::string title_, Task * task_, bool closeOnDone):
ui::Window(ui::Point(-1, -1), ui::Point(240, 60)),
task(task_), task(task_),
title(title_), title(title_),
ui::Window(ui::Point(-1, -1), ui::Point(240, 60)),
progress(0), progress(0),
done(false), done(false),
closeOnDone(closeOnDone), closeOnDone(closeOnDone),