URL:
<http://gna.org/bugs/?13863>
Summary: Remove old server goto code, step 1: warmap
alternatives
Project: Freeciv
Submitted by: pepeto
Submitted on: Saturday 07/04/2009 at 13:58
Category: general
Severity: 2 - Minor
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release:
Operating System: None
_______________________________________________________
Details:
The idea is to remove the old airgoto.[ch] and gotohand.[ch] from the server
code. The main problem is the AI code which use a lot of warmaps. Since the
pf air goto works well in trunk/, there is no more any reason to keep this
code which is sometimes quite hard to understand because of the static
variables.
The first step in this work consists to bring alternatives to the old warmaps
using the pf code. This step make 3 notables changes:
* There are 3 new functions in pf_tools.h (pft_fill_utype_parameter(),
pft_fill_utype_overlap_param(), pft_fill_utype_attack_param()) which are
equivalent to creating a virtual unit, call pft_fill_unit_*() respective
function and destroying the virtual unit.
* There is a minor change in the pf code itself. I noticed that the node
could be initialized many times if the first time, the node was considered
unreachable. I added a new node status "NS_INIT" which just marks to don't
initialize the node a second time (because it's only a waste of time).
* Warmaps are usually generated for one unit. However, in ai/advmilitary.c,
the warmap is deployed for a city. I added some equivalent named "struct
pf_city_map" which works by unit_class when warmap worked with move types.
The city map is a vector of pf_map (which are only created and deployed when
needed). The public interface grants 3 functions:
struct pf_city_map *pf_city_map_new(const struct city *pcity);
void pf_city_map_destroy(struct pf_city_map *pfcm);
int pf_city_map_get_move_cost(struct pf_city_map *pfcm, const struct
unit_class *punitclass, struct tile *ptile);
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Saturday 07/04/2009 at 13:58 Name: trunk_warmap_alternatives.diff.gz
Size: 6kB By: pepeto
<http://gna.org/bugs/download.php?file_id=6126>
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?13863>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev