Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
September 2004: [Freeciv-Dev] (PR#9563) Error in specialist change request from client. |
![]() |
[Freeciv-Dev] (PR#9563) Error in specialist change request from client.[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9563 > I added some logging (see attached patch) and got this result: 2: make: Sheffield(8) : 0; 0,2,0 1: No worker. 2: Now 0,2,0 2: change: Sheffield(8) : 1 => 0; 0,2,0 2: Changing 2: Now 1,1,0 2: Remove: Sheffield(8) : 1,1,0 2: Removing 0 2: Now 0,1,0 2: Remove: Sheffield(8) : 0,1,0 2: Removing 1 2: Now 0,0,0 > 2: make: Sheffield(8) : 0; 0,0,0 1: No worker. 2: Now 0,0,0 2: change: Sheffield(8) : 0 => 1; 0,0,0 1: Error in specialist change request from client. > 2: make: Sheffield(8) : 0; 0,0,0 1: No worker. 2: Now 0,0,0 2: change: Sheffield(8) : 0 => 1; 0,0,0 1: Error in specialist change request from client. > 2: make: Sheffield(8) : 0; 0,0,0 1: No worker. 2: Now 0,0,0 2: change: Sheffield(8) : 0 => 1; 0,0,0 1: Error in specialist change request from client. > 2: make: Sheffield(8) : 0; 0,0,0 1: No worker. 2: Now 0,0,0 2: change: Sheffield(8) : 0 => 1; 0,0,0 1: Error in specialist change request from client. So the client is trying to make a specialist out of a worker that isn't there. This change fails silently but it causes an error in the next step. (There's no real reason why one is a LOG_ERROR and not the other. However this does cause the "changed multiple times" error in the client because the CMA gets confused.) jason Index: server/cityhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v retrieving revision 1.134 diff -u -r1.134 cityhand.c --- server/cityhand.c 28 Aug 2004 19:15:39 -0000 1.134 +++ server/cityhand.c 3 Sep 2004 21:39:58 -0000 @@ -72,6 +72,10 @@ return; } + freelog(LOG_NORMAL, "change: %s(%d) : %d => %d; %d,%d,%d", + pcity->name, pcity->size, from, to, + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); if (to < 0 || to >= SP_COUNT || from < 0 || from >= SP_COUNT || !city_can_use_specialist(pcity, to) @@ -80,9 +84,13 @@ return; } + freelog(LOG_NORMAL, " Changing"); pcity->specialists[from]--; pcity->specialists[to]++; + freelog(LOG_NORMAL, " Now %d,%d,%d", + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); sanity_check_city(pcity); city_refresh(pcity); send_city_info(pplayer, pcity); @@ -99,6 +107,11 @@ if (!pcity) { return; } + + freelog(LOG_NORMAL, "make: %s(%d) : %d; %d,%d,%d", + pcity->name, pcity->size, SP_ELVIS, + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); if (is_city_center(worker_x, worker_y)) { auto_arrange_workers(pcity); sync_cities(); @@ -107,12 +120,17 @@ if (is_worker_here(pcity, worker_x, worker_y)) { server_remove_worker_city(pcity, worker_x, worker_y); pcity->specialists[SP_ELVIS]++; + freelog(LOG_NORMAL, " Making"); city_refresh(pcity); sync_cities(); } else { + freelog(LOG_ERROR, " No worker."); notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT, _("Game: You don't have a worker here.")); } + freelog(LOG_NORMAL, " Now %d,%d,%d", + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); sanity_check_city(pcity); } @@ -135,6 +153,11 @@ return; } + freelog(LOG_NORMAL, "Remove: %s(%d) : %d,%d,%d", + pcity->name, pcity->size, + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); + if (is_city_center(worker_x, worker_y)) { auto_arrange_workers(pcity); sync_cities(); @@ -149,12 +172,16 @@ for (i = 0; i < SP_COUNT; i++) { if (pcity->specialists[i] > 0) { + freelog(LOG_NORMAL, " Removing %d", i); pcity->specialists[i]--; break; } } assert(i < SP_COUNT); + freelog(LOG_NORMAL, " Now %d,%d,%d", + pcity->specialists[0], + pcity->specialists[1], pcity->specialists[2]); sanity_check_city(pcity); city_refresh(pcity); sync_cities();
|