diff -rc freeciv-1.10.0/client/gui-gtk/mapview.c freeciv-mod/client/gui-gtk/mapview.c *** freeciv-1.10.0/client/gui-gtk/mapview.c Tue Feb 15 13:32:37 2000 --- freeciv-mod/client/gui-gtk/mapview.c Mon Apr 17 06:25:08 2000 *************** *** 276,282 **** { char buffer[512]; ! my_snprintf(buffer, sizeof(buffer), "%d", seconds_to_turndone); gtk_set_label(timeout_label, buffer); } --- 276,289 ---- { char buffer[512]; ! if (seconds_to_turndone <= 999) ! my_snprintf(buffer, sizeof(buffer), "%d", seconds_to_turndone); ! else if (seconds_to_turndone <= 5940) /* 99 minutes */ ! my_snprintf(buffer, sizeof(buffer), "%dm", seconds_to_turndone/60); ! else if (seconds_to_turndone < 35640) /* 9.9 hours */ ! my_snprintf(buffer, sizeof(buffer), "%.1fh", seconds_to_turndone/3600.0); ! else ! my_snprintf(buffer, sizeof(buffer), "%dh", seconds_to_turndone/3600); gtk_set_label(timeout_label, buffer); } diff -rc freeciv-1.10.0/client/gui-xaw/mapview.c freeciv-mod/client/gui-xaw/mapview.c *** freeciv-1.10.0/client/gui-xaw/mapview.c Sun Jan 23 03:13:13 2000 --- freeciv-mod/client/gui-xaw/mapview.c Mon Apr 17 06:25:09 2000 *************** *** 261,267 **** { char buffer[512]; ! my_snprintf(buffer, sizeof(buffer), "%d", seconds_to_turndone); xaw_set_label(timeout_label, buffer); } --- 261,274 ---- { char buffer[512]; ! if (seconds_to_turndone <= 999) ! my_snprintf(buffer, sizeof(buffer), "%d", seconds_to_turndone); ! else if (seconds_to_turndone <= 5940) /* 99 minutes */ ! my_snprintf(buffer, sizeof(buffer), "%dm", seconds_to_turndone/60); ! else if (seconds_to_turndone < 35640) /* 9.9 hours */ ! my_snprintf(buffer, sizeof(buffer), "%.1fh", seconds_to_turndone/3600.0); ! else ! my_snprintf(buffer, sizeof(buffer), "%dh", seconds_to_turndone/3600); xaw_set_label(timeout_label, buffer); } diff -rc freeciv-1.10.0/client/packhand.c freeciv-mod/client/packhand.c *** freeciv-1.10.0/client/packhand.c Wed Jan 19 16:33:13 2000 --- freeciv-mod/client/packhand.c Tue Apr 18 04:49:23 2000 *************** *** 18,23 **** --- 18,27 ---- #include #include #include + #include + #ifdef HAVE_SYS_TIME_H + #include + #endif #include "capability.h" #include "capstr.h" *************** *** 637,643 **** game.techlevel=pinfo->techlevel; 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; --- 641,649 ---- game.techlevel=pinfo->techlevel; game.skill_level=pinfo->skill_level; game.timeout=pinfo->timeout; ! game.turn_start=pinfo->turn_start; ! if (game.timeout) ! seconds_to_turndone = game.turn_start + game.timeout - time(NULL); game.end_year=pinfo->end_year; game.year=pinfo->year; game.min_players=pinfo->min_players; diff -rc freeciv-1.10.0/common/game.h freeciv-mod/common/game.h *** freeciv-1.10.0/common/game.h Tue Feb 15 14:40:33 2000 --- freeciv-mod/common/game.h Tue Apr 18 04:52:30 2000 *************** *** 13,18 **** --- 13,23 ---- #ifndef FC__GAME_H #define FC__GAME_H + #include /* time_t */ + #ifdef HAVE_SYS_TIME_H + #include + #endif + #include "shared.h" #include "player.h" *************** *** 46,51 **** --- 51,57 ---- int tech; int skill_level; int timeout; + time_t turn_start; int end_year; int year; int techlevel; *************** *** 84,89 **** --- 90,96 ---- int add_to_size_limit; int spacerace; int turnblock; + int fixedlength; int num_unit_types; int num_tech_types; /* including A_NONE */ *************** *** 255,261 **** #define GAME_DEFAULT_TIMEOUT 0 #define GAME_MIN_TIMEOUT 0 ! #define GAME_MAX_TIMEOUT 999 #define GAME_DEFAULT_BARBARIANRATE 2 #define GAME_MIN_BARBARIANRATE 0 --- 262,268 ---- #define GAME_DEFAULT_TIMEOUT 0 #define GAME_MIN_TIMEOUT 0 ! #define GAME_MAX_TIMEOUT 86400 #define GAME_DEFAULT_BARBARIANRATE 2 #define GAME_MIN_BARBARIANRATE 0 diff -rc freeciv-1.10.0/common/packets.c freeciv-mod/common/packets.c *** freeciv-1.10.0/common/packets.c Sat Feb 19 05:15:47 2000 --- freeciv-mod/common/packets.c Tue Apr 18 01:57:46 2000 *************** *** 1383,1388 **** --- 1383,1389 ---- cptr=put_uint32(cptr, pinfo->skill_level); cptr=put_uint16(cptr, pinfo->timeout); + cptr=put_uint32(cptr, pinfo->turn_start); cptr=put_uint32(cptr, pinfo->end_year); cptr=put_uint32(cptr, pinfo->year); cptr=put_uint8(cptr, pinfo->min_players); *************** *** 1428,1433 **** --- 1429,1435 ---- iget_uint8(&iter, &pinfo->techlevel); iget_uint32(&iter, &pinfo->skill_level); iget_uint16(&iter, &pinfo->timeout); + iget_uint32(&iter, &pinfo->turn_start); iget_uint32(&iter, &pinfo->end_year); iget_uint32(&iter, &pinfo->year); iget_uint8(&iter, &pinfo->min_players); diff -rc freeciv-1.10.0/common/packets.h freeciv-mod/common/packets.h *** freeciv-1.10.0/common/packets.h Wed Jan 19 16:33:21 2000 --- freeciv-mod/common/packets.h Tue Apr 18 01:35:00 2000 *************** *** 694,699 **** --- 694,700 ---- int techlevel; int skill_level; int timeout; + time_t turn_start; int end_year; int year; int min_players, max_players, nplayers; diff -rc freeciv-1.10.0/server/civserver.c freeciv-mod/server/civserver.c *** freeciv-1.10.0/server/civserver.c Wed Feb 2 17:06:19 2000 --- freeciv-mod/server/civserver.c Tue Apr 18 04:02:17 2000 *************** *** 775,780 **** --- 775,781 ---- do_apollo_program(); make_history_report(); freelog(LOG_DEBUG, "Turn ended."); + game.turn_start = time(NULL); return 1; } *************** *** 828,833 **** --- 829,835 ---- server_state=SELECT_RACES_STATE; /* loaded ??? */ force_end_of_sniff=1; + game.turn_start = time(NULL); } *************** *** 1103,1108 **** --- 1105,1113 ---- { int i; + /* fixedlength is only applicable if we have a timeout set */ + if (game.fixedlength && game.timeout) + return 0; for(i=0; itime_at_turn_end) && (server_state == RUN_GAME_STATE)){ con_prompt_off(); return 0; --- 161,167 ---- if(select(max_desc+1, &readfs, NULL, NULL, &tv)==0) { /* timeout */ send_server_info_to_metaserver(0,0); if((game.timeout) ! && (time(NULL)>game.turn_start + game.timeout) && (server_state == RUN_GAME_STATE)){ con_prompt_off(); return 0; *************** *** 170,175 **** --- 171,178 ---- #endif continue; } + if (!game.timeout) + game.turn_start = time(NULL); if(FD_ISSET(sock, &readfs)) { /* new players connects */ freelog(LOG_VERBOSE, "got new connection"); *************** *** 225,232 **** con_prompt_off(); if((game.timeout) ! && (time(NULL)>time_at_turn_end) ! && (game.timeout)) return 0; return 1; } --- 228,234 ---- con_prompt_off(); if((game.timeout) ! && (time(NULL)>game.turn_start + game.timeout)) return 0; return 1; } diff -rc freeciv-1.10.0/server/stdinhand.c freeciv-mod/server/stdinhand.c *** freeciv-1.10.0/server/stdinhand.c Tue Feb 15 14:40:35 2000 --- freeciv-mod/server/stdinhand.c Tue Apr 18 03:52:53 2000 *************** *** 539,545 **** N_("Turn-blocking game play mode"), N_("If this is set to 1 the game turn is not advanced until all players " "have finished their turn, including disconnected players.") }, ! { "demography", NULL, SSET_META, SSET_TO_CLIENT, 0, 0, 0, --- 539,552 ---- N_("Turn-blocking game play mode"), N_("If this is set to 1 the game turn is not advanced until all players " "have finished their turn, including disconnected players.") }, ! ! { "fixedlength", &game.fixedlength, ! SSET_META, SSET_TO_CLIENT, ! 0, 1, 0, ! N_("Fixed-length turns play mode"), ! N_("If this is set to 1 the game turn will not advance until the timeout " ! "has expired, irrespective of players clicking on \"Turn Done\".") }, ! { "demography", NULL, SSET_META, SSET_TO_CLIENT, 0, 0, 0, *************** *** 2106,2111 **** --- 2113,2120 ---- settings[cmd].name, val); /* canonify map generator settings( all of which are int ) */ adjust_terrain_param(); + /* send any modified game parameters to the clients */ + send_game_info(0); } } else { cmd_reply(CMD_SET, caller, C_SYNTAX,