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));
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))
{
ch = parts[i][j+blen];

View File

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

View File

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

View File

@ -8,14 +8,14 @@
class ConsoleView;
class ConsoleModel {
int currentCommandIndex;
size_t currentCommandIndex;
std::vector<ConsoleView*> observers;
std::deque<ConsoleCommand> previousCommands;
void notifyPreviousCommandsChanged();
void notifyCurrentCommandChanged();
public:
int GetCurrentCommandIndex();
void SetCurrentCommandIndex(int index);
size_t GetCurrentCommandIndex();
void SetCurrentCommandIndex(size_t index);
ConsoleCommand GetCurrentCommand();
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)
{
for(int i = 0; i < commandList.size(); i++)
for (size_t i = 0; i < commandList.size(); i++)
{
RemoveComponent(commandList[i]);
delete commandList[i];

View File

@ -23,9 +23,9 @@ public:
ElementSearchActivity::ElementSearchActivity(GameController * gameController, std::vector<Tool*> tools) :
WindowActivity(ui::Point(-1, -1), ui::Point(236, 302)),
firstResult(NULL),
gameController(gameController),
tools(tools),
firstResult(NULL),
exit(false)
{
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)
{
for(int i = 0; i < components.size(); i++)
for (size_t i = 0; i < components.size(); i++)
{
RemoveComponent(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;
}
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;
}
@ -239,12 +239,12 @@ void FileBrowserActivity::NotifyDone(Task * task)
totalFiles = files.size();
delete loadFiles;
loadFiles = NULL;
if(!files.size())
if (!files.size())
{
progressBar->Visible = false;
infoText->Visible = true;
}
for(int i = 0; i < components.size(); i++)
for (size_t i = 0; i < components.size(); i++)
{
delete components[i];
}
@ -253,7 +253,7 @@ void FileBrowserActivity::NotifyDone(Task * task)
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();
}

View File

@ -119,18 +119,18 @@ public:
};
GameController::GameController():
firstTick(true),
foundSign(NULL),
activePreview(NULL),
search(NULL),
renderOptions(NULL),
loginWindow(NULL),
console(NULL),
tagsWindow(NULL),
options(NULL),
activePreview(NULL),
localBrowser(NULL),
foundSign(NULL),
HasDone(false),
firstTick(true),
debugFlags(0)
options(NULL),
debugFlags(0),
HasDone(false)
{
gameView = new GameView();
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));
x = point.X;
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);
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));
x = point.X;
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);
if(foundSign) {
@ -1455,7 +1455,7 @@ void GameController::NotifyNewNotification(Client * sender, std::pair<std::strin
{
std::string link;
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 void Action()
@ -1485,7 +1485,7 @@ void GameController::NotifyUpdateAvailable(Client * sender)
{
GameController * c;
public:
UpdateNotification(GameController * c, std::string message) : c(c), Notification(message) {}
UpdateNotification(GameController * c, std::string message) : Notification(message), c(c) {}
virtual ~UpdateNotification() {}
virtual void Action()

View File

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

View File

@ -19,19 +19,17 @@
#include "Format.h"
GameModel::GameModel():
sim(NULL),
ren(NULL),
currentBrush(0),
currentUser(0, ""),
currentSave(NULL),
currentFile(NULL),
colourSelector(false),
clipboard(NULL),
placeSave(NULL),
colour(255, 0, 0, 255),
toolStrength(1.0f),
activeColourPreset(-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)
{
sim = new Simulation();
@ -104,7 +102,7 @@ GameModel::GameModel():
//Load more from brushes folder
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]);
if(!brushData.size())
@ -112,8 +110,8 @@ GameModel::GameModel():
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl;
continue;
}
int dimension = std::sqrt((float)brushData.size());
if(dimension * dimension != brushData.size())
size_t dimension = std::sqrt((float)brushData.size());
if (dimension * dimension != brushData.size())
{
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl;
continue;
@ -164,15 +162,15 @@ GameModel::~GameModel()
Client::Ref().SetPref("Decoration.Blue", (int)colour.Blue);
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];
}
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;
}
for(int i = 0; i < brushList.size(); i++)
for (size_t i = 0; i < brushList.size(); i++)
{
delete brushList[i];
}
@ -306,7 +304,7 @@ void GameModel::BuildMenus()
}
//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;
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;
}
void GameModel::SetActiveColourPreset(int preset)
void GameModel::SetActiveColourPreset(size_t preset)
{
if (activeColourPreset != preset)
activeColourPreset = preset;
if (activeColourPreset-1 != preset)
activeColourPreset = preset+1;
else
{
activeTools[0] = GetToolFromIdentifier("DEFAULT_DECOR_SET");
@ -764,16 +762,16 @@ void GameModel::SetActiveColourPreset(int preset)
notifyColourActivePresetChanged();
}
int GameModel::GetActiveColourPreset()
size_t GameModel::GetActiveColourPreset()
{
return activeColourPreset;
return activeColourPreset-1;
}
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();
}
}
@ -802,7 +800,7 @@ void GameModel::SetColourSelectorColour(ui::Colour colour_)
colour = colour_;
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])->Green = colour.Green;
@ -999,7 +997,7 @@ std::string GameModel::GetInfoTip()
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);
}
@ -1007,7 +1005,7 @@ void GameModel::notifyNotificationsChanged()
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);
}
@ -1015,7 +1013,7 @@ void GameModel::notifyColourPresetsChanged()
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);
}
@ -1023,7 +1021,7 @@ void GameModel::notifyColourActivePresetChanged()
void GameModel::notifyColourSelectorColourChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyColourSelectorColourChanged(this);
}
@ -1031,7 +1029,7 @@ void GameModel::notifyColourSelectorColourChanged()
void GameModel::notifyColourSelectorVisibilityChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyColourSelectorVisibilityChanged(this);
}
@ -1039,7 +1037,7 @@ void GameModel::notifyColourSelectorVisibilityChanged()
void GameModel::notifyRendererChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyRendererChanged(this);
}
@ -1047,7 +1045,7 @@ void GameModel::notifyRendererChanged()
void GameModel::notifySaveChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifySaveChanged(this);
}
@ -1055,7 +1053,7 @@ void GameModel::notifySaveChanged()
void GameModel::notifySimulationChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifySimulationChanged(this);
}
@ -1063,7 +1061,7 @@ void GameModel::notifySimulationChanged()
void GameModel::notifyPausedChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyPausedChanged(this);
}
@ -1071,7 +1069,7 @@ void GameModel::notifyPausedChanged()
void GameModel::notifyDecorationChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
//observers[i]->NotifyPausedChanged(this);
}
@ -1079,7 +1077,7 @@ void GameModel::notifyDecorationChanged()
void GameModel::notifyBrushChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyBrushChanged(this);
}
@ -1087,7 +1085,7 @@ void GameModel::notifyBrushChanged()
void GameModel::notifyMenuListChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyMenuListChanged(this);
}
@ -1095,7 +1093,7 @@ void GameModel::notifyMenuListChanged()
void GameModel::notifyToolListChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyToolListChanged(this);
}
@ -1103,7 +1101,7 @@ void GameModel::notifyToolListChanged()
void GameModel::notifyActiveToolsChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyActiveToolsChanged(this);
}
@ -1111,7 +1109,7 @@ void GameModel::notifyActiveToolsChanged()
void GameModel::notifyUserChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyUserChanged(this);
}
@ -1119,7 +1117,7 @@ void GameModel::notifyUserChanged()
void GameModel::notifyZoomChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyZoomChanged(this);
}
@ -1127,7 +1125,7 @@ void GameModel::notifyZoomChanged()
void GameModel::notifyPlaceSaveChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyPlaceSaveChanged(this);
}
@ -1135,7 +1133,7 @@ void GameModel::notifyPlaceSaveChanged()
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);
}
@ -1143,7 +1141,7 @@ void GameModel::notifyLogChanged(string entry)
void GameModel::notifyInfoTipChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyInfoTipChanged(this);
}
@ -1151,7 +1149,7 @@ void GameModel::notifyInfoTipChanged()
void GameModel::notifyToolTipChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyToolTipChanged(this);
}
@ -1159,7 +1157,7 @@ void GameModel::notifyToolTipChanged()
void GameModel::notifyQuickOptionsChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyQuickOptionsChanged(this);
}
@ -1167,7 +1165,7 @@ void GameModel::notifyQuickOptionsChanged()
void GameModel::notifyLastToolChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
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
vector<Tool*> extraElementTools;
Simulation * sim;
Renderer * ren;
vector<Menu*> menuList;
vector<QuickOption*> quickOptions;
int activeMenu;
@ -56,8 +58,6 @@ private:
vector<Brush *> brushList;
SaveInfo * currentSave;
SaveFile * currentFile;
Simulation * sim;
Renderer * ren;
Tool * lastTool;
Tool ** activeTools;
Tool * decoToolset[4];
@ -66,7 +66,7 @@ private:
float toolStrength;
std::deque<Snapshot*> history;
int activeColourPreset;
size_t activeColourPreset;
std::vector<ui::Colour> colourPresets;
bool colourSelector;
ui::Colour colour;
@ -106,8 +106,8 @@ public:
void SetEdgeMode(int edgeMode);
int GetEdgeMode();
void SetActiveColourPreset(int preset);
int GetActiveColourPreset();
void SetActiveColourPreset(size_t preset);
size_t GetActiveColourPreset();
void SetPresetColour(ui::Colour colour);

View File

@ -41,10 +41,10 @@ private:
public:
SplitButton(ui::Point position, ui::Point size, std::string buttonText, std::string toolTip, std::string toolTip2, int split) :
Button(position, size, buttonText, toolTip),
toolTip2(toolTip2),
showSplit(true),
splitPosition(split),
splitActionCallback(NULL),
showSplit(true)
toolTip2(toolTip2),
splitActionCallback(NULL)
{
}
@ -150,51 +150,54 @@ public:
GameView::GameView():
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
pointQueue(queue<ui::Point>()),
isMouseDown(false),
ren(NULL),
activeBrush(NULL),
currentMouse(0, 0),
toolIndex(0),
zoomEnabled(false),
zoomCursorFixed(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),
toolTip(""),
infoTip(""),
infoTipPresence(0),
buttonTipShow(0),
isToolTipFadingIn(false),
isButtonTipFadingIn(false),
toolTipPosition(-1, -1),
saveSimulationButtonEnabled(false),
shiftBehaviour(false),
ctrlBehaviour(false),
altBehaviour(false),
showHud(true),
showDebug(false),
introText(2048),
introTextMessage(introTextData),
wallBrush(false),
toolBrush(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),
recording(false),
screenshotIndex(0),
recordingIndex(0),
toolTipPresence(0),
currentSaveType(0),
lastMenu(-1)
pointQueue(queue<ui::Point>()),
ren(NULL),
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;
@ -513,6 +516,9 @@ public:
case QuickOption::Toggle:
button->SetTogglable(true);
button->SetToggleState(option->GetToggle());
break;
default:
break;
}
}
};
@ -536,7 +542,7 @@ public:
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]);
delete quickOptionButtons[i];
@ -562,20 +568,20 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender)
void GameView::NotifyMenuListChanged(GameModel * sender)
{
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]);
delete menuButtons[i];
}
menuButtons.clear();
for(int i = 0; i < toolButtons.size(); i++)
for (size_t i = 0; i < toolButtons.size(); i++)
{
RemoveComponent(toolButtons[i]);
delete toolButtons[i];
}
toolButtons.clear();
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 = "";
tempString += menuList[i]->GetIcon();
@ -633,7 +639,7 @@ bool GameView::GetPlacingZoom()
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;
if(sender->GetActiveTool(0) == tool)
@ -685,9 +691,9 @@ void GameView::NotifyToolListChanged(GameModel * sender)
{
lastOffset = 0;
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);
}
@ -696,14 +702,14 @@ void GameView::NotifyToolListChanged(GameModel * sender)
menuButtons[i]->SetToggleState(false);
}
}
for(int i = 0; i < toolButtons.size(); i++)
for (size_t i = 0; i < toolButtons.size(); i++)
{
RemoveComponent(toolButtons[i]);
delete toolButtons[i];
}
toolButtons.clear();
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);
ToolButton * tempButton;
@ -823,9 +829,9 @@ void GameView::NotifyColourPresetsChanged(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
}

View File

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

View File

@ -101,11 +101,11 @@ public:
SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_):
ui::Window(ui::Point(-1, -1), ui::Point(200, 87)),
tool(tool_),
signID(signID_),
sim(sim_),
signPosition(position_),
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");
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)
{
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);
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;
break;

View File

@ -7,16 +7,16 @@
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)):
textureGen(textureGen),
toolID(id),
toolName(name),
toolDescription(description),
colRed(r),
colGreen(g),
colBlue(b),
textureGen(textureGen),
strength(1.0f),
resolution(1),
identifier(identifier)
identifier(identifier),
colRed(r),
colGreen(g),
colBlue(b)
{
}

View File

@ -23,6 +23,8 @@ protected:
int resolution;
std::string identifier;
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);
int GetToolID() { return toolID; }
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 DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
int colRed, colBlue, colGreen;
};
class GameModel;

View File

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

View File

@ -14,10 +14,10 @@ namespace ui {
AvatarButton::AvatarButton(Point position, Point size, std::string username):
Component(position, size),
name(username),
actionCallback(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):
Component(position, size),
Enabled(true),
ButtonText(buttonText),
isMouseInside(false),
toolTip(toolTip),
isButtonDown(false),
isMouseInside(false),
isTogglable(false),
toggle(false),
actionCallback(NULL),
Enabled(true),
toolTip(toolTip)
actionCallback(NULL)
{
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 = "");
virtual ~Button();
bool Toggleable;
bool Enabled;
virtual void OnMouseClick(int x, int y, unsigned int button);
@ -53,9 +52,9 @@ public:
void SetToolTip(std::string newToolTip) { toolTip = newToolTip; }
protected:
std::string ButtonText;
std::string toolTip;
std::string buttonDisplayText;
std::string ButtonText;
bool isButtonDown, isAltButtonDown, state, isMouseInside, isTogglable, toggle;
ButtonAction * actionCallback;

View File

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

View File

@ -12,15 +12,15 @@ using namespace ui;
Component::Component(Window* parent_state):
parentstate_(parent_state),
_parent(NULL),
Position(Point(0,0)),
Size(Point(0,0)),
Locked(false),
Visible(true),
drawn(false),
textPosition(0, 0),
textSize(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):
parentstate_(0),
_parent(NULL),
Position(position),
Size(size),
Locked(false),
Visible(true),
drawn(false),
textPosition(0, 0),
textSize(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():
parentstate_(NULL),
_parent(NULL),
Position(Point(0,0)),
Size(Point(0,0)),
Locked(false),
Visible(true),
drawn(false),
textPosition(0, 0),
textSize(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):
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;
std::string Text;
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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,18 +5,18 @@ using namespace ui;
ScrollPanel::ScrollPanel(Point position, Point size):
Panel(position, size),
scrollBarWidth(0),
maxOffset(0, 0),
offsetX(0),
offsetY(0),
yScrollVel(0.0f),
xScrollVel(0.0f),
scrollBarWidth(0),
isMouseInsideScrollbar(false),
isMouseInsideScrollbarArea(false),
scrollbarClickLocation(0),
scrollbarSelected(false),
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):
Label(position, size, ""),
actionCallback(NULL),
masked(false),
border(true),
mouseDown(false),
limit(std::string::npos),
ReadOnly(false),
inputType(All),
limit(std::string::npos),
keyDown(0),
characterDown(0),
ReadOnly(false)
mouseDown(false),
masked(false),
border(true),
actionCallback(NULL)
{
placeHolder = textboxPlaceholder;

View File

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

View File

@ -102,14 +102,14 @@ enum ChromeStyle
Component* focusedComponent_;
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)
void finalise();
bool halt;
bool destruct;
bool stop;
#ifdef DEBUG
bool debugMode;
#endif
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,8 +35,8 @@ public:
LocalSaveActivity::LocalSaveActivity(SaveFile save, FileSavedCallback * callback) :
WindowActivity(ui::Point(-1, -1), ui::Point(220, 200)),
thumbnail(NULL),
save(save),
thumbnail(NULL),
callback(callback)
{
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();
protected:
virtual void NotifyDone(Task * task);
Task * saveUploadTask;
SaveUploadedCallback * callback;
SaveInfo save;
VideoBuffer * thumbnail;
SaveInfo save;
SaveUploadedCallback * callback;
Task * saveUploadTask;
ui::Label * titleLabel;
ui::Textbox * nameField;
ui::Textbox * descriptionField;

View File

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

View File

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

View File

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

View File

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

View File

@ -4,10 +4,10 @@
#include "Misc.h"
sign::sign(std::string text_, int x_, int y_, Justification justification_):
text(text_),
x(x_),
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)
{
tempPart.tmp = partMap[tempPart.tmp&0xFF] | tempPart.tmp&~0xFF;
tempPart.tmp = partMap[tempPart.tmp&0xFF] | (tempPart.tmp&~0xFF);
}
//Replace existing
if (r = pmap[y][x])
if ((r = pmap[y][x]))
{
elementCount[parts[r>>8].type]--;
parts[r>>8] = tempPart;
@ -165,7 +165,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
parts_lastActiveIndex = NPART-1;
force_stacking_check = 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])
{
@ -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)
{
@ -979,9 +979,9 @@ int Simulation::Tool(int x, int y, int tool, float strength)
{
Particle * cpart = NULL;
int r;
if(r = pmap[y][x])
if ((r = pmap[y][x]))
cpart = &(parts[r>>8]);
else if(r = photons[y][x])
else if ((r = photons[y][x]))
cpart = &(parts[r>>8]);
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]))
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 (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].y = ny;
}
else pmap[ny][nx] = 0;
parts[e].x = x;
parts[e].y = y;
pmap[y][x] = (e<<8)|parts[e].type;
else
pmap[ny][nx] = 0;
parts[ri].x = x;
parts[ri].y = y;
pmap[y][x] = (ri<<8)|parts[ri].type;
return 1;
}
if ((pmap[ny][nx]>>8)==e) pmap[ny][nx] = 0;
parts[e].x += x-nx;
parts[e].y += y-ny;
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type;
if ((pmap[ny][nx]>>8) == ri)
pmap[ny][nx] = 0;
parts[ri].x += x-nx;
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;
}
@ -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)
{
unsigned r = pmap[y][x];
int r = pmap[y][x];
if ((r & 0xFF) != pt)
return 0;
r >>= 8;
@ -4854,26 +4856,26 @@ Simulation::~Simulation()
delete[] platent;
delete grav;
delete air;
for(int i = 0; i < tools.size(); i++)
for (size_t i = 0; i < tools.size(); i++)
delete tools[i];
}
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),
framerender(0),
aheat_enable(0),
legacy_enable(0),
gravityMode(0),
edgeMode(0),
water_equal_test(0),
pretty_powder(0),
sandcolour_frame(0),
emp_decor(0),
force_stacking_check(0),
ISWIRE(0),
gravWallChanged(false),
replaceModeSelected(0),
replaceModeFlags(0)
sandcolour_frame(0)
{
int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1};
int tportal_ry[] = {-1,-1,-1, 0, 1, 1, 1, 0};
@ -4928,7 +4930,7 @@ Simulation::Simulation():
DEFAULT_PT_NUM = elementList.size();
for(int i = 0; i < PT_NUM; i++)
{
if(i < elementList.size())
if (i < (int)elementList.size())
elements[i] = elementList[i];
else
elements[i] = Element();

View File

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