[Freeciv-Dev] Re: Sea movement bug (PR#5279)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Emanuele Ripamonti <ripa@xxxxxxxxxxxxx> wrote:
>
> Full Name: Emanuele Ripamonti
> Version: 1.13.0
> Distribution: freeciv-1.13.0.tar.gz
> Client: Gtk+
> OS: Linux
>
>
> I was trying to modify a ruleset introducing a very slow moving sea unit
> (a mine), but I was not able to set its movement rate below 2.
That's not a bug, it's a feature. Sea units are supposed not to have a move
rate lower than 2. It's a Civ 2 compatability feature. And I think your mine
unit is a bit strange.
<snip>
> you should use something like this
>
> -----------------------------------------------------------------
> int unit_move_rate(struct unit *punit)
> {
> int move_rate = unit_type(punit)->move_rate;
> int max_move_rate = unit_type(punit)->move_rate;
>
> switch (unit_type(punit)->move_type) {
> case LAND_MOVING:
> move_rate = (move_rate * punit->hp) / unit_type(punit)->hp;
> break;
>
> case SEA_MOVING:
> move_rate = (move_rate * punit->hp) / unit_type(punit)->hp;
>
> if (player_owns_active_wonder(unit_owner(punit), B_LIGHTHOUSE)) {
> move_rate += SINGLE_MOVE;
> max_move_taye += SINGLE_MOVE;
^^^
Substitute max_move_rate. Send in a diff next time. Read the Freeciv docs in
the Readme directory or the website to find out how to create a diff.
> }
>
> if (player_owns_active_wonder(unit_owner(punit), B_MAGELLAN)) {
> move_rate += (improvement_variant(B_MAGELLAN) == 1)
> ? SINGLE_MOVE : 2 * SINGLE_MOVE;
> max_move_rate += (improvement_variant(B_MAGELLAN) == 1)
> ? SINGLE_MOVE : 2 * SINGLE_MOVE;
> }
>
> if (player_knows_techs_with_flag(unit_owner(punit), TF_BOAT_FAST)) {
> move_rate += SINGLE_MOVE;
> max_move_rate += SINGLE_MOVE;
> }
>
> if (move_rate < 2 * SINGLE_MOVE) {
> move_rate = 2 * SINGLE_MOVE;
> }
>
> if (move_rate > max_move_rate) {
> move_rate = max_move_rate;
> }
>
> if (unit_type(punit)->move_rate==0) {
> move_rate=0;
> } /* assuming that you don't want Magellan/Lighthouse/tech to affect
> sea units with 0 movement */
>
> break;
>
I have to point out 2 facts. First off, is it fully intentional on your part to
allow mines to get +3 to their move rate, ending up with a move rate of 5?
Magellans, Lighthouse, and fast move techs.
Next: Mines require a different move type to any other unit. It doesn't make
sense to allow mines to move after you have placed them, so they must have a
one time move of 1.
Your version of mines are basically mobile kamikaze units. Not what is
intended!
You will have to rewrite a bit of movement code, allowing mines to move once
from land to ocean(So your mines built in cities can be placed on ships), and
once from ocean square to ocean square. And after that they will need to be
immobile and invisible to enemy units.
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: Sea movement bug (PR#5279),
Raahul Kumar <=
|
|