X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=685b4730ab952c17cf72bd8016d159777e558c1d;hb=51203b531b2054a8a7c40356e2108a5ec7b9f366;hp=8b7b2676d77127b7d93b53195932c6308a3cb4aa;hpb=e2cad9c4ba05196efe03ab2fed8e51bafda53759;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 8b7b267..685b473 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -3,20 +3,18 @@ Copyright (C) 2003, 2010 - Wolfire Games This file is part of Lugaru. -Lugaru is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +Lugaru is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, +Lugaru is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +along with Lugaru. If not, see . */ // Enable full math definitions @@ -4808,7 +4806,7 @@ void doPlayerCollisions() } } -void doAI(int i) +void doAI(unsigned i) { static bool connected; if (Person::players[i]->aitype != playercontrolled && indialogue == -1) { @@ -5402,7 +5400,7 @@ void doAI(int i) if (Person::players[i]->ally < 0) { int closest = -1; float closestdist = -1; - for (int k = 0; k < weapons.size(); k++) + for (unsigned k = 0; k < weapons.size(); k++) if (weapons[k].owner == -1) { float distance = distsq(&Person::players[i]->coords, &weapons[k].position); if (closestdist == -1 || distance < closestdist) { @@ -5514,7 +5512,7 @@ void doAI(int i) } //go for weapon on the ground if (Person::players[i]->wentforweapon < 3) - for (int k = 0; k < weapons.size(); k++) + for (unsigned k = 0; k < weapons.size(); k++) if (Person::players[i]->creature != wolftype) if (Person::players[i]->num_weapons == 0 && weapons[k].owner == -1 && @@ -6033,8 +6031,6 @@ void MenuTick() static int oldmainmenu = mainmenu; - char sbuf[256]; - if (Input::MouseClicked() && (selected >= 0)) { // handling of the left mouse clic in menus set>::iterator newscreenresolution; switch (mainmenu) { @@ -6628,8 +6624,9 @@ void Game::Tick() if (talkdelay <= 0 && indialogue == -1 && animation[Person::players[0]->animTarget].height != highheight) for (int i = 0; i < numdialogues; i++) { - int realdialoguetype; + unsigned realdialoguetype; bool special; + /* FIXME - Seems like modulo done with ifs */ if (dialoguetype[i] > 49) { realdialoguetype = dialoguetype[i] - 50; special = 1; @@ -6953,7 +6950,7 @@ void Game::Tick() } if (dialoguetype[whichdialogue] > 49 && dialoguetype[whichdialogue] < 60) { hostile = 1; - for (int i = 1; i < Person::players.size(); i++) { + for (unsigned i = 1; i < Person::players.size(); i++) { Person::players[i]->aitype = attacktypecutoff; } } @@ -7201,7 +7198,7 @@ void Game::Tick() Person::players[i]->isFlip() || Person::players[i]->isFlip() || Person::players[i]->aitype != playercontrolled)) { - for (int j = 0; j < weapons.size(); j++) { + for (unsigned j = 0; j < weapons.size(); j++) { if ((weapons[j].velocity.x == 0 && weapons[j].velocity.y == 0 && weapons[j].velocity.z == 0 || Person::players[i]->aitype == playercontrolled) && weapons[j].owner == -1 && @@ -7226,7 +7223,7 @@ void Game::Tick() Person::players[i]->aitype == playercontrolled) && weapons[j].owner == -1 || Person::players[i]->victim && - weapons[j].owner == Person::players[i]->victim->id) + weapons[j].owner == int(Person::players[i]->victim->id)) if (distsqflat(&Person::players[i]->coords, &weapons[j].position) < 2 && Person::players[i]->weaponactive == -1) if (distsq(&Person::players[i]->coords, &weapons[j].position) < 1 || Person::players[i]->victim) { if (weapons[j].getType() != staff) @@ -7254,13 +7251,13 @@ void Game::Tick() Person::players[i]->throwtogglekeydown = 1; Person::players[i]->hasvictim = 0; - for (int k = 0; k < weapons.size(); k++) { + for (unsigned k = 0; k < weapons.size(); k++) { if (Person::players[i]->weaponactive == -1) if ((weapons[k].velocity.x == 0 && weapons[k].velocity.y == 0 && weapons[k].velocity.z == 0 || Person::players[i]->aitype == playercontrolled) && weapons[k].owner == -1 || Person::players[i]->victim && - weapons[k].owner == Person::players[i]->victim->id) + weapons[k].owner == int(Person::players[i]->victim->id)) if (distsqflat(&Person::players[i]->coords, &weapons[k].position) < 3 && Person::players[i]->weaponactive == -1) { if (weapons[k].getType() != staff) @@ -8216,7 +8213,7 @@ void Game::TickOnceAfter() winhotspot = true; int numalarmed = 0; - for (int i = 1; i < Person::players.size(); i++) + for (unsigned i = 1; i < Person::players.size(); i++) if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0) numalarmed++; if (numalarmed > maxalarmed) @@ -8228,7 +8225,7 @@ void Game::TickOnceAfter() targetlevel = whichlevel; } alldead = true; - for (int i = 1; i < Person::players.size(); i++) { + for (unsigned i = 1; i < Person::players.size(); i++) { if (!Person::players[i]->dead && Person::players[i]->howactive < typedead1) { alldead = false; break;