mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-06 08:27:27 +02:00
fix ALL the warnings
mostly just using more size_t. Also do some formatting around if statements
This commit is contained in:
@@ -23,7 +23,7 @@ ContextMenu::ContextMenu(Component * source):
|
|||||||
|
|
||||||
void ContextMenu::Show(ui::Point position)
|
void ContextMenu::Show(ui::Point position)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < buttons.size(); i++)
|
for (size_t i = 0; i < buttons.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(buttons[i]);
|
RemoveComponent(buttons[i]);
|
||||||
delete buttons[i];
|
delete buttons[i];
|
||||||
@@ -40,7 +40,7 @@ void ContextMenu::Show(ui::Point position)
|
|||||||
Position = position;
|
Position = position;
|
||||||
|
|
||||||
int currentY = 1;
|
int currentY = 1;
|
||||||
for(int i = 0; i < items.size(); i++)
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
{
|
{
|
||||||
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), items[i].Text);
|
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), items[i].Text);
|
||||||
tempButton->Appearance = Appearance;
|
tempButton->Appearance = Appearance;
|
||||||
@@ -69,7 +69,7 @@ void ContextMenu::OnMouseDown(int x, int y, unsigned button)
|
|||||||
|
|
||||||
void ContextMenu::SetItem(int id, std::string text)
|
void ContextMenu::SetItem(int id, std::string text)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < items.size(); i++)
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
{
|
{
|
||||||
if (items[i].ID == id)
|
if (items[i].ID == id)
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ void ContextMenu::SetItem(int id, std::string text)
|
|||||||
|
|
||||||
void ContextMenu::RemoveItem(int id)
|
void ContextMenu::RemoveItem(int id)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < items.size(); i++)
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
{
|
{
|
||||||
if (items[i].ID == id)
|
if (items[i].ID == id)
|
||||||
{
|
{
|
||||||
|
@@ -32,7 +32,7 @@ public:
|
|||||||
appearance(dropDown->Appearance)
|
appearance(dropDown->Appearance)
|
||||||
{
|
{
|
||||||
int currentY = 1;
|
int currentY = 1;
|
||||||
for(int i = 0; i < dropDown->options.size(); i++)
|
for (size_t i = 0; i < dropDown->options.size(); i++)
|
||||||
{
|
{
|
||||||
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), dropDown->options[i].first);
|
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), dropDown->options[i].first);
|
||||||
tempButton->Appearance = appearance;
|
tempButton->Appearance = appearance;
|
||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
dropDown->SetOption(option);
|
dropDown->SetOption(option);
|
||||||
if (dropDown->callback)
|
if (dropDown->callback)
|
||||||
{
|
{
|
||||||
int optionIndex = 0;
|
size_t optionIndex = 0;
|
||||||
for (optionIndex = 0; optionIndex < dropDown->options.size(); optionIndex++)
|
for (optionIndex = 0; optionIndex < dropDown->options.size(); optionIndex++)
|
||||||
{
|
{
|
||||||
if(option == dropDown->options[optionIndex].first)
|
if(option == dropDown->options[optionIndex].first)
|
||||||
@@ -138,7 +138,7 @@ void DropDown::OnMouseLeave(int x, int y)
|
|||||||
|
|
||||||
void DropDown::SetOption(std::string option)
|
void DropDown::SetOption(std::string option)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < options.size(); i++)
|
for (size_t i = 0; i < options.size(); i++)
|
||||||
{
|
{
|
||||||
if (options[i].first == option)
|
if (options[i].first == option)
|
||||||
{
|
{
|
||||||
@@ -150,7 +150,7 @@ void DropDown::OnMouseLeave(int x, int y)
|
|||||||
}
|
}
|
||||||
void DropDown::SetOption(int option)
|
void DropDown::SetOption(int option)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < options.size(); i++)
|
for (size_t i = 0; i < options.size(); i++)
|
||||||
{
|
{
|
||||||
if (options[i].second == option)
|
if (options[i].second == option)
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@ void DropDown::OnMouseLeave(int x, int y)
|
|||||||
}
|
}
|
||||||
void DropDown::AddOption(std::pair<std::string, int> option)
|
void DropDown::AddOption(std::pair<std::string, int> option)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < options.size(); i++)
|
for (size_t i = 0; i < options.size(); i++)
|
||||||
{
|
{
|
||||||
if (options[i] == option)
|
if (options[i] == option)
|
||||||
return;
|
return;
|
||||||
@@ -172,11 +172,11 @@ void DropDown::OnMouseLeave(int x, int y)
|
|||||||
void DropDown::RemoveOption(std::string option)
|
void DropDown::RemoveOption(std::string option)
|
||||||
{
|
{
|
||||||
start:
|
start:
|
||||||
for(int i = 0; i < options.size(); i++)
|
for (size_t i = 0; i < options.size(); i++)
|
||||||
{
|
{
|
||||||
if (options[i].first == option)
|
if (options[i].first == option)
|
||||||
{
|
{
|
||||||
if(i == optionIndex)
|
if ((int)i == optionIndex)
|
||||||
optionIndex = -1;
|
optionIndex = -1;
|
||||||
options.erase(options.begin()+i);
|
options.erase(options.begin()+i);
|
||||||
goto start;
|
goto start;
|
||||||
|
@@ -81,7 +81,7 @@ void Label::updateMultiline()
|
|||||||
int wordWidth = 0;
|
int wordWidth = 0;
|
||||||
int lineWidth = 0;
|
int lineWidth = 0;
|
||||||
char * wordStart = NULL;
|
char * wordStart = NULL;
|
||||||
while(c = rawText[charIndex++])
|
while ((c = rawText[charIndex++]))
|
||||||
{
|
{
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
@@ -281,9 +281,9 @@ void Label::updateSelection()
|
|||||||
std::string currentText;
|
std::string currentText;
|
||||||
|
|
||||||
if (selectionIndex0 < 0) selectionIndex0 = 0;
|
if (selectionIndex0 < 0) selectionIndex0 = 0;
|
||||||
if(selectionIndex0 > text.length()) selectionIndex0 = text.length();
|
if (selectionIndex0 > (int)text.length()) selectionIndex0 = text.length();
|
||||||
if (selectionIndex1 < 0) selectionIndex1 = 0;
|
if (selectionIndex1 < 0) selectionIndex1 = 0;
|
||||||
if(selectionIndex1 > text.length()) selectionIndex1 = text.length();
|
if (selectionIndex1 > (int)text.length()) selectionIndex1 = text.length();
|
||||||
|
|
||||||
if(selectionIndex0 == -1 || selectionIndex1 == -1)
|
if(selectionIndex0 == -1 || selectionIndex1 == -1)
|
||||||
{
|
{
|
||||||
|
@@ -75,7 +75,7 @@ Component* Panel::GetChild(unsigned idx)
|
|||||||
|
|
||||||
void Panel::RemoveChild(Component* c)
|
void Panel::RemoveChild(Component* c)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if (children[i] == c)
|
if (children[i] == c)
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ void Panel::Draw(const Point& screenPos)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// attempt to draw all children
|
// attempt to draw all children
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
// the component must be visible
|
// the component must be visible
|
||||||
if (children[i]->Visible)
|
if (children[i]->Visible)
|
||||||
@@ -222,7 +222,7 @@ void Panel::OnMouseClick(int localx, int localy, unsigned button)
|
|||||||
void Panel::OnMouseDown(int x, int y, unsigned button)
|
void Panel::OnMouseDown(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
XOnMouseDown(x, y, button);
|
XOnMouseDown(x, y, button);
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!children[i]->Locked)
|
if(!children[i]->Locked)
|
||||||
children[i]->OnMouseDown(x, y, button);
|
children[i]->OnMouseDown(x, y, button);
|
||||||
@@ -254,7 +254,7 @@ void Panel::OnMouseHover(int localx, int localy)
|
|||||||
void Panel::OnMouseMoved(int localx, int localy, int dx, int dy)
|
void Panel::OnMouseMoved(int localx, int localy, int dx, int dy)
|
||||||
{
|
{
|
||||||
XOnMouseMoved(localx, localy, dx, dy);
|
XOnMouseMoved(localx, localy, dx, dy);
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if(!children[i]->Locked)
|
if(!children[i]->Locked)
|
||||||
children[i]->OnMouseMoved(localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y, dx, dy);
|
children[i]->OnMouseMoved(localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y, dx, dy);
|
||||||
@@ -264,7 +264,7 @@ void Panel::OnMouseMoved(int localx, int localy, int dx, int dy)
|
|||||||
void Panel::OnMouseMovedInside(int localx, int localy, int dx, int dy)
|
void Panel::OnMouseMovedInside(int localx, int localy, int dx, int dy)
|
||||||
{
|
{
|
||||||
mouseInside = true;
|
mouseInside = true;
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!children[i]->Locked)
|
if (!children[i]->Locked)
|
||||||
{
|
{
|
||||||
@@ -353,7 +353,7 @@ void Panel::OnMouseUnclick(int localx, int localy, unsigned button)
|
|||||||
void Panel::OnMouseUp(int x, int y, unsigned button)
|
void Panel::OnMouseUp(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
XOnMouseUp(x, y, button);
|
XOnMouseUp(x, y, button);
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!children[i]->Locked)
|
if (!children[i]->Locked)
|
||||||
children[i]->OnMouseUp(x, y, button);
|
children[i]->OnMouseUp(x, y, button);
|
||||||
@@ -363,7 +363,7 @@ void Panel::OnMouseUp(int x, int y, unsigned button)
|
|||||||
void Panel::OnMouseWheel(int localx, int localy, int d)
|
void Panel::OnMouseWheel(int localx, int localy, int d)
|
||||||
{
|
{
|
||||||
XOnMouseWheel(localx, localy, d);
|
XOnMouseWheel(localx, localy, d);
|
||||||
for(int i = 0; i < children.size(); ++i)
|
for (size_t i = 0; i < children.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!children[i]->Locked)
|
if (!children[i]->Locked)
|
||||||
children[i]->OnMouseWheel(localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y, d);
|
children[i]->OnMouseWheel(localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y, d);
|
||||||
|
@@ -42,7 +42,7 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
|
|||||||
|
|
||||||
votes = format::NumberToString<int>(save->GetVotesUp()-save->GetVotesDown());
|
votes = format::NumberToString<int>(save->GetVotesUp()-save->GetVotesDown());
|
||||||
icon += 0xBB;
|
icon += 0xBB;
|
||||||
for (int j = 1; j < votes.length(); j++)
|
for (size_t j = 1; j < votes.length(); j++)
|
||||||
icon += 0xBC;
|
icon += 0xBC;
|
||||||
icon += 0xB9;
|
icon += 0xB9;
|
||||||
icon += 0xBA;
|
icon += 0xBA;
|
||||||
|
@@ -66,7 +66,7 @@ void Slider::OnMouseUp(int x, int y, unsigned button)
|
|||||||
|
|
||||||
void Slider::SetColour(Colour col1, Colour col2)
|
void Slider::SetColour(Colour col1, Colour col2)
|
||||||
{
|
{
|
||||||
pixel pix[2] = {PIXRGB(col1.Red, col1.Green, col1.Blue), PIXRGB(col2.Red, col2.Green, col2.Blue)};
|
pixel pix[2] = {(pixel)PIXRGB(col1.Red, col1.Green, col1.Blue), (pixel)PIXRGB(col2.Red, col2.Green, col2.Blue)};
|
||||||
float fl[2] = {0.0f, 1.0f};
|
float fl[2] = {0.0f, 1.0f};
|
||||||
if(bgGradient)
|
if(bgGradient)
|
||||||
free(bgGradient);
|
free(bgGradient);
|
||||||
|
@@ -135,10 +135,9 @@ void Textbox::TabFocus()
|
|||||||
|
|
||||||
void Textbox::cutSelection()
|
void Textbox::cutSelection()
|
||||||
{
|
{
|
||||||
std::string newText = ClipboardPull();
|
|
||||||
if (HasSelection())
|
if (HasSelection())
|
||||||
{
|
{
|
||||||
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
|
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
|
||||||
return;
|
return;
|
||||||
ClipboardPush((char*)backingText.substr(getLowerSelectionBound(), getHigherSelectionBound()-getLowerSelectionBound()).c_str());
|
ClipboardPush((char*)backingText.substr(getLowerSelectionBound(), getHigherSelectionBound()-getLowerSelectionBound()).c_str());
|
||||||
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
||||||
@@ -191,7 +190,7 @@ void Textbox::pasteIntoSelection()
|
|||||||
std::string newText = ClipboardPull();
|
std::string newText = ClipboardPull();
|
||||||
if(HasSelection())
|
if(HasSelection())
|
||||||
{
|
{
|
||||||
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
|
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
|
||||||
return;
|
return;
|
||||||
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
||||||
cursor = getLowerSelectionBound();
|
cursor = getLowerSelectionBound();
|
||||||
@@ -356,7 +355,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
ClearSelection();
|
ClearSelection();
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
if(cursor < backingText.length())
|
if (cursor < (int)backingText.length())
|
||||||
cursor++;
|
cursor++;
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
break;
|
break;
|
||||||
@@ -365,13 +364,13 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
break;
|
break;
|
||||||
if (HasSelection())
|
if (HasSelection())
|
||||||
{
|
{
|
||||||
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
|
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
|
||||||
return;
|
return;
|
||||||
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
||||||
cursor = getLowerSelectionBound();
|
cursor = getLowerSelectionBound();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if(backingText.length() && cursor < backingText.length())
|
else if (backingText.length() && cursor < (int)backingText.length())
|
||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
backingText.erase(cursor, backingText.length()-cursor);
|
backingText.erase(cursor, backingText.length()-cursor);
|
||||||
@@ -386,7 +385,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
break;
|
break;
|
||||||
if (HasSelection())
|
if (HasSelection())
|
||||||
{
|
{
|
||||||
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
|
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
|
||||||
return;
|
return;
|
||||||
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
||||||
cursor = getLowerSelectionBound();
|
cursor = getLowerSelectionBound();
|
||||||
@@ -413,7 +412,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
{
|
{
|
||||||
if (HasSelection())
|
if (HasSelection())
|
||||||
{
|
{
|
||||||
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
|
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
|
||||||
return;
|
return;
|
||||||
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
|
||||||
cursor = getLowerSelectionBound();
|
cursor = getLowerSelectionBound();
|
||||||
@@ -426,7 +425,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
regionWidth -= Appearance.Margin.Right;
|
regionWidth -= Appearance.Margin.Right;
|
||||||
if ((limit==std::string::npos || backingText.length() < limit) && (Graphics::textwidth((char*)std::string(backingText+char(character)).c_str()) <= regionWidth || multiline || limit!=std::string::npos))
|
if ((limit==std::string::npos || backingText.length() < limit) && (Graphics::textwidth((char*)std::string(backingText+char(character)).c_str()) <= regionWidth || multiline || limit!=std::string::npos))
|
||||||
{
|
{
|
||||||
if(cursor == backingText.length())
|
if (cursor == (int)backingText.length())
|
||||||
{
|
{
|
||||||
backingText += character;
|
backingText += character;
|
||||||
}
|
}
|
||||||
@@ -453,7 +452,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
while(backingText[0] == '0' && backingText.length()>1)
|
while(backingText[0] == '0' && backingText.length()>1)
|
||||||
backingText.erase(backingText.begin());
|
backingText.erase(backingText.begin());
|
||||||
}
|
}
|
||||||
if(cursor > backingText.length())
|
if (cursor > (int)backingText.length())
|
||||||
cursor = backingText.length();
|
cursor = backingText.length();
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
ValidInput inputType;
|
ValidInput inputType;
|
||||||
size_t limit;
|
size_t limit;
|
||||||
int repeatTime;
|
unsigned long repeatTime;
|
||||||
int keyDown;
|
int keyDown;
|
||||||
Uint16 characterDown;
|
Uint16 characterDown;
|
||||||
bool mouseDown;
|
bool mouseDown;
|
||||||
|
@@ -64,7 +64,7 @@ void LocalBrowserController::removeSelectedC()
|
|||||||
RemoveSavesTask(LocalBrowserController * c, std::vector<std::string> saves_) : c(c) { saves = saves_; }
|
RemoveSavesTask(LocalBrowserController * c, std::vector<std::string> saves_) : c(c) { saves = saves_; }
|
||||||
virtual bool doWork()
|
virtual bool doWork()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
std::stringstream saveName;
|
std::stringstream saveName;
|
||||||
saveName << "Deleting stamp [" << saves[i] << "] ...";
|
saveName << "Deleting stamp [" << saves[i] << "] ...";
|
||||||
|
@@ -28,7 +28,7 @@ void LocalBrowserModel::AddObserver(LocalBrowserView * observer)
|
|||||||
|
|
||||||
void LocalBrowserModel::notifySavesListChanged()
|
void LocalBrowserModel::notifySavesListChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifySavesListChanged(this);
|
observers[i]->NotifySavesListChanged(this);
|
||||||
observers[i]->NotifyPageChanged(this);
|
observers[i]->NotifyPageChanged(this);
|
||||||
@@ -37,7 +37,7 @@ void LocalBrowserModel::notifySavesListChanged()
|
|||||||
|
|
||||||
void LocalBrowserModel::notifyPageChanged()
|
void LocalBrowserModel::notifyPageChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyPageChanged(this);
|
observers[i]->NotifyPageChanged(this);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ void LocalBrowserModel::UpdateSavesList(int pageNumber)
|
|||||||
|
|
||||||
stampIDs = Client::Ref().GetStamps((pageNumber-1)*20, 20);
|
stampIDs = Client::Ref().GetStamps((pageNumber-1)*20, 20);
|
||||||
|
|
||||||
for(int i = 0; i<stampIDs.size(); i++)
|
for (size_t i = 0; i < stampIDs.size(); i++)
|
||||||
{
|
{
|
||||||
SaveFile * tempSave = Client::Ref().GetStamp(stampIDs[i]);
|
SaveFile * tempSave = Client::Ref().GetStamp(stampIDs[i]);
|
||||||
if (tempSave)
|
if (tempSave)
|
||||||
@@ -103,7 +103,7 @@ int LocalBrowserModel::GetPageCount()
|
|||||||
|
|
||||||
void LocalBrowserModel::SelectSave(std::string stampID)
|
void LocalBrowserModel::SelectSave(std::string stampID)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (selected[i] == stampID)
|
if (selected[i] == stampID)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ void LocalBrowserModel::DeselectSave(std::string stampID)
|
|||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
restart:
|
restart:
|
||||||
for(int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (selected[i] == stampID)
|
if (selected[i] == stampID)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ restart:
|
|||||||
|
|
||||||
void LocalBrowserModel::notifySelectedChanged()
|
void LocalBrowserModel::notifySelectedChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
LocalBrowserView* cObserver = observers[i];
|
LocalBrowserView* cObserver = observers[i];
|
||||||
cObserver->NotifySelectedChanged(this);
|
cObserver->NotifySelectedChanged(this);
|
||||||
|
@@ -176,12 +176,11 @@ void LocalBrowserView::NotifyPageChanged(LocalBrowserModel * sender)
|
|||||||
|
|
||||||
void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
|
void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 2;
|
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 2;
|
||||||
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
|
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
|
||||||
|
|
||||||
vector<SaveFile*> saves = sender->GetSavesList();
|
vector<SaveFile*> saves = sender->GetSavesList();
|
||||||
for(i = 0; i < stampButtons.size(); i++)
|
for (size_t i = 0; i < stampButtons.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(stampButtons[i]);
|
RemoveComponent(stampButtons[i]);
|
||||||
delete stampButtons[i];
|
delete stampButtons[i];
|
||||||
@@ -209,7 +208,7 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
|
|||||||
v->c->Selected(sender->GetSaveFile()->GetName(), sender->GetSelected());
|
v->c->Selected(sender->GetSaveFile()->GetName(), sender->GetSelected());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for(i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
if(saveX == savesX)
|
if(saveX == savesX)
|
||||||
{
|
{
|
||||||
@@ -237,10 +236,10 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
|
|||||||
void LocalBrowserView::NotifySelectedChanged(LocalBrowserModel * sender)
|
void LocalBrowserView::NotifySelectedChanged(LocalBrowserModel * sender)
|
||||||
{
|
{
|
||||||
vector<std::string> selected = sender->GetSelected();
|
vector<std::string> selected = sender->GetSelected();
|
||||||
for (int j = 0; j < stampButtons.size(); j++)
|
for (size_t j = 0; j < stampButtons.size(); j++)
|
||||||
{
|
{
|
||||||
stampButtons[j]->SetSelected(false);
|
stampButtons[j]->SetSelected(false);
|
||||||
for (int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (stampButtons[j]->GetSaveFile()->GetName()==selected[i])
|
if (stampButtons[j]->GetSaveFile()->GetName()==selected[i])
|
||||||
stampButtons[j]->SetSelected(true);
|
stampButtons[j]->SetSelected(true);
|
||||||
|
@@ -27,13 +27,13 @@ class LocalBrowserView: public ui::Window {
|
|||||||
|
|
||||||
void textChanged();
|
void textChanged();
|
||||||
bool changed;
|
bool changed;
|
||||||
int lastChanged;
|
unsigned int lastChanged;
|
||||||
int pageCount;
|
int pageCount;
|
||||||
public:
|
public:
|
||||||
LocalBrowserView();
|
LocalBrowserView();
|
||||||
//virtual void OnDraw();
|
//virtual void OnDraw();
|
||||||
virtual void OnTick(float dt);
|
virtual void OnTick(float dt);
|
||||||
void AttachController(LocalBrowserController * c_) { c = c_; };
|
void AttachController(LocalBrowserController * c_) { c = c_; }
|
||||||
void NotifyPageChanged(LocalBrowserModel * sender);
|
void NotifyPageChanged(LocalBrowserModel * sender);
|
||||||
void NotifySavesListChanged(LocalBrowserModel * sender);
|
void NotifySavesListChanged(LocalBrowserModel * sender);
|
||||||
void NotifySelectedChanged(LocalBrowserModel * sender);
|
void NotifySelectedChanged(LocalBrowserModel * sender);
|
||||||
|
@@ -20,7 +20,7 @@ void LoginModel::Login(string username, string password)
|
|||||||
break;
|
break;
|
||||||
case LoginError:
|
case LoginError:
|
||||||
statusText = "Error: " + Client::Ref().GetLastError();
|
statusText = "Error: " + Client::Ref().GetLastError();
|
||||||
int banStart = statusText.find(". Ban expire in"); //TODO: temporary, remove this when the ban message is fixed
|
size_t banStart = statusText.find(". Ban expire in"); //TODO: temporary, remove this when the ban message is fixed
|
||||||
if (banStart != statusText.npos)
|
if (banStart != statusText.npos)
|
||||||
statusText.replace(banStart, 15, ". Login at http://powdertoy.co.uk in order to see the full ban reason. Ban expires in");
|
statusText.replace(banStart, 15, ". Login at http://powdertoy.co.uk in order to see the full ban reason. Ban expires in");
|
||||||
break;
|
break;
|
||||||
@@ -50,7 +50,7 @@ bool LoginModel::GetStatus()
|
|||||||
|
|
||||||
void LoginModel::notifyStatusChanged()
|
void LoginModel::notifyStatusChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyStatusChanged(this);
|
observers[i]->NotifyStatusChanged(this);
|
||||||
}
|
}
|
||||||
|
@@ -33,9 +33,9 @@ LoginView::LoginView():
|
|||||||
loginButton(new ui::Button(ui::Point(200-100, 87-17), ui::Point(100, 17), "Sign in")),
|
loginButton(new ui::Button(ui::Point(200-100, 87-17), ui::Point(100, 17), "Sign in")),
|
||||||
cancelButton(new ui::Button(ui::Point(0, 87-17), ui::Point(101, 17), "Sign Out")),
|
cancelButton(new ui::Button(ui::Point(0, 87-17), ui::Point(101, 17), "Sign Out")),
|
||||||
titleLabel(new ui::Label(ui::Point(4, 5), ui::Point(200-16, 16), "Server login")),
|
titleLabel(new ui::Label(ui::Point(4, 5), ui::Point(200-16, 16), "Server login")),
|
||||||
|
infoLabel(new ui::Label(ui::Point(8, 67), ui::Point(200-16, 16), "")),
|
||||||
usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username, "[username]")),
|
usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username, "[username]")),
|
||||||
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]")),
|
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]")),
|
||||||
infoLabel(new ui::Label(ui::Point(8, 67), ui::Point(200-16, 16), "")),
|
|
||||||
targetSize(0, 0)
|
targetSize(0, 0)
|
||||||
{
|
{
|
||||||
targetSize = Size;
|
targetSize = Size;
|
||||||
|
@@ -16,13 +16,13 @@ class LoginController;
|
|||||||
class LoginMode;
|
class LoginMode;
|
||||||
class LoginView: public ui::Window {
|
class LoginView: public ui::Window {
|
||||||
LoginController * c;
|
LoginController * c;
|
||||||
ui::Point targetSize;
|
|
||||||
ui::Button * loginButton;
|
ui::Button * loginButton;
|
||||||
ui::Button * cancelButton;
|
ui::Button * cancelButton;
|
||||||
ui::Label * titleLabel;
|
ui::Label * titleLabel;
|
||||||
ui::Label * infoLabel;
|
ui::Label * infoLabel;
|
||||||
ui::Textbox * usernameField;
|
ui::Textbox * usernameField;
|
||||||
ui::Textbox * passwordField;
|
ui::Textbox * passwordField;
|
||||||
|
ui::Point targetSize;
|
||||||
public:
|
public:
|
||||||
class LoginAction;
|
class LoginAction;
|
||||||
class CancelAction;
|
class CancelAction;
|
||||||
|
@@ -33,10 +33,10 @@ PreviewController::PreviewController(int saveID, int saveDate, bool instant, Con
|
|||||||
}
|
}
|
||||||
|
|
||||||
PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
|
PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
|
||||||
HasExited(false),
|
|
||||||
saveId(saveID),
|
saveId(saveID),
|
||||||
saveDate(0),
|
saveDate(0),
|
||||||
loginWindow(NULL)
|
loginWindow(NULL),
|
||||||
|
HasExited(false)
|
||||||
{
|
{
|
||||||
previewModel = new PreviewModel();
|
previewModel = new PreviewModel();
|
||||||
previewView = new PreviewView();
|
previewView = new PreviewView();
|
||||||
|
@@ -63,7 +63,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
|
|||||||
}
|
}
|
||||||
if (saveComments)
|
if (saveComments)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saveComments->size(); i++)
|
for (size_t i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
delete saveComments;
|
delete saveComments;
|
||||||
@@ -114,11 +114,12 @@ bool PreviewModel::GetCommentsLoaded()
|
|||||||
|
|
||||||
void PreviewModel::UpdateComments(int pageNumber)
|
void PreviewModel::UpdateComments(int pageNumber)
|
||||||
{
|
{
|
||||||
if(commentsLoaded){
|
if (commentsLoaded)
|
||||||
|
{
|
||||||
commentsLoaded = false;
|
commentsLoaded = false;
|
||||||
if (saveComments)
|
if (saveComments)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saveComments->size(); i++)
|
for (size_t i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
delete saveComments;
|
delete saveComments;
|
||||||
@@ -152,7 +153,7 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
|
|||||||
{
|
{
|
||||||
if (saveComments)
|
if (saveComments)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < saveComments->size(); i++)
|
for (size_t i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
delete saveComments;
|
delete saveComments;
|
||||||
@@ -199,7 +200,7 @@ std::vector<SaveComment*> * PreviewModel::GetComments()
|
|||||||
|
|
||||||
void PreviewModel::notifySaveChanged()
|
void PreviewModel::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);
|
||||||
}
|
}
|
||||||
@@ -207,7 +208,7 @@ void PreviewModel::notifySaveChanged()
|
|||||||
|
|
||||||
void PreviewModel::notifyCommentBoxEnabledChanged()
|
void PreviewModel::notifyCommentBoxEnabledChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyCommentBoxEnabledChanged(this);
|
observers[i]->NotifyCommentBoxEnabledChanged(this);
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ void PreviewModel::notifyCommentBoxEnabledChanged()
|
|||||||
|
|
||||||
void PreviewModel::notifyCommentsPageChanged()
|
void PreviewModel::notifyCommentsPageChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyCommentsPageChanged(this);
|
observers[i]->NotifyCommentsPageChanged(this);
|
||||||
}
|
}
|
||||||
@@ -223,7 +224,7 @@ void PreviewModel::notifyCommentsPageChanged()
|
|||||||
|
|
||||||
void PreviewModel::notifySaveCommentsChanged()
|
void PreviewModel::notifySaveCommentsChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyCommentsChanged(this);
|
observers[i]->NotifyCommentsChanged(this);
|
||||||
}
|
}
|
||||||
@@ -248,7 +249,7 @@ PreviewModel::~PreviewModel()
|
|||||||
delete saveData;
|
delete saveData;
|
||||||
if (saveComments)
|
if (saveComments)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saveComments->size(); i++)
|
for (size_t i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
delete saveComments;
|
delete saveComments;
|
||||||
|
@@ -254,7 +254,7 @@ void PreviewView::DoDraw()
|
|||||||
{
|
{
|
||||||
Window::DoDraw();
|
Window::DoDraw();
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
for(int i = 0; i < commentTextComponents.size(); i++)
|
for (size_t i = 0; i < commentTextComponents.size(); i++)
|
||||||
{
|
{
|
||||||
int linePos = commentTextComponents[i]->Position.Y+commentsPanel->ViewportPosition.Y+commentTextComponents[i]->Size.Y+4;
|
int linePos = commentTextComponents[i]->Position.Y+commentsPanel->ViewportPosition.Y+commentTextComponents[i]->Size.Y+4;
|
||||||
if (linePos > 0 && linePos < Size.Y-commentBoxHeight)
|
if (linePos > 0 && linePos < Size.Y-commentBoxHeight)
|
||||||
@@ -540,7 +540,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
|
|||||||
{
|
{
|
||||||
std::vector<SaveComment*> * comments = sender->GetComments();
|
std::vector<SaveComment*> * comments = sender->GetComments();
|
||||||
|
|
||||||
for(int i = 0; i < commentComponents.size(); i++)
|
for (size_t i = 0; i < commentComponents.size(); i++)
|
||||||
{
|
{
|
||||||
commentsPanel->RemoveChild(commentComponents[i]);
|
commentsPanel->RemoveChild(commentComponents[i]);
|
||||||
delete commentComponents[i];
|
delete commentComponents[i];
|
||||||
@@ -551,7 +551,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
|
|||||||
|
|
||||||
if (comments)
|
if (comments)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < commentComponents.size(); i++)
|
for (size_t i = 0; i < commentComponents.size(); i++)
|
||||||
{
|
{
|
||||||
commentsPanel->RemoveChild(commentComponents[i]);
|
commentsPanel->RemoveChild(commentComponents[i]);
|
||||||
delete commentComponents[i];
|
delete commentComponents[i];
|
||||||
@@ -563,7 +563,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
|
|||||||
ui::Label * tempUsername;
|
ui::Label * tempUsername;
|
||||||
ui::Label * tempComment;
|
ui::Label * tempComment;
|
||||||
ui::AvatarButton * tempAvatar;
|
ui::AvatarButton * tempAvatar;
|
||||||
for(int i = 0; i < comments->size(); i++)
|
for (size_t i = 0; i < comments->size(); i++)
|
||||||
{
|
{
|
||||||
if (showAvatars)
|
if (showAvatars)
|
||||||
{
|
{
|
||||||
|
@@ -101,7 +101,7 @@ Renderer * RenderModel::GetRenderer()
|
|||||||
|
|
||||||
void RenderModel::notifyRendererChanged()
|
void RenderModel::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);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ void RenderModel::notifyRendererChanged()
|
|||||||
|
|
||||||
void RenderModel::notifyRenderChanged()
|
void RenderModel::notifyRenderChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyRenderChanged(this);
|
observers[i]->NotifyRenderChanged(this);
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ void RenderModel::notifyRenderChanged()
|
|||||||
|
|
||||||
void RenderModel::notifyDisplayChanged()
|
void RenderModel::notifyDisplayChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyDisplayChanged(this);
|
observers[i]->NotifyDisplayChanged(this);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ void RenderModel::notifyDisplayChanged()
|
|||||||
|
|
||||||
void RenderModel::notifyColourChanged()
|
void RenderModel::notifyColourChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyColourChanged(this);
|
observers[i]->NotifyColourChanged(this);
|
||||||
}
|
}
|
||||||
|
@@ -302,7 +302,7 @@ void RenderView::NotifyRendererChanged(RenderModel * sender)
|
|||||||
|
|
||||||
void RenderView::NotifyRenderChanged(RenderModel * sender)
|
void RenderView::NotifyRenderChanged(RenderModel * sender)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < renderModes.size(); i++)
|
for (size_t i = 0; i < renderModes.size(); i++)
|
||||||
{
|
{
|
||||||
if (renderModes[i]->GetActionCallback())
|
if (renderModes[i]->GetActionCallback())
|
||||||
{
|
{
|
||||||
@@ -322,7 +322,7 @@ void RenderView::NotifyRenderChanged(RenderModel * sender)
|
|||||||
|
|
||||||
void RenderView::NotifyDisplayChanged(RenderModel * sender)
|
void RenderView::NotifyDisplayChanged(RenderModel * sender)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < displayModes.size(); i++)
|
for (size_t i = 0; i < displayModes.size(); i++)
|
||||||
{
|
{
|
||||||
if( displayModes[i]->GetActionCallback())
|
if( displayModes[i]->GetActionCallback())
|
||||||
{
|
{
|
||||||
@@ -341,7 +341,7 @@ void RenderView::NotifyDisplayChanged(RenderModel * sender)
|
|||||||
|
|
||||||
void RenderView::NotifyColourChanged(RenderModel * sender)
|
void RenderView::NotifyColourChanged(RenderModel * sender)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < colourModes.size(); i++)
|
for (size_t i = 0; i < colourModes.size(); i++)
|
||||||
{
|
{
|
||||||
if (colourModes[i]->GetActionCallback())
|
if (colourModes[i]->GetActionCallback())
|
||||||
{
|
{
|
||||||
|
@@ -33,12 +33,11 @@ public:
|
|||||||
|
|
||||||
SearchController::SearchController(ControllerCallback * callback):
|
SearchController::SearchController(ControllerCallback * callback):
|
||||||
activePreview(NULL),
|
activePreview(NULL),
|
||||||
HasExited(false),
|
|
||||||
nextQueryTime(0.0f),
|
nextQueryTime(0.0f),
|
||||||
nextQueryDone(true),
|
nextQueryDone(true),
|
||||||
instantOpen(false),
|
instantOpen(false),
|
||||||
doRefresh(false),
|
doRefresh(false),
|
||||||
searchModel(NULL)
|
HasExited(false)
|
||||||
{
|
{
|
||||||
searchModel = new SearchModel();
|
searchModel = new SearchModel();
|
||||||
searchView = new SearchView();
|
searchView = new SearchView();
|
||||||
@@ -259,7 +258,7 @@ void SearchController::removeSelectedC()
|
|||||||
RemoveSavesTask(std::vector<int> saves_, SearchController *c_) { saves = saves_; c = c_; }
|
RemoveSavesTask(std::vector<int> saves_, SearchController *c_) { saves = saves_; c = c_; }
|
||||||
virtual bool doWork()
|
virtual bool doWork()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
std::stringstream saveID;
|
std::stringstream saveID;
|
||||||
saveID << "Deleting save [" << saves[i] << "] ...";
|
saveID << "Deleting save [" << saves[i] << "] ...";
|
||||||
@@ -340,7 +339,7 @@ void SearchController::unpublishSelectedC(bool publish)
|
|||||||
virtual bool doWork()
|
virtual bool doWork()
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
for(int i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
if (publish)
|
if (publish)
|
||||||
ret = PublishSave(saves[i]);
|
ret = PublishSave(saves[i]);
|
||||||
@@ -374,7 +373,7 @@ void SearchController::FavouriteSelected()
|
|||||||
FavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
|
FavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
|
||||||
virtual bool doWork()
|
virtual bool doWork()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
std::stringstream saveID;
|
std::stringstream saveID;
|
||||||
saveID << "Favouring save [" << saves[i] << "]";
|
saveID << "Favouring save [" << saves[i] << "]";
|
||||||
@@ -399,7 +398,7 @@ void SearchController::FavouriteSelected()
|
|||||||
UnfavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
|
UnfavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
|
||||||
virtual bool doWork()
|
virtual bool doWork()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
std::stringstream saveID;
|
std::stringstream saveID;
|
||||||
saveID << "Unfavouring save [" << saves[i] << "]";
|
saveID << "Unfavouring save [" << saves[i] << "]";
|
||||||
|
@@ -185,7 +185,7 @@ void SearchModel::AddObserver(SearchView * observer)
|
|||||||
|
|
||||||
void SearchModel::SelectSave(int saveID)
|
void SearchModel::SelectSave(int saveID)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (selected[i] == saveID)
|
if (selected[i] == saveID)
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ void SearchModel::DeselectSave(int saveID)
|
|||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
restart:
|
restart:
|
||||||
for(int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (selected[i] == saveID)
|
if (selected[i] == saveID)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ restart:
|
|||||||
|
|
||||||
void SearchModel::notifySaveListChanged()
|
void SearchModel::notifySaveListChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifySaveListChanged(this);
|
cObserver->NotifySaveListChanged(this);
|
||||||
@@ -224,7 +224,7 @@ void SearchModel::notifySaveListChanged()
|
|||||||
|
|
||||||
void SearchModel::notifyTagListChanged()
|
void SearchModel::notifyTagListChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifyTagListChanged(this);
|
cObserver->NotifyTagListChanged(this);
|
||||||
@@ -233,7 +233,7 @@ void SearchModel::notifyTagListChanged()
|
|||||||
|
|
||||||
void SearchModel::notifyPageChanged()
|
void SearchModel::notifyPageChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifyPageChanged(this);
|
cObserver->NotifyPageChanged(this);
|
||||||
@@ -242,7 +242,7 @@ void SearchModel::notifyPageChanged()
|
|||||||
|
|
||||||
void SearchModel::notifySortChanged()
|
void SearchModel::notifySortChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifySortChanged(this);
|
cObserver->NotifySortChanged(this);
|
||||||
@@ -251,7 +251,7 @@ void SearchModel::notifySortChanged()
|
|||||||
|
|
||||||
void SearchModel::notifyShowOwnChanged()
|
void SearchModel::notifyShowOwnChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifyShowOwnChanged(this);
|
cObserver->NotifyShowOwnChanged(this);
|
||||||
@@ -260,7 +260,7 @@ void SearchModel::notifyShowOwnChanged()
|
|||||||
|
|
||||||
void SearchModel::notifyShowFavouriteChanged()
|
void SearchModel::notifyShowFavouriteChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifyShowOwnChanged(this);
|
cObserver->NotifyShowOwnChanged(this);
|
||||||
@@ -269,7 +269,7 @@ void SearchModel::notifyShowFavouriteChanged()
|
|||||||
|
|
||||||
void SearchModel::notifySelectedChanged()
|
void SearchModel::notifySelectedChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
SearchView* cObserver = observers[i];
|
SearchView* cObserver = observers[i];
|
||||||
cObserver->NotifySelectedChanged(this);
|
cObserver->NotifySelectedChanged(this);
|
||||||
|
@@ -301,7 +301,7 @@ SearchView::~SearchView()
|
|||||||
delete pageLabel;
|
delete pageLabel;
|
||||||
delete pageCountLabel;
|
delete pageCountLabel;
|
||||||
|
|
||||||
for(int i = 0; i < saveButtons.size(); i++)
|
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(saveButtons[i]);
|
RemoveComponent(saveButtons[i]);
|
||||||
delete saveButtons[i];
|
delete saveButtons[i];
|
||||||
@@ -440,7 +440,7 @@ void SearchView::CheckAccess()
|
|||||||
{
|
{
|
||||||
unpublishSelected->Enabled = true;
|
unpublishSelected->Enabled = true;
|
||||||
removeSelected->Enabled = true;
|
removeSelected->Enabled = true;
|
||||||
for(int i = 0; i < saveButtons.size(); i++)
|
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||||
{
|
{
|
||||||
saveButtons[i]->SetSelectable(true);
|
saveButtons[i]->SetSelectable(true);
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ void SearchView::CheckAccess()
|
|||||||
unpublishSelected->Enabled = false;
|
unpublishSelected->Enabled = false;
|
||||||
removeSelected->Enabled = false;
|
removeSelected->Enabled = false;
|
||||||
|
|
||||||
for(int i = 0; i < saveButtons.size(); i++)
|
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||||
{
|
{
|
||||||
saveButtons[i]->SetSelectable(false);
|
saveButtons[i]->SetSelectable(false);
|
||||||
saveButtons[i]->SetSelected(false);
|
saveButtons[i]->SetSelected(false);
|
||||||
@@ -467,7 +467,6 @@ void SearchView::CheckAccess()
|
|||||||
|
|
||||||
void SearchView::NotifyTagListChanged(SearchModel * sender)
|
void SearchView::NotifyTagListChanged(SearchModel * sender)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
int savesY = 4, buttonPadding = 1;
|
int savesY = 4, buttonPadding = 1;
|
||||||
int buttonAreaHeight, buttonYOffset;
|
int buttonAreaHeight, buttonYOffset;
|
||||||
|
|
||||||
@@ -482,7 +481,7 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
|
|||||||
RemoveComponent(tagsLabel);
|
RemoveComponent(tagsLabel);
|
||||||
tagsLabel->SetParentWindow(NULL);
|
tagsLabel->SetParentWindow(NULL);
|
||||||
|
|
||||||
for(i = 0; i < tagButtons.size(); i++)
|
for (size_t i = 0; i < tagButtons.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(tagButtons[i]);
|
RemoveComponent(tagButtons[i]);
|
||||||
delete tagButtons[i];
|
delete tagButtons[i];
|
||||||
@@ -525,7 +524,7 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
|
|||||||
};
|
};
|
||||||
if (sender->GetShowTags())
|
if (sender->GetShowTags())
|
||||||
{
|
{
|
||||||
for(i = 0; i < tags.size(); i++)
|
for (size_t i = 0; i < tags.size(); i++)
|
||||||
{
|
{
|
||||||
int maxTagVotes = tags[0].second;
|
int maxTagVotes = tags[0].second;
|
||||||
|
|
||||||
@@ -570,7 +569,6 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
|
|||||||
|
|
||||||
void SearchView::NotifySaveListChanged(SearchModel * sender)
|
void SearchView::NotifySaveListChanged(SearchModel * sender)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 1;
|
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 1;
|
||||||
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
|
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
|
||||||
|
|
||||||
@@ -583,7 +581,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
|
|||||||
favouriteSelected->SetText("Favourite");
|
favouriteSelected->SetText("Favourite");
|
||||||
|
|
||||||
Client::Ref().ClearThumbnailRequests();
|
Client::Ref().ClearThumbnailRequests();
|
||||||
for(i = 0; i < saveButtons.size(); i++)
|
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(saveButtons[i]);
|
RemoveComponent(saveButtons[i]);
|
||||||
}
|
}
|
||||||
@@ -641,7 +639,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
|
|||||||
delete errorLabel;
|
delete errorLabel;
|
||||||
errorLabel = NULL;
|
errorLabel = NULL;
|
||||||
}
|
}
|
||||||
for(i = 0; i < saveButtons.size(); i++)
|
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||||
{
|
{
|
||||||
delete saveButtons[i];
|
delete saveButtons[i];
|
||||||
}
|
}
|
||||||
@@ -688,7 +686,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
|
|||||||
v->Search("user:"+sender->GetSave()->GetUserName());
|
v->Search("user:"+sender->GetSave()->GetUserName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for(i = 0; i < saves.size(); i++)
|
for (size_t i = 0; i < saves.size(); i++)
|
||||||
{
|
{
|
||||||
if (saveX == savesX)
|
if (saveX == savesX)
|
||||||
{
|
{
|
||||||
@@ -721,11 +719,11 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
|
|||||||
void SearchView::NotifySelectedChanged(SearchModel * sender)
|
void SearchView::NotifySelectedChanged(SearchModel * sender)
|
||||||
{
|
{
|
||||||
vector<int> selected = sender->GetSelected();
|
vector<int> selected = sender->GetSelected();
|
||||||
int published = 0;
|
size_t published = 0;
|
||||||
for(int j = 0; j < saveButtons.size(); j++)
|
for (size_t j = 0; j < saveButtons.size(); j++)
|
||||||
{
|
{
|
||||||
saveButtons[j]->SetSelected(false);
|
saveButtons[j]->SetSelected(false);
|
||||||
for(int i = 0; i < selected.size(); i++)
|
for (size_t i = 0; i < selected.size(); i++)
|
||||||
{
|
{
|
||||||
if (saveButtons[j]->GetSave()->GetID() == selected[i])
|
if (saveButtons[j]->GetSave()->GetID() == selected[i])
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ private:
|
|||||||
void doSearch();
|
void doSearch();
|
||||||
void textChanged();
|
void textChanged();
|
||||||
bool changed;
|
bool changed;
|
||||||
int lastChanged;
|
unsigned int lastChanged;
|
||||||
int pageCount;
|
int pageCount;
|
||||||
bool publishButtonShown;
|
bool publishButtonShown;
|
||||||
public:
|
public:
|
||||||
|
@@ -65,7 +65,7 @@ void TagsModel::AddObserver(TagsView * observer)
|
|||||||
|
|
||||||
void TagsModel::notifyTagsChanged()
|
void TagsModel::notifyTagsChanged()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < observers.size(); i++)
|
for (size_t i = 0; i < observers.size(); i++)
|
||||||
{
|
{
|
||||||
observers[i]->NotifyTagsChanged(this);
|
observers[i]->NotifyTagsChanged(this);
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ void TagsView::OnDraw()
|
|||||||
|
|
||||||
void TagsView::NotifyTagsChanged(TagsModel * sender)
|
void TagsView::NotifyTagsChanged(TagsModel * sender)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < tags.size(); i++)
|
for (size_t i = 0; i < tags.size(); i++)
|
||||||
{
|
{
|
||||||
RemoveComponent(tags[i]);
|
RemoveComponent(tags[i]);
|
||||||
delete tags[i];
|
delete tags[i];
|
||||||
|
@@ -175,20 +175,24 @@ int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int dir
|
|||||||
int posX, posY, r, spaces = 0, currentPos = 0;
|
int posX, posY, r, spaces = 0, currentPos = 0;
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
for(posX = stackX, posY = stackY; currentPos < maxSize + amount && currentPos < XRES-1; posX += directionX, posY += directionY) {
|
for (posX = stackX, posY = stackY; currentPos < maxSize + amount && currentPos < XRES-1; posX += directionX, posY += directionY)
|
||||||
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0)) {
|
{
|
||||||
|
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0))
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
r = sim->pmap[posY][posX];
|
r = sim->pmap[posY][posX];
|
||||||
if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block))
|
if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block))
|
||||||
return spaces;
|
return spaces;
|
||||||
if(!r) {
|
if (!r)
|
||||||
|
{
|
||||||
spaces++;
|
spaces++;
|
||||||
tempParts[currentPos++] = -1;
|
tempParts[currentPos++] = -1;
|
||||||
if (spaces >= amount)
|
if (spaces >= amount)
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
if(spaces < maxSize && currentPos < maxSize && (!retract || ((r&0xFF) == PT_FRME) && posX == stackX && posY == stackY))
|
else
|
||||||
|
{
|
||||||
|
if (spaces < maxSize && currentPos < maxSize && (!retract || ((r&0xFF) == PT_FRME && posX == stackX && posY == stackY)))
|
||||||
tempParts[currentPos++] = r>>8;
|
tempParts[currentPos++] = r>>8;
|
||||||
else
|
else
|
||||||
return spaces;
|
return spaces;
|
||||||
|
Reference in New Issue
Block a user