Binary files freeciv.current/a.gz and turn1/a.gz differ diff -Nurd -X freeciv.current/diff_ignore freeciv.current/client/gui-gtk/gui_main.c turn1/client/gui-gtk/gui_main.c --- freeciv.current/client/gui-gtk/gui_main.c Fri Aug 3 03:13:35 2001 +++ turn1/client/gui-gtk/gui_main.c Sat Aug 11 11:52:54 2001 @@ -847,10 +847,10 @@ char buf[512]; my_snprintf(buf, sizeof(buf), - _("%s People\nYear: %s\nGold: %d\nNet Income: %d\n" + _("%s People\nYear: %s Turn: %d\nGold: %d\nNet Income: %d\n" "Tax:%d Lux:%d Sci:%d\nResearching %s: %d/%d"), int_to_text(civ_population(game.player_ptr)), - textyear(game.year), + textyear(game.year),game.turn, game.player_ptr->economic.gold, turn_gold_difference, game.player_ptr->economic.tax, diff -Nurd -X freeciv.current/diff_ignore freeciv.current/client/gui-gtk/mapview.c turn1/client/gui-gtk/mapview.c --- freeciv.current/client/gui-gtk/mapview.c Mon Aug 6 23:10:13 2001 +++ turn1/client/gui-gtk/mapview.c Sat Aug 11 12:05:35 2001 @@ -501,13 +501,13 @@ gtk_frame_set_label( GTK_FRAME( main_frame_civ_name ), get_nation_name(game.player_ptr->nation) ); my_snprintf(buffer, sizeof(buffer), - _("Population: %s\nYear: %s\nGold %d\nTax: %d Lux: %d Sci: %d"), - int_to_text( civ_population( game.player_ptr ) ), - textyear( game.year ), - game.player_ptr->economic.gold, - game.player_ptr->economic.tax, - game.player_ptr->economic.luxury, - game.player_ptr->economic.science ); + _("Population: %s\nYear: %s Turn: %d\nGold %d\nTax: %d Lux: %d Sci: %d"), + int_to_text(civ_population(game.player_ptr)), + textyear(game.year), game.turn, + game.player_ptr->economic.gold, + game.player_ptr->economic.tax, + game.player_ptr->economic.luxury, + game.player_ptr->economic.science); gtk_set_label(main_label_info, buffer); diff -Nurd -X freeciv.current/diff_ignore freeciv.current/client/packhand.c turn1/client/packhand.c --- freeciv.current/client/packhand.c Tue Jul 31 15:46:19 2001 +++ turn1/client/packhand.c Sat Aug 11 12:14:55 2001 @@ -589,8 +589,12 @@ { update_turn_done_button(1); enable_turn_done_button(); - - game.year=ppacket->year; + + game.year = ppacket->year; + /* + * The turn was increased in handle_before_new_year() + */ + assert(game.turn == ppacket->turn); update_info_label(); player_set_unit_focus_status(game.player_ptr); @@ -632,6 +636,15 @@ plrdlg_update_delay_on(); report_update_delay_on(); meswin_update_delay_on(); + /* + * The local idea of the game turn is increased here since the + * client will get unit updates (reset of move points for example) + * between handle_before_new_year() and handle_new_year(). These + * unit updates will look like they did take place in the old turn + * which is incorrect. If we get the authoritative information about + * the game turn in handle_new_year() we will check it. + */ + game.turn++; } /************************************************************************** @@ -950,43 +963,45 @@ void handle_game_info(struct packet_game_info *pinfo) { int i, boot_help; - game.gold=pinfo->gold; - game.tech=pinfo->tech; - game.researchcost=pinfo->researchcost; - game.skill_level=pinfo->skill_level; - game.timeout=pinfo->timeout; - game.end_year=pinfo->end_year; - game.year=pinfo->year; - game.min_players=pinfo->min_players; - game.max_players=pinfo->max_players; - game.nplayers=pinfo->nplayers; - game.globalwarming=pinfo->globalwarming; - game.heating=pinfo->heating; - game.nuclearwinter=pinfo->nuclearwinter; - game.cooling=pinfo->cooling; - if(get_client_state()!=CLIENT_GAME_RUNNING_STATE) { + game.gold = pinfo->gold; + game.tech = pinfo->tech; + game.researchcost = pinfo->researchcost; + game.skill_level = pinfo->skill_level; + game.timeout = pinfo->timeout; + + game.end_year = pinfo->end_year; + game.year = pinfo->year; + game.turn = pinfo->turn; + game.min_players = pinfo->min_players; + game.max_players = pinfo->max_players; + game.nplayers = pinfo->nplayers; + game.globalwarming = pinfo->globalwarming; + game.heating = pinfo->heating; + game.nuclearwinter = pinfo->nuclearwinter; + game.cooling = pinfo->cooling; + if (get_client_state() != CLIENT_GAME_RUNNING_STATE) { game.player_idx = pinfo->player_idx; game.player_ptr = &game.players[game.player_idx]; } - for(i=0; iglobal_advances[i]; - for(i=0; iglobal_wonders[i]; - - if(get_client_state()!=CLIENT_GAME_RUNNING_STATE) { - if(get_client_state()==CLIENT_SELECT_RACE_STATE) + for (i = 0; i < A_LAST /*game.num_tech_types */ ; i++) + game.global_advances[i] = pinfo->global_advances[i]; + for (i = 0; i < B_LAST /*game.num_impr_types */ ; i++) + game.global_wonders[i] = pinfo->global_wonders[i]; + + if (get_client_state() != CLIENT_GAME_RUNNING_STATE) { + if (get_client_state() == CLIENT_SELECT_RACE_STATE) popdown_races_dialog(); } - game.techpenalty=pinfo->techpenalty; - game.foodbox=pinfo->foodbox; - game.civstyle=pinfo->civstyle; + game.techpenalty = pinfo->techpenalty; + game.foodbox = pinfo->foodbox; + game.civstyle = pinfo->civstyle; game.unhappysize = pinfo->unhappysize; game.cityfactor = pinfo->cityfactor; boot_help = (get_client_state() == CLIENT_GAME_RUNNING_STATE && game.spacerace != pinfo->spacerace); - game.spacerace=pinfo->spacerace; + game.spacerace = pinfo->spacerace; if (game.timeout) { if (pinfo->seconds_to_turndone) seconds_to_turndone = pinfo->seconds_to_turndone; @@ -995,7 +1010,7 @@ if (boot_help) { boot_help_texts(); /* reboot, after setting game.spacerace */ } - + update_unit_focus(); } diff -Nurd -X freeciv.current/diff_ignore freeciv.current/common/capstr.c turn1/common/capstr.c --- freeciv.current/common/capstr.c Fri Jun 29 21:39:04 2001 +++ turn1/common/capstr.c Sat Aug 11 12:15:58 2001 @@ -70,12 +70,14 @@ * are not directly related to the capability strings discussed here.) */ -#define CAPABILITY "+1.11.6 conn_info" +#define CAPABILITY "+1.11.6 conn_info turn" -/* "+1.11.6" is protocol for 1.11.6 beta release. +/* "+1.11.6 turn" is protocol for 1.11.6 beta release. "conn_info" is sending the conn_id field. To preserve compatability with old clients trying to connect this should persist across releases. + + "turn" additionally transfers game.turn to the client. */ void init_our_capability(void) diff -Nurd -X freeciv.current/diff_ignore freeciv.current/common/game.c turn1/common/game.c --- freeciv.current/common/game.c Tue Jun 26 20:10:42 2001 +++ turn1/common/game.c Sat Aug 11 11:52:54 2001 @@ -687,6 +687,7 @@ game.pingtimeout = GAME_DEFAULT_PINGTIMEOUT; game.end_year = GAME_DEFAULT_END_YEAR; game.year = GAME_START_YEAR; + game.turn = 0; game.min_players = GAME_DEFAULT_MIN_PLAYERS; game.max_players = GAME_DEFAULT_MAX_PLAYERS; game.aifill = GAME_DEFAULT_AIFILL; @@ -858,6 +859,7 @@ void game_advance_year(void) { game.year = game_next_year(game.year); + game.turn++; } diff -Nurd -X freeciv.current/diff_ignore freeciv.current/common/game.h turn1/common/game.h --- freeciv.current/common/game.h Mon Jul 2 16:28:03 2001 +++ turn1/common/game.h Sat Aug 11 11:52:54 2001 @@ -66,6 +66,7 @@ time_t turn_start; int end_year; int year; + int turn; int researchcost; /* Multiplier on cost of new research */ int diplcost, freecost, conquercost; int diplchance; diff -Nurd -X freeciv.current/diff_ignore freeciv.current/common/packets.c turn1/common/packets.c --- freeciv.current/common/packets.c Fri Jun 29 21:39:04 2001 +++ turn1/common/packets.c Sat Aug 11 11:52:54 2001 @@ -1809,6 +1809,10 @@ /* computed values */ cptr=put_uint32(cptr, pinfo->seconds_to_turndone); + if (pc && has_capability("turn", pc->capability)) { + cptr = put_uint32(cptr, pinfo->turn); + } + put_uint16(buffer, cptr-buffer); return send_connection_data(pc, buffer, cptr-buffer); @@ -1860,6 +1864,13 @@ /* computed values */ iget_uint32(&iter, &pinfo->seconds_to_turndone); + if (pc && has_capability("turn", pc->capability)) { + + iget_uint32(&iter, &pinfo->turn); + } else { + pinfo->turn = -1; + } + pack_iter_end(&iter, pc); remove_packet_from_buffer(pc->buffer); return pinfo; @@ -1971,6 +1982,9 @@ unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_NEW_YEAR); cptr=put_uint32(cptr, request->year); + if (pc && has_capability("turn", pc->capability)) { + cptr = put_uint32(cptr, request->turn); + } put_uint16(buffer, cptr-buffer); return send_connection_data(pc, buffer, cptr-buffer); } @@ -2347,6 +2361,13 @@ pack_iter_init(&iter, pc); iget_uint32(&iter, &packet->year); + + if (pc && has_capability("turn", pc->capability)) { + + iget_uint32(&iter, &packet->turn); + } else { + packet->turn = -3; + } pack_iter_end(&iter, pc); remove_packet_from_buffer(pc->buffer); diff -Nurd -X freeciv.current/diff_ignore freeciv.current/common/packets.h turn1/common/packets.h --- freeciv.current/common/packets.h Fri Jun 29 21:39:05 2001 +++ turn1/common/packets.h Sat Aug 11 11:52:54 2001 @@ -264,7 +264,7 @@ send to each client whenever the turn has ended. *********************************************************/ struct packet_new_year { - int year; + int year, turn; }; @@ -789,6 +789,7 @@ int timeout; int end_year; int year; + int turn; int min_players, max_players, nplayers; int player_idx; int globalwarming; diff -Nurd -X freeciv.current/diff_ignore freeciv.current/server/gamehand.c turn1/server/gamehand.c --- freeciv.current/server/gamehand.c Sat Apr 14 13:30:45 2001 +++ turn1/server/gamehand.c Sat Aug 11 12:16:53 2001 @@ -164,6 +164,7 @@ } apacket.year = year; + apacket.turn = game.turn; lsend_packet_new_year(&game.est_connections, &apacket); /* Hmm, clients could add this themselves based on above packet? */ @@ -192,36 +193,39 @@ struct packet_game_info ginfo; int i; - if (dest==NULL) dest = &game.est_connections; - - ginfo.gold=game.gold; - ginfo.tech=game.tech; - ginfo.researchcost=game.researchcost; - ginfo.skill_level=game.skill_level; - ginfo.timeout=game.timeout; - ginfo.end_year=game.end_year; - ginfo.year=game.year; - ginfo.min_players=game.min_players; - ginfo.max_players=game.max_players; - ginfo.nplayers=game.nplayers; - ginfo.globalwarming=game.globalwarming; - ginfo.heating=game.heating; - ginfo.nuclearwinter=game.nuclearwinter; - ginfo.cooling=game.cooling; - ginfo.techpenalty=game.techpenalty; + if (dest == NULL) + dest = &game.est_connections; + + ginfo.gold = game.gold; + ginfo.tech = game.tech; + ginfo.researchcost = game.researchcost; + ginfo.skill_level = game.skill_level; + ginfo.timeout = game.timeout; + ginfo.end_year = game.end_year; + ginfo.year = game.year; + ginfo.turn = game.turn; + ginfo.min_players = game.min_players; + ginfo.max_players = game.max_players; + ginfo.nplayers = game.nplayers; + ginfo.globalwarming = game.globalwarming; + ginfo.heating = game.heating; + ginfo.nuclearwinter = game.nuclearwinter; + ginfo.cooling = game.cooling; + ginfo.techpenalty = game.techpenalty; ginfo.foodbox = game.foodbox; - ginfo.civstyle=game.civstyle; + ginfo.civstyle = game.civstyle; ginfo.spacerace = game.spacerace; ginfo.unhappysize = game.unhappysize; ginfo.cityfactor = game.cityfactor; - for(i=0; i