Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
May 1999: [Freeciv-Dev] PATCH: showing red-tiles after a game is reloaded |
![]() |
[Freeciv-Dev] PATCH: showing red-tiles after a game is reloaded[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
A well-known problem, occuring the first turn after a game is loaded, is that the red border around tiles occupied by workers from other cities is not displayed. This is because from the three states at which the tiles around a city can be (C_TILE_EMPTY, C_TILE_WORKER, C_TILE_UNAVAILABLE) only the first two are saved. The following patch (against current CVS) fixes this. --rizos --- plrhand.c Sat May 8 07:28:31 1999 +++ /home/rizos/civ/freeciv-1.8.0/server/plrhand.c.new Thu May 20 22:49:41 1999 @@ -1233,8 +1233,10 @@ for(y=0; y<CITY_MAP_SIZE; y++) { for(x=0; x<CITY_MAP_SIZE; x++) { /* sorry, I have to change this to make ->worked work -- Syela */ - if (*p++=='1') set_worker_city(pcity, x, y, C_TILE_WORKER); - else set_worker_city(pcity, x, y, C_TILE_EMPTY); + if (*p=='0') set_worker_city(pcity, x, y, C_TILE_EMPTY); + else if (*p=='1') set_worker_city(pcity, x, y, C_TILE_WORKER); + else set_worker_city(pcity, x, y, C_TILE_UNAVAILABLE); + *p++; } } /* was pcity->city_map[x][y]=(*p++=='1') ? C_TILE_WORKER : C_TILE_EMPTY; */ @@ -1467,7 +1469,11 @@ j=0; for(y=0; y<CITY_MAP_SIZE; y++) for(x=0; x<CITY_MAP_SIZE; x++) - buf[j++]=(get_worker_city(pcity, x, y)==C_TILE_WORKER) ? '1' : '0'; + switch (get_worker_city(pcity, x, y)) + { case C_TILE_EMPTY: buf[j++] = '0'; break; + case C_TILE_WORKER: buf[j++] = '1'; break; + case C_TILE_UNAVAILABLE: buf[j++] = '2'; + } buf[j]='\0'; secfile_insert_str(file, buf, "player%d.c%d.workers", plrno, i);
|