[Freeciv-Dev] (PR#2314) Changing tech lose bulbs after load
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
[kauf - Tue Nov 12 15:29:27 2002]:
> > When getting new tech, save game and restart saved game,
> > and changing the tech in the same turn, all bulbs are lost.
>
> that's because research.bulbs_researched_before is not currently saved in
> a savegame. Should be fixed, but I don't know if it's that critical for
> 1.14.0.
Actually, it turns out it's because got_tech isn't saved.
research.bulbs_researched_before is used in conjunction with
research.changed_from so that if you change your tech target, then
change it back in the same turn, you don't lose your bulbs. (Thanks to
Davide for pointing this out.)
This patch saves all three values. It should therefore fix both bugs.
P.S. IMO got_tech should be stored in the research struct as well. This
is reflected in my naming of the save-file entry. And why is it updated
in cityturn.c? Questions for another day...
jason
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.97
diff -u -r1.97 savegame.c
--- server/savegame.c 2002/11/14 09:15:05 1.97
+++ server/savegame.c 2002/11/17 00:38:06
@@ -619,8 +619,21 @@
plr->future_tech=secfile_lookup_int(file, "player%d.futuretech", plrno);
+ /* We use default values for bulbs_researched_before, changed_from
+ * and got_tech to preserve backwards-compatability with save files
+ * that didn't store this information. */
plr->research.bulbs_researched=secfile_lookup_int(file,
"player%d.researched", plrno);
+ plr->research.bulbs_researched_before =
+ secfile_lookup_int_default(file, 0,
+ "player%d.researched_before", plrno);
+ plr->research.changed_from =
+ secfile_lookup_int_default(file, -1,
+ "player%d.research_changed_from",
+ plrno);
+ plr->got_tech = secfile_lookup_bool_default(file, FALSE,
+ "player%d.research_got_tech",
+ plrno);
plr->research.techs_researched=secfile_lookup_int(file,
"player%d.researchpoints", plrno);
plr->research.researching=secfile_lookup_int(file,
@@ -1257,6 +1270,12 @@
secfile_insert_int(file, plr->research.bulbs_researched,
"player%d.researched", plrno);
+ secfile_insert_int(file, plr->research.bulbs_researched_before,
+ "player%d.researched_before", plrno);
+ secfile_insert_bool(file, plr->got_tech,
+ "player%d.research_got_tech", plrno);
+ secfile_insert_int(file, plr->research.changed_from,
+ "player%d.research_changed_from", plrno);
secfile_insert_int(file, plr->research.techs_researched,
"player%d.researchpoints", plrno);
secfile_insert_int(file, plr->research.researching,
- [Freeciv-Dev] (PR#2314) Changing tech lose bulbs after load,
Jason Short via RT <=
|
|