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 <http://www.gnu.org/licenses/>.
*/
// Enable full math definitions
}
}
-void doAI(int i)
+void doAI(unsigned i)
{
static bool connected;
if (Person::players[i]->aitype != playercontrolled && indialogue == -1) {
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) {
if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
if (Person::players[i]->isIdle() || Person::players[i]->isCrouch() || Person::players[i]->isRun() || Person::players[i]->isFlip()) {
- if (abs(Random() % 2 == 0))
+ if (abs(Random() % 2) == 0)
Person::players[i]->setAnimation(backhandspringanim);
else
Person::players[i]->setAnimation(rollanim);
}
//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 &&
static int oldmainmenu = mainmenu;
- char sbuf[256];
-
if (Input::MouseClicked() && (selected >= 0)) { // handling of the left mouse clic in menus
set<pair<int,int>>::iterator newscreenresolution;
switch (mainmenu) {
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;
}
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;
}
}
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 &&
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)
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)
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)
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;