Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: Unit move rate cleanup (PR#1343)
Home

[Freeciv-Dev] Re: Unit move rate cleanup (PR#1343)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Unit move rate cleanup (PR#1343)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Thu, 11 Apr 2002 03:59:05 -0700 (PDT)

--- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote:
> At 01:51 AM 02/03/25 -0800, Raahul Kumar wrote:
> >
> >--- "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> wrote:
> >> On Sun, 24 Mar 2002, Raahul Kumar wrote:
> 
> >> +  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.
> 
> Sea moves are stored as negative values. It is wrong to assume that
> you know every way that something might come to pass ...

To put it bluntly, I do know every legal way for something to come to pass.
Yes, sea moves is stored as negative values. Did you read this code properly?
Sea moves should not be negative at this stage. If they are, then it is a
tremendous bug that will screw up the users game long before they get 6 hrs of
gameplay.

Regardless, the only way that code block will be switched to is if there is a
unit with an invalid move_type. Certainly a big bug, and I think my actions are
correct. Raimar, Mike? Should developers write code that exits or not? Do you
feel continuing with a potentially unpredictably buggy program is better than
exiting?

> But more to the point, asserts and exceptions are very bad as Per says.
> 
> You might as well let the program fault itself as do it in most of the
> cases where asserts are used in Freeciv.
> 
> A good user friendly solution is to allow the game to continue to a 
> save point, or do a game save before trashing some poor user's 6 hour
> session. User's really don't appreciate your developer sentiments in
> general.

I don't care what the users think. I only have to please maintainers/ other
developers who review patches. They are my only priority. If other
developers(only those who review patches count)  or one maintainer agrees with
you, I will change my ways.

> >> And if you must exit, first call freelog(LOG_FATAL, ...) for a proper
> >> error message, and then do exit(EXIT_FAILURE).
> 
> At the minimum ... I agree.

Ross, you should have commented earlier. I've already fixed all these problems.
Check your CVS.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/


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