Update to 12.0-beta1
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "querystring_gui.h"
|
||||
#include "window_func.h"
|
||||
#include "townname_func.h"
|
||||
#include "core/backup_type.hpp"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "genworld.h"
|
||||
#include "stringfilter_type.h"
|
||||
@@ -84,8 +85,7 @@ private:
|
||||
static int GetNthSetBit(uint32 bits, int n)
|
||||
{
|
||||
if (n >= 0) {
|
||||
uint i;
|
||||
FOR_EACH_SET_BIT(i, bits) {
|
||||
for (uint i : SetBitIterator(bits)) {
|
||||
n--;
|
||||
if (n < 0) return i;
|
||||
}
|
||||
@@ -336,9 +336,10 @@ public:
|
||||
this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server);
|
||||
}
|
||||
|
||||
~TownViewWindow()
|
||||
void Close() override
|
||||
{
|
||||
SetViewportCatchmentTown(Town::Get(this->window_number), false);
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override
|
||||
@@ -435,7 +436,7 @@ public:
|
||||
}
|
||||
|
||||
if (!this->town->text.empty()) {
|
||||
SetDParamStr(0, this->town->text.c_str());
|
||||
SetDParamStr(0, this->town->text);
|
||||
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y += FONT_HEIGHT_NORMAL, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK);
|
||||
}
|
||||
}
|
||||
@@ -517,7 +518,7 @@ public:
|
||||
if (_settings_game.economy.station_noise_level) aimed_height += FONT_HEIGHT_NORMAL;
|
||||
|
||||
if (!this->town->text.empty()) {
|
||||
SetDParamStr(0, this->town->text.c_str());
|
||||
SetDParamStr(0, this->town->text);
|
||||
aimed_height += GetStringHeight(STR_JUST_RAW_STRING, width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT);
|
||||
}
|
||||
|
||||
@@ -576,7 +577,7 @@ static const NWidgetPart _nested_town_game_view_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN),
|
||||
NWidget(WWT_INSET, COLOUR_BROWN), SetPadding(2, 2, 2, 2),
|
||||
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 0), SetResize(1, 1), SetPadding(1, 1, 1, 1),
|
||||
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 0), SetResize(1, 1),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TV_INFO), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
|
||||
@@ -606,7 +607,7 @@ static const NWidgetPart _nested_town_editor_view_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN),
|
||||
NWidget(WWT_INSET, COLOUR_BROWN), SetPadding(2, 2, 2, 2),
|
||||
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 1), SetResize(1, 1), SetPadding(1, 1, 1, 1),
|
||||
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 1), SetResize(1, 1),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TV_INFO), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
|
||||
@@ -647,12 +648,12 @@ static const NWidgetPart _nested_town_directory_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_TD_SORT_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
|
||||
NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_TD_FILTER), SetFill(35, 12), SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
|
||||
NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_TD_FILTER), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TD_LIST), SetMinimalSize(196, 0), SetDataTip(0x0, STR_TOWN_DIRECTORY_LIST_TOOLTIP),
|
||||
SetFill(1, 0), SetResize(0, 10), SetScrollbar(WID_TD_SCROLLBAR), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TD_LIST), SetDataTip(0x0, STR_TOWN_DIRECTORY_LIST_TOOLTIP),
|
||||
SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_TD_SCROLLBAR), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_BROWN),
|
||||
NWidget(WWT_TEXT, COLOUR_BROWN, WID_TD_WORLD_POPULATION), SetPadding(2, 0, 0, 2), SetMinimalSize(196, 12), SetFill(1, 0), SetDataTip(STR_TOWN_POPULATION, STR_NULL),
|
||||
NWidget(WWT_TEXT, COLOUR_BROWN, WID_TD_WORLD_POPULATION), SetPadding(2, 0, 2, 2), SetMinimalTextLines(1, 0), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TOWN_POPULATION, STR_NULL),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL),
|
||||
@@ -1150,7 +1151,7 @@ public:
|
||||
|
||||
void ExecuteFoundTownCommand(TileIndex tile, bool random, StringID errstr, CommandCallback cc)
|
||||
{
|
||||
const char *name = nullptr;
|
||||
std::string name;
|
||||
|
||||
if (!this->townnamevalid) {
|
||||
name = this->townname_editbox.text.buf;
|
||||
@@ -1184,15 +1185,16 @@ public:
|
||||
this->SetFocusedWidget(WID_TF_TOWN_NAME_EDITBOX);
|
||||
break;
|
||||
|
||||
case WID_TF_MANY_RANDOM_TOWNS:
|
||||
_generating_world = true;
|
||||
case WID_TF_MANY_RANDOM_TOWNS: {
|
||||
Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
|
||||
UpdateNearestTownForRoadTiles(true);
|
||||
if (!GenerateTowns(this->town_layout)) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, WL_INFO);
|
||||
}
|
||||
UpdateNearestTownForRoadTiles(false);
|
||||
_generating_world = false;
|
||||
old_generating_world.Restore();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user