diff options
author | Eugene Sandulenko | 2016-02-14 15:25:44 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:13:25 +0100 |
commit | 499519fec3820d5f5ad377953560c321ac3efcab (patch) | |
tree | 396f8eeab07609528544f72d4c7337cccd0d0d65 /engines/wage | |
parent | eef56e167e481e413bd4c616e7c915e834c74726 (diff) | |
download | scummvm-rg350-499519fec3820d5f5ad377953560c321ac3efcab.tar.gz scummvm-rg350-499519fec3820d5f5ad377953560c321ac3efcab.tar.bz2 scummvm-rg350-499519fec3820d5f5ad377953560c321ac3efcab.zip |
WAGE: Fix int/uint comparison
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/combat.cpp | 4 | ||||
-rw-r--r-- | engines/wage/dialog.cpp | 10 | ||||
-rw-r--r-- | engines/wage/dialog.h | 4 | ||||
-rw-r--r-- | engines/wage/entities.h | 4 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 4 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 36 | ||||
-rw-r--r-- | engines/wage/world.cpp | 2 |
7 files changed, 32 insertions, 32 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp index b60c896098..aa8ec535d2 100644 --- a/engines/wage/combat.cpp +++ b/engines/wage/combat.cpp @@ -366,7 +366,7 @@ void WageEngine::performHealingMagic(Chr *chr, Obj *magicalObject) { appendText(buf); } - int chance = _rnd->getRandomNumber(255); + uint chance = _rnd->getRandomNumber(255); if (chance < magicalObject->_accuracy) { int type = magicalObject->_attackType; @@ -486,7 +486,7 @@ void WageEngine::regen() { } void WageEngine::takeObj(Obj *obj) { - if ((int)_world->_player->_inventory.size() >= _world->_player->_maximumCarriedObjects) { + if (_world->_player->_inventory.size() >= _world->_player->_maximumCarriedObjects) { appendText("Your pack is full, you must drop something."); } else { char buf[256]; diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp index d98af304cb..263570bddc 100644 --- a/engines/wage/dialog.cpp +++ b/engines/wage/dialog.cpp @@ -59,7 +59,7 @@ enum { kDialogHeight = 113 }; -Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, int defaultButton) : +Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, uint defaultButton) : _gui(gui), _text(text), _buttons(buttons), _defaultButton(defaultButton) { assert(_gui->_engine); assert(_gui->_engine->_world); @@ -78,7 +78,7 @@ Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons _mouseOverPressedButton = false; // Adjust button positions - for (int i = 0; i < _buttons->size(); i++) + for (uint i = 0; i < _buttons->size(); i++) _buttons->operator[](i)->bounds.translate(_bbox.left, _bbox.top); _needsRedraw = true; @@ -98,7 +98,7 @@ void Dialog::paint() { static int boxOutline[] = { 1, 0, 0, 1, 1 }; drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline)); - for (int i = 0; i < _buttons->size(); i++) { + for (uint i = 0; i < _buttons->size(); i++) { DialogButton *button = _buttons->operator[](i); static int buttonOutline[] = { 0, 0, 0, 0, 1 }; @@ -110,7 +110,7 @@ void Dialog::paint() { int color = kColorBlack; - if (i == _pressedButton && _mouseOverPressedButton) { + if ((int)i == _pressedButton && _mouseOverPressedButton) { Common::Rect bb(button->bounds.left + 5, button->bounds.top + 5, button->bounds.right - 5, button->bounds.bottom - 5); @@ -195,7 +195,7 @@ int Dialog::run() { } int Dialog::matchButton(int x, int y) { - for (int i = 0; i < _buttons->size(); i++) + for (uint i = 0; i < _buttons->size(); i++) if (_buttons->operator[](i)->bounds.contains(x, y)) return i; diff --git a/engines/wage/dialog.h b/engines/wage/dialog.h index 544b457c84..c5878acc95 100644 --- a/engines/wage/dialog.h +++ b/engines/wage/dialog.h @@ -67,7 +67,7 @@ typedef Common::Array<DialogButton *> DialogButtonArray; class Dialog { public: - Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, int defaultButton); + Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, uint defaultButton); ~Dialog(); int run(); @@ -81,7 +81,7 @@ private: const Graphics::Font *_font; DialogButtonArray *_buttons; int _pressedButton; - int _defaultButton; + uint _defaultButton; bool _mouseOverPressedButton; bool _needsRedraw; diff --git a/engines/wage/entities.h b/engines/wage/entities.h index f72df34723..0f5016e8b1 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -156,7 +156,7 @@ public: int _gender; bool _nameProperNoun; bool _playerCharacter; - int _maximumCarriedObjects; + uint _maximumCarriedObjects; int _returnTo; int _physicalStrength; @@ -168,7 +168,7 @@ public: int _resistanceToMagic; int _spiritualAccuracy; int _runningSpeed; - int _rejectsOffers; + uint _rejectsOffers; int _followsOpponent; Common::String _initialSound; diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 5267e4ee5d..f7196abf17 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -501,7 +501,7 @@ Designed *Gui::mouseUp(int x, int y) { bool cutAllowed = false; - if (_selectionStartY == _selectionEndY && _selectionStartY == _lines.size() - 1) + if (_selectionStartY == _selectionEndY && _selectionStartY == (int)_lines.size() - 1) cutAllowed = true; _menu->enableCommand(kMenuEdit, kMenuActionCut, cutAllowed); @@ -545,7 +545,7 @@ void Gui::mouseDown(int x, int y) { int Gui::calcTextX(int x, int textLine) { const Graphics::Font *font = getConsoleFont(); - if (textLine >= _lines.size()) + if ((uint)textLine >= _lines.size()) return 0; Common::String str = _lines[textLine]; diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index 6e2260ad40..b859867e9a 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -141,7 +141,7 @@ Menu::Menu(Gui *gui) : _gui(gui) { int y = 1; int x = 18; - for (int i = 0; i < _items.size(); i++) { + for (uint i = 0; i < _items.size(); i++) { int w = _font->getStringWidth(_items[i]->name); if (_items[i]->bbox.bottom == 0) { @@ -170,15 +170,15 @@ Menu::Menu(Gui *gui) : _gui(gui) { } Menu::~Menu() { - for (int i = 0; i < _items.size(); i++) { - for (int j = 0; j < _items[i]->subitems.size(); j++) + for (uint i = 0; i < _items.size(); i++) { + for (uint j = 0; j < _items[i]->subitems.size(); j++) delete _items[i]->subitems[j]; delete _items[i]; } } void Menu::regenCommandsMenu() { - for (int j = 0; j < _commands->subitems.size(); j++) + for (uint j = 0; j < _commands->subitems.size(); j++) delete _commands->subitems[j]; _commands->subitems.clear(); @@ -192,7 +192,7 @@ void Menu::createCommandsMenu(MenuItem *menu) { Common::String item; - for (int i = 0; i < string.size(); i++) { + for (uint i = 0; i < string.size(); i++) { while(i < string.size() && string[i] != ';') // Read token item += string[i++]; @@ -239,7 +239,7 @@ void Menu::createCommandsMenu(MenuItem *menu) { if (tmpitem[0] == '(') { enabled = false; - for (int j = 0; j < item.size(); j++) + for (uint j = 0; j < item.size(); j++) if (item[j] == '(') { item.deleteChar(j); break; @@ -257,7 +257,7 @@ void Menu::regenWeaponsMenu() { if (_gui->_engine->_world->_weaponMenuDisabled) return; - for (int j = 0; j < _weapons->subitems.size(); j++) + for (uint j = 0; j < _weapons->subitems.size(); j++) delete _weapons->subitems[j]; _weapons->subitems.clear(); @@ -270,7 +270,7 @@ void Menu::createWeaponsMenu(MenuItem *menu) { Chr *player = _gui->_engine->_world->_player; ObjArray *weapons = player->getWeapons(true); - for (int i = 0; i < weapons->size(); i++) { + for (uint i = 0; i < weapons->size(); i++) { Obj *obj = (*weapons)[i]; if (obj->_type == Obj::REGULAR_WEAPON || obj->_type == Obj::THROW_WEAPON || @@ -304,7 +304,7 @@ const char *Menu::getAcceleratorString(MenuSubItem *item, const char *prefix) { int Menu::calculateMenuWidth(MenuItem *menu) { int maxWidth = 0; - for (int i = 0; i < menu->subitems.size(); i++) { + for (uint i = 0; i < menu->subitems.size(); i++) { MenuSubItem *item = menu->subitems[i]; if (!item->text.empty()) { Common::String text(item->text); @@ -345,11 +345,11 @@ void Menu::render() { r.top = kMenuHeight - 1; Design::drawFilledRect(&_gui->_screen, r, kColorBlack, _gui->_patterns, kPatternSolid); - for (int i = 0; i < _items.size(); i++) { + for (uint i = 0; i < _items.size(); i++) { int color = kColorBlack; MenuItem *it = _items[i]; - if (_activeItem == i) { + if ((uint)_activeItem == i) { Common::Rect hbox = it->bbox; hbox.left -= 1; @@ -381,13 +381,13 @@ void Menu::renderSubmenu(MenuItem *menu) { int x = r->left + kMenuDropdownPadding; int y = r->top + 1; - for (int i = 0; i < menu->subitems.size(); i++) { + for (uint i = 0; i < menu->subitems.size(); i++) { Common::String text(menu->subitems[i]->text); Common::String acceleratorText(getAcceleratorString(menu->subitems[i], "")); int accelX = r->right - 25; int color = kColorBlack; - if (i == _activeSubItem && !text.empty() && menu->subitems[i]->enabled) { + if (i == (uint)_activeSubItem && !text.empty() && menu->subitems[i]->enabled) { color = kColorWhite; Common::Rect trect(r->left, y - (_gui->_builtInFonts ? 1 : 0), r->right, y + _font->getFontHeight()); @@ -442,9 +442,9 @@ bool Menu::mouseClick(int x, int y) { if (!_menuActivated) _screenCopy.copyFrom(_gui->_screen); - for (int i = 0; i < _items.size(); i++) + for (uint i = 0; i < _items.size(); i++) if (_items[i]->bbox.contains(x, y)) { - if (_activeItem == i) + if ((uint)_activeItem == i) return false; if (_activeItem != -1) { // Restore background @@ -545,8 +545,8 @@ void Menu::processMenuShortCut(byte flags, uint16 ascii) { ascii = tolower(ascii); if (flags & (Common::KBD_CTRL | Common::KBD_META)) { - for (int i = 0; i < _items.size(); i++) - for (int j = 0; j < _items[i]->subitems.size(); j++) + for (uint i = 0; i < _items.size(); i++) + for (uint j = 0; j < _items[i]->subitems.size(); j++) if (_items[i]->subitems[j]->enabled && tolower(_items[i]->subitems[j]->shortcut) == ascii) { executeCommand(_items[i]->subitems[j]); break; @@ -555,7 +555,7 @@ void Menu::processMenuShortCut(byte flags, uint16 ascii) { } void Menu::enableCommand(int menunum, int action, bool state) { - for (int i = 0; i < _items[menunum]->subitems.size(); i++) + for (uint i = 0; i < _items[menunum]->subitems.size(); i++) if (_items[menunum]->subitems[i]->action == action) _items[menunum]->subitems[i]->enabled = state; } diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index 6e79aaa310..a387d95c4a 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -268,7 +268,7 @@ bool World::loadWorld(Common::MacResManager *resMan) { _aboutMenuItemName.clear(); Common::String string = menu->operator[](1); - for (int i = 0; i < string.size() && string[i] != ';'; i++) // Read token + for (uint i = 0; i < string.size() && string[i] != ';'; i++) // Read token _aboutMenuItemName += string[i]; delete res; |