Add a build public roads button to the scenario editor
This commit is contained in:
@@ -3396,6 +3396,8 @@ STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND :{BLACK}Generate
|
|||||||
STR_TERRAFORM_SE_NEW_WORLD :{BLACK}Create new scenario
|
STR_TERRAFORM_SE_NEW_WORLD :{BLACK}Create new scenario
|
||||||
STR_TERRAFORM_RESET_LANDSCAPE :{BLACK}Reset landscape
|
STR_TERRAFORM_RESET_LANDSCAPE :{BLACK}Reset landscape
|
||||||
STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP :{BLACK}Remove all company-owned property from the map
|
STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP :{BLACK}Remove all company-owned property from the map
|
||||||
|
STR_TERRAFORM_PUBLIC_ROADS :{BLACK}Build public roads
|
||||||
|
STR_TERRAFORM_PUBLIC_ROADS_TOOLTIP :{BLACK}Build public roads between the towns on the map
|
||||||
|
|
||||||
STR_QUERY_RESET_LANDSCAPE_CAPTION :{WHITE}Reset Landscape
|
STR_QUERY_RESET_LANDSCAPE_CAPTION :{WHITE}Reset Landscape
|
||||||
STR_RESET_LANDSCAPE_CONFIRMATION_TEXT :{WHITE}Are you sure you want to remove all company-owned property?
|
STR_RESET_LANDSCAPE_CONFIRMATION_TEXT :{WHITE}Are you sure you want to remove all company-owned property?
|
||||||
|
@@ -1536,6 +1536,11 @@ static bool ChangeTrackTypeSortMode(int32 p1) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool PublicRoadsSettingChange(int32 p1) {
|
||||||
|
InvalidateWindowClassesData(WC_SCEN_LAND_GEN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Checks if any settings are set to incorrect values, and sets them to correct values in that case. */
|
/** Checks if any settings are set to incorrect values, and sets them to correct values in that case. */
|
||||||
static void ValidateSettings()
|
static void ValidateSettings()
|
||||||
{
|
{
|
||||||
|
@@ -63,6 +63,7 @@ static bool UpdateLinkgraphColours(int32 p1);
|
|||||||
static bool ClimateThresholdModeChanged(int32 p1);
|
static bool ClimateThresholdModeChanged(int32 p1);
|
||||||
static bool VelocityUnitsChanged(int32 p1);
|
static bool VelocityUnitsChanged(int32 p1);
|
||||||
static bool ChangeTrackTypeSortMode(int32 p1);
|
static bool ChangeTrackTypeSortMode(int32 p1);
|
||||||
|
static bool PublicRoadsSettingChange(int32 p1);
|
||||||
|
|
||||||
static bool UpdateClientName(int32 p1);
|
static bool UpdateClientName(int32 p1);
|
||||||
static bool UpdateServerPassword(int32 p1);
|
static bool UpdateServerPassword(int32 p1);
|
||||||
@@ -4080,13 +4081,14 @@ xref = ""game_creation.build_public_roads""
|
|||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = game_creation.build_public_roads
|
var = game_creation.build_public_roads
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY
|
guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO
|
||||||
def = 0
|
def = 0
|
||||||
min = 0
|
min = 0
|
||||||
max = 2
|
max = 2
|
||||||
str = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS
|
str = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS
|
||||||
strhelp = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_NONE
|
strval = STR_CONFIG_SETTING_BUILD_PUBLIC_ROADS_NONE
|
||||||
|
proc = PublicRoadsSettingChange
|
||||||
patxname = ""public_roads.game_creation.build_public_roads""
|
patxname = ""public_roads.game_creation.build_public_roads""
|
||||||
|
|
||||||
; locale
|
; locale
|
||||||
|
@@ -572,7 +572,12 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
|
|||||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_NEW_SCENARIO), SetMinimalSize(160, 12),
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_NEW_SCENARIO), SetMinimalSize(160, 12),
|
||||||
SetFill(1, 0), SetDataTip(STR_TERRAFORM_SE_NEW_WORLD, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetPadding(0, 2, 0, 2),
|
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),
|
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, 2, 2),
|
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(NWID_SPACER), SetMinimalSize(0, 2),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -617,8 +622,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
|||||||
ScenarioEditorLandscapeGenerationWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
ScenarioEditorLandscapeGenerationWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||||
{
|
{
|
||||||
this->CreateNestedTree();
|
this->CreateNestedTree();
|
||||||
NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT);
|
this->SetButtonStates();
|
||||||
show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
|
|
||||||
this->FinishInitNested(window_number);
|
this->FinishInitNested(window_number);
|
||||||
this->last_user_action = WIDGET_LIST_END;
|
this->last_user_action = WIDGET_LIST_END;
|
||||||
}
|
}
|
||||||
@@ -723,6 +727,12 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
|||||||
ShowQuery(STR_QUERY_RESET_LANDSCAPE_CAPTION, STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, nullptr, ResetLandscapeConfirmationCallback);
|
ShowQuery(STR_QUERY_RESET_LANDSCAPE_CAPTION, STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, nullptr, ResetLandscapeConfirmationCallback);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WID_ETT_PUBLIC_ROADS: { // Build public roads
|
||||||
|
extern void GeneratePublicRoads();
|
||||||
|
GeneratePublicRoads();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -798,6 +808,27 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
|
|||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some data on this window has become invalid.
|
||||||
|
* @param data Information about the changed data.
|
||||||
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
||||||
|
*/
|
||||||
|
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||||
|
{
|
||||||
|
if (!gui_scope) return;
|
||||||
|
|
||||||
|
this->SetButtonStates();
|
||||||
|
this->ReInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetButtonStates()
|
||||||
|
{
|
||||||
|
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;
|
static HotkeyList hotkeys;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ enum TerraformToolbarWidgets {
|
|||||||
/** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */
|
/** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */
|
||||||
enum EditorTerraformToolbarWidgets {
|
enum EditorTerraformToolbarWidgets {
|
||||||
WID_ETT_SHOW_PLACE_DESERT, ///< Should the place desert button be shown?
|
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_START, ///< Used for iterations.
|
||||||
WID_ETT_DOTS = WID_ETT_START, ///< Invisible widget for rendering the terraform size on.
|
WID_ETT_DOTS = WID_ETT_START, ///< Invisible widget for rendering the terraform size on.
|
||||||
WID_ETT_BUTTONS_START, ///< Start of pushable buttons.
|
WID_ETT_BUTTONS_START, ///< Start of pushable buttons.
|
||||||
@@ -44,6 +45,7 @@ enum EditorTerraformToolbarWidgets {
|
|||||||
WID_ETT_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size.
|
WID_ETT_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size.
|
||||||
WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario.
|
WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario.
|
||||||
WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property.
|
WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property.
|
||||||
|
WID_ETT_PUBLIC_ROADS, ///< Button for creating public roads.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WIDGETS_TERRAFORM_WIDGET_H */
|
#endif /* WIDGETS_TERRAFORM_WIDGET_H */
|
||||||
|
Reference in New Issue
Block a user