Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
September 2005: [Freeciv-Dev] (PR#12331) conquered city style |
![]() |
[Freeciv-Dev] (PR#12331) conquered city style[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12331 > > [paulz - Wed Feb 23 03:54:24 2005]: > > It might be cool if conquered cities kept their citystyle regardless of > the current owner. Here's an updated patch. It changes get_city_style to use the pcity->original player for the "base" city style, which is then upgraded based on the city's owner. get_player_city_style is removed. The only tricky part is that pcity->original is not currently sent to the client so this must now be sent in both city_info and city_short_info packets. -jason Index: client/packhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v retrieving revision 1.548 diff -p -u -r1.548 packhand.c --- client/packhand.c 5 Sep 2005 15:55:45 -0000 1.548 +++ client/packhand.c 14 Sep 2005 01:33:11 -0000 @@ -480,7 +480,6 @@ void handle_city_info(struct packet_city pcity->airlift=packet->airlift; pcity->turn_last_built=packet->turn_last_built; - pcity->turn_founded = packet->turn_founded; pcity->changed_from.value = packet->changed_from_id; pcity->changed_from.is_unit = packet->changed_from_is_unit; pcity->before_change_shields=packet->before_change_shields; @@ -488,6 +487,9 @@ void handle_city_info(struct packet_city pcity->caravan_shields=packet->caravan_shields; pcity->last_turns_shield_surplus = packet->last_turns_shield_surplus; + pcity->original = get_player(packet->original_owner); + pcity->turn_founded = packet->turn_founded; + for (i = 0; i < CITY_MAP_SIZE * CITY_MAP_SIZE; i++) { const int x = i % CITY_MAP_SIZE, y = i / CITY_MAP_SIZE; @@ -673,6 +675,8 @@ void handle_city_short_info(struct packe pcity->client.happy = packet->happy; pcity->client.unhappy = packet->unhappy; + pcity->original = get_player(packet->original_owner); + pcity->ppl_happy[4] = 0; pcity->ppl_content[4] = 0; pcity->ppl_unhappy[4] = 0; Index: common/capstr.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v retrieving revision 1.270 diff -p -u -r1.270 capstr.c --- common/capstr.c 4 Sep 2005 04:31:17 -0000 1.270 +++ common/capstr.c 14 Sep 2005 01:33:11 -0000 @@ -82,7 +82,7 @@ const char * const our_capability = our_ * as long as possible. We want to maintain network compatibility with * the stable branch for as long as possible. */ -#define CAPABILITY "+Freeciv.Devel.2005.Sep.4" +#define CAPABILITY "+Freeciv.Devel.2005.Sep.13" void init_our_capability(void) { Index: common/city.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.c,v retrieving revision 1.364 diff -p -u -r1.364 city.c --- common/city.c 18 Aug 2005 06:44:27 -0000 1.364 +++ common/city.c 14 Sep 2005 01:33:11 -0000 @@ -1100,24 +1100,17 @@ Evaluate which style should be used to d **************************************************************************/ int get_city_style(const struct city *pcity) { - return get_player_city_style(city_owner(pcity)); -} - -/************************************************************************** - Return the city style (used for drawing the city on the mapview in - the client) for this city. The city style depends on the - start-of-game choice by the player as well as techs researched. -**************************************************************************/ -int get_player_city_style(const struct player *plr) -{ + struct player *source_player + = pcity->original ? pcity->original : pcity->owner; + struct player *owner = pcity->owner; int replace, style, prev; - style = plr->city_style; + style = source_player->city_style; prev = style; while ((replace = city_styles[prev].replaced_by) != -1) { prev = replace; - if (are_reqs_active(plr, NULL, NULL, NULL, NULL, NULL, NULL, + if (are_reqs_active(owner, NULL, NULL, NULL, NULL, NULL, NULL, &city_styles[replace].reqs)) { style = replace; } Index: common/city.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.h,v retrieving revision 1.223 diff -p -u -r1.223 city.h --- common/city.h 1 Aug 2005 23:09:36 -0000 1.223 +++ common/city.h 14 Sep 2005 01:33:11 -0000 @@ -462,7 +462,6 @@ int citygov_free_happy(const struct city /* city style functions */ int get_city_style(const struct city *pcity); -int get_player_city_style(const struct player *plr); int get_style_by_name(const char *); int get_style_by_name_orig(const char *); const char *get_city_style_name(int style); Index: common/packets.def =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v retrieving revision 1.155 diff -p -u -r1.155 packets.def --- common/packets.def 4 Sep 2005 04:31:17 -0000 1.155 +++ common/packets.def 14 Sep 2005 01:33:15 -0000 @@ -528,6 +528,8 @@ PACKET_CITY_INFO=21; sc,lsend BOOL did_buy, did_sell, was_happy, airlift, diplomat_investigate; BV_CITY_OPTIONS city_options; + + PLAYER original_owner; TURN turn_founded; end @@ -543,6 +545,7 @@ PACKET_CITY_SHORT_INFO=22; sc,lsend BV_IMPRS improvements; BOOL occupied; UINT16 tile_trade; + PLAYER original_owner; end PACKET_CITY_SELL=23;cs,dsend Index: server/citytools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v retrieving revision 1.348 diff -p -u -r1.348 citytools.c --- server/citytools.c 8 Sep 2005 19:51:23 -0000 1.348 +++ server/citytools.c 14 Sep 2005 01:33:22 -0000 @@ -1345,6 +1345,8 @@ static void package_dumb_city(struct pla } packet->improvements = pdcity->improvements; + + packet->original_owner = pcity->original ? pcity->original->player_no : -1; } /************************************************************************** @@ -1599,7 +1601,6 @@ void package_city(struct city *pcity, st packet->production_value = pcity->production.value; packet->turn_last_built=pcity->turn_last_built; - packet->turn_founded = pcity->turn_founded; packet->changed_from_id = pcity->changed_from.value; packet->changed_from_is_unit = pcity->changed_from.is_unit; packet->before_change_shields=pcity->before_change_shields; @@ -1607,6 +1608,9 @@ void package_city(struct city *pcity, st packet->caravan_shields=pcity->caravan_shields; packet->last_turns_shield_surplus = pcity->last_turns_shield_surplus; + packet->original_owner = pcity->original ? pcity->original->player_no : -1; + packet->turn_founded = pcity->turn_founded; + copy_worklist(&packet->worklist, &pcity->worklist); packet->diplomat_investigate=dipl_invest;
|