Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2004:
[freeciv-ai] Re: (PR#8750) Clutter: ai parameters in savegames
Home

[freeciv-ai] Re: (PR#8750) Clutter: ai parameters in savegames

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: (PR#8750) Clutter: ai parameters in savegames
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Sep 2004 21:13:03 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8750 >

here's a patch to save aidata in tabular format. It made the first savegame
I did with 4 players 4k smaller gzipped.

The disadvantage is that new servers will ignore the aidata in older
savegames. Perfectly acceptable tradeoff in my opinion:

ai.control=1
ai={
"love","spam","patience","warn_space","ask_peace","ask_alliance","ask_ceasefire"
1,0,0,0,0,0,0
120,0,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
1,0,0,0,0,0,0
1,1,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
1,0,0,0,0,0,0
1,1,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
1,0,0,0,0,0,0
1,1,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
1,0,0,0,0,0,0
1,1,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
1,0,0,0,0,0,0
1,1,0,0,0,0,0
1,2,0,0,0,0,0
1,3,0,0,0,0,0
1,4,0,0,0,0,0
}
ai.tech_goal_name="Feudalism"

-mike

? remove_all.diff
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.186
diff -u -r1.186 savegame.c
--- server/savegame.c   14 Sep 2004 08:23:00 -0000      1.186
+++ server/savegame.c   15 Sep 2004 04:09:16 -0000
@@ -1534,19 +1534,19 @@
   plr->ai.control = secfile_lookup_bool(file, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
     plr->ai.love[i]
-         = secfile_lookup_int_default(file, 1, "player%d.ai.love%d", plrno, i);
+         = secfile_lookup_int_default(file, 1, "player%d.ai%d.love", plrno, i);
     ai->diplomacy.player_intel[i].spam 
-         = secfile_lookup_int_default(file, 0, "player%d.ai.spam%d", plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.spam", plrno, i);
     ai->diplomacy.player_intel[i].ally_patience
-         = secfile_lookup_int_default(file, 0, "player%d.ai.patience%d", 
plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.patience", 
plrno, i);
     ai->diplomacy.player_intel[i].warned_about_space
-         = secfile_lookup_int_default(file, 0, "player%d.ai.warn_space%d", 
plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.warn_space", 
plrno, i);
     ai->diplomacy.player_intel[i].asked_about_peace
-         = secfile_lookup_int_default(file, 0, "player%d.ai.ask_peace%d", 
plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.ask_peace", 
plrno, i);
     ai->diplomacy.player_intel[i].asked_about_alliance
-         = secfile_lookup_int_default(file, 0, "player%d.ai.ask_alliance%d", 
plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.ask_alliance", 
plrno, i);
     ai->diplomacy.player_intel[i].asked_about_ceasefire
-         = secfile_lookup_int_default(file, 0, "player%d.ai.ask_ceasefire%d", 
plrno, i);
+         = secfile_lookup_int_default(file, 0, "player%d.ai%d.ask_ceasefire", 
plrno, i);
   }
   plr->ai.tech_goal = load_technology(file, "player%d.ai.tech_goal", plrno);
   if (plr->ai.tech_goal == A_NONE) {
@@ -2245,19 +2245,19 @@
   secfile_insert_bool(file, plr->ai.control, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
     secfile_insert_int(file, plr->ai.love[i],
-                       "player%d.ai.love%d", plrno, i);
+                       "player%d.ai%d.love", plrno, i);
     secfile_insert_int(file, ai->diplomacy.player_intel[i].spam, 
-                       "player%d.ai.spam%d", plrno, i);
+                       "player%d.ai%d.spam", plrno, i);
     secfile_insert_int(file, ai->diplomacy.player_intel[i].ally_patience, 
-                       "player%d.ai.patience%d", plrno, i);
+                       "player%d.ai%d.patience", plrno, i);
     secfile_insert_int(file, ai->diplomacy.player_intel[i].warned_about_space, 
-                       "player%d.ai.warn_space%d", plrno, i);
+                       "player%d.ai%d.warn_space", plrno, i);
     secfile_insert_int(file, ai->diplomacy.player_intel[i].asked_about_peace, 
-                       "player%d.ai.ask_peace%d", plrno, i);
+                       "player%d.ai%d.ask_peace", plrno, i);
     secfile_insert_int(file, 
ai->diplomacy.player_intel[i].asked_about_alliance, 
-                       "player%d.ai.ask_alliance%d", plrno, i);
+                       "player%d.ai%d.ask_alliance", plrno, i);
     secfile_insert_int(file, 
ai->diplomacy.player_intel[i].asked_about_ceasefire, 
-                       "player%d.ai.ask_ceasefire%d", plrno, i);
+                       "player%d.ai%d.ask_ceasefire", plrno, i);
   }
   save_technology(file, "player%d.ai.tech_goal", plrno, plr->ai.tech_goal);
   secfile_insert_int(file, plr->ai.skill_level,

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] Re: (PR#8750) Clutter: ai parameters in savegames, Mike Kaufman <=