[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/ai ai_plan.c
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/ai ai_plan.c |
Date: |
23 Dec 2003 11:18:40 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/23 11:18:40
Modified files:
src/ai : ai_plan.c
Log message:
Clean up
Patches:
Index: stratagus/src/ai/ai_plan.c
diff -u stratagus/src/ai/ai_plan.c:1.26 stratagus/src/ai/ai_plan.c:1.27
--- stratagus/src/ai/ai_plan.c:1.26 Sun Dec 14 21:46:33 2003
+++ stratagus/src/ai/ai_plan.c Tue Dec 23 11:18:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_plan.c,v 1.26 2003/12/14 10:46:33 wizzard Exp $
+// $Id: ai_plan.c,v 1.27 2003/12/23 00:18:39 jsalmon3 Exp $
//@{
@@ -79,14 +79,14 @@
// if( UnitUnusable(unit) ) can't attack constructions
// FIXME: did SelectUnitsOnTile already filter this?
// Invisible and not Visible
- if (unit->Removed || unit->Invisible || !unit->HP
- || !(unit->Visible & (1 << source->Player->Player))
- || unit->Orders[0].Action == UnitActionDie) {
+ if (unit->Removed || unit->Invisible || !unit->HP ||
+ !(unit->Visible & (1 <<
source->Player->Player)) ||
+ unit->Orders[0].Action == UnitActionDie) {
continue;
}
type = unit->Type;
- if (tx < unit->X || tx >= unit->X + type->TileWidth
- || ty < unit->Y || ty >= unit->Y + type->TileHeight) {
+ if (tx < unit->X || tx >= unit->X + type->TileWidth ||
+ ty < unit->Y || ty >= unit->Y +
type->TileHeight) {
continue;
}
if (!CanTarget(source->Type, unit->Type)) {
@@ -144,7 +144,7 @@
}
points = malloc(TheMap.Width * TheMap.Height);
- size = TheMap.Width * TheMap.Height / sizeof (*points);
+ size = TheMap.Width * TheMap.Height / sizeof(*points);
//
// Make movement matrix.
@@ -245,7 +245,7 @@
unsigned char* m;
size = TheMap.Width * TheMap.Height / 2;
- points = malloc(size * sizeof (*points));
+ points = malloc(size * sizeof(*points));
x = unit->X;
y = unit->Y;
@@ -409,7 +409,7 @@
x = unit->X;
y = unit->Y;
size = TheMap.Width * TheMap.Height / 4;
- points = malloc(size * sizeof (*points));
+ points = malloc(size * sizeof(*points));
destx = -1;
desty = -1;
@@ -514,8 +514,8 @@
int state;
Unit* transporter;
- DebugLevel0Fn("Planning for force #%d of player #%d\n"
- _C_ force - AiPlayer->Force _C_ AiPlayer->Player->Player);
+ DebugLevel0Fn("Planning for force #%d of player #%d\n" _C_
+ force - AiPlayer->Force _C_ AiPlayer->Player->Player);
watermatrix = CreateMatrix();
@@ -628,8 +628,7 @@
requestcount = 0;
while (request) {
- requestcount ++;
-
+ ++requestcount;
request = request->Next;
}
@@ -641,7 +640,7 @@
outtrycount = 0;
do {
bestunit = 0;
- outtrycount++;
+ ++outtrycount;
// Choose a request
requestid = SyncRand() % requestcount;
@@ -649,7 +648,7 @@
request = AiPlayer->FirstExplorationRequest;
while (requestid) {
request = request->Next;
- requestid--;
+ --requestid;
}
// Choose a target, "near"
centerx = request->X;
@@ -668,7 +667,7 @@
}
ray = 3 * ray / 2;
- trycount ++;
+ ++trycount;
} while (trycount < 8 && !targetok);
if (!targetok) {
@@ -703,10 +702,10 @@
if (flyeronly) {
continue;
}
- if ((request->Mask & MapFieldLandUnit) &&
(type->UnitType != UnitTypeLand)) {
+ if ((request->Mask & MapFieldLandUnit) &&
type->UnitType != UnitTypeLand) {
continue;
}
- if ((request->Mask & MapFieldSeaUnit) &&
(type->UnitType != UnitTypeNaval)) {
+ if ((request->Mask & MapFieldSeaUnit) &&
type->UnitType != UnitTypeNaval) {
continue;
}
} else {
@@ -720,7 +719,7 @@
bestunit = (*unit);
}
}
- } while(outtrycount <= 4 && !bestunit);
+ } while (outtrycount <= 4 && !bestunit);
if (bestunit) {
CommandMove(bestunit, x, y, FlushCommands);