mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
9 Commits
a0c6259e33
...
6b7537646d
Author | SHA1 | Date |
---|---|---|
|
6b7537646d | |
|
122bfa2afd | |
|
aeaa552385 | |
|
2eacf36d0a | |
|
f40816503f | |
|
39e67b6f4c | |
|
e0df937247 | |
|
72323ae9e6 | |
|
b9a1cb5d7c |
|
@ -239,7 +239,7 @@ public:
|
||||||
|
|
||||||
void DrawWidget(const Rect &r, int widget) const override
|
void DrawWidget(const Rect &r, int widget) const override
|
||||||
{
|
{
|
||||||
if (widget != 0) return;
|
if (widget != WID_BAFD_QUESTION) return;
|
||||||
|
|
||||||
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER);
|
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@ struct GSConfigWindow : public Window {
|
||||||
list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false));
|
list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
ShowDropDownListAt(this, std::move(list), old_val, WID_GSC_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||||
|
@ -367,14 +367,14 @@ struct GSConfigWindow : public Window {
|
||||||
|
|
||||||
void OnDropdownSelect(int widget, int index) override
|
void OnDropdownSelect(int widget, int index) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_GSC_SETTING_DROPDOWN) return;
|
||||||
assert(this->clicked_dropdown);
|
assert(this->clicked_dropdown);
|
||||||
SetValue(index);
|
SetValue(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDropdownClose(Point, int widget, int, bool) override
|
void OnDropdownClose(Point, int widget, int, bool) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_GSC_SETTING_DROPDOWN) return;
|
||||||
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
||||||
* the same dropdown button was clicked again, and then not open the dropdown again.
|
* the same dropdown button was clicked again, and then not open the dropdown again.
|
||||||
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
||||||
|
|
|
@ -523,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Slet alle beske
|
||||||
# About menu
|
# About menu
|
||||||
###length 11
|
###length 11
|
||||||
STR_ABOUT_MENU_LAND_BLOCK_INFO :Landområde information
|
STR_ABOUT_MENU_LAND_BLOCK_INFO :Landområde information
|
||||||
|
STR_ABOUT_MENU_HELP :Hjælp & manualer
|
||||||
STR_ABOUT_MENU_SEPARATOR :
|
STR_ABOUT_MENU_SEPARATOR :
|
||||||
STR_ABOUT_MENU_TOGGLE_CONSOLE :Tænd/Sluk konsol
|
STR_ABOUT_MENU_TOGGLE_CONSOLE :Tænd/Sluk konsol
|
||||||
STR_ABOUT_MENU_AI_DEBUG :Computerspiller/spilscript debug
|
STR_ABOUT_MENU_AI_DEBUG :Computerspiller/spilscript debug
|
||||||
|
@ -2124,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Netværk
|
||||||
|
|
||||||
STR_INTRO_GAME_OPTIONS :{BLACK}Opsætning
|
STR_INTRO_GAME_OPTIONS :{BLACK}Opsætning
|
||||||
STR_INTRO_HIGHSCORE :{BLACK} Topresultater
|
STR_INTRO_HIGHSCORE :{BLACK} Topresultater
|
||||||
|
STR_INTRO_HELP :{BLACK}Hjælp og manualer
|
||||||
STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Indstillinger
|
STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Indstillinger
|
||||||
STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF indstillinger
|
STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF indstillinger
|
||||||
STR_INTRO_ONLINE_CONTENT :{BLACK}Tjek Online Indhold
|
STR_INTRO_ONLINE_CONTENT :{BLACK}Tjek Online Indhold
|
||||||
|
@ -2145,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Vælg 'l
|
||||||
|
|
||||||
STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Sæt spillet op
|
STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Sæt spillet op
|
||||||
STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hvis topscoreliste
|
STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hvis topscoreliste
|
||||||
|
STR_INTRO_TOOLTIP_HELP :{BLACK}Få adgang til dokumentation og online ressourcer
|
||||||
STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Skærm indstillinger
|
STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Skærm indstillinger
|
||||||
STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Vis NewGRF-indstillinger
|
STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Vis NewGRF-indstillinger
|
||||||
STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Tjek for nyt og opdateret indhold til download
|
STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Tjek for nyt og opdateret indhold til download
|
||||||
|
@ -2167,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Er du s
|
||||||
STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du sikker på, at du vil afslutte dette scenarie ?
|
STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du sikker på, at du vil afslutte dette scenarie ?
|
||||||
|
|
||||||
# Help window
|
# Help window
|
||||||
|
STR_HELP_WINDOW_CAPTION :{WHITE}Hjælp og manualer
|
||||||
|
STR_HELP_WINDOW_WEBSITES :{BLACK}Hjemmesider
|
||||||
|
STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenter
|
||||||
|
STR_HELP_WINDOW_README :{BLACK}Læs mig
|
||||||
|
STR_HELP_WINDOW_CHANGELOG :{BLACK}Ændringslog
|
||||||
|
STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Kendte Bugs
|
||||||
|
STR_HELP_WINDOW_LICENSE :{BLACK}Licens
|
||||||
|
STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD
|
||||||
|
STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manual / Wiki
|
||||||
|
STR_HELP_WINDOW_BUGTRACKER :{BLACK}Anmeld en fejl
|
||||||
|
STR_HELP_WINDOW_COMMUNITY :{BLACK}Fællesskab
|
||||||
|
|
||||||
# Cheat window
|
# Cheat window
|
||||||
STR_CHEATS :{WHITE}Snydefunktioner
|
STR_CHEATS :{WHITE}Snydefunktioner
|
||||||
|
@ -4701,6 +4715,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN
|
||||||
|
|
||||||
|
|
||||||
# Textfile window
|
# Textfile window
|
||||||
|
STR_TEXTFILE_JUMPLIST :{WHITE}Indholdsfortegnelse
|
||||||
|
STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Spring hurtigt til en sektion i den viste fil via denne liste
|
||||||
|
STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING}
|
||||||
|
STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Gå tilbage i navigationshistorikken
|
||||||
|
STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Vend tilbage i navigationshistorikken
|
||||||
STR_TEXTFILE_WRAP_TEXT :{WHITE}Ombryd tekst
|
STR_TEXTFILE_WRAP_TEXT :{WHITE}Ombryd tekst
|
||||||
STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ombryd teksten i vinduet, så det hele passer uden at skulle rulle
|
STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ombryd teksten i vinduet, så det hele passer uden at skulle rulle
|
||||||
STR_TEXTFILE_VIEW_README :{BLACK}Se readme
|
STR_TEXTFILE_VIEW_README :{BLACK}Se readme
|
||||||
|
@ -4711,6 +4730,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}{STRING}
|
||||||
STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} ændringslog for {STRING}
|
STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} ændringslog for {STRING}
|
||||||
STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licens for {STRING}
|
STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licens for {STRING}
|
||||||
STR_TEXTFILE_SURVEY_RESULT_CAPTION :Forhåndsvisning af undersøgelsesresultat
|
STR_TEXTFILE_SURVEY_RESULT_CAPTION :Forhåndsvisning af undersøgelsesresultat
|
||||||
|
STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD dokument '{STRING}'
|
||||||
|
|
||||||
|
|
||||||
# Vehicle loading indicators
|
# Vehicle loading indicators
|
||||||
|
|
|
@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect
|
||||||
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING1} at {HEX}
|
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING1} at {HEX}
|
||||||
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object
|
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object
|
||||||
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type
|
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type
|
||||||
|
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type
|
||||||
|
|
||||||
STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal)
|
STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal)
|
||||||
|
|
||||||
|
|
|
@ -775,7 +775,7 @@ GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
default: return GSF_INVALID;
|
default: return GSF_INVALID;
|
||||||
case MP_RAILWAY: return GSF_RAILTYPES;
|
case MP_RAILWAY: return GSF_RAILTYPES;
|
||||||
case MP_ROAD: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_INVALID;
|
case MP_ROAD: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_ROADTYPES;
|
||||||
case MP_HOUSE: return GSF_HOUSES;
|
case MP_HOUSE: return GSF_HOUSES;
|
||||||
case MP_INDUSTRY: return GSF_INDUSTRYTILES;
|
case MP_INDUSTRY: return GSF_INDUSTRYTILES;
|
||||||
case MP_OBJECT: return GSF_OBJECTS;
|
case MP_OBJECT: return GSF_OBJECTS;
|
||||||
|
|
|
@ -395,7 +395,7 @@ struct NewGRFParametersWindow : public Window {
|
||||||
list.emplace_back(new DropDownListStringItem(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i, false));
|
list.emplace_back(new DropDownListStringItem(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
ShowDropDownListAt(this, std::move(list), old_val, WID_NP_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||||
|
@ -453,7 +453,7 @@ struct NewGRFParametersWindow : public Window {
|
||||||
|
|
||||||
void OnDropdownSelect(int widget, int index) override
|
void OnDropdownSelect(int widget, int index) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_NP_SETTING_DROPDOWN) return;
|
||||||
assert(this->clicked_dropdown);
|
assert(this->clicked_dropdown);
|
||||||
GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row);
|
GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row);
|
||||||
par_info.SetValue(this->grf_config, index);
|
par_info.SetValue(this->grf_config, index);
|
||||||
|
@ -462,7 +462,7 @@ struct NewGRFParametersWindow : public Window {
|
||||||
|
|
||||||
void OnDropdownClose(Point, int widget, int, bool) override
|
void OnDropdownClose(Point, int widget, int, bool) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_NP_SETTING_DROPDOWN) return;
|
||||||
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
||||||
* the same dropdown button was clicked again, and then not open the dropdown again.
|
* the same dropdown button was clicked again, and then not open the dropdown again.
|
||||||
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
||||||
|
@ -1171,7 +1171,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
|
|
||||||
void OnDropdownSelect(int widget, int index) override
|
void OnDropdownSelect(int widget, int index) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_NS_PRESET_LIST) return;
|
||||||
if (!this->editable) return;
|
if (!this->editable) return;
|
||||||
|
|
||||||
ClearGRFConfigList(&this->actives);
|
ClearGRFConfigList(&this->actives);
|
||||||
|
|
|
@ -29,10 +29,9 @@ struct ScreenshotWindow : Window {
|
||||||
|
|
||||||
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
|
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
|
||||||
{
|
{
|
||||||
if (widget < 0) return;
|
|
||||||
ScreenshotType st;
|
ScreenshotType st;
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
default:
|
default: return;
|
||||||
case WID_SC_TAKE: st = SC_VIEWPORT; break;
|
case WID_SC_TAKE: st = SC_VIEWPORT; break;
|
||||||
case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break;
|
case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break;
|
||||||
case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break;
|
case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break;
|
||||||
|
|
|
@ -472,7 +472,7 @@ struct ScriptSettingsWindow : public Window {
|
||||||
list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false));
|
list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
ShowDropDownListAt(this, std::move(list), old_val, WID_SCRS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||||
|
@ -526,14 +526,14 @@ struct ScriptSettingsWindow : public Window {
|
||||||
|
|
||||||
void OnDropdownSelect(int widget, int index) override
|
void OnDropdownSelect(int widget, int index) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_SCRS_SETTING_DROPDOWN) return;
|
||||||
assert(this->clicked_dropdown);
|
assert(this->clicked_dropdown);
|
||||||
SetValue(index);
|
SetValue(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDropdownClose(Point, int widget, int, bool) override
|
void OnDropdownClose(Point, int widget, int, bool) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) return;
|
if (widget != WID_SCRS_SETTING_DROPDOWN) return;
|
||||||
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
|
||||||
* the same dropdown button was clicked again, and then not open the dropdown again.
|
* the same dropdown button was clicked again, and then not open the dropdown again.
|
||||||
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
* So, we only remember that it was closed, and process it on the next OnPaint, which is
|
||||||
|
|
|
@ -2394,7 +2394,7 @@ struct GameSettingsWindow : Window {
|
||||||
list.emplace_back(new DropDownListStringItem(sd->str_val + i - sd->min, i, false));
|
list.emplace_back(new DropDownListStringItem(sd->str_val + i - sd->min, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, std::move(list), value, -1, wi_rect, COLOUR_ORANGE);
|
ShowDropDownListAt(this, std::move(list), value, WID_GS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
@ -2526,23 +2526,21 @@ struct GameSettingsWindow : Window {
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case WID_GS_SETTING_DROPDOWN:
|
||||||
if (widget < 0) {
|
/* Deal with drop down boxes on the panel. */
|
||||||
/* Deal with drop down boxes on the panel. */
|
assert(this->valuedropdown_entry != nullptr);
|
||||||
assert(this->valuedropdown_entry != nullptr);
|
const IntSettingDesc *sd = this->valuedropdown_entry->setting;
|
||||||
const IntSettingDesc *sd = this->valuedropdown_entry->setting;
|
assert(sd->flags & SF_GUI_DROPDOWN);
|
||||||
assert(sd->flags & SF_GUI_DROPDOWN);
|
|
||||||
|
|
||||||
SetSettingValue(sd, index);
|
SetSettingValue(sd, index);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
|
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
|
||||||
{
|
{
|
||||||
if (widget >= 0) {
|
if (widget != WID_GS_SETTING_DROPDOWN) {
|
||||||
/* Normally the default implementation of OnDropdownClose() takes care of
|
/* Normally the default implementation of OnDropdownClose() takes care of
|
||||||
* a few things. We want that behaviour here too, but only for
|
* a few things. We want that behaviour here too, but only for
|
||||||
* "normal" dropdown boxes. The special dropdown boxes added for every
|
* "normal" dropdown boxes. The special dropdown boxes added for every
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +218,7 @@ enum StationNaming {
|
||||||
/** Information to handle station action 0 property 24 correctly */
|
/** Information to handle station action 0 property 24 correctly */
|
||||||
struct StationNameInformation {
|
struct StationNameInformation {
|
||||||
uint32_t free_names; ///< Current bitset of free names (we can remove names).
|
uint32_t free_names; ///< Current bitset of free names (we can remove names).
|
||||||
bool *indtypes; ///< Array of bools telling whether an industry type has been found.
|
std::bitset<NUM_INDUSTRYTYPES> indtypes; ///< Bit set indicating when an industry type has been found.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -255,21 +257,20 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
};
|
};
|
||||||
|
|
||||||
const Town *t = st->town;
|
const Town *t = st->town;
|
||||||
uint32_t free_names = UINT32_MAX;
|
|
||||||
|
|
||||||
bool indtypes[NUM_INDUSTRYTYPES];
|
StationNameInformation sni{};
|
||||||
memset(indtypes, 0, sizeof(indtypes));
|
sni.free_names = UINT32_MAX;
|
||||||
|
|
||||||
for (const Station *s : Station::Iterate()) {
|
for (const Station *s : Station::Iterate()) {
|
||||||
if (s != st && s->town == t) {
|
if (s != st && s->town == t) {
|
||||||
if (s->indtype != IT_INVALID) {
|
if (s->indtype != IT_INVALID) {
|
||||||
indtypes[s->indtype] = true;
|
sni.indtypes[s->indtype] = true;
|
||||||
StringID name = GetIndustrySpec(s->indtype)->station_name;
|
StringID name = GetIndustrySpec(s->indtype)->station_name;
|
||||||
if (name != STR_UNDEFINED) {
|
if (name != STR_UNDEFINED) {
|
||||||
/* Filter for other industrytypes with the same name */
|
/* Filter for other industrytypes with the same name */
|
||||||
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
|
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
|
||||||
const IndustrySpec *indsp = GetIndustrySpec(it);
|
const IndustrySpec *indsp = GetIndustrySpec(it);
|
||||||
if (indsp->enabled && indsp->station_name == name) indtypes[it] = true;
|
if (indsp->enabled && indsp->station_name == name) sni.indtypes[it] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -279,13 +280,12 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
if (str == M(STR_SV_STNAME_FOREST)) {
|
if (str == M(STR_SV_STNAME_FOREST)) {
|
||||||
str = M(STR_SV_STNAME_WOODS);
|
str = M(STR_SV_STNAME_WOODS);
|
||||||
}
|
}
|
||||||
ClrBit(free_names, str);
|
ClrBit(sni.free_names, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TileIndex indtile = tile;
|
TileIndex indtile = tile;
|
||||||
StationNameInformation sni = { free_names, indtypes };
|
|
||||||
if (CircularTileSearch(&indtile, 7, FindNearIndustryName, &sni)) {
|
if (CircularTileSearch(&indtile, 7, FindNearIndustryName, &sni)) {
|
||||||
/* An industry has been found nearby */
|
/* An industry has been found nearby */
|
||||||
IndustryType indtype = GetIndustryType(indtile);
|
IndustryType indtype = GetIndustryType(indtile);
|
||||||
|
@ -298,14 +298,13 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Oil rigs/mines name could be marked not free by looking for a near by industry. */
|
/* Oil rigs/mines name could be marked not free by looking for a near by industry. */
|
||||||
free_names = sni.free_names;
|
|
||||||
|
|
||||||
/* check default names */
|
/* check default names */
|
||||||
uint32_t tmp = free_names & _gen_station_name_bits[name_class];
|
uint32_t tmp = sni.free_names & _gen_station_name_bits[name_class];
|
||||||
if (tmp != 0) return STR_SV_STNAME + FindFirstBit(tmp);
|
if (tmp != 0) return STR_SV_STNAME + FindFirstBit(tmp);
|
||||||
|
|
||||||
/* check mine? */
|
/* check mine? */
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_MINES))) {
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_MINES))) {
|
||||||
if (CountMapSquareAround(tile, CMSAMine) >= 2) {
|
if (CountMapSquareAround(tile, CMSAMine) >= 2) {
|
||||||
return STR_SV_STNAME_MINES;
|
return STR_SV_STNAME_MINES;
|
||||||
}
|
}
|
||||||
|
@ -313,20 +312,20 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
|
|
||||||
/* check close enough to town to get central as name? */
|
/* check close enough to town to get central as name? */
|
||||||
if (DistanceMax(tile, t->xy) < 8) {
|
if (DistanceMax(tile, t->xy) < 8) {
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME))) return STR_SV_STNAME;
|
if (HasBit(sni.free_names, M(STR_SV_STNAME))) return STR_SV_STNAME;
|
||||||
|
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_CENTRAL))) return STR_SV_STNAME_CENTRAL;
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_CENTRAL))) return STR_SV_STNAME_CENTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check lakeside */
|
/* Check lakeside */
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_LAKESIDE)) &&
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_LAKESIDE)) &&
|
||||||
DistanceFromEdge(tile) < 20 &&
|
DistanceFromEdge(tile) < 20 &&
|
||||||
CountMapSquareAround(tile, CMSAWater) >= 5) {
|
CountMapSquareAround(tile, CMSAWater) >= 5) {
|
||||||
return STR_SV_STNAME_LAKESIDE;
|
return STR_SV_STNAME_LAKESIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check woods */
|
/* Check woods */
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_WOODS)) && (
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_WOODS)) && (
|
||||||
CountMapSquareAround(tile, CMSATree) >= 8 ||
|
CountMapSquareAround(tile, CMSATree) >= 8 ||
|
||||||
CountMapSquareAround(tile, IsTileForestIndustry) >= 2)
|
CountMapSquareAround(tile, IsTileForestIndustry) >= 2)
|
||||||
) {
|
) {
|
||||||
|
@ -337,9 +336,9 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
int z = GetTileZ(tile);
|
int z = GetTileZ(tile);
|
||||||
int z2 = GetTileZ(t->xy);
|
int z2 = GetTileZ(t->xy);
|
||||||
if (z < z2) {
|
if (z < z2) {
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
|
||||||
} else if (z > z2) {
|
} else if (z > z2) {
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS;
|
if (HasBit(sni.free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check direction compared to town */
|
/* check direction compared to town */
|
||||||
|
@ -350,12 +349,28 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
|
~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
|
||||||
};
|
};
|
||||||
|
|
||||||
free_names &= _direction_and_table[
|
sni.free_names &= _direction_and_table[
|
||||||
(TileX(tile) < TileX(t->xy)) +
|
(TileX(tile) < TileX(t->xy)) +
|
||||||
(TileY(tile) < TileY(t->xy)) * 2];
|
(TileY(tile) < TileY(t->xy)) * 2];
|
||||||
|
|
||||||
tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30));
|
/** Bitmask of remaining station names that can be used when a more specific name has not been used. */
|
||||||
return (tmp == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME + FindFirstBit(tmp));
|
static const uint32_t fallback_names = (
|
||||||
|
(1U << M(STR_SV_STNAME_NORTH)) |
|
||||||
|
(1U << M(STR_SV_STNAME_SOUTH)) |
|
||||||
|
(1U << M(STR_SV_STNAME_EAST)) |
|
||||||
|
(1U << M(STR_SV_STNAME_WEST)) |
|
||||||
|
(1U << M(STR_SV_STNAME_TRANSFER)) |
|
||||||
|
(1U << M(STR_SV_STNAME_HALT)) |
|
||||||
|
(1U << M(STR_SV_STNAME_EXCHANGE)) |
|
||||||
|
(1U << M(STR_SV_STNAME_ANNEXE)) |
|
||||||
|
(1U << M(STR_SV_STNAME_SIDINGS)) |
|
||||||
|
(1U << M(STR_SV_STNAME_BRANCH)) |
|
||||||
|
(1U << M(STR_SV_STNAME_UPPER)) |
|
||||||
|
(1U << M(STR_SV_STNAME_LOWER))
|
||||||
|
);
|
||||||
|
|
||||||
|
sni.free_names &= fallback_names;
|
||||||
|
return (sni.free_names == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME + FindFirstBit(sni.free_names));
|
||||||
}
|
}
|
||||||
#undef M
|
#undef M
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ static const NIVariable _niv_airports[] = {
|
||||||
NIV_END()
|
NIV_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
class NIHAiport : public NIHelper {
|
class NIHAirport : public NIHelper {
|
||||||
bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.grffile != nullptr; }
|
bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.grffile != nullptr; }
|
||||||
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); }
|
uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); }
|
||||||
const void *GetInstance(uint index)const override { return Station::Get(index); }
|
const void *GetInstance(uint index)const override { return Station::Get(index); }
|
||||||
|
@ -562,7 +562,7 @@ static const NIFeature _nif_airport = {
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
_niv_airports,
|
_niv_airports,
|
||||||
new NIHAiport(),
|
new NIHAirport(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ class NIHRoadType : public NIHelper {
|
||||||
uint GetParent(uint) const override { return UINT32_MAX; }
|
uint GetParent(uint) const override { return UINT32_MAX; }
|
||||||
const void *GetInstance(uint) const override { return nullptr; }
|
const void *GetInstance(uint) const override { return nullptr; }
|
||||||
const void *GetSpec(uint) const override { return nullptr; }
|
const void *GetSpec(uint) const override { return nullptr; }
|
||||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
|
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE, INVALID_STRING_ID, index); }
|
||||||
uint32_t GetGRFID(uint) const override { return 0; }
|
uint32_t GetGRFID(uint) const override { return 0; }
|
||||||
|
|
||||||
uint Resolve(uint index, uint var, uint param, bool *avail) const override
|
uint Resolve(uint index, uint var, uint param, bool *avail) const override
|
||||||
|
|
|
@ -23,6 +23,8 @@ enum GSConfigWidgets {
|
||||||
WID_GSC_CONTENT_DOWNLOAD = WID_GSC_TEXTFILE + TFT_CONTENT_END, ///< Download content button.
|
WID_GSC_CONTENT_DOWNLOAD = WID_GSC_TEXTFILE + TFT_CONTENT_END, ///< Download content button.
|
||||||
WID_GSC_ACCEPT, ///< Accept ("Close") button
|
WID_GSC_ACCEPT, ///< Accept ("Close") button
|
||||||
WID_GSC_RESET, ///< Reset button.
|
WID_GSC_RESET, ///< Reset button.
|
||||||
|
|
||||||
|
WID_GSC_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WIDGETS_GS_WIDGET_H */
|
#endif /* WIDGETS_GS_WIDGET_H */
|
||||||
|
|
|
@ -26,6 +26,8 @@ enum NewGRFParametersWidgets {
|
||||||
WID_NP_RESET, ///< Reset button.
|
WID_NP_RESET, ///< Reset button.
|
||||||
WID_NP_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions.
|
WID_NP_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions.
|
||||||
WID_NP_DESCRIPTION, ///< Multi-line description of a parameter.
|
WID_NP_DESCRIPTION, ///< Multi-line description of a parameter.
|
||||||
|
|
||||||
|
WID_NP_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value.
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Widgets of the #NewGRFWindow class. */
|
/** Widgets of the #NewGRFWindow class. */
|
||||||
|
|
|
@ -29,6 +29,8 @@ enum ScriptSettingsWidgets {
|
||||||
WID_SCRS_SCROLLBAR, ///< Scrollbar to scroll through all settings.
|
WID_SCRS_SCROLLBAR, ///< Scrollbar to scroll through all settings.
|
||||||
WID_SCRS_ACCEPT, ///< Accept button.
|
WID_SCRS_ACCEPT, ///< Accept button.
|
||||||
WID_SCRS_RESET, ///< Reset button.
|
WID_SCRS_RESET, ///< Reset button.
|
||||||
|
|
||||||
|
WID_SCRS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value.
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Widgets of the #ScriptDebugWindow class. */
|
/** Widgets of the #ScriptDebugWindow class. */
|
||||||
|
|
|
@ -64,6 +64,8 @@ enum GameSettingsWidgets {
|
||||||
WID_GS_RESTRICT_TYPE, ///< Label upfront to the type drop-down box to restrict the list of settings to show
|
WID_GS_RESTRICT_TYPE, ///< Label upfront to the type drop-down box to restrict the list of settings to show
|
||||||
WID_GS_RESTRICT_DROPDOWN, ///< The drop down box to restrict the list of settings
|
WID_GS_RESTRICT_DROPDOWN, ///< The drop down box to restrict the list of settings
|
||||||
WID_GS_TYPE_DROPDOWN, ///< The drop down box to choose client/game/company/all settings
|
WID_GS_TYPE_DROPDOWN, ///< The drop down box to choose client/game/company/all settings
|
||||||
|
|
||||||
|
WID_GS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value.
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Widgets of the #CustomCurrencyWindow class. */
|
/** Widgets of the #CustomCurrencyWindow class. */
|
||||||
|
|
Loading…
Reference in New Issue