[Freeciv-Dev] Re: Unit move rate cleanup (PR#1343)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> wrote:
> On Sun, 24 Mar 2002, Raahul Kumar wrote:
> > This cleans up unit move rate by getting rid of struct player *pplayer and
> > replacing val with move_rate. I've also made it return a static int, and
> > introduced an assert and -1 return value for errors.
>
> /***************************************************************
> -...
> +Unit move rate calculates the move rate of the unit taking into
> +account the penalty for reduced hitpoints(affects sea and land units
>
> Nitpick: ^--space
>
Sharp eyes.
> + default:
> + assert(0);
> + exit(1);
> + move_rate = -1;
>
> No, never exit(1) when the game can be continued in a playable state!
>
Playable???? The only possible way for a negative move cost to exist means
memory has been overwritten. I think it's better to exit with a log message
than continue with an unpredictably buggy program. I don't want Freeciv to be
some sort of security hole.
> And if you must exit, first call freelog(LOG_FATAL, ...) for a proper
> error message, and then do exit(EXIT_FAILURE).
>
Yikes. You are right. New patches will be sent. What should I say in the error
message? Illegal move cost should never be reached.
> Other than that, I think the patch is very good and should go in.
>
Decided to join the AI crew have you? Resistance is futile. You will be
assimilated. ;).
Nasrudin walked into a teahouse and declaimed, "The moon is more useful
than the sun." "Why?", he was asked. "Because at night we need the
light more."
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
|
|