[Freeciv-Dev] Re: (PR#10715) observing causes a crash
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10715 >
Mike Kaufman wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10715 >
>
> load the game attached as a comment.
> set timeout 0
> connect a client and /observe
> st.
>
> civserver: plrhand.c:1598: package_player_info: Assertion `server_state !=
> RUN_GAME_STATE || ((tech_exists(plr->research.researching) &&
> plr->research.researching != 0) ||
> is_future_tech(plr->research.researching) || plr->research.researching ==
> (200-1))' failed.
> Aborted (core dumped)
>
> core is garbage for me.
The interesting thing is that most of the time this assertion doesn't
fail in the current code. If you connect to a running game and /observe
you don't get a crash with the current code. This means the observer
acutally does have a valid research target!
I'd like to change this assertion so that for observers it asserts that
the research target is A_NONE (and goal is A_UNSET). However this check
would fail badly. So this patch just disables it for observers.
Also note that if you follow the original instructions under this patch,
you'll get an entirely different crash. I think this is unrelated.
jason
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.333
diff -u -r1.333 plrhand.c
--- server/plrhand.c 23 Oct 2004 19:01:01 -0000 1.333
+++ server/plrhand.c 25 Oct 2004 03:23:02 -0000
@@ -1591,13 +1591,15 @@
* This may be an odd time to check these values but we can be sure
* to have a consistent state here.
*/
- assert(server_state != RUN_GAME_STATE
- || ((tech_exists(plr->research.researching)
- && plr->research.researching != A_NONE)
- || is_future_tech(plr->research.researching)
- || plr->research.researching == A_UNSET));
- assert((tech_exists(plr->ai.tech_goal) && plr->ai.tech_goal != A_NONE)
- || plr->ai.tech_goal == A_UNSET);
+ if (!plr->is_observer) {
+ assert(server_state != RUN_GAME_STATE
+ || ((tech_exists(plr->research.researching)
+ && plr->research.researching != A_NONE)
+ || is_future_tech(plr->research.researching)
+ || plr->research.researching == A_UNSET));
+ assert((tech_exists(plr->ai.tech_goal) && plr->ai.tech_goal != A_NONE)
+ || plr->ai.tech_goal == A_UNSET);
+ }
}
/**************************************************************************
|
|