<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40495 >
> [EMAIL PROTECTED] - Fri Sep 19 00:39:59 2008]: > > This is a significant bug and should be backported, possibly even back > to 2.0. Ok, though this porting business is starting to get on my nerves, what with the 4 freeciv, 2 warclient, and 3 longturn branches, especially as most of the time the only difference between them is in arbitrary cosmetic code changes (name/access conventions). Well, too late to change it now, but something to keep in mind for the future. >:} (Also notice that in this case the patch gets larger as the branch version increases; clearly a sign of progress. ;)) > To avoid crashes maybe a placeholder data could be sent instead? > Like anarchy rather than NULL government. I do like that idea better than mucking about in common/ and having to hunt down all the non-NULL government assumptions in the client. Version 2 of the patch set uses the "government when anarchy/revolution" field of the game structure as a placeholder. ----------------------------------------------------------------------- 確かにその能力は役に立っていますが、本当に副作用がありませんか?
diff --git a/server/plrhand.c b/server/plrhand.c index e3e46ca..e98cfcc 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -1166,8 +1166,7 @@ static void package_player_info(struct player *plr, if (server_state == RUN_GAME_STATE) packet->inventions[city_styles[get_player_city_style(plr)].techreq] = '1'; - /* FIXME: temporary kludge */ - packet->government = plr->government; /*G_MAGIC;*/ + packet->government = game.government_when_anarchy; } if (info_level >= INFO_EMBASSY) {
diff --git a/server/plrhand.c b/server/plrhand.c index 315b332..5b497c2 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -1624,8 +1624,13 @@ static void package_player_info(struct player *plr, info_level = min_info_level; } - packet->gold = plr->economic.gold; - packet->government = plr->government; + if (info_level >= INFO_MEETING) { + packet->gold = plr->economic.gold; + packet->government = plr->government; + } else { + packet->gold = 0; + packet->government = game.government_when_anarchy; + } /* Send diplomatic status of the player to everyone they are in * contact with. */
diff --git a/server/plrhand.c b/server/plrhand.c index 098bf5e..755b4e7 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -877,11 +877,6 @@ static void package_player_common(struct player *plr, packet->small_wonders[i] = plr->small_wonders[i]; } packet->science_cost = plr->ai.science_cost; - - packet->gold = plr->economic.gold; - packet->government = government_of_player(plr) - ? government_number(government_of_player(plr)) - : -1; } /************************************************************************** @@ -902,6 +897,7 @@ static void package_player_info(struct player *plr, enum plr_info_level info_level; enum plr_info_level highest_team_level; struct player_research* research = get_player_research(plr); + struct government *pgov = NULL; if (receiver) { info_level = player_info_level(plr, receiver); @@ -928,6 +924,15 @@ static void package_player_info(struct player *plr, packet->score = 0; } + if (info_level >= INFO_MEETING) { + packet->gold = plr->economic.gold; + pgov = government_of_player(plr); + } else { + packet->gold = 0; + pgov = game.government_during_revolution; + } + packet->government = pgov ? government_number(pgov) : -1; + /* Send diplomatic status of the player to everyone they are in * contact with. */ if (info_level >= INFO_EMBASSY
diff --git a/server/plrhand.c b/server/plrhand.c index 49cae2c..b49c8ff 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -862,11 +862,6 @@ static void package_player_common(struct player *plr, packet->small_wonders[i] = plr->small_wonders[i]; } packet->science_cost = plr->ai.science_cost; - - packet->gold = plr->economic.gold; - packet->government = government_of_player(plr) - ? government_of_player(plr)->index - : -1; } /************************************************************************** @@ -887,6 +882,7 @@ static void package_player_info(struct player *plr, enum plr_info_level info_level; enum plr_info_level highest_team_level; struct player_research* research = get_player_research(plr); + struct government *pgov = NULL; if (receiver) { info_level = player_info_level(plr, receiver); @@ -913,6 +909,15 @@ static void package_player_info(struct player *plr, packet->score = 0; } + if (info_level >= INFO_MEETING) { + packet->gold = plr->economic.gold; + pgov = government_of_player(plr); + } else { + packet->gold = 0; + pgov = game.government_when_anarchy; + } + packet->government = pgov ? pgov->index : -1; + /* Send diplomatic status of the player to everyone they are in * contact with. */ if (info_level >= INFO_EMBASSY
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev