bugFreeciv - Bugs: bug #19836, Specials vector size saved as...

 
 
Show feedback again

bug #19836: Specials vector size saved as specials_size, but loaded as special_size

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Sat 23 Jun 2012 12:00:37 PM UTC  
 
Category: generalSeverity: 2 - Minor
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: 2.3.2,S2_4,trunkOperating System: Any
Planned Release: 2.4.1, 2.5.0, 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 01 Oct 2013 10:36:54 PM UTC, SVN revision 23523:

Fixed loading of specials_size information from savegame.

Reported by Jacob Nevins

See bug #19836

(Browse SVN revision 23523)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Tue 01 Oct 2013 10:36:48 PM UTC, SVN revision 23522:

Fixed loading of specials_size information from savegame.

Reported by Jacob Nevins

See bug #19836

(Browse SVN revision 23522)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Tue 01 Oct 2013 10:36:42 PM UTC, SVN revision 23521:

Fixed loading of specials_size information from savegame.

Reported by Jacob Nevins

See bug #19836

(Browse SVN revision 23521)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 29 Sep 2013 07:20:11 PM UTC, comment #3:

Fix attached

(file #19107, file #19108)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 29 Sep 2013 07:08:50 PM UTC, comment #2:

> OK, looking closer, improvement/technology/bases_size > 0 are
> used to gate calls to secfile_lookup_str_vec(), which would
> return an error on a zero-length vector. For some reason
> specials are not gated in this way (probably we never thought
> we'd have no specials defined in a savegame).


It seems to be gated now (check against special_size being 0 - which it always is for this very ticket). This means that specials order stuff if never executed, explaining things like bug #21138.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 24 Jun 2012 11:33:20 AM UTC, comment #1:

> I'm not quite sure of the purpose of these _size entries


OK, looking closer, improvement/technology/bases_size > 0 are used to gate calls to secfile_lookup_str_vec(), which would return an error on a zero-length vector. For some reason specials are not gated in this way (probably we never thought we'd have no specials defined in a savegame).

This arrangement hasn't changed since savegame2.c was introduced (patch #1541). The old format in savegame.c mostly uses capabilities to gate loading of these string vectors (except for bases).

It would be possible to rejig secfile_lookup_str_vec() to optionally allow zero-length arrays, and thus get rid of these redundant entries in the savefile. I'm tempted to do this on trunk. On stable branches I think we should just fix loading to use specials_size to remove the warning.

Jacob Nevins <jtn>
Project Administrator
Sat 23 Jun 2012 12:00:37 PM UTC, original submission:

In savegame2.c, the size of the specials vector is saved as "savefile.specials_size", but loaded as "savefile.special_size".

Noticed as this leads to a warning in the verbose log on load: "unused entry: savefile.specials_size"

(I'm not quite sure of the purpose of these _size entries, given that on loading they are immediately overwritten by the count returned by secfile_lookup_str_vec() anyway. So they seem redundant. Haven't thoroughly checked yet, though. The fact that we've been loading the specials size as 0 since 2.3.0 and the world hasn't ended yet corroborates this.)

Jacob Nevins <jtn>
Project Administrator

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #19107:  SpecialsSize.patch added by cazfi (535B - text/x-diff)
file #19108:  SpecialsSize-S2_5.patch added by cazfi (508B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by jtn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 02 Nov 2013 11:58:32 AM UTCjtnOpen/ClosedOpen=>Closed
    Tue 01 Oct 2013 10:37:13 PM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
    Sun 29 Sep 2013 07:20:11 PM UTCcazfiAttached File-=>Added SpecialsSize.patch, #19107
      Attached File-=>Added SpecialsSize-S2_5.patch, #19108
      CategoryNone=>general
      StatusNone=>Ready For Test
      Planned Release=>2.4.1, 2.5.0, 2.6.0
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup