[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/ai ai_rules.c
From: |
ludovic pollet |
Subject: |
[Stratagus-CVS] stratagus/src/ai ai_rules.c |
Date: |
Thu, 13 Nov 2003 06:20:03 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: ludovic pollet <address@hidden> 03/11/13 06:20:02
Modified files:
src/ai : ai_rules.c
Log message:
Ai won't try to exceed unit limits
Patches:
Index: stratagus/src/ai/ai_rules.c
diff -u stratagus/src/ai/ai_rules.c:1.8 stratagus/src/ai/ai_rules.c:1.9
--- stratagus/src/ai/ai_rules.c:1.8 Wed Nov 12 15:35:41 2003
+++ stratagus/src/ai/ai_rules.c Thu Nov 13 06:20:02 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_rules.c,v 1.8 2003/11/12 20:35:41 jsalmon3 Exp $
+// $Id: ai_rules.c,v 1.9 2003/11/13 11:20:02 pludov Exp $
//@{
@@ -117,17 +117,6 @@
** +3 allied
** +4 enemy
** +5 own
-** TODO : the remainder is not usefull and should be removed
-** UnitTypesBase:
-** Count by unittype ...
-** On the hotspot:
-** +0 allied
-** +1 enemy
-** +2 own
-** On the map:
-** +0 allied
-** +1 enemy
-** +2 own
*/
/*----------------------------------------------------------------------------
@@ -608,6 +597,7 @@
int cost, own;
int forcesize;
+ int missing;
AiUnitType *unittype;
UnitType * usedtype;
@@ -621,8 +611,16 @@
}
// We have everything ready
- if (!AiForceSubstractWant(force, count)) {
+ missing = AiForceSubstractWant(force, count);
+
+ if (!total && !missing) {
DebugLevel3Fn("Force ready, no cost\n");
+ return 0;
+ }
+
+ // Check that missing+nb of units < max nb of units
+ if (missing + AiPlayer->Player->TotalNumUnits >=
AiPlayer->Player->TotalUnitLimit) {
+ DebugLevel2Fn("Unit limit reached\n");
return 0;
}