Always enable public roads button in scenario editor

tmp-jgrpp
Jonathan G Rennison 2 weeks ago
parent 0badb27b7c
commit 8e0a1fa8ae

@ -46,7 +46,7 @@ void GenerateClearTile();
void GenerateIndustries();
void GenerateObjects();
void GenerateTrees();
void GeneratePublicRoads();
extern void GeneratePublicRoads(PublicRoadsConstruction build_mode);
void StartupEconomy();
void StartupCompanies();
@ -157,7 +157,7 @@ static void _GenerateWorld()
GenerateIndustries();
GenerateObjects();
GenerateTrees();
GeneratePublicRoads();
GeneratePublicRoads(_settings_game.game_creation.build_public_roads);
}
}

@ -309,6 +309,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32_t p1, uint3
static RoadType _public_road_type;
static const uint _public_road_hash_size = 8U; ///< The number of bits the hash for river finding should have.
static PublicRoadsConstruction _public_road_mode = PRC_NONE;
/** Helper function to check if a slope along a certain direction is going up an inclined slope. */
static bool IsUpwardsSlope(const Slope slope, DiagDirection road_direction)
@ -893,7 +894,7 @@ static int32_t PublicRoad_CalculateG(AyStar *, AyStarNode *current, OpenListNode
}
}
if (_settings_game.game_creation.build_public_roads == PRC_AVOID_CURVES &&
if (_public_road_mode == PRC_AVOID_CURVES &&
parent->path.parent != nullptr &&
DiagdirBetweenTiles(parent->path.parent->node.tile, parent->path.node.tile) != DiagdirBetweenTiles(parent->path.node.tile, current->tile)) {
cost += 1;
@ -977,9 +978,11 @@ void PostProcessNetworks(AyStar &finder, const std::vector<std::unique_ptr<TownN
/**
* Build the public road network connecting towns using AyStar.
*/
void GeneratePublicRoads()
void GeneratePublicRoads(PublicRoadsConstruction build_mode)
{
if (_settings_game.game_creation.build_public_roads == PRC_NONE) return;
if (build_mode == PRC_NONE) return;
_public_road_mode = build_mode;
std::vector<TileIndex> towns;
towns.clear();

@ -1775,10 +1775,6 @@ static void ChangeTrackTypeSortMode(int32_t new_value) {
MarkWholeScreenDirty();
}
static void PublicRoadsSettingChange(int32_t new_value) {
InvalidateWindowClassesData(WC_SCEN_LAND_GEN);
}
static void TrainSpeedAdaptationChanged(int32_t new_value) {
extern void ClearAllSignalSpeedRestrictions();
ClearAllSignalSpeedRestrictions();

@ -16,7 +16,6 @@ static void UpdateFreeformEdges(int32_t new_value);
static bool CheckMapEdgeMode(int32_t &new_value);
static void MapEdgeModeChanged(int32_t new_value);
static void ClimateThresholdModeChanged(int32_t new_value);
static void PublicRoadsSettingChange(int32_t new_value);
static void MarkAllViewportsDirty(int32_t new_value);
static bool AllowRoadStopsUnderBridgesSettingGUI(SettingOnGuiCtrlData &data);
@ -500,7 +499,6 @@ max = PRC_END - 1
str = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS
strhelp = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_HELPTEXT
strval = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_NONE
post_cb = PublicRoadsSettingChange
patxname = ""public_roads.game_creation.build_public_roads""
[SDT_VAR]

@ -563,10 +563,8 @@ static constexpr NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
SetFill(1, 0), SetDataTip(STR_TERRAFORM_SE_NEW_WORLD, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetPadding(0, 2, 0, 2),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_RESET_LANDSCAPE), SetMinimalSize(160, 12),
SetFill(1, 0), SetDataTip(STR_TERRAFORM_RESET_LANDSCAPE, STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP), SetPadding(1, 2, 0, 2),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_ETT_SHOW_PUBLIC_ROADS),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_PUBLIC_ROADS), SetMinimalSize(160, 12),
SetFill(1, 0), SetDataTip(STR_TERRAFORM_PUBLIC_ROADS, STR_TERRAFORM_PUBLIC_ROADS_TOOLTIP), SetPadding(1, 2, 0, 2),
EndContainer(),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_PUBLIC_ROADS), SetMinimalSize(160, 12),
SetFill(1, 0), SetDataTip(STR_TERRAFORM_PUBLIC_ROADS, STR_TERRAFORM_PUBLIC_ROADS_TOOLTIP), SetPadding(1, 2, 0, 2),
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
EndContainer(),
};
@ -713,8 +711,10 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
break;
case WID_ETT_PUBLIC_ROADS: { // Build public roads
extern void GeneratePublicRoads();
GeneratePublicRoads();
extern void GeneratePublicRoads(PublicRoadsConstruction build_mode);
PublicRoadsConstruction build_mode = _settings_game.game_creation.build_public_roads;
if (build_mode == PRC_NONE) build_mode = PRC_WITH_CURVES;
GeneratePublicRoads(build_mode);
break;
}
@ -807,8 +807,6 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
{
NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
NWidgetStacked *show_public_roads = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PUBLIC_ROADS);
show_public_roads->SetDisplayedPlane(_settings_game.game_creation.build_public_roads != 0 ? 0 : SZSP_NONE);
}
static HotkeyList hotkeys;

@ -30,7 +30,6 @@ enum TerraformToolbarWidgets : WidgetID {
/** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */
enum EditorTerraformToolbarWidgets : WidgetID {
WID_ETT_SHOW_PLACE_DESERT, ///< Should the place desert button be shown?
WID_ETT_SHOW_PUBLIC_ROADS, ///< Should the public roads button be shown?
WID_ETT_START, ///< Used for iterations.
WID_ETT_DOTS = WID_ETT_START, ///< Invisible widget for rendering the terraform size on.
WID_ETT_BUTTONS_START, ///< Start of pushable buttons.

Loading…
Cancel
Save