[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/ai ai_building.c ai_force.c ai_ma...
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/ai ai_building.c ai_force.c ai_ma... |
Date: |
Mon, 13 Oct 2003 22:47:35 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/13 22:47:35
Modified files:
src/ai : ai_building.c ai_force.c ai_magic.c
Log message:
Cleanup
Patches:
Index: stratagus/src/ai/ai_building.c
diff -u stratagus/src/ai/ai_building.c:1.39 stratagus/src/ai/ai_building.c:1.40
--- stratagus/src/ai/ai_building.c:1.39 Thu Sep 25 02:58:35 2003
+++ stratagus/src/ai/ai_building.c Mon Oct 13 22:47:35 2003
@@ -10,7 +10,7 @@
//
/address@hidden ai_building.c - AI building functions. */
//
-// (c) Copyright 2001,2002 by Lutz Sammer
+// (c) Copyright 2001-2003 by Lutz Sammer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_building.c,v 1.39 2003/09/25 06:58:35 mr-russ Exp $
+// $Id: ai_building.c,v 1.40 2003/10/14 02:47:35 jsalmon3 Exp $
//@{
@@ -65,50 +65,47 @@
** @note Can be faster written.
*/
local int AiCheckSurrounding(const Unit* worker,const UnitType* type,
- int x, int y)
+ int x, int y)
{
int i;
int h;
int w;
- h=type->TileHeight+2;
- w=type->TileWidth+2;
+ h = type->TileHeight + 2;
+ w = type->TileWidth + 2;
--x;
--y;
- for( i=0; i<w; ++i ) { // Top row
- if( (x+i)<0 || (x+i)>TheMap.Width ) { // FIXME: slow, worse,...
+ for (i = 0; i < w; ++i) { // Top row
+ if ((x + i) < 0 || (x + i) > TheMap.Width) { // FIXME: slow,
worse,...
continue;
}
- if( !((x+i)==worker->X && y==worker->Y) && y>=0
- && TheMap.Fields[x+i+y*TheMap.Width].Flags&(MapFieldUnpassable
- |MapFieldWall|MapFieldRocks|MapFieldForest|MapFieldBuilding) ) {
+ if (!((x + i) == worker->X && y == worker->Y) && y >= 0 &&
+ TheMap.Fields[x + i + y * TheMap.Width].Flags &
(MapFieldUnpassable |
+ MapFieldWall | MapFieldRocks | MapFieldForest |
MapFieldBuilding)) {
return 0;
} // Bot row
- if( !((x+i)==worker->X && (y+h)==worker->Y) && (y+h)<TheMap.Height
- && TheMap.Fields[x+i+(y+h)*TheMap.Width].Flags&
- (MapFieldUnpassable|MapFieldWall|MapFieldRocks
- |MapFieldForest|MapFieldBuilding) ) {
+ if (!((x + i) == worker->X && (y + h) == worker->Y) && (y + h) <
TheMap.Height &&
+ TheMap.Fields[x + i + (y + h) * TheMap.Width].Flags &
(MapFieldUnpassable |
+ MapFieldWall | MapFieldRocks | MapFieldForest |
MapFieldBuilding)) {
return 0;
}
}
++y;
- h-=2;
- for( i=0; i<h; ++i ) { // Left row
- if( (y+i)<0 || (y+i)>TheMap.Height ) { // FIXME: slow, worse,...
+ h -= 2;
+ for (i = 0; i < h; ++i) { // Left row
+ if ((y + i) < 0 || (y + i) > TheMap.Height) { // FIXME: slow,
worse,...
continue;
}
- if( !(x==worker->X && (y+i)==worker->Y) && x>=0
- && TheMap.Fields[x+(y+i)*TheMap.Width].Flags&
- (MapFieldUnpassable|MapFieldWall|MapFieldRocks
- |MapFieldForest|MapFieldBuilding) ) {
+ if (!(x == worker->X && (y + i) == worker->Y) && x >= 0 &&
+ TheMap.Fields[x + (y + i) * TheMap.Width].Flags &
(MapFieldUnpassable |
+ MapFieldWall | MapFieldRocks | MapFieldForest |
MapFieldBuilding)) {
return 0;
} // Right row
- if( !((x+w)==worker->X && (y+i)==worker->Y) && (x+w)<TheMap.Width
- && TheMap.Fields[x+w+(y+i)*TheMap.Width].Flags&
- (MapFieldUnpassable|MapFieldWall|MapFieldRocks
- |MapFieldForest|MapFieldBuilding) ) {
+ if (!((x + w) == worker->X && (y + i) == worker->Y) && (x + w) <
TheMap.Width &&
+ TheMap.Fields[x + w + (y + i) * TheMap.Width].Flags &
(MapFieldUnpassable |
+ MapFieldWall | MapFieldRocks | MapFieldForest |
MapFieldBuilding)) {
return 0;
}
}
@@ -128,11 +125,17 @@
**
** @note This can be done faster, use flood fill.
*/
-local int AiFindBuildingPlace2(const Unit * worker, const UnitType * type,
- int *dx, int *dy,int flag)
+local int AiFindBuildingPlace2(const Unit* worker, const UnitType* type,
+ int* dx, int* dy, int flag)
{
- int wx, wy, x, y, addx, addy;
- int end, state;
+ int wx;
+ int wy;
+ int x;
+ int y;
+ int addx;
+ int addy;
+ int end;
+ int state;
wx = worker->X;
wy = worker->Y;
@@ -145,44 +148,44 @@
end = y + addy - 1;
for (;;) { // test rectangles around the place
switch (state) {
- case 0:
- if (y++ == end) {
- ++state;
- end = x + addx++;
- }
- break;
- case 1:
- if (x++ == end) {
- ++state;
- end = y - addy++;
- }
- break;
- case 2:
- if (y-- == end) {
- ++state;
- end = x - addx++;
- }
- break;
- case 3:
- if (x-- == end) {
- state = 0;
- end = y + addy++;
- if( addx>=TheMap.Width && addy>=TheMap.Height ) {
- return 0;
+ case 0:
+ if (y++ == end) {
+ ++state;
+ end = x + addx++;
}
- }
- break;
+ break;
+ case 1:
+ if (x++ == end) {
+ ++state;
+ end = y - addy++;
+ }
+ break;
+ case 2:
+ if (y-- == end) {
+ ++state;
+ end = x - addx++;
+ }
+ break;
+ case 3:
+ if (x-- == end) {
+ state = 0;
+ end = y + addy++;
+ if (addx >= TheMap.Width && addy >= TheMap.Height) {
+ return 0;
+ }
+ }
+ break;
}
// FIXME: this check outside the map could be speeded up.
if (y < 0 || x < 0 || y >= TheMap.Height || x >= TheMap.Width) {
continue;
}
- if (CanBuildUnitType(worker, type, x, y)
- && (!flag || AiCheckSurrounding(worker,type, x, y))
- && PlaceReachable(worker, x, y, 1) ) {
- *dx=x;
- *dy=y;
+ if (CanBuildUnitType(worker, type, x, y) &&
+ (!flag || AiCheckSurrounding(worker, type, x, y)) &&
+ PlaceReachable(worker, x, y, 1)) {
+ *dx = x;
+ *dy = y;
return 1;
}
}
@@ -203,15 +206,15 @@
** @param flag Flag if surrounding must be free.
** @return True if place found, false if no found.
*/
-local int AiFindBuildingPlace2(const Unit * worker, const UnitType * type,
- int ox, int oy, int *dx, int *dy,int flag)
+local int AiFindBuildingPlace2(const Unit* worker, const UnitType* type,
+ int ox, int oy, int* dx, int* dy, int flag)
{
- static const int xoffset[]={ 0,-1,+1, 0, -1,+1,-1,+1 };
- static const int yoffset[]={ -1, 0, 0,+1, -1,-1,+1,+1 };
+ static const int xoffset[] = { 0,-1,+1, 0, -1,+1,-1,+1 };
+ static const int yoffset[] = { -1, 0, 0,+1, -1,-1,+1,+1 };
struct {
unsigned short X;
unsigned short Y;
- } * points;
+ } *points;
int size;
int x;
int y;
@@ -226,18 +229,18 @@
unsigned char* m;
unsigned char* matrix;
- points=malloc(TheMap.Width*TheMap.Height);
- size=TheMap.Width*TheMap.Height/sizeof(*points);
+ points = malloc(TheMap.Width * TheMap.Height);
+ size = TheMap.Width * TheMap.Height / sizeof(*points);
- x=ox;
- y=oy;
+ x = ox;
+ y = oy;
//
// Look if we can build at current place.
//
- if (CanBuildUnitType(worker, type, x, y)
- && (!flag || AiCheckSurrounding(worker,type, x, y)) ) {
- *dx=x;
- *dy=y;
+ if (CanBuildUnitType(worker, type, x, y) &&
+ (!flag || AiCheckSurrounding(worker, type, x, y))) {
+ *dx = x;
+ *dy = y;
free(points);
return 1;
}
@@ -245,82 +248,82 @@
//
// Make movement matrix.
//
- matrix=CreateMatrix();
- w=TheMap.Width+2;
+ matrix = CreateMatrix();
+ w = TheMap.Width + 2;
- mask=UnitMovementMask(worker);
+ mask = UnitMovementMask(worker);
// Ignore all possible mobile units.
- mask&=~(MapFieldLandUnit|MapFieldAirUnit|MapFieldSeaUnit);
+ mask &= ~(MapFieldLandUnit | MapFieldAirUnit | MapFieldSeaUnit);
- points[0].X=x;
- points[0].Y=y;
+ points[0].X = x;
+ points[0].Y = y;
// also use the bottom right
- if( type->TileWidth>1 &&
- x+type->TileWidth-1<TheMap.Width && y+type->TileHeight-1<TheMap.Height
) {
- points[1].X=x+type->TileWidth-1;
- points[1].Y=y+type->TileWidth-1;
- ep=wp=2; // start with two points
+ if (type->TileWidth>1 && x + type->TileWidth - 1 < TheMap.Width &&
+ y + type->TileHeight - 1 < TheMap.Height) {
+ points[1].X = x + type->TileWidth - 1;
+ points[1].Y = y + type->TileWidth - 1;
+ ep = wp = 2; // start with two points
} else {
- ep=wp=1; // start with one point
+ ep = wp = 1; // start with one point
}
- matrix+=w+w+2;
- rp=0;
- matrix[x+y*w]=1; // mark start point
+ matrix += w + w + 2;
+ rp = 0;
+ matrix[x + y * w] = 1; // mark start point
//
// Pop a point from stack, push all neighbours which could be entered.
//
- for( ;; ) {
- while( rp!=ep ) {
- rx=points[rp].X;
- ry=points[rp].Y;
- for( i=0; i<8; ++i ) { // mark all neighbors
- x=rx+xoffset[i];
- y=ry+yoffset[i];
- m=matrix+x+y*w;
- if( *m ) { // already checked
+ for (;;) {
+ while (rp != ep) {
+ rx = points[rp].X;
+ ry = points[rp].Y;
+ for (i = 0; i < 8; ++i) { // mark all neighbors
+ x = rx + xoffset[i];
+ y = ry + yoffset[i];
+ m = matrix + x + y * w;
+ if (*m) { // already checked
continue;
}
- DebugLevel3Fn("Checking to build %s(%s) at %d,%d\n"
- _C_ type->Ident _C_ type->Name _C_ x _C_ y);
+ DebugLevel3Fn("Checking to build %s(%s) at %d,%d\n" _C_
+ type->Ident _C_ type->Name _C_ x _C_ y);
//
// Look if we can build here.
//
- if (CanBuildUnitType(worker, type, x, y)
- && (!flag || AiCheckSurrounding(worker,type, x, y)) ) {
- *dx=x;
- *dy=y;
+ if (CanBuildUnitType(worker, type, x, y) &&
+ (!flag || AiCheckSurrounding(worker, type, x, y))) {
+ *dx = x;
+ *dy = y;
free(points);
DebugLevel3Fn("Found a building place!!!\n");
return 1;
}
- if( CanMoveToMask(x,y,mask) ) { // reachable
- *m=1;
- points[wp].X=x; // push the point
- points[wp].Y=y;
- if( ++wp>=size ) { // round about
- wp=0;
+ if (CanMoveToMask(x, y, mask)) { // reachable
+ *m = 1;
+ points[wp].X = x; // push the point
+ points[wp].Y = y;
+ if (++wp >= size) { // round about
+ wp = 0;
}
} else { // unreachable
- *m=99;
+ *m = 99;
}
}
- if( ++rp>=size ) { // round about
- rp=0;
+ if (++rp >= size) { // round about
+ rp = 0;
}
}
//
// Continue with next frame.
//
- if( rp==wp ) { // unreachable, no more points available
+ if (rp == wp) { // unreachable, no more points available
break;
}
- ep=wp;
+ ep = wp;
}
free(points);
@@ -349,15 +352,15 @@
** @todo FIXME: This is slow really slow, using two flood fills, is not
** a perfect solution.
*/
-local int AiFindHallPlace(const Unit * worker, const UnitType * type,
- int *dx, int *dy)
+local int AiFindHallPlace(const Unit* worker, const UnitType* type,
+ int* dx, int* dy)
{
- static const int xoffset[]={ 0,-1,+1, 0, -1,+1,-1,+1 };
- static const int yoffset[]={ -1, 0, 0,+1, -1,-1,+1,+1 };
+ static const int xoffset[] = { 0,-1,+1, 0, -1,+1,-1,+1 };
+ static const int yoffset[] = { -1, 0, 0,+1, -1,-1,+1,+1 };
struct {
unsigned short X;
unsigned short Y;
- } * points;
+ } *points;
int size;
int x;
int y;
@@ -376,45 +379,45 @@
int destx;
int desty;
- destx=x=worker->X;
- desty=y=worker->Y;
- size=TheMap.Width*TheMap.Height/4;
- points=malloc(size*sizeof(*points));
+ destx = x = worker->X;
+ desty = y = worker->Y;
+ size = TheMap.Width * TheMap.Height / 4;
+ points = malloc(size * sizeof(*points));
//
// Make movement matrix. FIXME: can create smaller matrix.
//
- morg=MakeMatrix();
- w=TheMap.Width+2;
- matrix=morg+w+w+2;
-
- points[0].X=x;
- points[0].Y=y;
- rp=0;
- matrix[x+y*w]=1; // mark start point
- ep=wp=1; // start with one point
+ morg = MakeMatrix();
+ w = TheMap.Width + 2;
+ matrix = morg + w + w + 2;
+
+ points[0].X = x;
+ points[0].Y = y;
+ rp = 0;
+ matrix[x + y * w] = 1; // mark start point
+ ep = wp = 1; // start with one point
- mask=UnitMovementMask(worker);
+ mask = UnitMovementMask(worker);
//
// Pop a point from stack, push all neighbors which could be entered.
//
- for( ;; ) {
- while( rp!=ep ) {
- rx=points[rp].X;
- ry=points[rp].Y;
- for( i=0; i<8; ++i ) { // mark all neighbors
- x=rx+xoffset[i];
- y=ry+yoffset[i];
- m=matrix+x+y*w;
- if( *m ) { // already checked
+ for (;;) {
+ while (rp!=ep) {
+ rx = points[rp].X;
+ ry = points[rp].Y;
+ for (i = 0; i < 8; ++i) { // mark all neighbors
+ x = rx + xoffset[i];
+ y = ry + yoffset[i];
+ m = matrix + x + y * w;
+ if (*m) { // already checked
continue;
}
//
// Look if there is a mine
//
- if ( (mine=ResourceOnMap(x,y,GoldCost)) ) {
+ if ((mine = ResourceOnMap(x, y, GoldCost))) {
int buildings;
int j;
int minx;
@@ -424,41 +427,50 @@
int nunits;
Unit* units[UnitMax];
- buildings=0;
+ buildings = 0;
//
// Check units around mine
//
- minx=mine->X-5;
- if( minx<0 ) minx=0;
- miny=mine->Y-5;
- if( miny<0 ) miny=0;
- maxx=mine->X+mine->Type->TileWidth+5;
- if( maxx>TheMap.Width ) maxx=TheMap.Width;
- maxy=mine->Y+mine->Type->TileHeight+5;
- if( maxy>TheMap.Height ) maxy=TheMap.Height;
+ minx = mine->X - 5;
+ if (minx < 0) {
+ minx = 0;
+ }
+ miny = mine->Y - 5;
+ if (miny < 0) {
+ miny = 0;
+ }
+ maxx = mine->X + mine->Type->TileWidth + 5;
+ if (maxx > TheMap.Width) {
+ maxx = TheMap.Width;
+ }
+ maxy = mine->Y + mine->Type->TileHeight + 5;
+ if (maxy > TheMap.Height) {
+ maxy = TheMap.Height;
+ }
- nunits=SelectUnits(minx,miny,maxx,maxy,units);
- for( j=0; j<nunits; ++j ) {
+ nunits = SelectUnits(minx, miny, maxx, maxy, units);
+ for (j = 0; j < nunits; ++j) {
// Enemy near mine
- if(
AiPlayer->Player->Enemy&(1<<units[j]->Player->Player) ) {
+ if (AiPlayer->Player->Enemy & (1 <<
units[j]->Player->Player)) {
break;
}
// Town hall near mine
- if( units[j]->Type->CanStore[GoldCost] ) {
+ if (units[j]->Type->CanStore[GoldCost]) {
break;
}
// Town hall may not be near but we may be using it,
check
// for 2 buildings near it and assume it's been used
- if( units[j]->Type->Building &&
!units[j]->Type->GivesResource==GoldCost ) {
+ if (units[j]->Type->Building &&
+ !units[j]->Type->GivesResource == GoldCost) {
++buildings;
- if( buildings==2 ) {
+ if (buildings == 2) {
break;
}
}
}
- if( j==nunits ) {
- if( AiFindBuildingPlace2(worker,type,x,y,dx,dy,0) ) {
+ if (j == nunits) {
+ if (AiFindBuildingPlace2(worker, type, x, y, dx, dy,
0)) {
free(morg);
free(points);
return 1;
@@ -466,29 +478,29 @@
}
}
- if( CanMoveToMask(x,y,mask) ) { // reachable
- *m=1;
- points[wp].X=x; // push the point
- points[wp].Y=y;
- if( ++wp>=size ) { // round about
- wp=0;
+ if (CanMoveToMask(x, y, mask)) { // reachable
+ *m = 1;
+ points[wp].X = x; // push the point
+ points[wp].Y = y;
+ if (++wp >= size) { // round about
+ wp = 0;
}
} else { // unreachable
- *m=99;
+ *m = 99;
}
}
- if( ++rp>=size ) { // round about
- rp=0;
+ if (++rp >= size) { // round about
+ rp = 0;
}
}
//
// Continue with next frame.
//
- if( rp==wp ) { // unreachable, no more points available
+ if (rp == wp) { // unreachable, no more points available
break;
}
- ep=wp;
+ ep = wp;
}
free(morg);
@@ -508,15 +520,15 @@
** @todo FIXME: This is slow really slow, using two flood fills, is not
** a perfect solution.
*/
-local int AiFindLumberMillPlace(const Unit * worker, const UnitType * type,
- int *dx, int *dy)
+local int AiFindLumberMillPlace(const Unit* worker, const UnitType* type,
+ int* dx, int* dy)
{
- static const int xoffset[]={ 0,-1,+1, 0, -1,+1,-1,+1 };
- static const int yoffset[]={ -1, 0, 0,+1, -1,-1,+1,+1 };
+ static const int xoffset[] = { 0,-1,+1, 0, -1,+1,-1,+1 };
+ static const int yoffset[] = { -1, 0, 0,+1, -1,-1,+1,+1 };
struct {
unsigned short X;
unsigned short Y;
- } * points;
+ } *points;
int size;
int x;
int y;
@@ -532,76 +544,76 @@
unsigned char* morg;
unsigned char* matrix;
- x=worker->X;
- y=worker->Y;
- size=TheMap.Width*TheMap.Height/4;
- points=malloc(size*sizeof(*points));
+ x = worker->X;
+ y = worker->Y;
+ size = TheMap.Width * TheMap.Height / 4;
+ points = malloc(size * sizeof(*points));
//
// Make movement matrix.
//
- morg=MakeMatrix();
- w=TheMap.Width+2;
- matrix=morg+w+w+2;
-
- points[0].X=x;
- points[0].Y=y;
- rp=0;
- matrix[x+y*w]=1; // mark start point
- ep=wp=1; // start with one point
+ morg = MakeMatrix();
+ w = TheMap.Width + 2;
+ matrix = morg + w + w + 2;
+
+ points[0].X = x;
+ points[0].Y = y;
+ rp = 0;
+ matrix[x + y * w] = 1; // mark start point
+ ep = wp = 1; // start with one point
- mask=UnitMovementMask(worker);
+ mask = UnitMovementMask(worker);
//
// Pop a point from stack, push all neightbors which could be entered.
//
- for( ;; ) {
- while( rp!=ep ) {
- rx=points[rp].X;
- ry=points[rp].Y;
- for( i=0; i<8; ++i ) { // mark all neighbors
- x=rx+xoffset[i];
- y=ry+yoffset[i];
- m=matrix+x+y*w;
- if( *m ) { // already checked
+ for (;;) {
+ while (rp != ep) {
+ rx = points[rp].X;
+ ry = points[rp].Y;
+ for (i = 0; i < 8; ++i) { // mark all neighbors
+ x = rx + xoffset[i];
+ y = ry + yoffset[i];
+ m = matrix + x + y * w;
+ if (*m) { // already checked
continue;
}
//
// Look if there is wood
//
- if ( ForestOnMap(x,y) ) {
- if( AiFindBuildingPlace2(worker,type,x,y,dx,dy,1) ) {
+ if (ForestOnMap(x, y)) {
+ if (AiFindBuildingPlace2(worker, type, x, y, dx, dy, 1)) {
free(morg);
free(points);
return 1;
}
}
- if( CanMoveToMask(x,y,mask) ) { // reachable
- *m=1;
- points[wp].X=x; // push the point
- points[wp].Y=y;
- if( ++wp>=size ) { // round about
- wp=0;
+ if (CanMoveToMask(x, y, mask)) { // reachable
+ *m = 1;
+ points[wp].X = x; // push the point
+ points[wp].Y = y;
+ if (++wp >= size) { // round about
+ wp = 0;
}
} else { // unreachable
- *m=99;
+ *m = 99;
}
}
- if( ++rp>=size ) { // round about
- rp=0;
+ if (++rp >= size) { // round about
+ rp = 0;
}
}
//
// Continue with next frame.
//
- if( rp==wp ) { // unreachable, no more points available
+ if (rp == wp) { // unreachable, no more points available
break;
}
- ep=wp;
+ ep = wp;
}
free(morg);
@@ -621,35 +633,37 @@
** @todo Better and faster way to find building place of oil platforms
** Special routines for special buildings.
*/
-global int AiFindBuildingPlace(const Unit * worker, const UnitType * type,
- int *dx, int *dy)
+global int AiFindBuildingPlace(const Unit* worker, const UnitType* type,
+ int* dx, int* dy)
{
//
// Find a good place for a new hall
//
DebugLevel0Fn("Want to build a %s(%s)\n" _C_ type->Ident _C_ type->Name);
- if( type->CanStore[GoldCost] && AiFindHallPlace(worker,type,dx,dy) ) {
- DebugLevel0Fn("Found place for town hall (%s,%s)\n" _C_ type->Ident _C_
type->Name);
+ if (type->CanStore[GoldCost] && AiFindHallPlace(worker, type, dx, dy)) {
+ DebugLevel0Fn("Found place for town hall (%s,%s)\n" _C_
+ type->Ident _C_ type->Name);
return 1;
}
//
// Find a place near wood for a lumber mill
//
- if( type->CanStore[WoodCost] && AiFindLumberMillPlace(worker,type,dx,dy) )
{
+ if (type->CanStore[WoodCost] && AiFindLumberMillPlace(worker, type, dx,
dy)) {
return 1;
}
//
// Platforms can only be built on oil patches
//
- if( type->GivesResource!=OilCost &&
AiFindBuildingPlace2(worker,type,worker->X,worker->Y,dx,dy,1) ) {
+ if (type->GivesResource != OilCost &&
+ AiFindBuildingPlace2(worker, type, worker->X, worker->Y, dx, dy,
1)) {
return 1;
}
// FIXME: Should do this if all units can't build better!
- return AiFindBuildingPlace2(worker,type,worker->X,worker->Y,dx,dy,0);
+ return AiFindBuildingPlace2(worker, type, worker->X, worker->Y, dx, dy, 0);
// return 0;
}
Index: stratagus/src/ai/ai_force.c
diff -u stratagus/src/ai/ai_force.c:1.33 stratagus/src/ai/ai_force.c:1.34
--- stratagus/src/ai/ai_force.c:1.33 Thu Sep 25 02:58:35 2003
+++ stratagus/src/ai/ai_force.c Mon Oct 13 22:47:35 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_force.c,v 1.33 2003/09/25 06:58:35 mr-russ Exp $
+// $Id: ai_force.c,v 1.34 2003/10/14 02:47:35 jsalmon3 Exp $
//@{
@@ -69,76 +69,76 @@
//
// Release all killed units.
//
- prev=&AiPlayer->Force[force].Units;
- while( (aiunit=*prev) ) {
- if( aiunit->Unit->Destroyed ) {
- RefsDebugCheck( !aiunit->Unit->Refs );
- if( !--aiunit->Unit->Refs ) {
+ prev = &AiPlayer->Force[force].Units;
+ while ((aiunit = *prev)) {
+ if (aiunit->Unit->Destroyed) {
+ RefsDebugCheck(!aiunit->Unit->Refs);
+ if (!--aiunit->Unit->Refs) {
ReleaseUnit(aiunit->Unit);
}
- *prev=aiunit->Next;
+ *prev = aiunit->Next;
free(aiunit);
continue;
- } else if( !aiunit->Unit->HP
- || aiunit->Unit->Orders[0].Action==UnitActionDie ) {
- RefsDebugCheck( !aiunit->Unit->Refs );
+ } else if (!aiunit->Unit->HP ||
+ aiunit->Unit->Orders[0].Action == UnitActionDie) {
+ RefsDebugCheck(!aiunit->Unit->Refs);
--aiunit->Unit->Refs;
- RefsDebugCheck( !aiunit->Unit->Refs );
- *prev=aiunit->Next;
+ RefsDebugCheck(!aiunit->Unit->Refs);
+ *prev = aiunit->Next;
free(aiunit);
continue;
}
- prev=&aiunit->Next;
+ prev = &aiunit->Next;
}
//
// Count units in force.
//
- memset(counter,0,sizeof(counter));
- aiunit=AiPlayer->Force[force].Units;
- while( aiunit ) {
+ memset(counter, 0, sizeof(counter));
+ aiunit = AiPlayer->Force[force].Units;
+ while (aiunit) {
// FIXME: Should I use equivalent unit types?
counter[aiunit->Unit->Type->Type]++;
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
//
// Look if the force is complete.
//
- AiPlayer->Force[force].Completed=1;
- aitype=AiPlayer->Force[force].UnitTypes;
- while( aitype ) {
- if( aitype->Want>counter[aitype->Type->Type] ) {
+ AiPlayer->Force[force].Completed = 1;
+ aitype = AiPlayer->Force[force].UnitTypes;
+ while (aitype) {
+ if (aitype->Want > counter[aitype->Type->Type]) {
DebugLevel3Fn("%d: missing %s.\n" _C_ force _C_
aitype->Type->Ident);
- AiPlayer->Force[force].Completed=0;
+ AiPlayer->Force[force].Completed = 0;
}
- counter[aitype->Type->Type]-=aitype->Want;
- aitype=aitype->Next;
+ counter[aitype->Type->Type] -= aitype->Want;
+ aitype = aitype->Next;
}
//
// Release units too much in force.
//
- if( !AiPlayer->Force[force].Attacking ) {
- prev=&AiPlayer->Force[force].Units;
- while( (aiunit=*prev) ) {
- if( counter[aiunit->Unit->Type->Type]>0 ) {
- DebugLevel0Fn("Release unit %s\n"
- _C_ aiunit->Unit->Type->Ident);
+ if (!AiPlayer->Force[force].Attacking) {
+ prev = &AiPlayer->Force[force].Units;
+ while ((aiunit = *prev)) {
+ if (counter[aiunit->Unit->Type->Type] > 0) {
+ DebugLevel0Fn("Release unit %s\n" _C_
+ aiunit->Unit->Type->Ident);
counter[aiunit->Unit->Type->Type]--;
- RefsDebugCheck( !aiunit->Unit->Refs );
+ RefsDebugCheck(!aiunit->Unit->Refs);
--aiunit->Unit->Refs;
- RefsDebugCheck( !aiunit->Unit->Refs );
- *prev=aiunit->Next;
+ RefsDebugCheck(!aiunit->Unit->Refs);
+ *prev = aiunit->Next;
free(aiunit);
continue;
}
- prev=&aiunit->Next;
+ prev = &aiunit->Next;
}
}
- DebugLevel3Fn("%d complete %d\n" _C_ force
- _C_ AiPlayer->Force[force].Completed);
+ DebugLevel3Fn("%d complete %d\n" _C_ force _C_
+ AiPlayer->Force[force].Completed);
}
/**
@@ -151,7 +151,7 @@
//
// Release all killed units.
//
- for( force=0; force<AI_MAX_ATTACKING_FORCES; ++force ) {
+ for (force = 0; force < AI_MAX_ATTACKING_FORCES; ++force) {
AiCleanForce(force);
}
}
@@ -163,42 +163,42 @@
** @param type Type to check.
** @return Returns true if it fits, false otherwise.
*/
-local int AiCheckBelongsToForce(int force,const UnitType* type)
+local int AiCheckBelongsToForce(int force, const UnitType* type)
{
AiUnit* aiunit;
AiUnitType* aitype;
int counter[UnitTypeMax];
int flag;
- memset(counter,0,sizeof(counter));
+ memset(counter, 0, sizeof(counter));
//
// Count units in force.
//
- aiunit=AiPlayer->Force[force].Units;
- while( aiunit ) {
+ aiunit = AiPlayer->Force[force].Units;
+ while (aiunit) {
// FIXME: Should I use equivalent unit types?
counter[aiunit->Unit->Type->Type]++;
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
//
// Look what should be in the force.
//
- flag=0;
- AiPlayer->Force[force].Completed=1;
- aitype=AiPlayer->Force[force].UnitTypes;
- while( aitype ) {
- if( aitype->Want>counter[aitype->Type->Type] ) {
- if( type==aitype->Type ) {
- if( aitype->Want-1>counter[aitype->Type->Type] ) {
- AiPlayer->Force[force].Completed=0;
+ flag = 0;
+ AiPlayer->Force[force].Completed = 1;
+ aitype = AiPlayer->Force[force].UnitTypes;
+ while (aitype) {
+ if (aitype->Want > counter[aitype->Type->Type]) {
+ if (type == aitype->Type) {
+ if (aitype->Want - 1 > counter[aitype->Type->Type]) {
+ AiPlayer->Force[force].Completed = 0;
}
- flag=1;
+ flag = 1;
} else {
- AiPlayer->Force[force].Completed=0;
+ AiPlayer->Force[force].Completed = 0;
}
}
- aitype=aitype->Next;
+ aitype = aitype->Next;
}
return flag;
}
@@ -215,21 +215,21 @@
//
// Check to which force it belongs
//
- for( force=0; force<AI_MAX_FORCES; ++force ) {
+ for (force = 0; force < AI_MAX_FORCES; ++force) {
// No troops for attacking force
- if( !AiPlayer->Force[force].Defending
- && AiPlayer->Force[force].Attacking ) {
+ if (!AiPlayer->Force[force].Defending &&
+ AiPlayer->Force[force].Attacking) {
continue;
}
- if( AiCheckBelongsToForce(force,unit->Type) ) {
+ if (AiCheckBelongsToForce(force, unit->Type)) {
AiUnit* aiunit;
- aiunit=malloc(sizeof(*aiunit));
- aiunit->Next=AiPlayer->Force[force].Units;
- AiPlayer->Force[force].Units=aiunit;
- aiunit->Unit=unit;
- RefsDebugCheck( unit->Destroyed || !unit->Refs );
+ aiunit = malloc(sizeof(*aiunit));
+ aiunit->Next = AiPlayer->Force[force].Units;
+ AiPlayer->Force[force].Units = aiunit;
+ aiunit->Unit = unit;
+ RefsDebugCheck(unit->Destroyed || !unit->Refs);
++unit->Refs;
break;
}
@@ -250,30 +250,30 @@
AiCleanForces();
- n=AiPlayer->Player->TotalNumUnits;
- memcpy(table,AiPlayer->Player->Units,sizeof(*AiPlayer->Player->Units)*n);
+ n = AiPlayer->Player->TotalNumUnits;
+ memcpy(table, AiPlayer->Player->Units, sizeof(*AiPlayer->Player->Units) *
n);
//
// Remove all units already in forces.
//
- for( f=0; f<AI_MAX_ATTACKING_FORCES; ++f ) {
- aiunit=AiPlayer->Force[f].Units;
- while( aiunit ) {
- unit=aiunit->Unit;
- for( i=0; i<n; ++i ) {
- if( table[i]==unit ) {
- table[i]=table[--n];
+ for (f = 0; f < AI_MAX_ATTACKING_FORCES; ++f) {
+ aiunit = AiPlayer->Force[f].Units;
+ while (aiunit) {
+ unit = aiunit->Unit;
+ for (i = 0; i < n; ++i) {
+ if (table[i] == unit) {
+ table[i] = table[--n];
}
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
}
//
// Try to assign the remaining units.
//
- for( i=0; i<n; ++i ) {
- if( table[i]->Active ) {
+ for (i = 0; i < n; ++i) {
+ if (table[i]->Active) {
AiAssignToForce(table[i]);
}
}
@@ -286,25 +286,25 @@
** @param x X tile map position to be attacked.
** @param y Y tile map position to be attacked.
*/
-global void AiAttackWithForceAt(int force,int x,int y)
+global void AiAttackWithForceAt(int force, int x, int y)
{
const AiUnit* aiunit;
AiCleanForce(force);
- if( (aiunit=AiPlayer->Force[force].Units) ) {
- AiPlayer->Force[force].Attacking=1;
+ if ((aiunit = AiPlayer->Force[force].Units)) {
+ AiPlayer->Force[force].Attacking = 1;
//
// Send all units in the force to enemy.
//
- while( aiunit ) {
- if( aiunit->Unit->Type->CanAttack ) {
- CommandAttack(aiunit->Unit, x, y, NULL,FlushCommands);
+ while (aiunit) {
+ if (aiunit->Unit->Type->CanAttack) {
+ CommandAttack(aiunit->Unit, x, y, NULL, FlushCommands);
} else {
CommandMove(aiunit->Unit, x, y, FlushCommands);
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
}
}
@@ -324,83 +324,83 @@
// Move the force to a free position so it can be used for a new
// attacking party
- if( force<AI_MAX_FORCES ) {
- AiUnitType *aiut;
- AiUnitType *temp;
- AiUnitType **aiut2;
+ if (force < AI_MAX_FORCES) {
+ AiUnitType* aiut;
+ AiUnitType* temp;
+ AiUnitType** aiut2;
- f=AI_MAX_FORCES;
- while( AiPlayer->Force[f].Attacking ) {
+ f = AI_MAX_FORCES;
+ while (AiPlayer->Force[f].Attacking) {
++f;
- if( f==AI_MAX_ATTACKING_FORCES ) {
+ if (f == AI_MAX_ATTACKING_FORCES) {
DebugLevel0Fn("No free attacking forces\n");
- f=force;
+ f = force;
break;
}
}
- if( f!=AI_MAX_ATTACKING_FORCES ) {
- for( aiut=AiPlayer->Force[f].UnitTypes; aiut; aiut=temp ) {
- temp=aiut->Next;
+ if (f != AI_MAX_ATTACKING_FORCES) {
+ for (aiut = AiPlayer->Force[f].UnitTypes; aiut; aiut = temp) {
+ temp = aiut->Next;
free(aiut);
}
- AiPlayer->Force[f]=AiPlayer->Force[force];
- memset(&AiPlayer->Force[force],0,sizeof(AiForce));
- aiut=AiPlayer->Force[force].UnitTypes;
- aiut2=&AiPlayer->Force[force].UnitTypes;
- while( aiut ) {
- *aiut2=malloc(sizeof(**aiut2));
- (*aiut2)->Next=NULL;
- (*aiut2)->Want=aiut->Want;
- (*aiut2)->Type=aiut->Type;
- aiut=aiut->Next;
- aiut2=&(*aiut2)->Next;
+ AiPlayer->Force[f] = AiPlayer->Force[force];
+ memset(&AiPlayer->Force[force], 0, sizeof(AiForce));
+ aiut = AiPlayer->Force[force].UnitTypes;
+ aiut2 = &AiPlayer->Force[force].UnitTypes;
+ while (aiut) {
+ *aiut2 = malloc(sizeof(**aiut2));
+ (*aiut2)->Next = NULL;
+ (*aiut2)->Want = aiut->Want;
+ (*aiut2)->Type = aiut->Type;
+ aiut = aiut->Next;
+ aiut2 = &(*aiut2)->Next;
}
}
- force=f;
+ force = f;
}
AiCleanForce(force);
- AiPlayer->Force[force].Attacking=0;
- if( (aiunit=AiPlayer->Force[force].Units) ) {
- AiPlayer->Force[force].Attacking=1;
-
- enemy=NoUnitP;
- while( aiunit && !enemy ) { // Use an unit that can attack
- if( aiunit->Unit->Type->CanAttack ) {
+ AiPlayer->Force[force].Attacking = 0;
+ if ((aiunit = AiPlayer->Force[force].Units)) {
+ AiPlayer->Force[force].Attacking = 1;
+
+ enemy = NoUnitP;
+ while (aiunit && !enemy) { // Use an unit that can attack
+ if (aiunit->Unit->Type->CanAttack) {
enemy = AttackUnitsInDistance(aiunit->Unit, MaxMapWidth);
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
if (!enemy) {
DebugLevel0Fn("Need to plan an attack with transporter\n");
- if( !AiPlayer->Force[force].State
- && !AiPlanAttack(&AiPlayer->Force[force]) ) {
+ if (!AiPlayer->Force[force].State &&
+ !AiPlanAttack(&AiPlayer->Force[force])) {
DebugLevel0Fn("Can't transport, look for walls\n");
- if( !AiFindWall(&AiPlayer->Force[force]) ) {
- AiPlayer->Force[force].Attacking=0;
+ if (!AiFindWall(&AiPlayer->Force[force])) {
+ AiPlayer->Force[force].Attacking = 0;
}
}
return;
}
- AiPlayer->Force[force].State=0;
+ AiPlayer->Force[force].State = 0;
x = enemy->X;
y = enemy->Y;
//
// Send all units in the force to enemy.
//
- aiunit=AiPlayer->Force[force].Units;
- while( aiunit ) {
- if( aiunit->Unit->Type->CanAttack ) {
- CommandAttack(aiunit->Unit, x, y, NULL,FlushCommands);
+ aiunit = AiPlayer->Force[force].Units;
+ while (aiunit) {
+ if (aiunit->Unit->Type->CanAttack) {
+ CommandAttack(aiunit->Unit, x, y, NULL, FlushCommands);
} else {
CommandMove(aiunit->Unit, x, y, FlushCommands);
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
}
}
@@ -431,55 +431,55 @@
//
// Find all transporters.
//
- n=0;
- aiunit=force->Units;
- while( aiunit ) {
- if( aiunit->Unit->Type->Transporter ) {
- table[n++]=aiunit->Unit;
+ n = 0;
+ aiunit = force->Units;
+ while (aiunit) {
+ if (aiunit->Unit->Type->Transporter) {
+ table[n++] = aiunit->Unit;
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
- if( !n ) {
+ if (!n) {
DebugLevel0Fn("No transporter, lost or error in code?\n");
- force->MustTransport=0;
- force->State=0;
+ force->MustTransport = 0;
+ force->State = 0;
return;
}
//
// Load all on transporter.
//
- f=o=i=0;
- aiunit=force->Units;
- while( aiunit ) {
+ f = o = i = 0;
+ aiunit = force->Units;
+ while (aiunit) {
Unit* unit;
- unit=aiunit->Unit;
- if( !unit->Type->Transporter
- && unit->Type->UnitType==UnitTypeLand ) {
- if( !unit->Removed ) {
- f=1;
- if( unit->Orders[0].Action!=UnitActionBoard ) {
- if( table[i]->Orders[0].Action==UnitActionStill
- && table[i]->OrderCount==1 ) {
+ unit = aiunit->Unit;
+ if (!unit->Type->Transporter &&
+ unit->Type->UnitType == UnitTypeLand) {
+ if (!unit->Removed) {
+ f = 1;
+ if (unit->Orders[0].Action != UnitActionBoard) {
+ if (table[i]->Orders[0].Action == UnitActionStill &&
+ table[i]->OrderCount == 1) {
DebugLevel0Fn("Send transporter %d\n" _C_ i);
- CommandFollow(table[i],unit,FlushCommands);
+ CommandFollow(table[i], unit, FlushCommands);
}
- CommandBoard(unit,table[i],FlushCommands);
+ CommandBoard(unit, table[i], FlushCommands);
++o;
// FIXME
- if( o==table[i]->Type->MaxOnBoard ) {
+ if (o == table[i]->Type->MaxOnBoard) {
DebugLevel0Fn("FIXME: next transporter for AI
boarding\n");
return;
}
}
}
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
- if( !f ) {
+ if (!f) {
DebugLevel0Fn("All are loaded\n");
++force->State;
}
@@ -502,16 +502,16 @@
//
// Find all transporters.
//
- aiunit=force->Units;
- while( aiunit ) {
+ aiunit = force->Units;
+ while (aiunit) {
// Transporter to unload units
- if( aiunit->Unit->Type->Transporter ) {
+ if (aiunit->Unit->Type->Transporter) {
CommandUnload(aiunit->Unit, force->GoalX, force->GoalY, NoUnitP,
- FlushCommands);
+ FlushCommands);
// Ships to defend transporter
- } else if( aiunit->Unit->Type->UnitType==UnitTypeNaval ) {
+ } else if (aiunit->Unit->Type->UnitType == UnitTypeNaval) {
CommandAttack(aiunit->Unit, force->GoalX, force->GoalY, NoUnitP,
- FlushCommands);
+ FlushCommands);
}
aiunit=aiunit->Next;
}
@@ -534,25 +534,25 @@
//
// Find all transporters.
//
- i=1;
- aiunit=force->Units;
- while( aiunit ) {
- if( aiunit->Unit->Type->Transporter ) {
- if( aiunit->Unit->Orders[0].Action==UnitActionStill ) {
+ i = 1;
+ aiunit = force->Units;
+ while (aiunit) {
+ if (aiunit->Unit->Type->Transporter) {
+ if (aiunit->Unit->Orders[0].Action == UnitActionStill) {
DebugLevel0Fn("Unloading\n");
// Don't tell empty transporters to unload.
if (aiunit->Unit->InsideCount) {
- CommandUnload(aiunit->Unit,force->GoalX,force->GoalY,
- NoUnitP,FlushCommands);
- i=0;
+ CommandUnload(aiunit->Unit, force->GoalX, force->GoalY,
+ NoUnitP, FlushCommands);
+ i = 0;
}
} else {
- i=0;
+ i = 0;
}
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
- if( i ) {
+ if (i) {
++force->State; // all unloaded
}
}
@@ -567,19 +567,19 @@
{
const AiUnit* aiunit;
- if( (aiunit=force->Units) ) {
- while( aiunit ) {
+ if ((aiunit = force->Units)) {
+ while (aiunit) {
// Still some action
- if( aiunit->Unit->Orders[0].Action!=UnitActionStill ) {
+ if (aiunit->Unit->Orders[0].Action != UnitActionStill) {
break;
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
- if( !aiunit ) {
- AiAttackWithForce(force-AiPlayer->Force);
+ if (!aiunit) {
+ AiAttackWithForce(force - AiPlayer->Force);
}
} else {
- force->Attacking=0;
+ force->Attacking = 0;
}
}
@@ -590,9 +590,9 @@
*/
local void AiGuideAttackForce(AiForce* force)
{
- enum { StartState=1, TransporterLoaded, WaitLanded, AttackNow };
+ enum { StartState = 1, TransporterLoaded, WaitLanded, AttackNow };
- switch( force->State ) {
+ switch (force->State) {
//
// Load units on transporters.
//
@@ -606,8 +606,8 @@
AiWaitLanded(force);
break;
case AttackNow:
- force->State=0;
- AiAttackWithForce(force-AiPlayer->Force);
+ force->State = 0;
+ AiAttackWithForce(force - AiPlayer->Force);
break;
//
@@ -629,29 +629,29 @@
//
// Look if our defenders still have enemies in range.
//
- for( force=0; force<AI_MAX_ATTACKING_FORCES; ++force ) {
- if( AiPlayer->Force[force].Defending ) {
+ for (force = 0; force < AI_MAX_ATTACKING_FORCES; ++force) {
+ if (AiPlayer->Force[force].Defending) {
const AiUnit* aiunit;
AiCleanForce(force);
//
// Look if still enemies in attack range.
//
- aiunit=AiPlayer->Force[force].Units;
- while( aiunit ) {
- if( aiunit->Unit->Type->CanAttack &&
- AttackUnitsInReactRange(aiunit->Unit) ) {
+ aiunit = AiPlayer->Force[force].Units;
+ while (aiunit) {
+ if (aiunit->Unit->Type->CanAttack &&
+ AttackUnitsInReactRange(aiunit->Unit)) {
break;
}
- aiunit=aiunit->Next;
+ aiunit = aiunit->Next;
}
- if( !aiunit ) { // No enemies go home.
+ if (!aiunit) { // No enemies go home.
DebugLevel0Fn("FIXME: not written, should send force home\n");
- AiPlayer->Force[force].Defending=0;
- AiPlayer->Force[force].Attacking=0;
+ AiPlayer->Force[force].Defending = 0;
+ AiPlayer->Force[force].Attacking = 0;
}
}
- if( AiPlayer->Force[force].Attacking ) {
+ if (AiPlayer->Force[force].Attacking) {
AiCleanForce(force);
AiGuideAttackForce(&AiPlayer->Force[force]);
}
Index: stratagus/src/ai/ai_magic.c
diff -u stratagus/src/ai/ai_magic.c:1.19 stratagus/src/ai/ai_magic.c:1.20
--- stratagus/src/ai/ai_magic.c:1.19 Fri Oct 3 06:37:05 2003
+++ stratagus/src/ai/ai_magic.c Mon Oct 13 22:47:35 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_magic.c,v 1.19 2003/10/03 10:37:05 n0body Exp $
+// $Id: ai_magic.c,v 1.20 2003/10/14 02:47:35 jsalmon3 Exp $
//@{
@@ -60,7 +60,7 @@
int n;
Unit** units;
Unit* unit;
- const Player *player;
+ const Player* player;
#ifdef DEBUG
int success;
#endif
@@ -68,11 +68,11 @@
n = AiPlayer->Player->TotalNumUnits;
units = AiPlayer->Player->Units;
player = AiPlayer->Player;/*units[0]->Player*/
- for(i = 0; i < n; ++i) {
+ for (i = 0; i < n; ++i) {
unit = units[i];
// Check only magic units
- if(unit->Type->CanCastSpell) {
- for (j = 0; j < SpellTypeCount; j++) {
+ if (unit->Type->CanCastSpell) {
+ for (j = 0; j < SpellTypeCount; ++j) {
// Check if we can cast this spell. SpellIsAvailable checks
for upgrades.
if (unit->Type->CanCastSpell[j] && SpellIsAvailable(player, j)
&&
(SpellTypeById(j)->AutoCast ||
SpellTypeById(j)->AICast)) {
@@ -80,10 +80,10 @@
success = // Follow on next line (AutoCastSpell).
#endif
AutoCastSpell(unit, SpellTypeById(j));
- DebugLevel3Fn("Mage '%s' cast '%s' : %s\n"
- _C_ unit->Type->Ident
- _C_ SpellTypeById(j)->Ident
- _C_ success ? "success" : "fail");
+ DebugLevel3Fn("Mage '%s' cast '%s' : %s\n" _C_
+ unit->Type->Ident _C_
+ SpellTypeById(j)->Ident _C_
+ success ? "success" : "fail");
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/ai ai_building.c ai_force.c ai_ma...,
Jimmy Salmon <=