[Freeciv-Dev] Railroad movement patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This patch updates the AI and movement code, replacing a lot of those
based on 3 with constants defined below. This should make it easier to
more civ variants and make the AI code a little bit easier to follow. This
was mostly based on Artur Biesiadowski's patch for 1.8.1.
Will someone who understands the AI code please rename those variables? It
is difficult to understand where those numbers come from in particular:
-3 for sea movement cost appears to be a special number(Does it depend on
the movement cost of 1 square or not?)
maxcost = 72 ( apparently this is computed as a result of threshold * 6)
How was this number derived?
In general, whoever is currently maintaining the AI code needs to insert a
lot of comments. It would be nice if the AI was moved away from relying on
so many hardcoded numbers.
some funcs in server/gotohand.c
some funcs in ai/advmilitary.c
some funcs in ai/advunit.c
I've added a few additonal /* MOVEFIXME */ comments in places where I
wasn't sure of
meaning of code (3 or 4 places) - somebody should review those places
The plan is to to use 30 instead of 3 as a base - 1/3 for road/river, 1/10
for rail. It would also allow C:CTP costs (1/2 for river, 1/3 for road,
1/5 for rail, 1/10 for maglev). It should also make it easier for SMAC and
Civ III. There is some additional code currently commented out that allows
a fixed railroad movement - i.e if you stuck a howitzer or a mech infantry
on a railroad they would both move the same distance.
For now it is defined in unit.h
#define SINGLE_MOVE 3
Also there are definitions for
#define MOVE_COST_RIVER 1
#define MOVE_COST_ROAD 1
#define MOVE_COST_RAIL 0
used only in once place, so it should be easy for grep for them and
change (or even replace with
#define MOVE_COST_RIVER game.river_movement_cost
Somebody has to work hard on goto code - there is way too much places
where magic numbers are used, which probably are dependent on 3.
- [Freeciv-Dev] Railroad movement patch,
Raahul Kumar <=