Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] patch: ruleset_control packet (PR#113)
Home

[Freeciv-Dev] patch: ruleset_control packet (PR#113)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] patch: ruleset_control packet (PR#113)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Wed, 25 Aug 1999 06:40:05 -0700 (PDT)

This patch tidies up some things about ruleset data and packets,
especially for government rulesets.  

The current government ruleset stuff has problems if the client 
disconnects and re-connects: will leak memory, and may get the 
number of governments wrong.

This patch fixes this by sending a new packet which specifies
the number of governments explictly (previously was implicit 
based on received government packet ids).  This also allows 
independently sanity-checking the received government packet ids.

I called the new packet "ruleset control" (like separate terrain
control) and put in other miscellaneous ruleset data (but left
terrain separate).  That is, data  which was previously sent as 
part of the game_info packet.  Its better this way because 
game_info is re-sent every turn, but the ruleset stuff doesn't 
change (except when re-connect, when will get a new ruleset 
control packet). 

Also changed strings in government data (gov name and ruler titles)
to use MAX_LEN_NAME char arrays instead of (char*) and mystrdup, 
to make memory management in client easier (eg, on re-connection), 
and since we can't use longer than MAX_LEN_NAME anyway (due to 
packets), and since having a max len is easier in other respects, 
eg for display.

Also made the ruler_titles array have number of titles stored
explicitly in government struct (rather than use special terminator
title), which allows client to sanity-check packet data vs what
was allocated.  Added some similar sanity checking for received 
tech, building and terrain packets.

Plus minor fix: government flags data was in government packet,
but never initialized in send_ruleset_governments()!

Regards,
-- David

Attachment: ruleset_control.diff.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] patch: ruleset_control packet (PR#113), David Pfitzner <=