fix ALL the warnings

mostly just using more size_t. Also do some formatting around if statements
This commit is contained in:
jacob1 2015-01-16 22:35:32 -05:00
parent efd69b208d
commit ace9e36cc6
27 changed files with 206 additions and 206 deletions

View File

@ -23,7 +23,7 @@ ContextMenu::ContextMenu(Component * source):
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]);
delete buttons[i];
@ -40,7 +40,7 @@ void ContextMenu::Show(ui::Point position)
Position = position;
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);
tempButton->Appearance = Appearance;
@ -69,9 +69,9 @@ void ContextMenu::OnMouseDown(int x, int y, unsigned button)
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)
{
items[i].Text = text;
break;
@ -81,9 +81,9 @@ void ContextMenu::SetItem(int id, std::string text)
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)
{
items.erase(items.begin()+i);
break;

View File

@ -32,11 +32,11 @@ public:
appearance(dropDown->Appearance)
{
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);
tempButton->Appearance = appearance;
if(i)
if (i)
tempButton->Appearance.Border = ui::Border(0, 1, 1, 1);
tempButton->SetActionCallback(new ItemSelectedAction(this, dropDown->options[i].first));
AddComponent(tempButton);
@ -51,10 +51,10 @@ public:
void setOption(std::string option)
{
dropDown->SetOption(option);
if(dropDown->callback)
if (dropDown->callback)
{
int optionIndex = 0;
for(optionIndex = 0; optionIndex < dropDown->options.size(); optionIndex++)
size_t optionIndex = 0;
for (optionIndex = 0; optionIndex < dropDown->options.size(); optionIndex++)
{
if(option == dropDown->options[optionIndex].first)
break;
@ -138,9 +138,9 @@ void DropDown::OnMouseLeave(int x, int y)
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)
{
optionIndex = i;
TextPosition(options[optionIndex].first);
@ -150,9 +150,9 @@ void DropDown::OnMouseLeave(int x, int y)
}
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)
{
optionIndex = i;
TextPosition(options[optionIndex].first);
@ -162,9 +162,9 @@ void DropDown::OnMouseLeave(int x, int y)
}
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;
}
options.push_back(option);
@ -172,11 +172,11 @@ void DropDown::OnMouseLeave(int x, int y)
void DropDown::RemoveOption(std::string option)
{
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;
options.erase(options.begin()+i);
goto start;

View File

@ -69,7 +69,7 @@ void Label::AutoHeight()
void Label::updateMultiline()
{
int lines = 1;
if(text.length()>0)
if (text.length()>0)
{
char * rawText = new char[text.length()+1];
std::copy(text.begin(), text.end(), rawText);
@ -81,7 +81,7 @@ void Label::updateMultiline()
int wordWidth = 0;
int lineWidth = 0;
char * wordStart = NULL;
while(c = rawText[charIndex++])
while ((c = rawText[charIndex++]))
{
switch(c)
{
@ -98,19 +98,19 @@ void Label::updateMultiline()
wordWidth += Graphics::CharWidth(c);
break;
}
if(pc == ' ')
if (pc == ' ')
{
wordStart = &rawText[charIndex-2];
}
if ((c != ' ' || pc == ' ') && lineWidth + wordWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
{
if(wordStart && *wordStart)
if (wordStart && *wordStart)
{
*wordStart = '\n';
if (lineWidth != 0)
lineWidth = wordWidth;
}
else if(!wordStart)
else if (!wordStart)
{
rawText[charIndex-1] = '\n';
lineWidth = 0;
@ -121,7 +121,7 @@ void Label::updateMultiline()
}
pc = c;
}
if(autoHeight)
if (autoHeight)
{
Size.Y = lines*12;
}
@ -162,7 +162,7 @@ void Label::updateMultiline()
}
else
{
if(autoHeight)
if (autoHeight)
{
Size.Y = 12;
}
@ -280,10 +280,10 @@ void Label::updateSelection()
{
std::string currentText;
if(selectionIndex0 < 0) selectionIndex0 = 0;
if(selectionIndex0 > text.length()) selectionIndex0 = text.length();
if(selectionIndex1 < 0) selectionIndex1 = 0;
if(selectionIndex1 > text.length()) selectionIndex1 = text.length();
if (selectionIndex0 < 0) selectionIndex0 = 0;
if (selectionIndex0 > (int)text.length()) selectionIndex0 = text.length();
if (selectionIndex1 < 0) selectionIndex1 = 0;
if (selectionIndex1 > (int)text.length()) selectionIndex1 = text.length();
if(selectionIndex0 == -1 || selectionIndex1 == -1)
{

View File

@ -75,9 +75,9 @@ Component* Panel::GetChild(unsigned idx)
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)
{
//remove child from parent. Does not free memory
children.erase(children.begin() + i);
@ -114,13 +114,13 @@ void Panel::Draw(const Point& screenPos)
#endif
// 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
if(children[i]->Visible)
if (children[i]->Visible)
{
//check if the component is in the screen, draw if it is
if( children[i]->Position.X + ViewportPosition.X + children[i]->Size.X >= 0 &&
if (children[i]->Position.X + ViewportPosition.X + children[i]->Size.X >= 0 &&
children[i]->Position.Y + ViewportPosition.Y + children[i]->Size.Y >= 0 &&
children[i]->Position.X + ViewportPosition.X < ui::Engine::Ref().GetWidth() &&
children[i]->Position.Y + ViewportPosition.Y < ui::Engine::Ref().GetHeight() )
@ -222,7 +222,7 @@ void Panel::OnMouseClick(int localx, int localy, unsigned button)
void Panel::OnMouseDown(int x, int y, unsigned 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)
children[i]->OnMouseDown(x, y, button);
@ -232,9 +232,9 @@ void Panel::OnMouseDown(int x, int y, unsigned button)
void Panel::OnMouseHover(int localx, int localy)
{
// check if hovering on children
for(int i = children.size() - 1; i >= 0; --i)
for (int i = children.size() - 1; i >= 0; --i)
{
if(!children[i]->Locked)
if (!children[i]->Locked)
{
if( localx >= children[i]->Position.X &&
localy >= children[i]->Position.Y &&
@ -254,7 +254,7 @@ void Panel::OnMouseHover(int localx, int localy)
void Panel::OnMouseMoved(int localx, int localy, int dx, int 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)
children[i]->OnMouseMoved(localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y, dx, dy);
@ -264,9 +264,9 @@ void Panel::OnMouseMoved(int localx, int localy, int dx, int dy)
void Panel::OnMouseMovedInside(int localx, int localy, int dx, int dy)
{
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)
{
Point local (localx - children[i]->Position.X - ViewportPosition.X, localy - children[i]->Position.Y - ViewportPosition.Y)
, prevlocal (local.X - dx, local.Y - dy);
@ -344,7 +344,7 @@ void Panel::OnMouseUnclick(int localx, int localy, unsigned button)
}
//if a child wasn't clicked, send click to ourself
if(!childunclicked)
if (!childunclicked)
{
XOnMouseUnclick(localx, localy, button);
}
@ -353,9 +353,9 @@ void Panel::OnMouseUnclick(int localx, int localy, unsigned button)
void Panel::OnMouseUp(int x, int y, unsigned 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);
}
}
@ -363,9 +363,9 @@ void Panel::OnMouseUp(int x, int y, unsigned button)
void Panel::OnMouseWheel(int localx, int localy, int 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);
}
}
@ -374,13 +374,13 @@ void Panel::OnMouseWheelInside(int localx, int localy, int d)
{
XOnMouseWheelInside(localx, localy, d);
//check if clicked a child
for(int i = children.size()-1; i >= 0 ; --i)
for (int i = children.size()-1; i >= 0 ; --i)
{
//child must be unlocked
if(!children[i]->Locked)
if (!children[i]->Locked)
{
//is mouse inside?
if( localx >= children[i]->Position.X + ViewportPosition.X &&
if (localx >= children[i]->Position.X + ViewportPosition.X &&
localy >= children[i]->Position.Y + ViewportPosition.Y &&
localx < children[i]->Position.X + ViewportPosition.X + children[i]->Size.X &&
localy < children[i]->Position.Y + ViewportPosition.Y + children[i]->Size.Y )

View File

@ -42,7 +42,7 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
votes = format::NumberToString<int>(save->GetVotesUp()-save->GetVotesDown());
icon += 0xBB;
for (int j = 1; j < votes.length(); j++)
for (size_t j = 1; j < votes.length(); j++)
icon += 0xBC;
icon += 0xB9;
icon += 0xBA;

View File

@ -66,7 +66,7 @@ void Slider::OnMouseUp(int x, int y, unsigned button)
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};
if(bgGradient)
free(bgGradient);

View File

@ -135,10 +135,9 @@ void Textbox::TabFocus()
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;
ClipboardPush((char*)backingText.substr(getLowerSelectionBound(), getHigherSelectionBound()-getLowerSelectionBound()).c_str());
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
@ -191,7 +190,7 @@ void Textbox::pasteIntoSelection()
std::string newText = ClipboardPull();
if(HasSelection())
{
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
return;
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
cursor = getLowerSelectionBound();
@ -288,12 +287,12 @@ bool Textbox::CharacterValid(Uint16 character)
void Textbox::Tick(float dt)
{
Label::Tick(dt);
if(!IsFocused())
if (!IsFocused())
{
keyDown = 0;
characterDown = 0;
}
if((keyDown || characterDown) && repeatTime <= gettime())
if ((keyDown || characterDown) && repeatTime <= gettime())
{
OnVKeyPress(keyDown, characterDown, false, false, false);
repeatTime = gettime()+30;
@ -356,24 +355,24 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
ClearSelection();
break;
case KEY_RIGHT:
if(cursor < backingText.length())
if (cursor < (int)backingText.length())
cursor++;
ClearSelection();
break;
case KEY_DELETE:
if(ReadOnly)
break;
if(HasSelection())
if (HasSelection())
{
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
return;
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
cursor = getLowerSelectionBound();
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);
else
backingText.erase(cursor, 1);
@ -382,19 +381,19 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
ClearSelection();
break;
case KEY_BACKSPACE:
if(ReadOnly)
if (ReadOnly)
break;
if(HasSelection())
if (HasSelection())
{
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
return;
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
cursor = getLowerSelectionBound();
changed = true;
}
else if(backingText.length() && cursor > 0)
else if (backingText.length() && cursor > 0)
{
if(ctrl)
if (ctrl)
{
backingText.erase(0, cursor);
cursor = 0;
@ -409,24 +408,24 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
ClearSelection();
break;
default:
if(CharacterValid(character) && !ReadOnly)
if (CharacterValid(character) && !ReadOnly)
{
if(HasSelection())
if (HasSelection())
{
if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length())
if (getLowerSelectionBound() < 0 || getHigherSelectionBound() > (int)backingText.length())
return;
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
cursor = getLowerSelectionBound();
}
int regionWidth = Size.X;
if(Appearance.icon)
if( Appearance.icon)
regionWidth -= 13;
regionWidth -= Appearance.Margin.Left;
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;
}
@ -442,22 +441,22 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break;
}
}
catch(std::out_of_range &e)
catch (std::out_of_range &e)
{
cursor = 0;
backingText = "";
}
if(inputType == Number)
if (inputType == Number)
{
//Remove extra preceding 0's
while(backingText[0] == '0' && backingText.length()>1)
backingText.erase(backingText.begin());
}
if(cursor > backingText.length())
if (cursor > (int)backingText.length())
cursor = backingText.length();
if(changed)
if (changed)
{
if(masked)
if (masked)
{
std::string maskedText = std::string(backingText);
std::fill(maskedText.begin(), maskedText.end(), '\x8D');

View File

@ -59,7 +59,7 @@ public:
protected:
ValidInput inputType;
size_t limit;
int repeatTime;
unsigned long repeatTime;
int keyDown;
Uint16 characterDown;
bool mouseDown;

View File

@ -64,7 +64,7 @@ void LocalBrowserController::removeSelectedC()
RemoveSavesTask(LocalBrowserController * c, std::vector<std::string> saves_) : c(c) { saves = saves_; }
virtual bool doWork()
{
for(int i = 0; i < saves.size(); i++)
for (size_t i = 0; i < saves.size(); i++)
{
std::stringstream saveName;
saveName << "Deleting stamp [" << saves[i] << "] ...";

View File

@ -28,7 +28,7 @@ void LocalBrowserModel::AddObserver(LocalBrowserView * observer)
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]->NotifyPageChanged(this);
@ -37,7 +37,7 @@ void LocalBrowserModel::notifySavesListChanged()
void LocalBrowserModel::notifyPageChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyPageChanged(this);
}
@ -80,10 +80,10 @@ void LocalBrowserModel::UpdateSavesList(int pageNumber)
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]);
if(tempSave)
if (tempSave)
{
savesList.push_back(tempSave);
}
@ -103,9 +103,9 @@ int LocalBrowserModel::GetPageCount()
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)
{
return;
}
@ -118,9 +118,9 @@ void LocalBrowserModel::DeselectSave(std::string stampID)
{
bool changed = false;
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)
{
selected.erase(selected.begin()+i);
changed = true;
@ -133,7 +133,7 @@ restart:
void LocalBrowserModel::notifySelectedChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
LocalBrowserView* cObserver = observers[i];
cObserver->NotifySelectedChanged(this);

View File

@ -176,12 +176,11 @@ void LocalBrowserView::NotifyPageChanged(LocalBrowserModel * sender)
void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
{
int i = 0;
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 2;
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
vector<SaveFile*> saves = sender->GetSavesList();
for(i = 0; i < stampButtons.size(); i++)
for (size_t i = 0; i < stampButtons.size(); i++)
{
RemoveComponent(stampButtons[i]);
delete stampButtons[i];
@ -209,7 +208,7 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
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)
{
@ -237,10 +236,10 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
void LocalBrowserView::NotifySelectedChanged(LocalBrowserModel * sender)
{
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);
for (int i = 0; i < selected.size(); i++)
for (size_t i = 0; i < selected.size(); i++)
{
if (stampButtons[j]->GetSaveFile()->GetName()==selected[i])
stampButtons[j]->SetSelected(true);

View File

@ -27,13 +27,13 @@ class LocalBrowserView: public ui::Window {
void textChanged();
bool changed;
int lastChanged;
unsigned int lastChanged;
int pageCount;
public:
LocalBrowserView();
//virtual void OnDraw();
virtual void OnTick(float dt);
void AttachController(LocalBrowserController * c_) { c = c_; };
void AttachController(LocalBrowserController * c_) { c = c_; }
void NotifyPageChanged(LocalBrowserModel * sender);
void NotifySavesListChanged(LocalBrowserModel * sender);
void NotifySelectedChanged(LocalBrowserModel * sender);

View File

@ -20,7 +20,7 @@ void LoginModel::Login(string username, string password)
break;
case LoginError:
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)
statusText.replace(banStart, 15, ". Login at http://powdertoy.co.uk in order to see the full ban reason. Ban expires in");
break;
@ -50,7 +50,7 @@ bool LoginModel::GetStatus()
void LoginModel::notifyStatusChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyStatusChanged(this);
}

View File

@ -33,9 +33,9 @@ LoginView::LoginView():
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")),
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]")),
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 = Size;

View File

@ -16,13 +16,13 @@ class LoginController;
class LoginMode;
class LoginView: public ui::Window {
LoginController * c;
ui::Point targetSize;
ui::Button * loginButton;
ui::Button * cancelButton;
ui::Label * titleLabel;
ui::Label * infoLabel;
ui::Textbox * usernameField;
ui::Textbox * passwordField;
ui::Point targetSize;
public:
class LoginAction;
class CancelAction;

View File

@ -33,10 +33,10 @@ PreviewController::PreviewController(int saveID, int saveDate, bool instant, Con
}
PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
HasExited(false),
saveId(saveID),
saveDate(0),
loginWindow(NULL)
loginWindow(NULL),
HasExited(false)
{
previewModel = new PreviewModel();
previewView = new PreviewView();

View File

@ -51,7 +51,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
this->tSaveID = saveID;
this->tSaveDate = saveDate;
if(save)
if (save)
{
delete save;
save = NULL;
@ -61,9 +61,9 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
delete saveData;
saveData = NULL;
}
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);
saveComments->clear();
delete saveComments;
@ -75,7 +75,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
RequestBroker::Ref().Start(Client::Ref().GetSaveDataAsync(saveID, saveDate), this, 1);
RequestBroker::Ref().Start(Client::Ref().GetSaveAsync(saveID, saveDate), this, 2);
if(!GetDoOpen())
if (!GetDoOpen())
{
commentsLoaded = false;
RequestBroker::Ref().Start(Client::Ref().GetCommentsAsync(saveID, (commentsPageNumber-1)*20, 20), this, 3);
@ -114,11 +114,12 @@ bool PreviewModel::GetCommentsLoaded()
void PreviewModel::UpdateComments(int pageNumber)
{
if(commentsLoaded){
if (commentsLoaded)
{
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);
saveComments->clear();
delete saveComments;
@ -126,7 +127,7 @@ void PreviewModel::UpdateComments(int pageNumber)
}
commentsPageNumber = pageNumber;
if(!GetDoOpen())
if (!GetDoOpen())
RequestBroker::Ref().Start(Client::Ref().GetCommentsAsync(tSaveID, (commentsPageNumber-1)*20, 20), this, 3);
notifySaveCommentsChanged();
@ -150,9 +151,9 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
}
if (identifier == 3)
{
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);
saveComments->clear();
delete saveComments;
@ -164,7 +165,7 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
notifySaveCommentsChanged();
}
if(identifier == 1 || identifier == 2)
if (identifier == 1 || identifier == 2)
{
if (save && saveData)
{
@ -199,7 +200,7 @@ std::vector<SaveComment*> * PreviewModel::GetComments()
void PreviewModel::notifySaveChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifySaveChanged(this);
}
@ -207,7 +208,7 @@ void PreviewModel::notifySaveChanged()
void PreviewModel::notifyCommentBoxEnabledChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyCommentBoxEnabledChanged(this);
}
@ -215,7 +216,7 @@ void PreviewModel::notifyCommentBoxEnabledChanged()
void PreviewModel::notifyCommentsPageChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyCommentsPageChanged(this);
}
@ -223,7 +224,7 @@ void PreviewModel::notifyCommentsPageChanged()
void PreviewModel::notifySaveCommentsChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyCommentsChanged(this);
}
@ -242,13 +243,13 @@ void PreviewModel::AddObserver(PreviewView * observer)
PreviewModel::~PreviewModel()
{
RequestBroker::Ref().DetachRequestListener(this);
if(save)
if (save)
delete save;
if (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);
saveComments->clear();
delete saveComments;

View File

@ -254,10 +254,10 @@ void PreviewView::DoDraw()
{
Window::DoDraw();
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;
if(linePos > 0 && linePos < Size.Y-commentBoxHeight)
if (linePos > 0 && linePos < Size.Y-commentBoxHeight)
g->draw_line(
Position.X+1+XRES/2,
Position.Y+linePos,
@ -265,7 +265,7 @@ void PreviewView::DoDraw()
Position.Y+linePos,
255, 255, 255, 100);
}
if(c->GetDoOpen())
if (c->GetDoOpen())
{
g->fillrect(Position.X+(Size.X/2)-101, Position.Y+(Size.Y/2)-26, 202, 52, 0, 0, 0, 210);
g->drawrect(Position.X+(Size.X/2)-100, Position.Y+(Size.Y/2)-25, 200, 50, 255, 255, 255, 180);
@ -540,7 +540,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
{
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]);
delete commentComponents[i];
@ -549,9 +549,9 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
commentTextComponents.clear();
commentsPanel->InnerSize = ui::Point(0, 0);
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]);
delete commentComponents[i];
@ -563,9 +563,9 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
ui::Label * tempUsername;
ui::Label * tempComment;
ui::AvatarButton * tempAvatar;
for(int i = 0; i < comments->size(); i++)
for (size_t i = 0; i < comments->size(); i++)
{
if(showAvatars)
if (showAvatars)
{
tempAvatar = new ui::AvatarButton(ui::Point(2, currentY+7), ui::Point(26, 26), comments->at(i)->authorName);
tempAvatar->SetActionCallback(new AvatarAction(this));
@ -573,7 +573,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
commentsPanel->AddChild(tempAvatar);
}
if(showAvatars)
if (showAvatars)
tempUsername = new ui::Label(ui::Point(31, currentY+3), ui::Point(Size.X-((XRES/2) + 13 + 26), 16), comments->at(i)->authorNameFormatted);
else
tempUsername = new ui::Label(ui::Point(5, currentY+3), ui::Point(Size.X-((XRES/2) + 13), 16), comments->at(i)->authorNameFormatted);
@ -588,7 +588,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
commentComponents.push_back(tempUsername);
commentsPanel->AddChild(tempUsername);
if(showAvatars)
if (showAvatars)
tempComment = new ui::Label(ui::Point(31, currentY+5), ui::Point(Size.X-((XRES/2) + 13 + 26), -1), comments->at(i)->comment);
else
tempComment = new ui::Label(ui::Point(5, currentY+5), ui::Point(Size.X-((XRES/2) + 13), -1), comments->at(i)->comment);

View File

@ -101,7 +101,7 @@ Renderer * RenderModel::GetRenderer()
void RenderModel::notifyRendererChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyRendererChanged(this);
}
@ -109,7 +109,7 @@ void RenderModel::notifyRendererChanged()
void RenderModel::notifyRenderChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyRenderChanged(this);
}
@ -117,7 +117,7 @@ void RenderModel::notifyRenderChanged()
void RenderModel::notifyDisplayChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyDisplayChanged(this);
}
@ -125,7 +125,7 @@ void RenderModel::notifyDisplayChanged()
void RenderModel::notifyColourChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyColourChanged(this);
}

View File

@ -302,13 +302,13 @@ void RenderView::NotifyRendererChanged(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())
{
//Compares bitmasks at the moment, this means that "Point" is always on when other options that depend on it are, this might confuse some users, TODO: get the full list and compare that?
RenderModeAction * action = (RenderModeAction *)(renderModes[i]->GetActionCallback());
if(action->renderMode == (sender->GetRenderMode() & action->renderMode))
if (action->renderMode == (sender->GetRenderMode() & action->renderMode))
{
renderModes[i]->SetChecked(true);
}
@ -322,12 +322,12 @@ void RenderView::NotifyRenderChanged(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())
{
DisplayModeAction * action = (DisplayModeAction *)(displayModes[i]->GetActionCallback());
if(action->displayMode == (sender->GetDisplayMode() & action->displayMode))
if (action->displayMode == (sender->GetDisplayMode() & action->displayMode))
{
displayModes[i]->SetChecked(true);
}
@ -341,12 +341,12 @@ void RenderView::NotifyDisplayChanged(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())
{
ColourModeAction * action = (ColourModeAction *)(colourModes[i]->GetActionCallback());
if(action->colourMode == sender->GetColourMode())
if (action->colourMode == sender->GetColourMode())
{
colourModes[i]->SetChecked(true);
}

View File

@ -33,12 +33,11 @@ public:
SearchController::SearchController(ControllerCallback * callback):
activePreview(NULL),
HasExited(false),
nextQueryTime(0.0f),
nextQueryDone(true),
instantOpen(false),
doRefresh(false),
searchModel(NULL)
HasExited(false)
{
searchModel = new SearchModel();
searchView = new SearchView();
@ -259,12 +258,12 @@ void SearchController::removeSelectedC()
RemoveSavesTask(std::vector<int> saves_, SearchController *c_) { saves = saves_; c = c_; }
virtual bool doWork()
{
for(int i = 0; i < saves.size(); i++)
for (size_t i = 0; i < saves.size(); i++)
{
std::stringstream saveID;
saveID << "Deleting save [" << saves[i] << "] ...";
notifyStatus(saveID.str());
if(Client::Ref().DeleteSave(saves[i])!=RequestOkay)
if (Client::Ref().DeleteSave(saves[i])!=RequestOkay)
{
std::stringstream saveIDF;
saveIDF << "\boFailed to delete [" << saves[i] << "] ...";
@ -301,7 +300,7 @@ void SearchController::UnpublishSelected(bool publish)
std::stringstream desc;
desc << "Are you sure you want to " << (publish ? "publish " : "unpublish ") << searchModel->GetSelected().size() << " save";
if(searchModel->GetSelected().size()>1)
if (searchModel->GetSelected().size() > 1)
desc << "s";
desc << "?";
new ConfirmPrompt((publish ? "Publish Saves" : "Unpublish Saves"), desc.str(), new UnpublishSelectedConfirmation(this, publish));
@ -340,7 +339,7 @@ void SearchController::unpublishSelectedC(bool publish)
virtual bool doWork()
{
bool ret;
for(int i = 0; i < saves.size(); i++)
for (size_t i = 0; i < saves.size(); i++)
{
if (publish)
ret = PublishSave(saves[i]);
@ -374,12 +373,12 @@ void SearchController::FavouriteSelected()
FavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
virtual bool doWork()
{
for(int i = 0; i < saves.size(); i++)
for (size_t i = 0; i < saves.size(); i++)
{
std::stringstream saveID;
saveID << "Favouring save [" << saves[i] << "]";
notifyStatus(saveID.str());
if(Client::Ref().FavouriteSave(saves[i], true)!=RequestOkay)
if (Client::Ref().FavouriteSave(saves[i], true)!=RequestOkay)
{
std::stringstream saveIDF;
saveIDF << "\boFailed to favourite [" << saves[i] << "], are you logged in?";
@ -399,12 +398,12 @@ void SearchController::FavouriteSelected()
UnfavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
virtual bool doWork()
{
for(int i = 0; i < saves.size(); i++)
for (size_t i = 0; i < saves.size(); i++)
{
std::stringstream saveID;
saveID << "Unfavouring save [" << saves[i] << "]";
notifyStatus(saveID.str());
if(Client::Ref().FavouriteSave(saves[i], false)!=RequestOkay)
if (Client::Ref().FavouriteSave(saves[i], false)!=RequestOkay)
{
std::stringstream saveIDF;
saveIDF << "\boFailed to unfavourite [" << saves[i] << "], are you logged in?";
@ -418,7 +417,7 @@ void SearchController::FavouriteSelected()
};
std::vector<int> selected = searchModel->GetSelected();
if(!searchModel->GetShowFavourite())
if (!searchModel->GetShowFavourite())
new TaskWindow("Favouring saves", new FavouriteSavesTask(selected));
else
new TaskWindow("Unfavouring saves", new UnfavouriteSavesTask(selected));

View File

@ -185,9 +185,9 @@ void SearchModel::AddObserver(SearchView * observer)
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)
{
return;
}
@ -200,9 +200,9 @@ void SearchModel::DeselectSave(int saveID)
{
bool changed = false;
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)
{
selected.erase(selected.begin()+i);
changed = true;
@ -215,7 +215,7 @@ restart:
void SearchModel::notifySaveListChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifySaveListChanged(this);
@ -224,7 +224,7 @@ void SearchModel::notifySaveListChanged()
void SearchModel::notifyTagListChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifyTagListChanged(this);
@ -233,7 +233,7 @@ void SearchModel::notifyTagListChanged()
void SearchModel::notifyPageChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifyPageChanged(this);
@ -242,7 +242,7 @@ void SearchModel::notifyPageChanged()
void SearchModel::notifySortChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifySortChanged(this);
@ -251,7 +251,7 @@ void SearchModel::notifySortChanged()
void SearchModel::notifyShowOwnChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifyShowOwnChanged(this);
@ -260,7 +260,7 @@ void SearchModel::notifyShowOwnChanged()
void SearchModel::notifyShowFavouriteChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifyShowOwnChanged(this);
@ -269,7 +269,7 @@ void SearchModel::notifyShowFavouriteChanged()
void SearchModel::notifySelectedChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
SearchView* cObserver = observers[i];
cObserver->NotifySelectedChanged(this);
@ -278,6 +278,6 @@ void SearchModel::notifySelectedChanged()
SearchModel::~SearchModel()
{
if(loadedSave)
if (loadedSave)
delete loadedSave;
}

View File

@ -301,7 +301,7 @@ SearchView::~SearchView()
delete pageLabel;
delete pageCountLabel;
for(int i = 0; i < saveButtons.size(); i++)
for (size_t i = 0; i < saveButtons.size(); i++)
{
RemoveComponent(saveButtons[i]);
delete saveButtons[i];
@ -420,7 +420,7 @@ void SearchView::NotifyAuthUserChanged(Client * sender)
void SearchView::CheckAccess()
{
if(c)
if (c)
{
c->ClearSelection();
@ -430,17 +430,17 @@ void SearchView::CheckAccess()
favButton->DoAction();
}
if(Client::Ref().GetAuthUser().ID)
if (Client::Ref().GetAuthUser().ID)
{
ownButton->Enabled = true;
favButton->Enabled = true;
favouriteSelected->Enabled = true;
if(Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
if (Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
{
unpublishSelected->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);
}
@ -457,7 +457,7 @@ void SearchView::CheckAccess()
unpublishSelected->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]->SetSelected(false);
@ -467,7 +467,6 @@ void SearchView::CheckAccess()
void SearchView::NotifyTagListChanged(SearchModel * sender)
{
int i = 0;
int savesY = 4, buttonPadding = 1;
int buttonAreaHeight, buttonYOffset;
@ -482,7 +481,7 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
RemoveComponent(tagsLabel);
tagsLabel->SetParentWindow(NULL);
for(i = 0; i < tagButtons.size(); i++)
for (size_t i = 0; i < tagButtons.size(); i++)
{
RemoveComponent(tagButtons[i]);
delete tagButtons[i];
@ -492,7 +491,7 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
buttonYOffset = 28;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
if(sender->GetShowTags())
if (sender->GetShowTags())
{
buttonYOffset += (buttonAreaHeight/savesY) - buttonPadding*2;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
@ -523,15 +522,15 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
v->Search(tag);
}
};
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;
pair<string, int> tag = tags[i];
if(tagX == tagsX)
if (tagX == tagsX)
{
if(tagY == tagsY-1)
break;
@ -570,7 +569,6 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
void SearchView::NotifySaveListChanged(SearchModel * sender)
{
int i = 0;
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 1;
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
@ -583,11 +581,11 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
favouriteSelected->SetText("Favourite");
Client::Ref().ClearThumbnailRequests();
for(i = 0; i < saveButtons.size(); i++)
for (size_t i = 0; i < saveButtons.size(); i++)
{
RemoveComponent(saveButtons[i]);
}
if(!sender->GetSavesLoaded())
if (!sender->GetSavesLoaded())
{
nextButton->Enabled = false;
previousButton->Enabled = false;
@ -611,15 +609,15 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
ownButton->Enabled = true;
sortButton->Enabled = true;
}
if(!saves.size())
if (!saves.size())
{
loadingSpinner->Visible = false;
if(!errorLabel)
if (!errorLabel)
{
errorLabel = new ui::Label(ui::Point((WINDOWW/2)-100, (WINDOWH/2)-6), ui::Point(200, 12), "Error");
AddComponent(errorLabel);
}
if(!sender->GetSavesLoaded())
if (!sender->GetSavesLoaded())
{
errorLabel->SetText("Loading...");
loadingSpinner->Visible = true;
@ -635,13 +633,13 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
else
{
loadingSpinner->Visible = false;
if(errorLabel)
if (errorLabel)
{
RemoveComponent(errorLabel);
delete errorLabel;
errorLabel = NULL;
}
for(i = 0; i < saveButtons.size(); i++)
for (size_t i = 0; i < saveButtons.size(); i++)
{
delete saveButtons[i];
}
@ -652,7 +650,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
buttonAreaWidth = Size.X;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
if(sender->GetShowTags())
if (sender->GetShowTags())
{
buttonYOffset += (buttonAreaHeight/savesY) - buttonPadding*2;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
@ -688,11 +686,11 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
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)
{
if(saveY == savesY-1)
if (saveY == savesY-1)
break;
saveX = 0;
saveY++;
@ -721,13 +719,13 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
void SearchView::NotifySelectedChanged(SearchModel * sender)
{
vector<int> selected = sender->GetSelected();
int published = 0;
for(int j = 0; j < saveButtons.size(); j++)
size_t published = 0;
for (size_t j = 0; j < saveButtons.size(); j++)
{
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])
{
saveButtons[j]->SetSelected(true);
if (saveButtons[j]->GetSave()->GetPublished())
@ -736,7 +734,7 @@ void SearchView::NotifySelectedChanged(SearchModel * sender)
}
}
if(selected.size())
if (selected.size())
{
removeSelected->Visible = true;
unpublishSelected->Visible = true;

View File

@ -48,7 +48,7 @@ private:
void doSearch();
void textChanged();
bool changed;
int lastChanged;
unsigned int lastChanged;
int pageCount;
bool publishButtonShown;
public:

View File

@ -65,7 +65,7 @@ void TagsModel::AddObserver(TagsView * observer)
void TagsModel::notifyTagsChanged()
{
for(int i = 0; i < observers.size(); i++)
for (size_t i = 0; i < observers.size(); i++)
{
observers[i]->NotifyTagsChanged(this);
}

View File

@ -75,7 +75,7 @@ void TagsView::OnDraw()
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]);
delete tags[i];

View File

@ -175,20 +175,24 @@ int Element_PSTN::CanMoveStack(Simulation * sim, int stackX, int stackY, int dir
int posX, posY, r, spaces = 0, currentPos = 0;
if (amount <= 0)
return 0;
for(posX = stackX, posY = stackY; currentPos < maxSize + amount && currentPos < XRES-1; posX += directionX, posY += directionY) {
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0)) {
for (posX = stackX, posY = stackY; currentPos < maxSize + amount && currentPos < XRES-1; posX += directionX, posY += directionY)
{
if (!(posX < XRES && posY < YRES && posX >= 0 && posY >= 0))
break;
}
r = sim->pmap[posY][posX];
if (sim->IsWallBlocking(posX, posY, 0) || (block && (r&0xFF) == block))
return spaces;
if(!r) {
if (!r)
{
spaces++;
tempParts[currentPos++] = -1;
if(spaces >= amount)
if (spaces >= amount)
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;
else
return spaces;