Changeset - r26690:a20b3b19a636
[Not reviewed]
master
0 3 0
Didac Perez Parera - 21 months ago 2022-12-25 18:42:50
perez.didac@gmail.com
Feature: Expand all towns in the scenario editor (#10215)
3 files changed with 13 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2851,6 +2851,8 @@ STR_FOUND_TOWN_RANDOM_TOWN_BUTTON       
 
STR_FOUND_TOWN_RANDOM_TOWN_TOOLTIP                              :{BLACK}Found town in random location
 
STR_FOUND_TOWN_MANY_RANDOM_TOWNS                                :{BLACK}Many random towns
 
STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP                             :{BLACK}Cover the map with randomly placed towns
 
STR_FOUND_TOWN_EXPAND_ALL_TOWNS                                 :{BLACK}Expand all towns
 
STR_FOUND_TOWN_EXPAND_ALL_TOWNS_TOOLTIP                         :{BLACK}Make all towns grow slightly
 

	
 
STR_FOUND_TOWN_NAME_TITLE                                       :{YELLOW}Town name:
 
STR_FOUND_TOWN_NAME_EDITOR_TITLE                                :{BLACK}Enter town name
src/town_gui.cpp
Show inline comments
 
@@ -1061,7 +1061,9 @@ static const NWidgetPart _nested_found_t
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_RANDOM_TOWN), SetMinimalSize(156, 12), SetFill(1, 0),
 
										SetDataTip(STR_FOUND_TOWN_RANDOM_TOWN_BUTTON, STR_FOUND_TOWN_RANDOM_TOWN_TOOLTIP), SetPadding(0, 2, 1, 2),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_MANY_RANDOM_TOWNS), SetMinimalSize(156, 12), SetFill(1, 0),
 
										SetDataTip(STR_FOUND_TOWN_MANY_RANDOM_TOWNS, STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP), SetPadding(0, 2, 0, 2),
 
										SetDataTip(STR_FOUND_TOWN_MANY_RANDOM_TOWNS, STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP), SetPadding(0, 2, 1, 2),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_EXPAND_ALL_TOWNS), SetMinimalSize(156, 12), SetFill(1, 0),
 
										SetDataTip(STR_FOUND_TOWN_EXPAND_ALL_TOWNS, STR_FOUND_TOWN_EXPAND_ALL_TOWNS_TOOLTIP), SetPadding(0, 2, 0, 2),
 
		/* Town name selection. */
 
		NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(156, 14), SetPadding(0, 2, 0, 2), SetDataTip(STR_FOUND_TOWN_NAME_TITLE, STR_NULL),
 
		NWidget(WWT_EDITBOX, COLOUR_GREY, WID_TF_TOWN_NAME_EDITBOX), SetMinimalSize(156, 12), SetPadding(0, 2, 3, 2),
 
@@ -1155,7 +1157,7 @@ public:
 
	void UpdateButtons(bool check_availability)
 
	{
 
		if (check_availability && _game_mode != GM_EDITOR) {
 
			this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_SIZE_LARGE, WIDGET_LIST_END);
 
			this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE, WIDGET_LIST_END);
 
			this->SetWidgetsDisabledState(_settings_game.economy.found_town != TF_CUSTOM_LAYOUT,
 
					WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM, WIDGET_LIST_END);
 
			if (_settings_game.economy.found_town != TF_CUSTOM_LAYOUT) town_layout = _settings_game.economy.town_layout;
 
@@ -1222,6 +1224,12 @@ public:
 
				break;
 
			}
 

	
 
			case WID_TF_EXPAND_ALL_TOWNS:
 
				for (Town *t : Town::Iterate()) {
 
					Command<CMD_EXPAND_TOWN>::Do(DC_EXEC, t->index, 0);
 
				}
 
				break;
 

	
 
			case WID_TF_SIZE_SMALL: case WID_TF_SIZE_MEDIUM: case WID_TF_SIZE_LARGE: case WID_TF_SIZE_RANDOM:
 
				this->town_size = (TownSize)(widget - WID_TF_SIZE_SMALL);
 
				this->UpdateButtons(false);
src/widgets/town_widget.h
Show inline comments
 
@@ -49,6 +49,7 @@ enum TownFoundingWidgets {
 
	WID_TF_NEW_TOWN,          ///< Create a new town.
 
	WID_TF_RANDOM_TOWN,       ///< Randomly place a town.
 
	WID_TF_MANY_RANDOM_TOWNS, ///< Randomly place many towns.
 
	WID_TF_EXPAND_ALL_TOWNS,  ///< Make all towns grow slightly.
 
	WID_TF_TOWN_NAME_EDITBOX, ///< Editor for the town name.
 
	WID_TF_TOWN_NAME_RANDOM,  ///< Generate a random town name.
 
	WID_TF_SIZE_SMALL,        ///< Selection for a small town.
0 comments (0 inline, 0 general)