<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40466 >
As mentioned on the forums: http://forum.freeciv.org/viewtopic.php?p=21251 Patch prevents setting timeout values greater than zero but less than 30 seconds, preventing abuse due to e.g. timeout=1. ---------------------------------------------------------------------- 犯罪者は処刑される。
diff --git a/server/settings.c b/server/settings.c index e1bb83b..484fc45 100644 --- a/server/settings.c +++ b/server/settings.c @@ -196,6 +196,19 @@ static bool aifill_callback(int value, const char **error_string) return TRUE; } +/************************************************************************* + Check that the timeout value is reasonable. +*************************************************************************/ +static bool timeout_callback(int value, const char **error_string) +{ + if (0 < value && value < 30) { + *error_string = _("That timeout value is too low."); + return FALSE; + } + *error_string = NULL; + return TRUE; +} + #define GEN_BOOL(name, value, sclass, scateg, slevel, to_client, \ short_help, extra_help, func, default) \ {name, sclass, to_client, short_help, extra_help, SSET_BOOL, \ @@ -884,11 +897,13 @@ struct settings_s settings[] = { N_("Maximum seconds per turn"), N_("If all players have not hit \"Turn Done\" before this " "time is up, then the turn ends automatically. Zero " - "means there is no timeout. In servers compiled with " + "means there is no timeout, and positive values below " + "30 are not allowed. In servers compiled with " "debugging, a timeout " "of -1 sets the autogame test mode. Use this with the command " - "\"timeoutincrease\" to have a dynamic timer."), NULL, - GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, GAME_DEFAULT_TIMEOUT) + "\"timeoutincrease\" to have a dynamic timer."), + timeout_callback, GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, + GAME_DEFAULT_TIMEOUT) GEN_INT("timeaddenemymove", game.timeoutaddenemymove, SSET_META, SSET_INTERNAL, SSET_VITAL, SSET_TO_CLIENT,
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev