[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/ai ai_force.c ai_local.h ai_rules...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/ai ai_force.c ai_local.h ai_rules... |
Date: |
20 Dec 2003 16:02:02 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/20 16:02:02
Modified files:
src/ai : ai_force.c ai_local.h ai_rules.c ccl_ai.c
new_ai.c
Log message:
Lua updates
Patches:
Index: stratagus/src/ai/ai_force.c
diff -u stratagus/src/ai/ai_force.c:1.44 stratagus/src/ai/ai_force.c:1.45
--- stratagus/src/ai/ai_force.c:1.44 Sun Dec 14 20:44:31 2003
+++ stratagus/src/ai/ai_force.c Sat Dec 20 16:02:00 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_force.c,v 1.44 2003/12/14 09:44:31 wizzard Exp $
+// $Id: ai_force.c,v 1.45 2003/12/20 05:02:00 jsalmon3 Exp $
//@{
@@ -728,9 +728,7 @@
curpower[0] = power[0];
curpower[1] = power[1];
curpower[2] = power[2];
- AiEraseForce(AiScript->ownForce);
-
-
+ AiEraseForce(AiScript->OwnForce);
do {
forceUpdated = 0;
@@ -746,13 +744,13 @@
continue;
}
- unittypeforce = AiUnittypeForce(ut);
+ unittypeforce = AiUnitTypeForce(ut);
unittypeforce = (unittypeforce ? unittypeforce
: 1);
// Try to respond to the most important power
...
maxadd = 1 + curpower[maxPower] / unittypeforce;
- lefttoadd =
AiEnroleSpecificUnitType(AiScript->ownForce, ut, maxadd);
+ lefttoadd =
AiEnroleSpecificUnitType(AiScript->OwnForce, ut, maxadd);
// Nothing added, continue.
if (lefttoadd == maxadd) {
@@ -768,14 +766,14 @@
(curpower[0] > curpower[2] ? 0 : 2) :
(curpower[1] > curpower[2] ? 1 : 2));
if (curpower[maxPower] <= 0) {
- AiFinalizeForce(AiScript->ownForce);
+ AiFinalizeForce(AiScript->OwnForce);
return 0;
}
}
}
} while (forceUpdated);
// Sth missing...
- AiFinalizeForce(AiScript->ownForce);
+ AiFinalizeForce(AiScript->OwnForce);
return -1;
}
Index: stratagus/src/ai/ai_local.h
diff -u stratagus/src/ai/ai_local.h:1.50 stratagus/src/ai/ai_local.h:1.51
--- stratagus/src/ai/ai_local.h:1.50 Tue Dec 16 16:57:48 2003
+++ stratagus/src/ai/ai_local.h Sat Dec 20 16:02:00 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_local.h,v 1.50 2003/12/16 05:57:48 jsalmon3 Exp $
+// $Id: ai_local.h,v 1.51 2003/12/20 05:02:00 jsalmon3 Exp $
#ifndef __AI_LOCAL_H__
#define __AI_LOCAL_H__
@@ -189,15 +189,15 @@
char* Script; /// Script executed
#endif
unsigned long SleepCycles; /// Cycles to sleep
- char ident[10]; /// Debugging !
+ char Ident[10]; /// Debugging !
int HotSpotX; /// Hot spot ( for defense, attack, ... )
int HotSpotY;
int HotSpotRay;
- int ownForce; /// A force ID ( the n° of the script... )
- int* gauges; /// Gauges values ( initially 0 )
+ int OwnForce; /// A force ID ( the n° of the script... )
+ int* Gauges; /// Gauges values ( initially 0 )
// Total number of resource gauges
-#define RESOURCE_COUNT 3
+#define RESOURCE_COUNT 3
// Total number of forces gauges
#define FORCE_COUNT 11
@@ -214,8 +214,9 @@
typedef struct _ai_script_action_ {
#if defined(USE_GUILE) || defined(USE_SIOD)
SCM Action; /// Scheme description, in the form :
-
/// '((name evaluate-lambda run-script) ... )
+ /// '((name evaluate-lambda run-script) ... )
#elif defined(USE_LUA)
+ char* Action; /// Name of lua table
#endif
int Defensive; /// Is this action usable for defense
@@ -239,12 +240,12 @@
**
*/
struct _ai_action_evaluation_ {
- AiScriptAction* aiScriptAction; /// Action evaluated
- int gamecycle; /// Gamecycle when this evaluation
occured
- int hotSpotX; /// X position of the hotspot, or -1
- int hotSpotY; /// Y position of the hotspot, or -1
- int hotSpotValue; /// Value of the hotspot ( total
points to get... )
- int value; /// Result of the evaluation (
resources needed... )
+ AiScriptAction* AiScriptAction; /// Action evaluated
+ unsigned long GameCycle; /// Gamecycle when this evaluation
occured
+ int HotSpotX; /// X position of the hotspot, or -1
+ int HotSpotY; /// Y position of the hotspot, or -1
+ int HotSpotValue; /// Value of the hotspot ( total
points to get... )
+ int Value; /// Result of the evaluation (
resources needed... )
AiActionEvaluation* Next; /// Next in linked list
};
@@ -492,7 +493,7 @@
extern int AiFindGaugeId(lua_State* l);
#endif
/// return the force of the unittype.
-extern int AiUnittypeForce(UnitType* unitType);
+extern int AiUnitTypeForce(UnitType* unitType);
//
// Magic
Index: stratagus/src/ai/ai_rules.c
diff -u stratagus/src/ai/ai_rules.c:1.14 stratagus/src/ai/ai_rules.c:1.15
--- stratagus/src/ai/ai_rules.c:1.14 Mon Dec 15 18:12:54 2003
+++ stratagus/src/ai/ai_rules.c Sat Dec 20 16:02:00 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_rules.c,v 1.14 2003/12/15 07:12:54 wizzard Exp $
+// $Id: ai_rules.c,v 1.15 2003/12/20 05:02:00 jsalmon3 Exp $
//@{
@@ -218,13 +218,13 @@
----------------------------------------------------------------------------*/
/**
-** Force Guagges value
+** Force Gauges value
**
-** @param force Force Number
+** @param force Force number
** @param location FIXME: DOCU
** @param camp FIXME: DOCU
**
-** @return Guage Number
+** @return Gauge number
*/
local int ForceGauge(int force, int location, int camp)
{
@@ -234,7 +234,7 @@
/**
** FIXME: docu
**
-** @param guage FIXME: DOCU
+** @param gauge FIXME: DOCU
** @param buffer FIXME: DOCU
** @param bufferSize FIXME: DOCU
*/
@@ -328,7 +328,7 @@
**
** @return FIXME: DOCU
*/
-global int AiUnittypeForce(UnitType* unitType)
+global int AiUnitTypeForce(UnitType* unitType)
{
int influence;
@@ -378,7 +378,7 @@
// Updates unit counts...
#if 0
- unittype_slot=unitType->Type;
+ unittype_slot = unitType->Type;
#endif
onhotspot = AiCheckOnHotSpot(x, y);
@@ -455,7 +455,7 @@
int* values;
char buffer[256];
- values = AiScript->gauges;
+ values = AiScript->Gauges;
if (!values) {
return;
}
@@ -518,11 +518,11 @@
// debugGauge(GaugeValues);
// If necessary, allocate space for values
- if (!AiScript->gauges) {
- AiScript->gauges = (int*)malloc(sizeof(int) * BasicGaugeNb);
+ if (!AiScript->Gauges) {
+ AiScript->Gauges = (int*)malloc(sizeof(int) * BasicGaugeNb);
}
// Copy gauges
- memcpy(AiScript->gauges, GaugeValues, sizeof(int) * BasicGaugeNb);
+ memcpy(AiScript->Gauges, GaugeValues, sizeof(int) * BasicGaugeNb);
}
/**
@@ -534,10 +534,10 @@
*/
global int AiGetGaugeValue(int gauge)
{
- if (!AiScript->gauges) {
+ if (!AiScript->Gauges) {
return 0;
}
- return AiScript->gauges[gauge];
+ return AiScript->Gauges[gauge];
}
/**
@@ -861,7 +861,7 @@
bestValue = curValue;
}
// TODO : move to force 1 if attacking!!!!
- AiEraseForce(AiScript->ownForce);
+ AiEraseForce(AiScript->OwnForce);
}
}
@@ -870,7 +870,6 @@
}
/**
-**
** Prepare a script execution, by filling fields & computing gauges
**
** @param hotspotx X position of the hotspot
@@ -900,13 +899,13 @@
AiScript->HotSpotY = hotspoty;
AiScript->HotSpotRay = hotspotray;
- AiEraseForce(AiScript->ownForce);
- AiPlayer->Force[AiScript->ownForce].Role =
+ AiEraseForce(AiScript->OwnForce);
+ AiPlayer->Force[AiScript->OwnForce].Role =
(defend ? AiForceRoleDefend : AiForceRoleAttack);
- AiPlayer->Force[AiScript->ownForce].PopulateMode =
+ AiPlayer->Force[AiScript->OwnForce].PopulateMode =
(defend ? AiForcePopulateAny : AiForcePopulateFromAttack);
- AiPlayer->Force[AiScript->ownForce].UnitsReusable = 0;
- AiPlayer->Force[AiScript->ownForce].HelpMode = AiForceHelpForce;
+ AiPlayer->Force[AiScript->OwnForce].UnitsReusable = 0;
+ AiPlayer->Force[AiScript->OwnForce].HelpMode = AiForceHelpForce;
AiComputeCurrentScriptGauges();
@@ -933,9 +932,9 @@
AiScript->SleepCycles = 0;
// Don't add anymore units to this force.
- AiPlayer->Force[AiScript->ownForce].PopulateMode = AiForceDontPopulate;
+ AiPlayer->Force[AiScript->OwnForce].PopulateMode = AiForceDontPopulate;
- snprintf(AiScript->ident, 10, "%s", ident);
+ snprintf(AiScript->Ident, 10, "%s", ident);
#elif defined(USE_LUA)
#endif
}
@@ -961,8 +960,8 @@
if (!bestScriptAction) {
// Nothing available, ouch !
- AiUpdateForce(0, AiScript->ownForce);
- AiEraseForce(AiScript->ownForce);
+ AiUpdateForce(0, AiScript->OwnForce);
+ AiEraseForce(AiScript->OwnForce);
DebugLevel3Fn("no correct defense action script
available...\n");
return;
}
@@ -972,8 +971,8 @@
#elif defined(USE_LUA)
#endif
- leftCost = AiEvaluateForceCost(AiScript->ownForce, 0);
- totalCost = AiEvaluateForceCost(AiScript->ownForce, 1);
+ leftCost = AiEvaluateForceCost(AiScript->OwnForce, 0);
+ totalCost = AiEvaluateForceCost(AiScript->OwnForce, 1);
if (leftCost <= (7 * totalCost) / 10) {
DebugLevel3Fn("launch defense script\n");
AiStartScript(bestScriptAction, "defend");
@@ -1013,8 +1012,8 @@
// Don't take unit near past evaluations
action = AiPlayer->FirstEvaluation;
while (action) {
- if ((abs(action->hotSpotX - unit->X) < 8) &&
- (abs(action->hotSpotY - unit->Y) < 8)) {
+ if ((abs(action->HotSpotX - unit->X) < 8) &&
+ (abs(action->HotSpotY - unit->Y) < 8)) {
unit = NoUnitP;
break;
}
@@ -1092,7 +1091,7 @@
*/
local void AiCleanAiPlayerEvaluations(void)
{
- int memorylimit;
+ unsigned long memorylimit;
// Don't keep more than AI_MEMORY_SIZE ( remove old ones )
while (AiPlayer->EvaluationCount >= AI_MEMORY_SIZE) {
@@ -1103,7 +1102,7 @@
memorylimit = GameCycle - 30 * 60;
while (AiPlayer->FirstEvaluation &&
- AiPlayer->FirstEvaluation->gamecycle < memorylimit){
+ AiPlayer->FirstEvaluation->GameCycle < memorylimit){
AiRemoveFirstAiPlayerEvaluation();
}
}
@@ -1150,18 +1149,18 @@
// Add a new ActionEvaluation at the end of the queue
actionEvaluation =
(AiActionEvaluation*)malloc(sizeof(AiActionEvaluation));
- actionEvaluation->aiScriptAction = bestScriptAction;
- actionEvaluation->gamecycle = GameCycle;
- actionEvaluation->hotSpotX = enemy->X;
- actionEvaluation->hotSpotY = enemy->Y;
- actionEvaluation->value = bestScriptValue;
- actionEvaluation->hotSpotValue =
+ actionEvaluation->AiScriptAction = bestScriptAction;
+ actionEvaluation->GameCycle = GameCycle;
+ actionEvaluation->HotSpotX = enemy->X;
+ actionEvaluation->HotSpotY = enemy->Y;
+ actionEvaluation->Value = bestScriptValue;
+ actionEvaluation->HotSpotValue =
AiGetGaugeValue(ForceGauge(WATER_UNITS_VALUE, HOTSPOT_AREA,
FOR_ENEMY)) +
AiGetGaugeValue(ForceGauge(GROUND_UNITS_VALUE,
HOTSPOT_AREA, FOR_ENEMY)) +
AiGetGaugeValue(ForceGauge(AIR_UNITS_VALUE,
HOTSPOT_AREA, FOR_ENEMY));
DebugLevel2Fn("new action at %d %d, hotspotValue=%d, cost=%d\n" _C_
enemy->X _C_ enemy->Y _C_
- actionEvaluation->hotSpotValue _C_ actionEvaluation->value);
+ actionEvaluation->HotSpotValue _C_ actionEvaluation->Value);
// Insert the evaluation result at the end...
AiPlayer->EvaluationCount++;
@@ -1180,16 +1179,16 @@
actionEvaluation = AiPlayer->FirstEvaluation;
while (actionEvaluation) {
- if ((bestValue == -1 || actionEvaluation->value <= bestValue) &&
- actionEvaluation->hotSpotValue >= bestHotSpot) {
+ if ((bestValue == -1 || actionEvaluation->Value <= bestValue) &&
+ actionEvaluation->HotSpotValue >= bestHotSpot) {
bestActionEvaluation = actionEvaluation;
}
- if (bestValue == -1 || actionEvaluation->value <= bestValue) {
- bestValue = actionEvaluation->value;
+ if (bestValue == -1 || actionEvaluation->Value <= bestValue) {
+ bestValue = actionEvaluation->Value;
}
- if (actionEvaluation->hotSpotValue >= bestHotSpot) {
- bestHotSpot = actionEvaluation->hotSpotValue;
+ if (actionEvaluation->HotSpotValue >= bestHotSpot) {
+ bestHotSpot = actionEvaluation->HotSpotValue;
}
actionEvaluation = actionEvaluation->Next;
}
@@ -1198,8 +1197,8 @@
// If nothing available, try the best compromise ( value -
hotspot )
actionEvaluation = AiPlayer->FirstEvaluation;
bestDelta = 0;
- while (actionEvaluation) {
- delta = (20 * actionEvaluation->hotSpotValue) /
(actionEvaluation->value + 1);
+ while (actionEvaluation) {
+ delta = (20 * actionEvaluation->HotSpotValue) /
(actionEvaluation->Value + 1);
if (bestDelta == -1 || delta <= bestDelta) {
bestActionEvaluation = actionEvaluation;
}
@@ -1210,16 +1209,16 @@
DebugLevel3Fn("has a best script, value=%d, hotspot=%d\n" _C_
bestValue _C_
bestHotSpot);
// => lance si la force est à 80-90%...
- AiPrepareScript(bestActionEvaluation->hotSpotX,
bestActionEvaluation->hotSpotY,
+ AiPrepareScript(bestActionEvaluation->HotSpotX,
bestActionEvaluation->HotSpotY,
16, 0);
#if defined(USE_GUILE) || defined(USE_SIOD)
- AiEvaluateScript(bestActionEvaluation->aiScriptAction->Action);
+ AiEvaluateScript(bestActionEvaluation->AiScriptAction->Action);
#elif defined(USE_LUA)
#endif
- leftCost = AiEvaluateForceCost(AiScript->ownForce, 0);
- totalCost = AiEvaluateForceCost(AiScript->ownForce, 1);
+ leftCost = AiEvaluateForceCost(AiScript->OwnForce, 0);
+ totalCost = AiEvaluateForceCost(AiScript->OwnForce, 1);
if (leftCost > totalCost) {
DebugLevel0Fn("Left cost superior to totalcost ( %d >
%d )\n" _C_
leftCost _C_ totalCost);
@@ -1227,18 +1226,18 @@
if (leftCost <= ((2 * totalCost) / 10)) {
DebugLevel3Fn("Attack script !...\n");
- AiStartScript(bestActionEvaluation->aiScriptAction,
"attack");
- } else if (leftCost <= ((9 * totalCost) /10)) {
+ AiStartScript(bestActionEvaluation->AiScriptAction,
"attack");
+ } else if (leftCost <= ((9 * totalCost) / 10)) {
DebugLevel3Fn("Not ready for attack script, wait...\n");
- AiUpdateForce(1, AiScript->ownForce);
- AiEraseForce(AiScript->ownForce);
+ AiUpdateForce(1, AiScript->OwnForce);
+ AiEraseForce(AiScript->OwnForce);
} else {
DebugLevel3Fn("Attacking crisis ! reseting.\n");
AiEraseForce(1);
// FIXME : should update with lower values
- AiUpdateForce(1, AiScript->ownForce);
- AiEraseForce(AiScript->ownForce);
+ AiUpdateForce(1, AiScript->OwnForce);
+ AiEraseForce(AiScript->OwnForce);
}
}
}
Index: stratagus/src/ai/ccl_ai.c
diff -u stratagus/src/ai/ccl_ai.c:1.91 stratagus/src/ai/ccl_ai.c:1.92
--- stratagus/src/ai/ccl_ai.c:1.91 Tue Dec 16 18:24:18 2003
+++ stratagus/src/ai/ccl_ai.c Sat Dec 20 16:02:00 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ai.c,v 1.91 2003/12/16 07:24:18 wizzard Exp $
+// $Id: ccl_ai.c,v 1.92 2003/12/20 05:02:00 jsalmon3 Exp $
//@{
@@ -71,12 +71,12 @@
-1,
{
{"`next", NULL, &((AiActionEvaluation*)0)->Next, NULL},
- {"ai-script-action", &IOAiScriptActionPtr,
&((AiActionEvaluation*)0)->aiScriptAction, NULL},
- {"gamecycle", &IOInt, &((AiActionEvaluation*)0)->gamecycle,
NULL},
- {"hotspot-x", &IOInt, &((AiActionEvaluation*)0)->hotSpotX,
NULL},
- {"hotspot-y", &IOInt, &((AiActionEvaluation*)0)->hotSpotY,
NULL},
- {"hotspot-value", &IOInt,
&((AiActionEvaluation*)0)->hotSpotValue, NULL},
- {"value", &IOInt, &((AiActionEvaluation*)0)->value, NULL},
+ {"ai-script-action", &IOAiScriptActionPtr,
&((AiActionEvaluation*)0)->AiScriptAction, NULL},
+ {"gamecycle", &IOInt, &((AiActionEvaluation*)0)->GameCycle,
NULL},
+ {"hotspot-x", &IOInt, &((AiActionEvaluation*)0)->HotSpotX,
NULL},
+ {"hotspot-y", &IOInt, &((AiActionEvaluation*)0)->HotSpotY,
NULL},
+ {"hotspot-value", &IOInt,
&((AiActionEvaluation*)0)->HotSpotValue, NULL},
+ {"value", &IOInt, &((AiActionEvaluation*)0)->Value, NULL},
{0, 0, 0, 0}
}
};
@@ -102,12 +102,12 @@
{
{"script", &IOCcl, &((AiRunningScript*)0)->Script, NULL},
{"sleep-cycles", &IOInt, &((AiRunningScript*)0)->SleepCycles,
NULL},
- {"ident", &IOStrBuffer, &((AiRunningScript*)0)->ident, (void*)
10},
+ {"ident", &IOStrBuffer, &((AiRunningScript*)0)->Ident, (void*)
10},
{"hotspot-x", &IOInt, &((AiRunningScript*)0)->HotSpotX, NULL},
{"hotspot-y", &IOInt, &((AiRunningScript*)0)->HotSpotY, NULL},
{"hotspot-ray", &IOInt, &((AiRunningScript*)0)->HotSpotRay,
NULL},
- {"own-force", &IOInt, &((AiRunningScript*)0)->ownForce, NULL},
- {"gauges", &IOIntArrayPtr, &((AiRunningScript*)0)->gauges,
(void*) GAUGE_NB},
+ {"own-force", &IOInt, &((AiRunningScript*)0)->OwnForce, NULL},
+ {"gauges", &IOIntArrayPtr, &((AiRunningScript*)0)->Gauges,
(void*) GAUGE_NB},
{0, 0, 0, 0}
}
};
@@ -366,7 +366,7 @@
}
}
-/*
+/**
** Handle loading an array of int for each ressource ( int[MAX_COSTS] )
**
** @param scmfrom FIXME: docu
@@ -435,7 +435,7 @@
}
}
}
-/*
+/**
** FIXME: docu
**
** @param scmform When loading, the scm data to load
@@ -453,7 +453,7 @@
}
}
-/*
+/**
** FIXME: docu
**
** @param scmform When loading, the scm data to load
@@ -471,7 +471,7 @@
#ifdef INCOMPLETE_SIOD
-/*
+/**
** FIXME: docu
**
** @param a FIXME: docu
@@ -490,7 +490,7 @@
return gh_int2scm(va / vb);
}
-/*
+/**
** FIXME: docu
**
** @param x FIXME: docu
@@ -745,7 +745,7 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
-/*
+/**
** FIXME: docu
**
** @param l FIXME: docu
@@ -899,7 +899,7 @@
#endif
#if defined(USE_GUILE) || defined(USE_SIOD)
-/*
+/**
** FIXME: docu
**
** @param type FIXME: docu
@@ -933,7 +933,7 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
-/*
+/**
** FIXME: docu
**
** @param l FIXME: docu
@@ -956,10 +956,11 @@
memset(aiScriptAction, 0, sizeof(AiScriptAction));
-#if 0
- aiScriptAction->Action = definition;
- CclGcProtect(&aiScriptAction->Action);
-#endif
+ aiScriptAction->Action = malloc(20);
+ sprintf(aiScriptAction->Action, "_ai_action_%d_", AiScriptActionNum -
1);
+ lua_pushstring(l, aiScriptAction->Action);
+ lua_pushvalue(l, 2);
+ lua_settable(l, LUA_GLOBALSINDEX);
args = luaL_getn(l, 1);
for (j = 0; j < args; ++j) {
@@ -1683,7 +1684,7 @@
*/
local SCM CclAiOwnForce(void)
{
- return gh_int2scm(AiScript->ownForce);
+ return gh_int2scm(AiScript->OwnForce);
}
#elif defined(USE_LUA)
/**
@@ -1699,7 +1700,7 @@
lua_pushstring(l, "incorrect argument");
lua_error(l);
}
- lua_pushnumber(l, AiScript->ownForce);
+ lua_pushnumber(l, AiScript->OwnForce);
return 1;
}
#endif
@@ -2372,7 +2373,7 @@
ZoneSetAddSet(&transportable, &sources);
- aiunit = AiPlayer->Force[AiScript->ownForce].Units;
+ aiunit = AiPlayer->Force[AiScript->OwnForce].Units;
while (aiunit) {
switch(aiunit->Unit->Type->UnitType) {
@@ -2464,7 +2465,7 @@
ZoneSetAddSet(&transportable, &sources);
- aiunit = AiPlayer->Force[AiScript->ownForce].Units;
+ aiunit = AiPlayer->Force[AiScript->OwnForce].Units;
while (aiunit) {
switch(aiunit->Unit->Type->UnitType) {
@@ -3045,7 +3046,7 @@
unitType = CclGetUnitType(value);
- return gh_int2scm(AiUnittypeForce(unitType));
+ return gh_int2scm(AiUnitTypeForce(unitType));
}
#elif defined(USE_LUA)
local int CclAiGetUnitTypeForce(lua_State* l)
@@ -3058,7 +3059,7 @@
}
unitType = CclGetUnitType(l);
- lua_pushnumber(l, AiUnittypeForce(unitType));
+ lua_pushnumber(l, AiUnitTypeForce(unitType));
return 1;
}
#endif
@@ -3073,11 +3074,11 @@
CclGcProtectedAssign(&AiPlayer->Scripts[0].Script,
AiPlayer->AiType->Script);
AiPlayer->Scripts[0].SleepCycles = 0;
- snprintf(AiPlayer->Scripts[0].ident, 10, "Main AI");
+ snprintf(AiPlayer->Scripts[0].Ident, 10, "Main AI");
for (i = 1; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
CclGcProtectedAssign(&AiPlayer->Scripts[i].Script, NIL);
AiPlayer->Scripts[i].SleepCycles = 0;
- snprintf(AiPlayer->Scripts[i].ident, 10, "Empty");
+ snprintf(AiPlayer->Scripts[i].Ident, 10, "Empty");
}
return SCM_BOOL_T;
}
@@ -3098,7 +3099,7 @@
{
CclGcProtectedAssign(&AiPlayer->Scripts[script].Script, list);
AiPlayer->Scripts[script].SleepCycles = 0;
- snprintf(AiPlayer->Scripts[script].ident, 10, "AiRunScript");
+ snprintf(AiPlayer->Scripts[script].Ident, 10, "AiRunScript");
AiPlayer->Scripts[script].HotSpotX = hotSpotX;
AiPlayer->Scripts[script].HotSpotY = hotSpotY;
AiPlayer->Scripts[script].HotSpotRay = hotSpotRay;
@@ -3128,7 +3129,7 @@
{
CclGcProtectedAssign(&AiPlayer->Scripts[0].Script, value);
AiPlayer->Scripts[0].SleepCycles = 0;
- snprintf(AiPlayer->Scripts[0].ident, 10, "MainScript");
+ snprintf(AiPlayer->Scripts[0].Ident, 10, "MainScript");
return SCM_BOOL_T;
}
#elif defined(USE_LUA)
Index: stratagus/src/ai/new_ai.c
diff -u stratagus/src/ai/new_ai.c:1.100 stratagus/src/ai/new_ai.c:1.101
--- stratagus/src/ai/new_ai.c:1.100 Tue Dec 16 16:57:48 2003
+++ stratagus/src/ai/new_ai.c Sat Dec 20 16:02:01 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: new_ai.c,v 1.100 2003/12/16 05:57:48 jsalmon3 Exp $
+// $Id: new_ai.c,v 1.101 2003/12/20 05:02:01 jsalmon3 Exp $
//@{
@@ -197,13 +197,13 @@
DebugLevel2Fn(" AI MEMORY (%d)\n" _C_ AiPlayer->EvaluationCount);
aiaction = AiPlayer->FirstEvaluation;
while (aiaction) {
- str =
gh_scm2newstr(gh_car(gh_car(aiaction->aiScriptAction->Action)),NULL);
+ str =
gh_scm2newstr(gh_car(gh_car(aiaction->AiScriptAction->Action)),NULL);
DebugLevel2(" %8d: (%3d,%3d) => points:%9d, needs: %9d ( %s )\n" _C_
- aiaction->gamecycle _C_
- aiaction->hotSpotX _C_
- aiaction->hotSpotY _C_
- aiaction->hotSpotValue _C_
- aiaction->value _C_
+ aiaction->GameCycle _C_
+ aiaction->HotSpotX _C_
+ aiaction->HotSpotY _C_
+ aiaction->HotSpotValue _C_
+ aiaction->Value _C_
str);
free(str);
aiaction = aiaction->Next;
@@ -263,7 +263,7 @@
AiScript = pai->Scripts + i;
if (!gh_null_p(AiScript->Script)) {
/*DebugLevel3Fn("%d.%d (%12s) @ %3d.%3d :" _C_
- pai->Player->Player _C_ i _C_ AiScript->ident _C_
+ pai->Player->Player _C_ i _C_ AiScript->Ident _C_
AiScript->HotSpotX _C_ AiScript->HotSpotY);
gh_display(AiScript->Script);
gh_newline();*/
@@ -273,8 +273,8 @@
CclGcProtectedAssign(&AiScript->Script,
gh_cdr(AiScript->Script));
}
- if (gh_null_p(AiScript->Script) && AiScript->ownForce) {
- AiEraseForce(AiScript->ownForce);
+ if (gh_null_p(AiScript->Script) && AiScript->OwnForce) {
+ AiEraseForce(AiScript->OwnForce);
}
}
}
@@ -293,7 +293,7 @@
AiScript = pai->Scripts + i;
if (AiScript->Script) {
/*DebugLevel3Fn("%d.%d (%12s) @ %3d.%3d :" _C_
- pai->Player->Player _C_ i _C_ AiScript->ident _C_
+ pai->Player->Player _C_ i _C_ AiScript->Ident _C_
AiScript->HotSpotX _C_ AiScript->HotSpotY);
gh_display(AiScript->Script);
gh_newline();*/
@@ -304,8 +304,8 @@
lua_rawget(Lua, 1);
LuaCall(0, 1);
- if (/*gh_null_p(AiScript->Script)*/0 && AiScript->ownForce) {
- AiEraseForce(AiScript->ownForce);
+ if (/*gh_null_p(AiScript->Script)*/0 && AiScript->OwnForce) {
+ AiEraseForce(AiScript->OwnForce);
}
}
}
@@ -817,7 +817,7 @@
{
CLprintf(file, "\n;;; -----------------------------------------\n");
CLprintf(file,
- ";;; MODULE: AI $Id: new_ai.c,v 1.100 2003/12/16 05:57:48 jsalmon3 Exp
$\n\n");
+ ";;; MODULE: AI $Id: new_ai.c,v 1.101 2003/12/20 05:02:01 jsalmon3 Exp
$\n\n");
SaveAiTypesWcName(file);
SaveAiHelper(file);
@@ -851,11 +851,11 @@
ait = AiTypes;
for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
- pai->Scripts[i].ownForce = AI_GENERIC_FORCES + i;
+ pai->Scripts[i].OwnForce = AI_GENERIC_FORCES + i;
pai->Scripts[i].HotSpotX = -1;
pai->Scripts[i].HotSpotY = -1;
pai->Scripts[i].HotSpotRay = -1;
- pai->Scripts[i].gauges = 0;
+ pai->Scripts[i].Gauges = 0;
pai->Scripts[i].SleepCycles = 0;
#if defined(USE_GUILE) || defined(USE_SIOD)
pai->Scripts[i].Script = NIL;
@@ -863,7 +863,7 @@
#elif defined(USE_LUA)
pai->Scripts[i].Script = NULL;
#endif
- snprintf(pai->Scripts[i].ident, 10, "Empty");
+ snprintf(pai->Scripts[i].Ident, 10, "Empty");
}
// Set autoattack to 1 as default
@@ -988,8 +988,8 @@
}
for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
- if (pai->Scripts[i].gauges) {
- free(pai->Scripts[i].gauges);
+ if (pai->Scripts[i].Gauges) {
+ free(pai->Scripts[i].Gauges);
}
#if defined(USE_GUILE) || defined(USE_SIOD)
CclGcUnprotect(&pai->Scripts[i].Script);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/ai ai_force.c ai_local.h ai_rules...,
address@hidden <=