From 6f9f6c423169a78a9e1e0653d312249942e6b449 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 15 Jan 2022 15:52:58 +0200 Subject: [PATCH 46/46] Rename server setting "spaceship_travel_time" as "spaceship_travel_pct" See osdn #42102 Signed-off-by: Marko Lindqvist --- common/game.c | 2 +- common/game.h | 8 ++++---- server/setcompat.c | 1 + server/settings.c | 6 +++--- server/spacerace.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/game.c b/common/game.c index 27db3dce00..b7c7c7bde7 100644 --- a/common/game.c +++ b/common/game.c @@ -415,7 +415,7 @@ static void game_defaults(bool keep_ruleset_value) game.server.scoreturn = GAME_DEFAULT_SCORETURN - 1; game.server.seed = GAME_DEFAULT_SEED; sz_strlcpy(game.server.start_units, GAME_DEFAULT_START_UNITS); - game.server.spaceship_travel_time = GAME_DEFAULT_SPACESHIP_TRAVEL_TIME; + game.server.spaceship_travel_pct = GAME_DEFAULT_SPACESHIP_TRAVEL_PCT; game.server.start_year = GAME_DEFAULT_START_YEAR; game.server.tcptimeout = GAME_DEFAULT_TCPTIMEOUT; game.server.techlost_donor = GAME_DEFAULT_TECHLOST_DONOR; diff --git a/common/game.h b/common/game.h index 352d7d6190..1ed67f1025 100644 --- a/common/game.h +++ b/common/game.h @@ -174,7 +174,7 @@ struct civ_game { int razechance; unsigned revealmap; int revolution_length; - int spaceship_travel_time; + int spaceship_travel_pct; bool threaded_save; int save_compress_level; enum fz_method save_compress_type; @@ -566,9 +566,9 @@ extern struct world wld; #define GAME_DEFAULT_VICTORY_CONDITIONS (1 << VC_SPACERACE | 1 << VC_ALLIED) #define GAME_DEFAULT_END_SPACESHIP TRUE -#define GAME_DEFAULT_SPACESHIP_TRAVEL_TIME 100 -#define GAME_MIN_SPACESHIP_TRAVEL_TIME 50 -#define GAME_MAX_SPACESHIP_TRAVEL_TIME 1000 +#define GAME_DEFAULT_SPACESHIP_TRAVEL_PCT 100 +#define GAME_MIN_SPACESHIP_TRAVEL_PCT 50 +#define GAME_MAX_SPACESHIP_TRAVEL_PCT 1000 #define GAME_DEFAULT_TURNBLOCK TRUE diff --git a/server/setcompat.c b/server/setcompat.c index c755510cb8..020ba2589d 100644 --- a/server/setcompat.c +++ b/server/setcompat.c @@ -30,6 +30,7 @@ struct set_name_compat { static struct set_name_compat set_name_compat_S3_1_to_S3_2[] = { + { "spaceship_travel_time", "spaceship_travel_pct" }, { NULL, NULL } }; diff --git a/server/settings.c b/server/settings.c index 63215e2972..81e47a74e4 100644 --- a/server/settings.c +++ b/server/settings.c @@ -2504,14 +2504,14 @@ static struct setting settings[] = { "arrival of a spaceship at Alpha Centauri."), NULL, NULL, GAME_DEFAULT_END_SPACESHIP) - GEN_INT("spaceship_travel_time", game.server.spaceship_travel_time, + GEN_INT("spaceship_travel_pct", game.server.spaceship_travel_pct, SSET_RULES_FLEXIBLE, SSET_SCIENCE, SSET_VITAL, ALLOW_NONE, ALLOW_BASIC, N_("Percentage to multiply spaceship travel time by"), N_("This percentage is multiplied onto the time it will take for " "a spaceship to arrive at Alpha Centauri."), NULL, NULL, NULL, - GAME_MIN_SPACESHIP_TRAVEL_TIME, GAME_MAX_SPACESHIP_TRAVEL_TIME, - GAME_DEFAULT_SPACESHIP_TRAVEL_TIME) + GAME_MIN_SPACESHIP_TRAVEL_PCT, GAME_MAX_SPACESHIP_TRAVEL_PCT, + GAME_DEFAULT_SPACESHIP_TRAVEL_PCT) GEN_INT("civilwarsize", game.server.civilwarsize, SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE, diff --git a/server/spacerace.c b/server/spacerace.c index 95f05e670b..4e97a85854 100644 --- a/server/spacerace.c +++ b/server/spacerace.c @@ -115,7 +115,7 @@ void spaceship_calc_derived(struct player_spaceship *ship) Actually, the Civ1 manual suggests travel time is relevant. --dwp */ - ship->travel_time = ship->mass * game.server.spaceship_travel_time + ship->travel_time = ship->mass * game.server.spaceship_travel_pct / 100 / (200.0 * MIN(propulsion,fuel) + 20.0); } -- 2.34.1