Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] [PATCH] Generalised improvements patches for current CVS
Home

[Freeciv-Dev] [PATCH] Generalised improvements patches for current CVS

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] [PATCH] Generalised improvements patches for current CVS
From: Ben Webb <ben@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jan 2002 18:04:25 +0000 (GMT)

        The attached patches should apply to current CVS. They correct a 
few bugs in the generalised improvements code, while adding sufficient 
functionality to cover the original effect-implement, effect-iterator, and 
island-active-fix patches. (effect-init and part of effect-implement are 
currently in CVS.) This then enables the remaining generalised 
improvements patches at http://freecivac.sourceforge.net/ to be applied to 
current CVS, to largely remove hard-coded building effects. The patches 
make use of derived classes (or at least, the best C approximation 
thereto) to cut down on code redundancy.

        Comments on code style and this implementation are welcomed; in 
particular, if large changes in implementation are likely to be made 
before CVS inclusion, I'd like to know ASAP, as this would most likely 
affect current work on FreecivAC.

neweff-implement.patch:-
 - Streamlines renumber_island_impr_effect() in client/climisc.c to use 
   the append_geff function
 - Fixes specvec_c.h so that it handles derived classes properly 
   (eff_global in common/improvement.h is derived from eff_city; this 
   patch then allows a vector of eff_globals - geff_vector - to be safely 
   cast to a vector of eff_citys - ceff_vector)
 - Properly implements update_all_effects(), using the new ceff_vector and 
   geff_vector types
 - Corrects get_eff_island to take an island number rather than a city 
   pointer, so that the effects of things not in cities (e.g. units in the 
   field) can be considered
 - Adds a get_all_effect_vectors() function that returns a list of all 
   effects that affect a given "thing", cast to ceff_vectors
 - Fixes a bug in update_global_effect() so that Island-range effects are 
   updated properly

neweff-iterator.patch (requires the above patch to first be applied):-
 - Adds a function eff_iterator_impr_init() to iterate over all effects 
   that influence a given city improvement, or other city-related entity
 - Adds a function eff_iterator_unit_init() to iterate over all effects
   that influence a given unit at a specified map position (N.B. both 
   these functions take often-redundant data, e.g. both a city and a
   player pointer, so that unusual cases can be considered - e.g. for
   prediction by the AI "what happens if I move this unit to these
   coordinates?" etc.)
 - Defines Freeciv-consistent iterator macros to iterate over improvement 
   effects (uses the get_all_effect_vectors() function defined above)
 - Adds is_city_affected() and is_unit_terrain_affected() to test the 
   cond_bldg and the various aff_xxx fields of improvement effects
 - Adds functions to common/unit.c and common/unittype.c to convert unit 
   types and flags to "unit classes" as used in buildings.ruleset
 - Clarifies the meanings of cond_bldg and cond_eff in 
   data/default/buildings.ruleset

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"So maybe you're a 4 horse engine with a power drive"

Attachment: neweff-implement.patch.gz
Description: GNU Zip compressed data

Attachment: neweff-iterator.patch.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]