diff client/packhand.c client/packhand.c --- client/packhand.c Fri Jul 28 21:47:59 2000 +++ client/packhand.c Sat Jul 29 02:40:49 2000 @@ -333,6 +333,15 @@ } } + pcity->style=packet->style; + + /* When removing capability checks for "keep_citystyle", remove also + this */ + if (pcity->style==-1) { + pcity->original=pcity->owner; /* Client does not know truth about this. */ + pcity->style=update_city_style(pcity); + } + if(draw_map_grid && city_is_new && get_client_state()==CLIENT_GAME_RUNNING_STATE) { /* just to update grid; slow, but doesn't happen very often --jjm */ diff client/tilespec.c client/tilespec.c --- client/tilespec.c Tue Jul 11 10:12:35 2000 +++ client/tilespec.c Fri Jul 28 22:49:21 2000 @@ -715,14 +715,13 @@ **************************************************************************/ static struct Sprite *get_city_sprite(struct city *pcity) { - int size, style; - - style = get_city_style(pcity); /* get style and match the best tile */ - /* based on city size */ - for( size=0; size < city_styles[style].tiles_num; size++) - if( pcity->size < city_styles[style].tresh[size]) + int size; + + /* Match the best tile based on city size */ + for( size=0; size < city_styles[pcity->style].tiles_num; size++) + if( pcity->size < city_styles[pcity->style].tresh[size]) break; - return sprites.city.tile[style][size-1]; + return sprites.city.tile[pcity->style][size-1]; } /************************************************************************** @@ -730,9 +729,7 @@ **************************************************************************/ static struct Sprite *get_city_wall_sprite(struct city *pcity) { - int style = get_city_style(pcity); - - return sprites.city.tile[style][city_styles[style].tiles_num]; + return sprites.city.tile[pcity->style][city_styles[pcity->style].tiles_num]; } /************************************************************************** @@ -740,9 +737,7 @@ **************************************************************************/ static struct Sprite *get_city_occupied_sprite(struct city *pcity) { - int style = get_city_style(pcity); - - return sprites.city.tile[style][city_styles[style].tiles_num+1]; + return sprites.city.tile[pcity->style][city_styles[pcity->style].tiles_num+1]; } /********************************************************************** diff common/capstr.c common/capstr.c --- common/capstr.c Fri Jul 28 21:48:32 2000 +++ common/capstr.c Sat Jul 29 02:40:21 2000 @@ -72,7 +72,7 @@ #define CAPABILITY "+1.11 diplomat_investigate_fix production_change_fix" \ " game_ruleset nuclear_fallout land_channel_requirement event_wonder_obsolete" \ -" event00_fix" +" event00_fix keep_citystyle" /* "+1.11" is protocol for 1.11.0 stable release. @@ -100,6 +100,9 @@ "event00_fix" is that client understands that negative positions for events means no position. Previous clients expect (0,0), which is also a genuine position. + + "keep_citystyle" allows citystyle of conquered cities to depend on + original owner. */ void init_our_capability(void) diff common/city.c common/city.c --- common/city.c Fri Jul 28 21:47:59 2000 +++ common/city.c Sat Jul 29 02:26:13 2000 @@ -1328,12 +1328,12 @@ /************************************************************************** Evaluate which style should be used to draw a city. **************************************************************************/ -int get_city_style(struct city *pcity) +int update_city_style(struct city *pcity) { int replac, style; struct player *plr = &game.players[pcity->owner]; - style = plr->city_style; + style = game.players[pcity->original].city_style; while( ((replac = city_styles[style].replaced_by) != -1) && (get_invention( plr, city_styles[replac].techreq) == TECH_KNOWN) ) { diff common/city.h common/city.h --- common/city.h Fri Jul 28 21:47:59 2000 +++ common/city.h Sat Jul 29 02:26:13 2000 @@ -367,6 +367,8 @@ struct unit_list info_units_present; struct ai_city ai; + + int style; }; /* city drawing styles */ @@ -493,7 +495,7 @@ int citygov_free_gold(struct city *pcity, struct government *gov); /* city style functions */ -int get_city_style(struct city *pcity); +int update_city_style(struct city *pcity); int get_style_by_name(char *); #endif /* FC__CITY_H */ diff common/packets.c common/packets.c --- common/packets.c Fri Jul 28 21:47:59 2000 +++ common/packets.c Sat Jul 29 02:40:21 2000 @@ -2064,7 +2064,11 @@ /* only 8 options allowed before need to extend protocol */ cptr=put_uint8(cptr, req->city_options); - + +if (pc && has_capability("keep_citystyle", pc->capability)) { + cptr=put_uint8(cptr, req->style); +} + for(data=0;data<4;data++) { if(req->trade[data]) { cptr=put_uint16(cptr, req->trade[data]); @@ -2154,6 +2158,15 @@ sizeof(packet->improvements)); iget_uint8(&iter, &packet->city_options); + +if (pc && has_capability("keep_citystyle", pc->capability)) { + iget_uint8(&iter, &packet->style); +} else { + /* This forces client to figure it out at handle_city_info(). + When removing has_capability(), edit also that checking against + -1 at handle_city_info(). */ + packet->style = -1; +} for(data=0;data<4;data++) { if (pack_iter_remaining(&iter) < 3) diff common/packets.h common/packets.h --- common/packets.h Fri Jul 28 21:47:59 2000 +++ common/packets.h Fri Jul 28 22:30:12 2000 @@ -352,6 +352,8 @@ int airlift; int diplomat_investigate; int city_options; + + int style; }; diff server/cityhand.c server/cityhand.c --- server/cityhand.c Fri Jul 28 21:47:59 2000 +++ server/cityhand.c Sat Jul 29 02:26:12 2000 @@ -993,6 +993,7 @@ for(i=0; iimprovements[i]) ? '1' : '0'; *p='\0'; + packet->style=update_city_style(pcity); } /************************************************************************** @@ -1084,6 +1085,8 @@ for(x=0; xstyle=pdcity->style; } /************************************************************************** @@ -1108,6 +1111,7 @@ pdcity->size = pcity->size; pdcity->has_walls = city_got_citywalls(pcity); pdcity->owner = pcity->owner; + pdcity->style = update_city_style(pcity); } /************************************************************************** diff server/maphand.c server/maphand.c --- server/maphand.c Fri Jul 28 19:40:24 2000 +++ server/maphand.c Fri Jul 28 22:49:40 2000 @@ -1183,6 +1183,7 @@ dest_city->size = from_city->size; dest_city->has_walls = from_city->has_walls; dest_city->owner = from_city->owner; + dest_city->style = from_city->style; send_city_info_at_tile(pdest,x,y); } } diff server/maphand.h server/maphand.h --- server/maphand.h Tue Jul 25 21:18:35 2000 +++ server/maphand.h Fri Jul 28 22:30:12 2000 @@ -24,6 +24,7 @@ unsigned short size; unsigned char has_walls; unsigned char owner; + unsigned char style; }; struct player_tile{ diff server/plrhand.c server/plrhand.c --- server/plrhand.c Fri Jul 28 19:40:24 2000 +++ server/plrhand.c Sat Jul 29 00:05:40 2000 @@ -2687,6 +2687,12 @@ pdcity->size = secfile_lookup_int(file, "player%d.dc%d.size", plrno, j); pdcity->has_walls = secfile_lookup_int(file, "player%d.dc%d.has_walls", plrno, j); pdcity->owner = secfile_lookup_int(file, "player%d.dc%d.owner", plrno, j); + pdcity->style = secfile_lookup_int_default(file, 255, + "player%d.dc%d.style", plrno, j); + if (pdcity->style==255) { /* Old savegames */ + /* Should probably use style modified with current techs. */ + pdcity->style=game.players[pdcity->owner].city_style; + } map_get_player_tile(x, y, plrno)->city = pdcity; alloc_id(pdcity->id); } @@ -3032,6 +3038,7 @@ secfile_insert_int(file, pdcity->size, "player%d.dc%d.size", plrno, i); secfile_insert_int(file, pdcity->has_walls, "player%d.dc%d.has_walls", plrno, i); secfile_insert_int(file, pdcity->owner, "player%d.dc%d.owner", plrno, i); + secfile_insert_int(file, pdcity->style, "player%d.dc%d.style", plrno, i); i++; } }