stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus data/ccl/ai.ccl src/action/action_tra...


From: ludovic pollet
Subject: [Stratagus-CVS] stratagus data/ccl/ai.ccl src/action/action_tra...
Date: Tue, 25 Nov 2003 05:34:17 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     ludovic pollet <address@hidden> 03/11/25 05:34:16

Modified files:
        data/ccl       : ai.ccl 
        src/action     : action_train.c 
        src/ai         : ai_building.c new_ai.c 
        src/include    : ai.h 
        src/pathfinder : splitter.c 

Log message:
        AI will not place building where that could block its units

Patches:
Index: stratagus/data/ccl/ai.ccl
diff -u stratagus/data/ccl/ai.ccl:1.62 stratagus/data/ccl/ai.ccl:1.63
--- stratagus/data/ccl/ai.ccl:1.62      Wed Nov 19 21:23:39 2003
+++ stratagus/data/ccl/ai.ccl   Tue Nov 25 05:34:14 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: ai.ccl,v 1.62 2003/11/20 02:23:39 pludov Exp $
+;;     $Id: ai.ccl,v 1.63 2003/11/25 10:34:14 pludov Exp $
 
 ;(define (ai:sleep) () #t)
 
@@ -424,6 +424,8 @@
        ((ai:destroyer)
            (enemy-hotspot-sea-fire 70)
            (enemy-hotspot-ground-force 20) (enemy-hotspot-sea-force 20) 
(enemy-hotspot-air-force 80))
+       ((ai:scout)
+           (enemy-hotspot-sea-force 1))
        ))
 
 (define-ai-action '(defense attack)
@@ -561,7 +563,7 @@
                        (unit_force (ai:get-unittype-force unittype))
                        (wanted (quotient want_pct (* unit_force 100))))
                (if (< wanted 1)
-                   (ai:units_pct_to_wants (cdr pcts))
+                   (cons unittype (cons 1 (ai:units_pct_to_wants (cdr pcts))))
                    (cons unittype (cons wanted (ai:units_pct_to_wants (cdr 
pcts))))                
 ))))))
 
@@ -644,7 +646,10 @@
                    ;; return the computed value if can transport
                    (if (ai:can-reach-hotspot 'lazy)
                        result
-                       -1)
+                       (begin
+                               (writes nil "can't reach hotspot\n")
+                               -1
+                       ))
                )
                ;; can't, return -1
                -1
@@ -1420,9 +1425,6 @@
     (ai:force 1 (ai:flyer) 2)
     (ai:wait-force 1)
     
-;;    (ai:wait-force 2)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-
     (ai:set-auto-attack #t)
     (ai:sleep 500)
     (ai:need (ai:city-center))
@@ -1430,7 +1432,6 @@
     (ai:upgrade-to (ai:guard-tower))
     (ai:need (ai:airport))
     (ai:force 0 (ai:flyer) 3)
-;;    (ai:wait-force 2)                ;; wait until attack party is completed
 
     (ai:need (ai:city-center))
     (ai:need (ai:tower))
@@ -1438,87 +1439,41 @@
     (ai:need (ai:airport))
     (ai:set  (ai:worker) 20)
     (ai:force 1 (ai:flyer) 4)
-;;    (ai:attack-with-force 2)
 
-    (ai:sleep 500)
+    (ai:sleep 1200)
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:guard-tower))
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:cannon-tower))
-;;    (ai:force 2 (ai:flyer) 1)
-;;    (ai:wait-force 2)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 1)
 
-    (ai:sleep 500)
+    (ai:sleep 1200)
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:guard-tower))
     (ai:need (ai:tower))
-;;    (ai:force 1 (ai:flyer) 2)
-;;    (ai:force 2 (ai:flyer) 2)
-;;    (ai:wait-force 2)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 1)
 
-    (ai:sleep 500)
+    (ai:sleep 1200)
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:guard-tower))
-    (ai:need (ai:tower))
-    (ai:force 0 (ai:flyer) 6)
-;;    (ai:force 1 (ai:flyer) 1)
-;;    (ai:force 2 (ai:flyer) 2)
-;;    (ai:force 3 (ai:flyer) 2)
-;;    (ai:wait-force 2)
-;;    (ai:wait-force 3)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-;;    (ai:attack-with-force 3)
+    (ai:force 1 (ai:flyer) 6)
 
-    (ai:sleep 500)
+    (ai:sleep 1200)
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:guard-tower))
-    (ai:need (ai:tower))
-;;    (ai:force 1 (ai:flyer) 2)
-;;    (ai:force 2 (ai:flyer) 2)
-;;    (ai:force 3 (ai:flyer) 2)
-;;    (ai:wait-force 2)
-;;    (ai:wait-force 3)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-;;    (ai:attack-with-force 3)
 
-    (ai:sleep 500)
+    (ai:sleep 1200)
     (ai:need (ai:tower))
     (ai:upgrade-to (ai:guard-tower))
     (ai:need (ai:tower))
-;;    (ai:force 1 (ai:flyer) 2)
-;;    (ai:force 2 (ai:flyer) 2)
-;;    (ai:force 3 (ai:flyer) 3)
-;;    (ai:wait-force 2)
-;;    (ai:wait-force 3)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-;;    (ai:attack-with-force 3)
 
-    (ai:sleep 500)
-    (ai:need (ai:tower))
-    (ai:upgrade-to (ai:guard-tower))
-    (ai:need (ai:tower))
-;;    (ai:force 1 (ai:flyer) 2)
-;;    (ai:force 2 (ai:flyer) 3)
-;;    (ai:force 3 (ai:flyer) 3)
-;;    (ai:wait-force 2)
-;;    (ai:wait-force 3)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-;;    (ai:attack-with-force 3)
+    (ai:sleep 1200)
+    (ai:force 1 (ai:flyer) 10)
 
-    (ai:sleep 500)
-    (ai:force 0 (ai:flyer) 10)
-;;    (ai:force 1 (ai:flyer) 1)
-;;    (ai:force 2 (ai:flyer) 2)
-;;    (ai:force 3 (ai:flyer) 2)
-;;    (ai:force 4 (ai:flyer) 2)
-;;    (ai:force 5 (ai:flyer) 2)
-;;    (ai:wait-force 5)                ;; wait until attack party is completed
-;;    (ai:attack-with-force 2)
-;;    (ai:attack-with-force 3)
-;;    (ai:attack-with-force 4)
-;;    (ai:attack-with-force 5)
+    (ai:research 'upgrade-sword1)
+    (ai:research 'upgrade-human-shield1)
+    (ai:research 'upgrade-arrow1)
+    (ai:research 'upgrade-sword2)
+    (ai:research 'upgrade-human-shield2)
+    (ai:research 'upgrade-arrow2)
 
     (ai:sleep 500)
     (ai:script ai:air-attack-endloop) ))
@@ -1538,7 +1493,7 @@
     (ai:force 0 
              (ai:destroyer) 6 (ai:battleship) 7 (ai:scout) 1
              (ai:soldier) 4 (ai:cavalrie) 4 (ai:catapult) 4
-             (ai:transporter) 2)
+             (ai:transporter) 4)
     (ai:sleep 500)
     (ai:script ai:sea-attack-endloop) ))
 
@@ -1624,12 +1579,12 @@
     (ai:sleep 500)
     (ai:research (ai:upgrade-catapult-2))
     (ai:research (ai:upgrade-ship-cannon-1))
-    (ai:force 0 (ai:cavalrie) 1 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 2 
(ai:destroyer) 4 (ai:battleship) 5 (ai:submarine) 3 (ai:transporter) 1)
+    (ai:force 0 (ai:cavalrie) 1 (ai:soldier) 3 (ai:catapult) 1 (ai:scout) 2 
(ai:destroyer) 4 (ai:battleship) 5 (ai:submarine) 3 (ai:transporter) 2)
 
     (ai:sleep 500)
     (ai:research (ai:upgrade-ship-cannon-2))
     (ai:need (ai:city-center))
-    (ai:force 0 (ai:cavalrie) 2 (ai:soldier) 5 (ai:catapult) 3 (ai:scout) 3 
(ai:destroyer) 6 (ai:battleship) 6 (ai:submarine) 3 (ai:transporter) 2)
+    (ai:force 0 (ai:cavalrie) 2 (ai:soldier) 5 (ai:catapult) 3 (ai:scout) 3 
(ai:destroyer) 6 (ai:battleship) 6 (ai:submarine) 3 (ai:transporter) 3)
 
     (ai:sleep 500)
     (ai:need (ai:harbor))
@@ -1978,10 +1933,11 @@
 
     (ai:need (ai:platform))
 
-    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 4 
(ai:transporter) 1)
+    (ai:force 0 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 4 
(ai:transporter) 4)
+    (ai:force 1 (ai:destroyer) 2 (ai:soldier) 3 (ai:shooter) 4 
(ai:transporter) 4)
     (ai:sleep 27000)
 
-    (ai:set  (ai:transporter) 2)
+    (ai:force 1 (ai:destroyer) 4 (ai:soldier) 10 (ai:shooter) 8 
(ai:transporter) 6)
     (ai:sleep 22000)
 
     (ai:sleep 22000)
@@ -2060,7 +2016,7 @@
 
     (ai:need (ai:platform))
 
-    (ai:force 0 (ai:destroyer) 3 (ai:soldier) 4 (ai:shooter) 3 
(ai:transporter) 1)
+    (ai:force 0 (ai:destroyer) 3 (ai:soldier) 4 (ai:shooter) 3 
(ai:transporter) 2)
 
     (ai:sleep 3000)
 
@@ -2070,7 +2026,7 @@
 
     (ai:sleep 12000)
 
-    (ai:force 0 (ai:destroyer) 4 (ai:soldier) 6 (ai:shooter) 4 
(ai:transporter) 1)
+    (ai:force 0 (ai:destroyer) 4 (ai:soldier) 12 (ai:shooter) 4 
(ai:transporter) 4)
 
 
     (ai:sleep 14000)
Index: stratagus/src/action/action_train.c
diff -u stratagus/src/action/action_train.c:1.63 
stratagus/src/action/action_train.c:1.64
--- stratagus/src/action/action_train.c:1.63    Tue Nov 18 12:56:19 2003
+++ stratagus/src/action/action_train.c Tue Nov 25 05:34:14 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_train.c,v 1.63 2003/11/18 17:56:19 pludov Exp $
+//     $Id: action_train.c,v 1.64 2003/11/25 10:34:14 pludov Exp $
 
 //@{
 
@@ -97,7 +97,7 @@
        food = PlayerCheckLimits(player, unit->Data.Train.What[0]);
        if (food < 0) {
            if (food == -3 && unit->Player->AiEnabled) {
-               AiNeedMoreFarms(unit, unit->Orders[0].Type);
+               AiNeedMoreSupply(unit, unit->Orders[0].Type);
            }
 
            unit->Data.Train.Ticks = 
Index: stratagus/src/ai/ai_building.c
diff -u stratagus/src/ai/ai_building.c:1.43 stratagus/src/ai/ai_building.c:1.44
--- stratagus/src/ai/ai_building.c:1.43 Sun Oct 26 10:34:58 2003
+++ stratagus/src/ai/ai_building.c      Tue Nov 25 05:34:15 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_building.c,v 1.43 2003/10/26 15:34:58 pludov Exp $
+//      $Id: ai_building.c,v 1.44 2003/11/25 10:34:15 pludov Exp $
 
 //@{
 
@@ -53,153 +53,89 @@
 ----------------------------------------------------------------------------*/
 
 /**
-**     Check if the surrounding are free.
+**     Check if the surrounding are free. Depending on the value of flag, it 
will check :
+**     0: the building will not block any way
+**     1: all surrounding is free
 **
 **     @param worker   Worker to build.
 **     @param type     Type of building.
 **     @param x        X map tile position for the building.
 **     @param y        Y map tile position for the building.
+**     @param flag     0: only check that building will not block anything.
 **
 **     @return         True if the surrounding is free, false otherwise.
 **
 **     @note           Can be faster written.
 */
-local int AiCheckSurrounding(const Unit * worker, const UnitType * type, int 
x, int y)
+local int AiCheckSurrounding(const Unit * worker, const UnitType * type, int 
x, int y, int flag)
 {
+    static int dirs[5][2] = {{1,0},{0,1},{-1,0},{0,-1},{0,0}};
+    int surrounding[1024]; // Max criconference for building
+    int surroundingnb;
+    int x0, y0, x1, y1;
     int i;
-    int h;
-    int w;
-
-    h = type->TileHeight + 2;
-    w = type->TileWidth + 2;
-    --x;
-    --y;
-
-    for (i = 0; i < w; ++i) {          // Top row
-       // FIXME: (pludov) slow, worse,...
-       if (x + i < 0 || x + i > TheMap.Width) {
-           continue;
-       }
-       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)) {
-           return 0;
+    int lastval;
+    int dir;
+    int obstacle;
+    
+    x0 = x - 1;
+    y0 = y - 1;
+    x1 = x0 + type->TileWidth + 1;
+    y1 = y0 + type->TileWidth + 1;
+    
+    
+    x = x0;
+    y = y0;
+    dir = -1;
+    surroundingnb = 0;
+    while (dir < 4) {
+       if ((unsigned)x < (unsigned)TheMap.Width && (unsigned)y < 
(unsigned)TheMap.Height) {
+           if (worker && x == worker->X && y == worker->Y) {
+               surrounding[surroundingnb++] = 1;
+           } else if (TheMap.Fields[x + y * TheMap.Width].Flags &
+                       (MapFieldUnpassable | MapFieldWall | MapFieldRocks |
+                       MapFieldForest | MapFieldBuilding)) {
+               surrounding[surroundingnb++] = 0;
+           } else{
+               // Can pass there
+               surrounding[surroundingnb++] = (TheMap.Fields[x + y * 
TheMap.Width].Flags & 
+                       (MapFieldWaterAllowed + MapFieldCoastAllowed + 
MapFieldLandAllowed)) != 0;;
+           }
+       } else {
+           surrounding[surroundingnb++] = 0;
        }
+       
+       if ((x == x0 || x == x1) && (y == y0 || y == y1)) {
+           dir++;
+       }
+       
+       x += dirs[dir][0];
+       y += dirs[dir][1];
     }
-
-    ++y;
-    h -= 2;
-    for (i = 0; i < h; ++i) {          // Left row
-       // FIXME: (pludov) slow, worse,...
-       if (y + i < 0 || y + i > TheMap.Height) {
-           continue;
-       }
-       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)) {
-           return 0;
+    
+    lastval = surrounding[surroundingnb - 1];
+    obstacle = 0;
+    for (i = 0 ; i < surroundingnb; i++) {
+       if (lastval && !surrounding[i]) {
+           obstacle++;
        }
+       lastval = surrounding[i];
     }
-    return 1;
-}
-
-#if 0
-/**
-**      Find free building place.
-**
-**     @param worker   Worker to build building.
-**     @param type     Type of building.
-**     @param dx       Pointer for X position returned.
-**     @param dy       Pointer for Y position returned.
-**     @param flag     Flag if surrounding must be free.
-**     @return         True if place found, false if no found.
-**
-**     @note   This can be done faster, use flood fill.
-*/
-local int AiFindBuildingPlace2(const Unit * worker, const UnitType * type,
-    int *dx, int *dy, int flag)
-{
-    int wx;
-    int wy;
-    int x;
-    int y;
-    int addx;
-    int addy;
-    int end;
-    int state;
-
-    wx = worker->X;
-    wy = worker->Y;
-    x = wx;
-    y = wy;
-    addx = 1;
-    addy = 1;
-
-    state = 0;
-    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;
-                   }
-               }
-               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;
-           return 1;
-       }
+    
+    if (obstacle == 0) {
+       obstacle = !surrounding[0];
+    }
+    
+    if (flag) {
+       return obstacle == 0;
+    } else if (!type->ShoreBuilding) {
+       return obstacle < 2;
+    } else {
+       // Shore building haves at least 2 obstacles : sea->ground & ground->sea
+       return obstacle < 3;
     }
-    return 0;
 }
 
-#endif
-
 /**
 **      Find free building place. (flood fill version)
 **
@@ -244,7 +180,7 @@
     //  Look if we can build at current place.
     //
     if (CanBuildUnitType(worker, type, x, y) &&
-       (!flag || AiCheckSurrounding(worker, type, x, y))) {
+       (/*!flag || */AiCheckSurrounding(worker, type, x, y, flag))) {
        *dx = x;
        *dy = y;
        free(points);
@@ -297,7 +233,7 @@
                //      Look if we can build here.
                //
                if (CanBuildUnitType(worker, type, x, y) &&
-                   (!flag || AiCheckSurrounding(worker, type, x, y))) {
+                   (/*!flag ||*/ AiCheckSurrounding(worker, type, x, y, 
flag))) {
                    *dx = x;
                    *dy = y;
                    free(points);
@@ -635,8 +571,7 @@
 **     @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)
 {
 
     //
Index: stratagus/src/ai/new_ai.c
diff -u stratagus/src/ai/new_ai.c:1.95 stratagus/src/ai/new_ai.c:1.96
--- stratagus/src/ai/new_ai.c:1.95      Thu Nov 20 15:35:43 2003
+++ stratagus/src/ai/new_ai.c   Tue Nov 25 05:34:15 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: new_ai.c,v 1.95 2003/11/20 20:35:43 n0body Exp $
+//      $Id: new_ai.c,v 1.96 2003/11/25 10:34:15 pludov Exp $
 
 
 //@{
@@ -105,10 +105,10 @@
 **
 **             Called if an unit owned by the AI is killed.
 **
-**     ::AiNeedMoreFarms()
+**     ::AiNeedMoreSupply()
 **
 **             Called if an trained unit is ready, but not enough food is
-**             available.
+**             available for it.
 **
 **     ::AiWorkComplete()
 **
@@ -784,7 +784,7 @@
 {
     CLprintf(file, "\n;;; -----------------------------------------\n");
     CLprintf(file,
-       ";;; MODULE: AI $Id: new_ai.c,v 1.95 2003/11/20 20:35:43 n0body Exp 
$\n\n");
+       ";;; MODULE: AI $Id: new_ai.c,v 1.96 2003/11/25 10:34:15 pludov Exp 
$\n\n");
 
     SaveAiTypesWcName(file);
     SaveAiHelper(file);
@@ -1158,7 +1158,6 @@
 local int AiReduceMadeInBuilded2(const PlayerAi * pai, const UnitType * type)
 {
     AiBuildQueue *queue;
-
     //
     //  Search the unit-type order.
     //
@@ -1197,7 +1196,7 @@
        }
     }
 
-    //DebugCheck(1);
+    DebugCheck(1);
 }
 
 /*----------------------------------------------------------------------------
@@ -1405,8 +1404,8 @@
 
        bx0 = blocker->X;
        by0 = blocker->Y;
-       bx1 = bx0;
-       by1 = by0;
+       bx1 = bx0 + blocker->Type->TileWidth - 1;
+       by1 = by0 + blocker->Type->TileHeight - 1;;
 
        // Check for collision
 #define int_min(a,b)  ((a)<(b)?(a):(b))
@@ -1725,7 +1724,7 @@
 **     @param unit     Point to unit.
 **      @param what     Pointer to unit-type.
 */
-global void AiNeedMoreFarms(Unit * unit, const UnitType * what __attribute__ 
((unused)))
+global void AiNeedMoreSupply(Unit * unit, const UnitType * what __attribute__ 
((unused)))
 {
     DebugLevel3Fn("%d: %d(%s) need more farms %s at %d,%d\n" _C_
        unit->Player->Player _C_ UnitNumber(unit) _C_ unit->Type->Ident _C_
Index: stratagus/src/include/ai.h
diff -u stratagus/src/include/ai.h:1.31 stratagus/src/include/ai.h:1.32
--- stratagus/src/include/ai.h:1.31     Fri Nov 14 12:35:52 2003
+++ stratagus/src/include/ai.h  Tue Nov 25 05:34:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ai.h,v 1.31 2003/11/14 17:35:52 pludov Exp $
+//     $Id: ai.h,v 1.32 2003/11/25 10:34:16 pludov Exp $
 
 #ifndef __AI_H__
 #define __AI_H__
@@ -70,7 +70,7 @@
     /// Called if AI unit is killed
 extern void AiUnitKilled(Unit* unit);
     /// Called if AI needs more farms
-extern void AiNeedMoreFarms(Unit* unit,const UnitType* what);
+extern void AiNeedMoreSupply(const Unit* unit,const UnitType* what);
     /// Called if AI unit has completed work
 extern void AiWorkComplete(Unit* unit,Unit* what);
     /// Called if AI unit can't build
Index: stratagus/src/pathfinder/splitter.c
diff -u stratagus/src/pathfinder/splitter.c:1.2 
stratagus/src/pathfinder/splitter.c:1.3
--- stratagus/src/pathfinder/splitter.c:1.2     Sun Nov 23 06:55:35 2003
+++ stratagus/src/pathfinder/splitter.c Tue Nov 25 05:34:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: splitter.c,v 1.2 2003/11/23 11:55:35 mr-russ Exp $
+//     $Id: splitter.c,v 1.3 2003/11/25 10:34:16 pludov Exp $
 
 //@{
     
@@ -209,7 +209,7 @@
     }
     RegionCount++;
     
-    DebugLevel2Fn("New region %d, iswater = %d\n" _C_ result _C_ iswater);
+    DebugLevel3Fn("New region %d, iswater = %d\n" _C_ result _C_ iswater);
     DebugCheck(Regions[result].TileCount);
     
     Regions[result].TileCount = 0;
@@ -549,7 +549,7 @@
     int nbarea;
     int tilesleft;
     
-    DebugLevel2Fn("Region %d checked for splitting\n" _C_ reg);
+    DebugLevel3Fn("Region %d checked for splitting\n" _C_ reg);
     RegionSegment * seg;
     
     RegionTempStorageAllocate();
@@ -580,7 +580,7 @@
 
     if (nbarea > 1) {
        // RegionDebugAllConnexions();
-       DebugLevel2Fn("Region %d must be splitted into %d...\n" _C_ reg _C_ 
nbarea);
+       DebugLevel3Fn("Region %d must be splitted into %d...\n" _C_ reg _C_ 
nbarea);
        Regions[reg].Dirty += 10;
        RegionSplitUsingTemp(reg, nbarea, 1);
        ZoneNeedRefresh = 1;
@@ -646,7 +646,7 @@
        return;
     }
 
-    DebugLevel2Fn("Region %d should be checked\n" _C_ reg);
+    DebugLevel3Fn("Region %d should be checked\n" _C_ reg);
     // Here we'll need to flood fill the region to be sure...
     Regions[reg].NeedConnectTest = 1;
 }
@@ -678,7 +678,7 @@
     for (y = y0; y <= y1; y++) {
        for (x = x0; x <= x1; x++) {
            if (RegionMapping(x, y) != NoRegion) {
-               DebugLevel2Fn("Clearing an already clear tile %d %d -- applying 
ugly hack\n" _C_ x _C_ y);
+               DebugLevel3Fn("Clearing an already clear tile %d %d -- applying 
ugly hack\n" _C_ x _C_ y);
                
                for (y = y0; y <= y1; y++) {
                    for (x = x0; x <= x1; x++) { 
@@ -919,7 +919,7 @@
            }
 
            CurrentIsWater = TileIsWater(x, y);
-           DebugLevel2Fn("CurrentIsWater %d at %d %d\n" _C_ CurrentIsWater _C_ 
x _C_ y);
+           DebugLevel3Fn("CurrentIsWater %d at %d %d\n" _C_ CurrentIsWater _C_ 
x _C_ y);
            FindHExtent(x, y, &x0, &x1, CurrentIsWater);
            
            RegionFloodFill(x0, x1, y, NewRegion(CurrentIsWater), 
CurrentIsWater);
@@ -928,7 +928,7 @@
     }
     UpdateConnections();
     
-    DebugLevel2Fn( "Map FloodFill done\n");
+    DebugLevel3Fn( "Map FloodFill done\n");
     RegionDebugAllConnexions();
     RegionDebugWater();
     
@@ -944,7 +944,7 @@
            if ( (Regions[i].TileCount > 1024) ||
                 (Regions[i].TileCount > 64 &&
                 max(x,y) * max(x,y) > 3 * Regions[i].TileCount)){
-               DebugLevel2Fn( "Split %d\n" _C_ i);
+               DebugLevel3Fn( "Split %d\n" _C_ i);
                RegionSplit(i, 1);
                // RegionDebugAllConnexions();
                found = 1;
@@ -1101,7 +1101,7 @@
     RefreshZones();
     ZoneNeedRefresh = 0;
 
-    DebugLevel2Fn("Mapping initialised\n");
+    DebugLevel3Fn("Mapping initialised\n");
     RegionDebugAllConnexions();
 }
 
@@ -1140,7 +1140,7 @@
        for (i = 0; i < RegionMax; i++) {
            if (Regions[i].Dirty && 
ShouldBreakRegion(Regions[i].MinX,Regions[i].MinY,
                Regions[i].MaxX,Regions[i].MaxY,Regions[i].TileCount,1)) {
-               DebugLevel2Fn("Splitting region %d\n" _C_ i);
+               DebugLevel3Fn("Splitting region %d\n" _C_ i);
                
                
                RegionSplit(i, 1);
@@ -1184,7 +1184,7 @@
                
                if (!ShouldBreakRegion(x0, y0, x1, y1, 
                        Regions[i].TileCount + Regions[j].TileCount, 1)) {
-                   DebugLevel2Fn("Joining regions %d - %d\n" _C_ i _C_ j);
+                   DebugLevel3Fn("Joining regions %d - %d\n" _C_ i _C_ j);
                    RegionJoin(i, j);
                    // RegionDebugAllConnexions();
                    if (!Regions[i].TileCount) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]