[Freeciv-Dev] Re: (PR#14586) civclient: government.c:80: get_gov_pplayer
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14586 >
Per I. Mathisen wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14586 >
>
> On Fri, 11 Nov 2005, Brendon wrote:
>
>>HEAD
>>
>>1. Start a game
>>2. Global observe/obs
>>3. Middle click on terrain
>>
>>civclient: government.c:80: get_gov_pplayer: Assertion `pplayer !=
>>((void *)0)' failed.
>
> Patch that fixes this attached. Jason, take a look at it, please. I am not
> sure if this is how the global observer is supposed to work.
Yeah, that's how observers work - game.player_ptr is simply NULL.
However this patch is better - with your patch observers always see the
anarchy penalty.
-jason
Index: server/unittools.c
===================================================================
--- server/unittools.c (revision 11238)
+++ server/unittools.c (working copy)
@@ -1374,7 +1374,7 @@
}
players_iterate(pplayer) {
- if (can_player_see_unit(pplayer, punit)) {
+ if (map_is_known_and_seen(unit->tile, pplayer)) {
dlsend_packet_unit_remove(pplayer->connections, punit->id);
}
} players_iterate_end;
Index: common/player.c
===================================================================
--- common/player.c (revision 11238)
+++ common/player.c (working copy)
@@ -292,8 +292,6 @@
/* Hiding units are only seen by the V_INVIS fog layer. */
return BV_ISSET(ptile->tile_seen[V_INVIS], pplayer->player_no);
-
- return FALSE;
}
Index: client/text.c
===================================================================
--- client/text.c (revision 11238)
+++ client/text.c (working copy)
@@ -41,14 +41,15 @@
static struct astring str = ASTRING_INIT;
int i;
char output_text[O_MAX][16];
- struct government *gov;
-
- gov = get_gov_pplayer(game.player_ptr);
for (i = 0; i < O_MAX; i++) {
- int before_penalty = gov->output_before_penalty[i];
+ int before_penalty = 0;
int x = get_output_tile(ptile, i);
-
+
+ if (game.player_ptr) {
+ before_penalty = game.player_ptr->government->output_before_penalty[i];
+ }
+
if (before_penalty > 0 && x > before_penalty) {
my_snprintf(output_text[i], sizeof(output_text[i]), "%d(-1)", x);
} else {
|
|