Summary: apply_disaster() can reference city after it's freed
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Sun 25 May 2014 12:27:18 BST
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: S2_5 r24940
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 2.5.0, 2.6.0



I think that a disaster which has the ReducePopulation effect and some other
effect (such as 'Nuclear Accident' in the classic ruleset), if the city was
size 1 and thus destroyed, can cause pcity to be referenced after being freed.

Disaster effects after ReducePopulation should check city_or_null (or possibly
pcity should become NULL) before doing their thing.

Also, disaster effects should be reordered. It's silly saying a building is
destroyed when the whole city is then lost. On the other hand,
pollution/fallout effects can sensibly occur simultaneously with city loss, so
should be moved before DE_REDUCE_POP.

(Having DE_REDUCE_POP able to destroy cities seems very fierce for a random
disaster. I'm inclined to add a similar disaster effect that can only reduce
population, not destroy a city. But that's a new ticket. Too late for 2.5?)


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to