[Freeciv-Dev] Re: [Patch] turn_founded
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Mike Kaufman wrote:
On Mon, Mar 04, 2002 at 05:25:14PM +0100, Raimar Falke wrote:
I think it is bad if a value is normally >=0 and for some cities -1.
But actually, I don't think it can give a negative value. If a city is
founded on the first turn and then you save/reload on the first turn,
then did_buy would have been -1 anyway.
IMHO we should insert an assert:
+ if (did_buy >= 0) {
assert(game.turn>0);
no. this assert crap is starting to get silly. We should write the code so
that game turn is initialized to a non-negative number and stays
non-negative.
Well, that's what this code is intended to do, and I really don't see
how it could fail.
The purpose of the assert is to make sure what you're certain of really
is true. If we're *absolutely* certain of it, then the assert basically
acts as a comment to someone reading the code:
/* this will never make the game turn drop below 0 */
(but, Raimar, shouldn't it be assert(game.turn >= 0)? Is the first turn
0 or 1?)
speaking of asserts, has anybody attempted to run an autogame with -DNDEBUG
lately? I didn't think so.
I did a month or so ago. I found a whole slew of compiler warnings (now
fixed, I believe), and a significant improvement in runtime [1].
[1] This is mostly from all of the assert(is_normal_map_pos(...)) calls.
jason
- [Freeciv-Dev] [Patch] turn_founded, Raimar Falke, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Jason Short, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Raimar Falke, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Raimar Falke, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Mike Kaufman, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded,
Jason Short <=
- [Freeciv-Dev] Re: [Patch] turn_founded, Raimar Falke, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Mike Kaufman, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Raimar Falke, 2002/03/04
- [Freeciv-Dev] Re: [Patch] turn_founded, Raimar Falke, 2002/03/04
[Freeciv-Dev] Re: [Patch] turn_founded, Gregory Berkolaiko, 2002/03/04
|
|