Summary: Disaster nreq processing causes disasters mostly not
to happen
                 Project: Freeciv
            Submitted by: persia
            Submitted on: Mon 01 Apr 2013 03:06:35 AM GMT
                Category: general
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 2.4.99-r22636
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



The current code handling nreqs for disasters causes disasters without defined
nreqs not to happen.  Specifically, can_disaster_happen() depends on
!are_reqs_inactive(... nreqs ...).  If there are nreqs defined, this happens
to be the correct logic, but in the case of an empty nreq vector,
are_reqs_active() never iterates, so always returns TRUE, causing
can_req_happen() to return FALSE.  This affects the following disasters in
shipping rulesets:

alien: Earthquake, Fire, Radiation Burst, Rebels, Alien Microbes
civ1: Earthquake
civ2civ3: Nuclear Accident
classic: Earthquake, Plague, Fire, Nuclear Accident
experimental: Earthquake, Fire

    This can be fixed by adding a disjunctive test to requirements.c and
calling that disjunctive test from can_disaster_happen(), as illustrated in
attached fix-disaster-nreqs.patch, but this is a less ideal way to do it, as
we currently have two different means of expressing nreqs: one used for
effects.c and the other used for everything else (aside from diassters, which
doesn't work).  In the everything else case, the correct representation is
with the use of "negated" to negate a requirement (and thereby make it an
nreq).  This works because "A and not (B or C)" is equivalent to "A and not B
and not C", and doesn't offer any richer syntax because "A and not (B or not
C)" is equivalent to "A and C and not B".

    So, remove-disaster-nreqs.patch attached, which rewrites the civ1 ruleset
to use "negated", and removes all mention of and support for disaster nreqs
(this requires a change to the capabilities string, as the network protocol is
affected).  Since disasters don't appear to exist in S2_4, I don't believe
there is any need to backport the fix-disaster-nreqs solution.


File Attachments:

Date: Mon 01 Apr 2013 03:06:35 AM GMT  Name:
fix-disaster-nreqs.patch.DONTAPPLY  Size: 4kB   By: persia

Date: Mon 01 Apr 2013 03:06:35 AM GMT  Name: remove-disaster-nreqs.patch 
Size: 14kB   By: persia



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to