[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/unit depend.c unit.c unit_draw.c ...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/unit depend.c unit.c unit_draw.c ... |
Date: |
3 Jan 2004 11:33:05 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/03 11:33:04
Modified files:
src/unit : depend.c unit.c unit_draw.c unittype.c
upgrade.c
Log message:
Load/Save updates
Patches:
Index: stratagus/src/unit/depend.c
diff -u stratagus/src/unit/depend.c:1.36 stratagus/src/unit/depend.c:1.37
--- stratagus/src/unit/depend.c:1.36 Fri Jan 2 08:24:20 2004
+++ stratagus/src/unit/depend.c Sat Jan 3 11:33:01 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: depend.c,v 1.36 2004/01/01 21:24:20 jsalmon3 Exp $
+// $Id: depend.c,v 1.37 2004/01/03 00:33:01 jsalmon3 Exp $
//@{
@@ -281,13 +281,14 @@
*/
global void SaveDependencies(CLFile* file)
{
+#if 0
unsigned u;
const DependRule* node;
const DependRule* rule;
const DependRule* temp;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: dependencies $Id: depend.c,v 1.36 2004/01/01
21:24:20 jsalmon3 Exp $\n\n");
+ CLprintf(file,";;; MODULE: dependencies $Id: depend.c,v 1.37 2004/01/03
00:33:01 jsalmon3 Exp $\n\n");
// Save all dependencies
@@ -335,6 +336,7 @@
node = node->Next;
}
}
+#endif
}
/**
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.352 stratagus/src/unit/unit.c:1.353
--- stratagus/src/unit/unit.c:1.352 Fri Jan 2 11:36:33 2004
+++ stratagus/src/unit/unit.c Sat Jan 3 11:33:01 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.352 2004/01/02 00:36:33 jsalmon3 Exp $
+// $Id: unit.c,v 1.353 2004/01/03 00:33:01 jsalmon3 Exp $
//@{
@@ -3316,123 +3316,123 @@
}
/**
-** Save an order.
+** Save an order.
**
-** @param order Order who should be saved.
-** @param file Output file.
+** @param order Order who should be saved.
+** @param file Output file.
*/
local void SaveOrder(const Order* order, CLFile* file)
{
char* ref;
- CLprintf(file, "(");
+ CLprintf(file, "{");
switch (order->Action) {
case UnitActionNone:
- CLprintf(file, "action-none");
+ CLprintf(file, "\"action-none\",");
break;
case UnitActionStill:
- CLprintf(file, "action-still");
+ CLprintf(file, "\"action-still\",");
break;
case UnitActionStandGround:
- CLprintf(file, "action-stand-ground");
+ CLprintf(file, "\"action-stand-ground\",");
break;
case UnitActionFollow:
- CLprintf(file, "action-follow");
+ CLprintf(file, "\"action-follow\",");
break;
case UnitActionMove:
- CLprintf(file, "action-move");
+ CLprintf(file, "\"action-move\",");
break;
case UnitActionAttack:
- CLprintf(file, "action-attack");
+ CLprintf(file, "\"action-attack\",");
break;
case UnitActionAttackGround:
- CLprintf(file, "action-attack-ground");
+ CLprintf(file, "\"action-attack-ground\",");
break;
case UnitActionDie:
- CLprintf(file, "action-die");
+ CLprintf(file, "\"action-die\",");
break;
case UnitActionSpellCast:
- CLprintf(file, "action-spell-cast");
+ CLprintf(file, "\"action-spell-cast\",");
break;
case UnitActionTrain:
- CLprintf(file, "action-train");
+ CLprintf(file, "\"action-train\",");
break;
case UnitActionUpgradeTo:
- CLprintf(file, "action-upgrade-to");
+ CLprintf(file, "\"action-upgrade-to\",");
break;
case UnitActionResearch:
- CLprintf(file, "action-research");
+ CLprintf(file, "\"action-research\",");
break;
case UnitActionBuilded:
- CLprintf(file, "action-builded");
+ CLprintf(file, "\"action-builded\",");
break;
case UnitActionBoard:
- CLprintf(file, "action-board");
+ CLprintf(file, "\"action-board\",");
break;
case UnitActionUnload:
- CLprintf(file, "action-unload");
+ CLprintf(file, "\"action-unload\",");
break;
case UnitActionPatrol:
- CLprintf(file, "action-patrol");
+ CLprintf(file, "\"action-patrol\",");
break;
case UnitActionBuild:
- CLprintf(file, "action-build");
+ CLprintf(file, "\"action-build\",");
break;
case UnitActionRepair:
- CLprintf(file, "action-repair");
+ CLprintf(file, "\"action-repair\",");
break;
case UnitActionResource:
- CLprintf(file, "action-resource");
+ CLprintf(file, "\"action-resource\",");
break;
case UnitActionReturnGoods:
- CLprintf(file, "action-return-goods");
+ CLprintf(file, "\"action-return-goods\",");
break;
default:
DebugLevel0Fn("Unknown action in order\n");
}
- CLprintf(file, " flags %d", order->Flags);
- CLprintf(file, " range %d", order->Range);
- CLprintf(file, " width %d", order->Width);
- CLprintf(file, " height %d", order->Height);
- CLprintf(file, " min-range %d", order->MinRange);
+ CLprintf(file, " \"flags\", %d,", order->Flags);
+ CLprintf(file, " \"range\", %d,", order->Range);
+ CLprintf(file, " \"width\", %d,", order->Width);
+ CLprintf(file, " \"height\", %d,", order->Height);
+ CLprintf(file, " \"min-range\", %d,", order->MinRange);
if (order->Goal) {
if (order->Goal->Destroyed) {
/* this unit is destroyed so it's not in the global unit
* array - this means it won't be saved!!! */
printf ("FIXME: storing destroyed Goal - loading will
fail.\n");
}
- CLprintf(file, " goal %s", ref = UnitReference(order->Goal));
+ CLprintf(file, " \"goal\", \"%s\",", ref =
UnitReference(order->Goal));
free(ref);
}
- CLprintf(file, " tile (%d %d)", order->X, order->Y);
+ CLprintf(file, " \"tile\", {%d, %d},", order->X, order->Y);
if (order->Type) {
- CLprintf(file, " type %s", order->Type->Ident);
+ CLprintf(file, " \"type\", \"%s\",", order->Type->Ident);
}
if (order->Arg1) {
// patrol=pos, research=upgrade, spell=spell
switch (order->Action) {
case UnitActionPatrol:
- CLprintf(file, " patrol (%d %d)",
+ CLprintf(file, " \"patrol\", {%d, %d},",
(int)order->Arg1 >> 16,
(int)order->Arg1 & 0xFFFF);
break;
case UnitActionSpellCast:
- CLprintf(file, " spell %s",
((SpellType*)order->Arg1)->IdentName);
+ CLprintf(file, " \"spell\", \"%s\",",
((SpellType*)order->Arg1)->IdentName);
break;
case UnitActionResearch:
- CLprintf(file, " upgrade %s",
((Upgrade*)order->Arg1)->Ident);
+ CLprintf(file, " \"upgrade\", \"%s\",",
((Upgrade*)order->Arg1)->Ident);
break;
default:
- CLprintf(file, " arg1 %d", (int)order->Arg1);
+ CLprintf(file, " \"arg1\", %d,",
(int)order->Arg1);
break;
}
}
- CLprintf(file, ")");
+ CLprintf(file, "}");
}
/**
@@ -3447,166 +3447,168 @@
Unit* uins;
int i;
- CLprintf(file, "\n(unit %d ", UnitNumber(unit));
+ CLprintf(file, "\nUnit(%d, ", UnitNumber(unit));
// 'type and 'player must be first, needed to create the unit slot
- CLprintf(file, "'type '%s ", unit->Type->Ident);
+ CLprintf(file, "\"type\", \"%s\", ", unit->Type->Ident);
if (unit->SeenType) {
- CLprintf(file, "'seen-type '%s ", unit->SeenType->Ident);
+ CLprintf(file, "\"seen-type\", \"%s\", ",
unit->SeenType->Ident);
}
- CLprintf(file, "'player %d\n ", unit->Player->Player);
+ CLprintf(file, "\"player\", %d,\n ", unit->Player->Player);
if (unit->Next) {
- CLprintf(file, "'next '%d ", UnitNumber(unit->Next));
+ CLprintf(file, "\"next\", %d, ", UnitNumber(unit->Next));
}
- CLprintf(file, "'tile '(%d %d) ", unit->X, unit->Y);
+ CLprintf(file, "\"tile\", {%d, %d}, ", unit->X, unit->Y);
#if 0
// latimerius: why is this so complex?
// JOHNS: An unit can be owned by a new player and have still the old
stats
for (i = 0; i < PlayerMax; ++i) {
if (&unit->Type->Stats[i] == unit->Stats) {
- CLprintf(file, "'stats %d\n ", i);
+ CLprintf(file, "\"stats\", %d,\n ", i);
break;
}
}
// latimerius: what's the point of storing a pointer value anyway?
if (i == PlayerMax) {
- CLprintf(file, "'stats 'S%08X\n ", (int)unit->Stats);
+ CLprintf(file, "\"stats\", \"S%08X\",\n ", (int)unit->Stats);
}
#else
- CLprintf(file, "'stats %d\n ", unit->Player->Player);
+ CLprintf(file, "\"stats\", %d,\n ", unit->Player->Player);
#endif
- CLprintf(file, "'pixel '(%d %d) ", unit->IX, unit->IY);
- CLprintf(file, "'seen-pixel '(%d %d) ", unit->SeenIX, unit->SeenIY);
- CLprintf(file, "'%sframe %d ",
+ CLprintf(file, "\"pixel\", {%d, %d}, ", unit->IX, unit->IY);
+ CLprintf(file, "\"seen-pixel\", {%d, %d}, ", unit->SeenIX,
unit->SeenIY);
+ CLprintf(file, "\"%sframe\", %d, ",
unit->Frame < 0 ? "flipped-" : "",
unit->Frame < 0 ? -unit->Frame : unit->Frame);
if (unit->SeenFrame != UnitNotSeen) {
- CLprintf(file, "'%sseen %d ",
+ CLprintf(file, "\"%sseen\", %d, ",
unit->SeenFrame < 0 ? "flipped-" : "",
unit->SeenFrame < 0 ? -unit->SeenFrame :
unit->SeenFrame);
} else {
- CLprintf(file, "'not-seen ");
+ CLprintf(file, "\"not-seen\", ");
}
- CLprintf(file, "'direction %d\n ", unit->Direction);
- CLprintf(file, "'attacked %lu\n ", unit->Attacked);
- CLprintf(file, " 'current-sight-range %d", unit->CurrentSightRange);
+ CLprintf(file, "\"direction\", %d,\n ", unit->Direction);
+ CLprintf(file, "\"attacked\", %lu,\n ", unit->Attacked);
+ CLprintf(file, " \"current-sight-range\", %d,",
unit->CurrentSightRange);
if (unit->Burning) {
- CLprintf(file, " 'burning");
+ CLprintf(file, " \"burning\",");
}
if (unit->Destroyed) {
- CLprintf(file, " 'destroyed");
+ CLprintf(file, " \"destroyed\",");
}
if (unit->SeenDestroyed) {
- CLprintf(file, " 'seen-destroyed");
+ CLprintf(file, " \"seen-destroyed\",");
}
if (unit->Removed) {
- CLprintf(file, " 'removed");
+ CLprintf(file, " \"removed\",");
}
if (unit->Selected) {
- CLprintf(file, " 'selected");
+ CLprintf(file, " \"selected\",");
}
if (unit->RescuedFrom) {
- CLprintf(file, " 'rescued-from %d", unit->RescuedFrom->Player);
+ CLprintf(file, " \"rescued-from\", %d,",
unit->RescuedFrom->Player);
}
// n0b0dy: How is this usefull?
// mr-russ: You can't always load units in order, it saved the
information
// so you can load a unit who's Container hasn't been loaded yet.
// SEE unit loading code.
if (unit->Container && unit->Removed) {
- CLprintf(file, " 'host-info '(%d %d %d %d) ",
+ CLprintf(file, " \"host-info\", {%d, %d, %d, %d}, ",
unit->Container->X, unit->Container->Y,
unit->Container->Type->TileWidth,
unit->Container->Type->TileHeight);
}
- CLprintf(file, " 'visible \"");
+ CLprintf(file, " \"visible\", \"");
for (i = 0; i < PlayerMax; ++i) {
CLprintf(file, "%c", (unit->Visible & (1 << i)) ? 'X' : '_');
}
- CLprintf(file, "\"\n ");
+ CLprintf(file, "\",\n ");
if (unit->Constructed) {
- CLprintf(file, " 'constructed");
+ CLprintf(file, " \"constructed\",");
}
if (unit->SeenConstructed) {
- CLprintf(file, " 'seen-constructed");
+ CLprintf(file, " \"seen-constructed\",");
}
- CLprintf(file, " 'seen-state %d ", unit->SeenState);
+ CLprintf(file, " \"seen-state\", %d, ", unit->SeenState);
if (unit->Active) {
- CLprintf(file, " 'active");
+ CLprintf(file, " \"active\",");
}
- CLprintf(file, " 'mana %d", unit->Mana);
- CLprintf(file, " 'hp %d", unit->HP);
- CLprintf(file, " 'xp %d", unit->XP);
- CLprintf(file, " 'kills %d\n ", unit->Kills);
-
- CLprintf(file, "'ttl %lu ", unit->TTL);
- CLprintf(file, "'bloodlust %d ", unit->Bloodlust);
- CLprintf(file, "'haste %d ", unit->Haste);
- CLprintf(file, "'slow %d\n ", unit->Slow);
- CLprintf(file, "'invisible %d ", unit->Invisible);
- CLprintf(file, "'flame-shield %d ", unit->FlameShield);
- CLprintf(file, "'unholy-armor %d\n ", unit->UnholyArmor);
+ CLprintf(file, " \"mana\", %d,", unit->Mana);
+ CLprintf(file, " \"hp\", %d,", unit->HP);
+ CLprintf(file, " \"xp\", %d,", unit->XP);
+ CLprintf(file, " \"kills\", %d,\n ", unit->Kills);
+
+ CLprintf(file, "\"ttl\", %lu, ", unit->TTL);
+ CLprintf(file, "\"bloodlust\", %d, ", unit->Bloodlust);
+ CLprintf(file, "\"haste\", %d, ", unit->Haste);
+ CLprintf(file, "\"slow\", %d,\n ", unit->Slow);
+ CLprintf(file, "\"invisible\", %d, ", unit->Invisible);
+ CLprintf(file, "\"flame-shield\", %d, ", unit->FlameShield);
+ CLprintf(file, "\"unholy-armor\", %d,\n ", unit->UnholyArmor);
- CLprintf(file, "'group-id %d\n ", unit->GroupId);
- CLprintf(file, "'last-group %d\n ", unit->LastGroup);
+ CLprintf(file, "\"group-id\", %d,\n ", unit->GroupId);
+ CLprintf(file, "\"last-group\", %d,\n ", unit->LastGroup);
- CLprintf(file, "'value %d\n ", unit->Value);
+ CLprintf(file, "\"value\", %d,\n ", unit->Value);
if (unit->CurrentResource) {
- CLprintf(file, "'current-resource '%s\n ",
+ CLprintf(file, "\"current-resource\", \"%s\",\n ",
DefaultResourceNames[unit->CurrentResource]);
}
- CLprintf(file, "'sub-action %d ", unit->SubAction);
- CLprintf(file, "'wait %d ", unit->Wait);
- CLprintf(file, "'state %d", unit->State);
+ CLprintf(file, "\"sub-action\", %d, ", unit->SubAction);
+ CLprintf(file, "\"wait\", %d, ", unit->Wait);
+ CLprintf(file, "\"state\", %d,", unit->State);
if (unit->Reset) {
- CLprintf(file, " 'reset");
+ CLprintf(file, " \"reset\",");
}
- CLprintf(file, "\n 'blink %d", unit->Blink);
+ CLprintf(file, "\n \"blink\", %d,", unit->Blink);
if (unit->Moving) {
- CLprintf(file, " 'moving");
+ CLprintf(file, " \"moving\",");
}
- CLprintf(file, " 'rs %d", unit->Rs);
- CLprintf(file, " 'units-contained-count %d", unit->InsideCount);
- CLprintf(file, "\n 'units-contained #(");
+ CLprintf(file, " \"rs\", %d,", unit->Rs);
+ CLprintf(file, " \"units-contained-count\", %d,", unit->InsideCount);
+ CLprintf(file, "\n \"units-contained\", {");
uins = unit->UnitInside;
for (i = unit->InsideCount; i; --i, uins = uins->NextContained) {
- CLprintf(file, "%s", ref = UnitReference(uins));
+ CLprintf(file, "\"%s\",", ref = UnitReference(uins));
+ free(ref);
if (i > 1) {
CLprintf(file, " ");
}
}
- CLprintf(file, ")\n ");
- CLprintf(file, "'order-count %d\n ", unit->OrderCount);
- CLprintf(file, "'order-flush %d\n ", unit->OrderFlush);
- CLprintf(file, "'orders #(");
+ CLprintf(file, "},\n ");
+ CLprintf(file, "\"order-count\", %d,\n ", unit->OrderCount);
+ CLprintf(file, "\"order-flush\", %d,\n ", unit->OrderFlush);
+ CLprintf(file, "\"orders\", {");
for (i = 0; i < MAX_ORDERS; ++i) {
CLprintf(file, "\n ");
SaveOrder(&unit->Orders[i], file);
+ CLprintf(file, ",");
}
- CLprintf(file, ")\n 'saved-order '");
+ CLprintf(file, "},\n \"saved-order\", ");
SaveOrder(&unit->SavedOrder, file);
- CLprintf(file, "\n 'new-order '");
+ CLprintf(file, ",\n \"new-order\", ");
SaveOrder(&unit->NewOrder, file);
//
- // Order data part
+ // Order data part
//
switch (unit->Orders[0].Action) {
case UnitActionStill:
// FIXME: support other resource types
if (unit->Type->GivesResource) {
- CLprintf(file, " 'resource-active %d",
unit->Data.Resource.Active);
+ CLprintf(file, ", \"resource-active\", %d",
unit->Data.Resource.Active);
}
break;
case UnitActionResource:
- CLprintf(file, " 'data-res-worker '(time-to-harvest
%d", unit->Data.ResWorker.TimeToHarvest);
+ CLprintf(file, ", \"data-res-worker\",
{\"time-to-harvest\", %d,", unit->Data.ResWorker.TimeToHarvest);
if (unit->Data.ResWorker.DoneHarvesting) {
- CLprintf(file, " done-harvesting");
+ CLprintf(file, " \"done-harvesting\",");
}
- CLprintf(file, ")");
+ CLprintf(file, "}");
break;
case UnitActionBuilded:
{
@@ -3619,67 +3621,67 @@
cframe = cframe->Next;
++frame;
}
- CLprintf(file, "\n 'data-builded '(");
+ CLprintf(file, ",\n \"data-builded\", {");
if (unit->Data.Builded.Worker) {
- CLprintf(file, "worker %s ",
+ CLprintf(file, "\"worker\", \"%s\", ",
ref =
UnitReference(unit->Data.Builded.Worker));
free(ref);
}
- CLprintf(file, "progress %d frame %d",
+ CLprintf(file, "\"progress\", %d, \"frame\",
%d,",
unit->Data.Builded.Progress, frame);
if (unit->Data.Builded.Cancel) {
- CLprintf(file, " cancel");
+ CLprintf(file, " \"cancel\",");
}
- CLprintf(file, ")");
+ CLprintf(file, "}");
break;
}
case UnitActionResearch:
- CLprintf(file, "\n 'data-research '(");
- CLprintf(file, "ident %s",
unit->Data.Research.Upgrade->Ident);
- CLprintf(file, ")");
+ CLprintf(file, ",\n \"data-research\", {");
+ CLprintf(file, "\"ident\", \"%s\",",
unit->Data.Research.Upgrade->Ident);
+ CLprintf(file, "}");
break;
case UnitActionUpgradeTo:
- CLprintf(file, "\n 'data-upgrade-to '(");
- CLprintf(file, "ticks %d", unit->Data.UpgradeTo.Ticks);
- CLprintf(file, ")");
+ CLprintf(file, ",\n \"data-upgrade-to\", {");
+ CLprintf(file, "\"ticks\", %d,",
unit->Data.UpgradeTo.Ticks);
+ CLprintf(file, "}");
break;
case UnitActionTrain:
- CLprintf(file, "\n 'data-train '(");
- CLprintf(file, "ticks %d ", unit->Data.Train.Ticks);
- CLprintf(file, "count %d ", unit->Data.Train.Count);
- CLprintf(file, "queue #(");
+ CLprintf(file, ",\n \"data-train\", {");
+ CLprintf(file, "\"ticks\", %d, ",
unit->Data.Train.Ticks);
+ CLprintf(file, "\"count\", %d, ",
unit->Data.Train.Count);
+ CLprintf(file, "\"queue\", {");
for (i = 0; i < MAX_UNIT_TRAIN; ++i) {
if (i < unit->Data.Train.Count) {
- CLprintf(file, "%s ",
unit->Data.Train.What[i]->Ident);
+ CLprintf(file, "\"%s\", ",
unit->Data.Train.What[i]->Ident);
} else {
/* this slot is currently unused */
- CLprintf(file, "unit-none ");
+ CLprintf(file, "\"unit-none\", ");
}
}
- CLprintf(file, "))");
+ CLprintf(file, "}}");
break;
default:
- CLprintf(file, "\n 'data-move '(");
+ CLprintf(file, ",\n \"data-move\", {");
if (unit->Data.Move.Fast) {
- CLprintf(file, "fast ");
+ CLprintf(file, "\"fast\", ");
}
if (unit->Data.Move.Length) {
- CLprintf(file, "path #(");
+ CLprintf(file, "\"path\", {");
for (i = 0; i < unit->Data.Move.Length; ++i) {
- CLprintf(file, "%d ",
unit->Data.Move.Path[i]);
+ CLprintf(file, "%d, ",
unit->Data.Move.Path[i]);
}
- CLprintf(file, ")");
+ CLprintf(file, "},");
}
- CLprintf(file, ")");
+ CLprintf(file, "}");
break;
}
if (unit->Goal) {
- CLprintf(file, "\n 'goal %d", UnitNumber(unit->Goal));
+ CLprintf(file, ",\n \"goal\", %d", UnitNumber(unit->Goal));
}
if (unit->AutoCastSpell) {
- CLprintf(file, "\n 'auto-cast '%s",
unit->AutoCastSpell->Ident);
+ CLprintf(file, ",\n \"auto-cast\", \"%s\"",
unit->AutoCastSpell->Ident);
}
CLprintf(file, ")\n");
@@ -3698,9 +3700,10 @@
int InRun;
int RunStart;
- CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.352 2004/01/02
00:36:33 jsalmon3 Exp $\n\n");
+ CLprintf(file, "\n--- -----------------------------------------\n");
+ CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.353 2004/01/03
00:33:01 jsalmon3 Exp $\n\n");
+#if 0
//
// Local variables
//
@@ -3710,9 +3713,10 @@
FancyBuildings ? "t" : "f");
CLprintf(file, "(set-training-queue! #%s)\n",
EnableTrainingQueue ? "t" : "f");
+#endif
- CLprintf(file, "; Unit slot usage bitmap\n");
- CLprintf(file, "(slot-usage '(");
+ CLprintf(file, "-- Unit slot usage bitmap\n");
+ CLprintf(file, "SlotUsage({");
memset(SlotUsage, 0, MAX_UNIT_SLOTS / 8 + 1);
for (i = 0; i < NumUnits; ++i) {
@@ -3739,15 +3743,15 @@
if (!SlotUsed(i) && InRun) {
InRun = 0;
if (i - 1 == RunStart) {
- CLprintf(file, "%d ", i - 1);
+ CLprintf(file, "%d, ", i - 1);
} else {
- CLprintf(file, "%d - %d ", RunStart, i - 1);
+ CLprintf(file, "%d, \"-\", %d, ", RunStart, i -
1);
}
}
}
#endif
- CLprintf (file, "))\n");
+ CLprintf (file, "})\n");
for (table = Units; table < &Units[NumUnits]; ++table) {
SaveUnit(*table, file);
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.198
stratagus/src/unit/unit_draw.c:1.199
--- stratagus/src/unit/unit_draw.c:1.198 Fri Jan 2 08:24:20 2004
+++ stratagus/src/unit/unit_draw.c Sat Jan 3 11:33:02 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.198 2004/01/01 21:24:20 jsalmon3 Exp $
+// $Id: unit_draw.c,v 1.199 2004/01/03 00:33:02 jsalmon3 Exp $
//@{
@@ -739,8 +739,9 @@
*/
global void SaveDecorations(CLFile* file)
{
+#if 0
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.198
2004/01/01 21:24:20 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.199
2004/01/03 00:33:02 jsalmon3 Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -795,6 +796,7 @@
if (DecorationOnTop) {
CLprintf(file, ";(decoration-on-top)\n");
}
+#endif
}
/**
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.133 stratagus/src/unit/unittype.c:1.134
--- stratagus/src/unit/unittype.c:1.133 Sat Dec 20 16:33:46 2003
+++ stratagus/src/unit/unittype.c Sat Jan 3 11:33:02 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.133 2003/12/20 05:33:46 jsalmon3 Exp $
+// $Id: unittype.c,v 1.134 2004/01/03 00:33:02 jsalmon3 Exp $
//@{
@@ -1109,51 +1109,47 @@
}
/**
-** Save state of an unit-stats to file.
+** Save state of an unit-stats to file.
**
-** @param stats Unit-stats to save.
-** @param ident Unit-type ident.
-** @param plynr Player number.
-** @param file Output file.
+** @param stats Unit-stats to save.
+** @param ident Unit-type ident.
+** @param plynr Player number.
+** @param file Output file.
*/
-local void SaveUnitStats(const UnitStats* stats,const char* ident,int plynr,
+local void SaveUnitStats(const UnitStats* stats, const char* ident, int plynr,
CLFile* file)
{
int j;
DebugCheck(plynr >= PlayerMax);
- CLprintf(file, "(define-unit-stats '%s %d\n ", ident, plynr);
- CLprintf(file, "'level %d ", stats->Level);
- CLprintf(file, "'speed %d ", stats->Speed);
- CLprintf(file, "'attack-range %d ", stats->AttackRange);
- CLprintf(file, "'sight-range %d\n ", stats->SightRange);
- CLprintf(file, "'armor %d ", stats->Armor);
- CLprintf(file, "'basic-damage %d ", stats->BasicDamage);
- CLprintf(file, "'piercing-damage %d ", stats->PiercingDamage);
- CLprintf(file, "'hit-points %d\n ", stats->HitPoints);
- CLprintf(file, " 'regeneration-rate %d\n", stats->RegenerationRate);
- CLprintf(file, "'costs '(");
+ CLprintf(file, "DefineUnitStats(\"%s\", %d,\n ", ident, plynr);
+ CLprintf(file, "\"level\", %d, ", stats->Level);
+ CLprintf(file, "\"speed\", %d, ", stats->Speed);
+ CLprintf(file, "\"attack-range\", %d, ", stats->AttackRange);
+ CLprintf(file, "\"sight-range\", %d,\n ", stats->SightRange);
+ CLprintf(file, "\"armor\", %d, ", stats->Armor);
+ CLprintf(file, "\"basic-damage\", %d, ", stats->BasicDamage);
+ CLprintf(file, "\"piercing-damage\", %d, ", stats->PiercingDamage);
+ CLprintf(file, "\"hit-points\", %d,\n ", stats->HitPoints);
+ CLprintf(file, "\"regeneration-rate\", %d,\n ",
stats->RegenerationRate);
+ CLprintf(file, "\"costs\", {");
for (j = 0; j < MaxCosts; ++j) {
if (j) {
-// if (j == MaxCosts / 2) {
-// fputs("\n ", file);
-// } else {
- CLprintf(file, " ");
-// }
+ CLprintf(file, " ");
}
- CLprintf(file, "%s %d", DefaultResourceNames[j],
stats->Costs[j]);
+ CLprintf(file, "\"%s\", %d,", DefaultResourceNames[j],
stats->Costs[j]);
}
-
- CLprintf(file, ") )\n");
+ CLprintf(file, "})\n");
}
- /**
-** Save declaration of user defined flags.
+/**
+** Save declaration of user defined flags.
**
-** @param file Output file.
+** @param file Output file.
*/
global void SaveFlags(CLFile* file)
{
+#if 0
int i;
if (NumberBoolFlag != 0) {
@@ -1163,15 +1159,17 @@
}
CLprintf(file, ")\n");
}
+#endif
}
/**
-** Save the names of all unit types, before actually defining
anything about them.
+** Save the names of all unit types, before actually defining anything about
them.
**
-** @param file Output file.
+** @param file Output file.
*/
global void SaveUnitTypeDefs(CLFile* file)
{
+#if 0
int i;
CLprintf(file, "\n;;; Declare all unit types in advance.\n");
@@ -1180,23 +1178,24 @@
CLprintf(file, "(define-unit-type '%s)\n", UnitTypes[i]->Ident);
}
CLprintf(file, "\n");
+#endif
}
/**
-** Save state of the unit-type table to file.
+** Save state of the unit-type table to file.
**
-** @param file Output file.
+** @param file Output file.
*/
global void SaveUnitTypes(CLFile* file)
{
int i;
int j;
- char** sp;
-
- CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.133
2003/12/20 05:33:46 jsalmon3 Exp $\n\n");
+// char** sp;
- // Original number to internal unit-type name.
+ CLprintf(file, "\n--- -----------------------------------------\n");
+ CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.134
2004/01/03 00:33:02 jsalmon3 Exp $\n\n");
+#if 0
+ // Original number to internal unit-type name.
i = CLprintf(file, "(define-unittype-wc-names");
for (sp = UnitTypeWcNames; *sp; ++sp) {
@@ -1207,20 +1206,20 @@
}
CLprintf(file, ")\n");
- // Save all animations.
+ // Save all animations.
for (i = 0; i < NumUnitTypes; ++i) {
SaveAnimations(UnitTypes[i], file);
}
- // Save all types
+ // Save all types
for (i = 0; i < NumUnitTypes; ++i) {
CLprintf(file, "\n");
SaveUnitType(file, UnitTypes[i], 0);
}
-
- // Save all stats
+#endif
+ // Save all stats
for (i = 0; i < NumUnitTypes; ++i) {
CLprintf(file, "\n");
Index: stratagus/src/unit/upgrade.c
diff -u stratagus/src/unit/upgrade.c:1.70 stratagus/src/unit/upgrade.c:1.71
--- stratagus/src/unit/upgrade.c:1.70 Fri Jan 2 08:24:20 2004
+++ stratagus/src/unit/upgrade.c Sat Jan 3 11:33:03 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade.c,v 1.70 2004/01/01 21:24:20 jsalmon3 Exp $
+// $Id: upgrade.c,v 1.71 2004/01/03 00:33:03 jsalmon3 Exp $
//@{
@@ -116,7 +116,7 @@
}
// Fill upgrade structure
- if ((tmp = (Upgrade **)hash_find(UpgradeHash, (char*)ident)) && *tmp) {
+ if ((tmp = (Upgrade**)hash_find(UpgradeHash, (char*)ident)) && *tmp) {
DebugLevel0Fn("Already defined upgrade `%s'\n" _C_ ident);
upgrade = *tmp;
free(upgrade->Icon.Name);
@@ -124,7 +124,7 @@
upgrade = Upgrades + NumUpgrades++;
upgrade->OType = UpgradeType;
upgrade->Ident = strdup(ident);
- *(Upgrade **)hash_add(UpgradeHash, upgrade->Ident) = upgrade;
+ *(Upgrade**)hash_add(UpgradeHash, upgrade->Ident) = upgrade;
}
if (icon) {
@@ -533,34 +533,19 @@
}
/**
-** save state of the dependencies to file.
+** Save state of the dependencies to file.
**
-** @param file Output file.
+** @param file Output file.
*/
global void SaveUpgrades(CLFile* file)
{
int i;
- int j;
int p;
+#if 0
+ int j;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.70 2004/01/01
21:24:20 jsalmon3 Exp $\n\n");
-
- /* remove?
- //
- // Save all upgrades
- //
- for (i = 0; i < NumUpgrades; ++i) {
- CLprintf(file, "(define-upgrade '%s 'icon '%s\n",
- Upgrades[i].Ident, Upgrades[i].Icon.Name);
- CLprintf(file, " 'costs #(");
- for (j = 0; j < MaxCosts; ++j) {
- CLprintf(file, " %5d", Upgrades[i].Costs[j]);
- }
- CLprintf(file, "))\n");
- }
- CLprintf(file, "\n");
- */
+ CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.71 2004/01/03
00:33:03 jsalmon3 Exp $\n\n");
//
// Save all upgrades
@@ -652,47 +637,31 @@
CLprintf(file, ")\n\n");
}
-
+#endif
//
- // Save the allow
+ // Save the allow
//
for (i = 0; i < NumUnitTypes; ++i) {
- CLprintf(file, "(define-unit-allow '%s\t", UnitTypes[i]->Ident);
- if (strlen(UnitTypes[i]->Ident) < 9) {
- CLprintf(file, "\t\t\t");
- } else if (strlen(UnitTypes[i]->Ident) < 17) {
- CLprintf(file, "\t\t");
- } else if (strlen(UnitTypes[i]->Ident) < 25) {
- CLprintf(file, "\t");
- } else {
- CLprintf(file, "");
- }
+ CLprintf(file, "DefineUnitAllow(\"%s\", ", UnitTypes[i]->Ident);
for (p = 0; p < PlayerMax; ++p) {
- CLprintf(file, "%d ", Players[p].Allow.Units[i]);
+ if (p) {
+ CLprintf(file, ", ");
+ }
+ CLprintf(file, "%d", Players[p].Allow.Units[i]);
}
CLprintf(file, ")\n");
}
CLprintf(file, "\n");
//
- // Save the upgrades
+ // Save the upgrades
//
for (i = 0; i < NumUpgrades; ++i) {
- CLprintf(file, "(define-allow '%s\t", Upgrades[i].Ident);
- if (strlen(Upgrades[i].Ident) < 9) {
- CLprintf(file, "\t\t\t\"");
- } else if (strlen(Upgrades[i].Ident) < 17) {
- CLprintf(file, "\t\t\"");
- } else if (strlen(Upgrades[i].Ident) < 25) {
- CLprintf(file, "\t\"");
- } else {
- CLprintf(file, "\"");
- }
+ CLprintf(file, "DefineAllow(\"%s\", \"", Upgrades[i].Ident);
for (p = 0; p < PlayerMax; ++p) {
CLprintf(file, "%c", Players[p].Allow.Upgrades[i]);
}
- CLprintf(file, "\"");
- CLprintf(file, ")\n");
+ CLprintf(file, "\")\n");
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/unit depend.c unit.c unit_draw.c ...,
address@hidden <=