Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2000:
[Freeciv-Dev] Railroad movement patch
Home

[Freeciv-Dev] Railroad movement patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Railroad movement patch
From: Raahul Kumar <z1156937@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Nov 2000 14:48:36 +1000 (EST)

This patch updates the AI and movement code, replacing a lot of those
magic numbers
based on 3 with constants defined below. This should make it easier to
support
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.

Missing:

some funcs in server/gotohand.c
common/map.c:tile_move_cost_ai
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
closely.

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
for
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 

They are
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
or anything).

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. 






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