mirror of https://github.com/OpenTTD/OpenTTD
Codechange: do not hide variables with other variables
parent
1951af07c0
commit
6ba55e663e
|
@ -446,11 +446,11 @@ bool SQFunctionProto::Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr
|
||||||
|
|
||||||
for(i = 0; i < noutervalues; i++){
|
for(i = 0; i < noutervalues; i++){
|
||||||
SQUnsignedInteger type;
|
SQUnsignedInteger type;
|
||||||
SQObjectPtr name;
|
SQObjectPtr value_name;
|
||||||
_CHECK_IO(SafeRead(v,read,up, &type, sizeof(SQUnsignedInteger)));
|
_CHECK_IO(SafeRead(v,read,up, &type, sizeof(SQUnsignedInteger)));
|
||||||
_CHECK_IO(ReadObject(v, up, read, o));
|
_CHECK_IO(ReadObject(v, up, read, o));
|
||||||
_CHECK_IO(ReadObject(v, up, read, name));
|
_CHECK_IO(ReadObject(v, up, read, value_name));
|
||||||
f->_outervalues[i] = SQOuterVar(name,o, (SQOuterType)type);
|
f->_outervalues[i] = SQOuterVar(value_name,o, (SQOuterType)type);
|
||||||
}
|
}
|
||||||
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
|
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
|
||||||
|
|
||||||
|
|
|
@ -781,7 +781,6 @@ CommandCost CmdAutoreplaceVehicle(DoCommandFlag flags, VehicleID veh_id)
|
||||||
RestoreRandomSeeds(saved_seeds);
|
RestoreRandomSeeds(saved_seeds);
|
||||||
|
|
||||||
if (cost.Succeeded() && (flags & DC_EXEC) != 0) {
|
if (cost.Succeeded() && (flags & DC_EXEC) != 0) {
|
||||||
CommandCost ret;
|
|
||||||
if (free_wagon) {
|
if (free_wagon) {
|
||||||
ret = ReplaceFreeUnit(&v, flags, ¬hing_to_do);
|
ret = ReplaceFreeUnit(&v, flags, ¬hing_to_do);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
|
||||||
this->description[std::string{}] = *item->value;
|
this->description[std::string{}] = *item->value;
|
||||||
|
|
||||||
/* Add the translations of the descriptions too. */
|
/* Add the translations of the descriptions too. */
|
||||||
for (const IniItem *item = metadata->item; item != nullptr; item = item->next) {
|
for (item = metadata->item; item != nullptr; item = item->next) {
|
||||||
if (item->name.compare(0, 12, "description.") != 0) continue;
|
if (item->name.compare(0, 12, "description.") != 0) continue;
|
||||||
|
|
||||||
this->description[item->name.substr(12)] = item->value.value_or("");
|
this->description[item->name.substr(12)] = item->value.value_or("");
|
||||||
|
|
|
@ -633,7 +633,6 @@ private:
|
||||||
void ShowColourDropDownMenu(uint32 widget)
|
void ShowColourDropDownMenu(uint32 widget)
|
||||||
{
|
{
|
||||||
uint32 used_colours = 0;
|
uint32 used_colours = 0;
|
||||||
const Company *c;
|
|
||||||
const Livery *livery, *default_livery = nullptr;
|
const Livery *livery, *default_livery = nullptr;
|
||||||
bool primary = widget == WID_SCL_PRI_COL_DROPDOWN;
|
bool primary = widget == WID_SCL_PRI_COL_DROPDOWN;
|
||||||
byte default_col = 0;
|
byte default_col = 0;
|
||||||
|
@ -645,7 +644,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c = Company::Get((CompanyID)this->window_number);
|
const Company *c = Company::Get((CompanyID)this->window_number);
|
||||||
|
|
||||||
if (this->livery_class < LC_GROUP_RAIL) {
|
if (this->livery_class < LC_GROUP_RAIL) {
|
||||||
/* Get the first selected livery to use as the default dropdown item */
|
/* Get the first selected livery to use as the default dropdown item */
|
||||||
|
|
19
src/gfx.cpp
19
src/gfx.cpp
|
@ -1327,7 +1327,6 @@ void DoPaletteAnimations()
|
||||||
const ExtraPaletteValues *ev = &_extra_palette_values;
|
const ExtraPaletteValues *ev = &_extra_palette_values;
|
||||||
Colour old_val[PALETTE_ANIM_SIZE];
|
Colour old_val[PALETTE_ANIM_SIZE];
|
||||||
const uint old_tc = palette_animation_counter;
|
const uint old_tc = palette_animation_counter;
|
||||||
uint i;
|
|
||||||
uint j;
|
uint j;
|
||||||
|
|
||||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
|
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
|
||||||
|
@ -1342,7 +1341,7 @@ void DoPaletteAnimations()
|
||||||
/* Fizzy Drink bubbles animation */
|
/* Fizzy Drink bubbles animation */
|
||||||
s = ev->fizzy_drink;
|
s = ev->fizzy_drink;
|
||||||
j = EXTR2(512, EPV_CYCLES_FIZZY_DRINK);
|
j = EXTR2(512, EPV_CYCLES_FIZZY_DRINK);
|
||||||
for (i = 0; i != EPV_CYCLES_FIZZY_DRINK; i++) {
|
for (uint i = 0; i != EPV_CYCLES_FIZZY_DRINK; i++) {
|
||||||
*palette_pos++ = s[j];
|
*palette_pos++ = s[j];
|
||||||
j++;
|
j++;
|
||||||
if (j == EPV_CYCLES_FIZZY_DRINK) j = 0;
|
if (j == EPV_CYCLES_FIZZY_DRINK) j = 0;
|
||||||
|
@ -1351,7 +1350,7 @@ void DoPaletteAnimations()
|
||||||
/* Oil refinery fire animation */
|
/* Oil refinery fire animation */
|
||||||
s = ev->oil_refinery;
|
s = ev->oil_refinery;
|
||||||
j = EXTR2(512, EPV_CYCLES_OIL_REFINERY);
|
j = EXTR2(512, EPV_CYCLES_OIL_REFINERY);
|
||||||
for (i = 0; i != EPV_CYCLES_OIL_REFINERY; i++) {
|
for (uint i = 0; i != EPV_CYCLES_OIL_REFINERY; i++) {
|
||||||
*palette_pos++ = s[j];
|
*palette_pos++ = s[j];
|
||||||
j++;
|
j++;
|
||||||
if (j == EPV_CYCLES_OIL_REFINERY) j = 0;
|
if (j == EPV_CYCLES_OIL_REFINERY) j = 0;
|
||||||
|
@ -1391,7 +1390,7 @@ void DoPaletteAnimations()
|
||||||
/* Handle lighthouse and stadium animation */
|
/* Handle lighthouse and stadium animation */
|
||||||
s = ev->lighthouse;
|
s = ev->lighthouse;
|
||||||
j = EXTR(256, EPV_CYCLES_LIGHTHOUSE);
|
j = EXTR(256, EPV_CYCLES_LIGHTHOUSE);
|
||||||
for (i = 0; i != EPV_CYCLES_LIGHTHOUSE; i++) {
|
for (uint i = 0; i != EPV_CYCLES_LIGHTHOUSE; i++) {
|
||||||
*palette_pos++ = s[j];
|
*palette_pos++ = s[j];
|
||||||
j++;
|
j++;
|
||||||
if (j == EPV_CYCLES_LIGHTHOUSE) j = 0;
|
if (j == EPV_CYCLES_LIGHTHOUSE) j = 0;
|
||||||
|
@ -1400,7 +1399,7 @@ void DoPaletteAnimations()
|
||||||
/* Dark blue water */
|
/* Dark blue water */
|
||||||
s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->dark_water_toyland : ev->dark_water;
|
s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->dark_water_toyland : ev->dark_water;
|
||||||
j = EXTR(320, EPV_CYCLES_DARK_WATER);
|
j = EXTR(320, EPV_CYCLES_DARK_WATER);
|
||||||
for (i = 0; i != EPV_CYCLES_DARK_WATER; i++) {
|
for (uint i = 0; i != EPV_CYCLES_DARK_WATER; i++) {
|
||||||
*palette_pos++ = s[j];
|
*palette_pos++ = s[j];
|
||||||
j++;
|
j++;
|
||||||
if (j == EPV_CYCLES_DARK_WATER) j = 0;
|
if (j == EPV_CYCLES_DARK_WATER) j = 0;
|
||||||
|
@ -1409,7 +1408,7 @@ void DoPaletteAnimations()
|
||||||
/* Glittery water */
|
/* Glittery water */
|
||||||
s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->glitter_water_toyland : ev->glitter_water;
|
s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->glitter_water_toyland : ev->glitter_water;
|
||||||
j = EXTR(128, EPV_CYCLES_GLITTER_WATER);
|
j = EXTR(128, EPV_CYCLES_GLITTER_WATER);
|
||||||
for (i = 0; i != EPV_CYCLES_GLITTER_WATER / 3; i++) {
|
for (uint i = 0; i != EPV_CYCLES_GLITTER_WATER / 3; i++) {
|
||||||
*palette_pos++ = s[j];
|
*palette_pos++ = s[j];
|
||||||
j += 3;
|
j += 3;
|
||||||
if (j >= EPV_CYCLES_GLITTER_WATER) j -= EPV_CYCLES_GLITTER_WATER;
|
if (j >= EPV_CYCLES_GLITTER_WATER) j -= EPV_CYCLES_GLITTER_WATER;
|
||||||
|
@ -1669,23 +1668,23 @@ void DrawDirtyBlocks()
|
||||||
|
|
||||||
while (right != w) {
|
while (right != w) {
|
||||||
byte *p2 = ++p;
|
byte *p2 = ++p;
|
||||||
int h = h2;
|
int i = h2;
|
||||||
/* Check if a full line of dirty flags is set. */
|
/* Check if a full line of dirty flags is set. */
|
||||||
do {
|
do {
|
||||||
if (!*p2) goto no_more_coalesc;
|
if (!*p2) goto no_more_coalesc;
|
||||||
p2 += _dirty_bytes_per_line;
|
p2 += _dirty_bytes_per_line;
|
||||||
} while (--h != 0);
|
} while (--i != 0);
|
||||||
|
|
||||||
/* Wohoo, can combine it one step to the right!
|
/* Wohoo, can combine it one step to the right!
|
||||||
* Do that, and clear the bits. */
|
* Do that, and clear the bits. */
|
||||||
right += DIRTY_BLOCK_WIDTH;
|
right += DIRTY_BLOCK_WIDTH;
|
||||||
|
|
||||||
h = h2;
|
i = h2;
|
||||||
p2 = p;
|
p2 = p;
|
||||||
do {
|
do {
|
||||||
*p2 = 0;
|
*p2 = 0;
|
||||||
p2 += _dirty_bytes_per_line;
|
p2 += _dirty_bytes_per_line;
|
||||||
} while (--h != 0);
|
} while (--i != 0);
|
||||||
}
|
}
|
||||||
no_more_coalesc:
|
no_more_coalesc:
|
||||||
|
|
||||||
|
|
|
@ -662,8 +662,6 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
||||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
||||||
if ((_tick_counter & 3) == 0) {
|
if ((_tick_counter & 3) == 0) {
|
||||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
|
||||||
|
|
||||||
gfx = (gfx < 155) ? gfx + 1 : 148;
|
gfx = (gfx < 155) ? gfx + 1 : 148;
|
||||||
SetIndustryGfx(tile, gfx);
|
SetIndustryGfx(tile, gfx);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
@ -675,8 +673,6 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||||
case GFX_OILWELL_ANIMATED_3:
|
case GFX_OILWELL_ANIMATED_3:
|
||||||
if ((_tick_counter & 7) == 0) {
|
if ((_tick_counter & 7) == 0) {
|
||||||
bool b = Chance16(1, 7);
|
bool b = Chance16(1, 7);
|
||||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
|
||||||
|
|
||||||
byte m = GetAnimationFrame(tile) + 1;
|
byte m = GetAnimationFrame(tile) + 1;
|
||||||
if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) {
|
if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) {
|
||||||
SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED);
|
SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED);
|
||||||
|
@ -1467,13 +1463,13 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||||
|
|
||||||
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
|
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
|
||||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, cur_tile);
|
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_NONE, cur_tile);
|
||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
|
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
} else {
|
} else {
|
||||||
/* Clear the tiles, but do not affect town ratings */
|
/* Clear the tiles, but do not affect town ratings */
|
||||||
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile);
|
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, cur_tile);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2775,7 +2775,7 @@ struct IndustryCargoesWindow : public Window {
|
||||||
int num_cust = CountMatchingAcceptingIndustries(central_sp->produced_cargo, lengthof(central_sp->produced_cargo)) + houses_accept;
|
int num_cust = CountMatchingAcceptingIndustries(central_sp->produced_cargo, lengthof(central_sp->produced_cargo)) + houses_accept;
|
||||||
int num_indrows = std::max(3, std::max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels.
|
int num_indrows = std::max(3, std::max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels.
|
||||||
for (int i = 0; i < num_indrows; i++) {
|
for (int i = 0; i < num_indrows; i++) {
|
||||||
CargoesRow &row = this->fields.emplace_back();
|
row = this->fields.emplace_back();
|
||||||
row.columns[0].MakeEmpty(CFT_EMPTY);
|
row.columns[0].MakeEmpty(CFT_EMPTY);
|
||||||
row.columns[1].MakeCargo(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
row.columns[1].MakeCargo(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
||||||
row.columns[2].MakeEmpty(CFT_EMPTY);
|
row.columns[2].MakeEmpty(CFT_EMPTY);
|
||||||
|
@ -2850,7 +2850,7 @@ struct IndustryCargoesWindow : public Window {
|
||||||
int num_cust = CountMatchingAcceptingIndustries(&cid, 1) + houses_accept;
|
int num_cust = CountMatchingAcceptingIndustries(&cid, 1) + houses_accept;
|
||||||
int num_indrows = std::max(num_supp, num_cust);
|
int num_indrows = std::max(num_supp, num_cust);
|
||||||
for (int i = 0; i < num_indrows; i++) {
|
for (int i = 0; i < num_indrows; i++) {
|
||||||
CargoesRow &row = this->fields.emplace_back();
|
row = this->fields.emplace_back();
|
||||||
row.columns[0].MakeEmpty(CFT_EMPTY);
|
row.columns[0].MakeEmpty(CFT_EMPTY);
|
||||||
row.columns[1].MakeCargo(&cid, 1);
|
row.columns[1].MakeCargo(&cid, 1);
|
||||||
row.columns[2].MakeEmpty(CFT_EMPTY);
|
row.columns[2].MakeEmpty(CFT_EMPTY);
|
||||||
|
|
|
@ -1054,11 +1054,11 @@ void ClientNetworkContentSocketHandler::CheckDependencyState(ContentInfo *ci)
|
||||||
* After that's done run over them once again to test their children
|
* After that's done run over them once again to test their children
|
||||||
* to unselect. Don't do it immediately because it'll do exactly what
|
* to unselect. Don't do it immediately because it'll do exactly what
|
||||||
* we're doing now. */
|
* we're doing now. */
|
||||||
for (const ContentInfo *c : parents) {
|
for (const ContentInfo *parent : parents) {
|
||||||
if (c->state == ContentInfo::AUTOSELECTED) this->Unselect(c->id);
|
if (parent->state == ContentInfo::AUTOSELECTED) this->Unselect(parent->id);
|
||||||
}
|
}
|
||||||
for (const ContentInfo *c : parents) {
|
for (const ContentInfo *parent : parents) {
|
||||||
this->CheckDependencyState(this->GetContent(c->id));
|
this->CheckDependencyState(this->GetContent(parent->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4270,13 +4270,13 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
|
||||||
int n = buf->ReadByte();
|
int n = buf->ReadByte();
|
||||||
for (int j = 0; j != n; j++) {
|
for (int j = 0; j != n; j++) {
|
||||||
RailTypeLabel label = buf->ReadDWord();
|
RailTypeLabel label = buf->ReadDWord();
|
||||||
RailType rt = GetRailTypeByLabel(BSWAP32(label), false);
|
RailType resolved_rt = GetRailTypeByLabel(BSWAP32(label), false);
|
||||||
if (rt != INVALID_RAILTYPE) {
|
if (resolved_rt != INVALID_RAILTYPE) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 0x0F: SetBit(rti->powered_railtypes, rt); FALLTHROUGH; // Powered implies compatible.
|
case 0x0F: SetBit(rti->powered_railtypes, resolved_rt); FALLTHROUGH; // Powered implies compatible.
|
||||||
case 0x0E: SetBit(rti->compatible_railtypes, rt); break;
|
case 0x0E: SetBit(rti->compatible_railtypes, resolved_rt); break;
|
||||||
case 0x18: SetBit(rti->introduction_required_railtypes, rt); break;
|
case 0x18: SetBit(rti->introduction_required_railtypes, resolved_rt); break;
|
||||||
case 0x19: SetBit(rti->introduces_railtypes, rt); break;
|
case 0x19: SetBit(rti->introduces_railtypes, resolved_rt); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4484,12 +4484,12 @@ static ChangeInfoResult RoadTypeChangeInfo(uint id, int numinfo, int prop, ByteR
|
||||||
int n = buf->ReadByte();
|
int n = buf->ReadByte();
|
||||||
for (int j = 0; j != n; j++) {
|
for (int j = 0; j != n; j++) {
|
||||||
RoadTypeLabel label = buf->ReadDWord();
|
RoadTypeLabel label = buf->ReadDWord();
|
||||||
RoadType rt = GetRoadTypeByLabel(BSWAP32(label), false);
|
RoadType resolved_rt = GetRoadTypeByLabel(BSWAP32(label), false);
|
||||||
if (rt != INVALID_ROADTYPE) {
|
if (resolved_rt != INVALID_ROADTYPE) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 0x0F: SetBit(rti->powered_roadtypes, rt); break;
|
case 0x0F: SetBit(rti->powered_roadtypes, resolved_rt); break;
|
||||||
case 0x18: SetBit(rti->introduction_required_roadtypes, rt); break;
|
case 0x18: SetBit(rti->introduction_required_roadtypes, resolved_rt); break;
|
||||||
case 0x19: SetBit(rti->introduces_roadtypes, rt); break;
|
case 0x19: SetBit(rti->introduces_roadtypes, resolved_rt); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1285,16 +1285,16 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
WIDGET_LIST_END
|
WIDGET_LIST_END
|
||||||
);
|
);
|
||||||
|
|
||||||
const GRFConfig *c = (this->avail_sel == nullptr) ? this->active_sel : this->avail_sel;
|
const GRFConfig *selected_config = (this->avail_sel == nullptr) ? this->active_sel : this->avail_sel;
|
||||||
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
|
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
|
||||||
this->SetWidgetDisabledState(WID_NS_NEWGRF_TEXTFILE + tft, c == nullptr || c->GetTextfile(tft) == nullptr);
|
this->SetWidgetDisabledState(WID_NS_NEWGRF_TEXTFILE + tft, selected_config == nullptr || selected_config->GetTextfile(tft) == nullptr);
|
||||||
}
|
}
|
||||||
this->SetWidgetDisabledState(WID_NS_OPEN_URL, c == nullptr || StrEmpty(c->GetURL()));
|
this->SetWidgetDisabledState(WID_NS_OPEN_URL, selected_config == nullptr || StrEmpty(selected_config->GetURL()));
|
||||||
|
|
||||||
this->SetWidgetDisabledState(WID_NS_SET_PARAMETERS, !this->show_params || this->active_sel == nullptr || this->active_sel->num_valid_params == 0);
|
this->SetWidgetDisabledState(WID_NS_SET_PARAMETERS, !this->show_params || this->active_sel == nullptr || this->active_sel->num_valid_params == 0);
|
||||||
this->SetWidgetDisabledState(WID_NS_VIEW_PARAMETERS, !this->show_params || this->active_sel == nullptr || this->active_sel->num_valid_params == 0);
|
this->SetWidgetDisabledState(WID_NS_VIEW_PARAMETERS, !this->show_params || this->active_sel == nullptr || this->active_sel->num_valid_params == 0);
|
||||||
this->SetWidgetDisabledState(WID_NS_TOGGLE_PALETTE, disable_all ||
|
this->SetWidgetDisabledState(WID_NS_TOGGLE_PALETTE, disable_all ||
|
||||||
(!(_settings_client.gui.newgrf_developer_tools || _settings_client.gui.scenario_developer) && ((c->palette & GRFP_GRF_MASK) != GRFP_GRF_UNSET)));
|
(!(_settings_client.gui.newgrf_developer_tools || _settings_client.gui.scenario_developer) && ((selected_config->palette & GRFP_GRF_MASK) != GRFP_GRF_UNSET)));
|
||||||
|
|
||||||
if (!disable_all) {
|
if (!disable_all) {
|
||||||
/* All widgets are now enabled, so disable widgets we can't use */
|
/* All widgets are now enabled, so disable widgets we can't use */
|
||||||
|
|
|
@ -1403,7 +1403,7 @@ void StateGameLoop()
|
||||||
|
|
||||||
#ifndef DEBUG_DUMP_COMMANDS
|
#ifndef DEBUG_DUMP_COMMANDS
|
||||||
{
|
{
|
||||||
PerformanceMeasurer framerate(PFE_ALLSCRIPTS);
|
PerformanceMeasurer script_framerate(PFE_ALLSCRIPTS);
|
||||||
AI::GameLoop();
|
AI::GameLoop();
|
||||||
Game::GameLoop();
|
Game::GameLoop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,7 +754,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
||||||
if (st == nullptr) return CMD_ERROR;
|
if (st == nullptr) return CMD_ERROR;
|
||||||
|
|
||||||
if (st->owner != OWNER_NONE) {
|
if (st->owner != OWNER_NONE) {
|
||||||
CommandCost ret = CheckOwnership(st->owner);
|
ret = CheckOwnership(st->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
||||||
|
|
||||||
if (st == nullptr) return CMD_ERROR;
|
if (st == nullptr) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(st->owner);
|
ret = CheckOwnership(st->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
if (!CanVehicleUseStation(v, st) || !st->airport.HasHangar()) {
|
if (!CanVehicleUseStation(v, st) || !st->airport.HasHangar()) {
|
||||||
|
@ -811,7 +811,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
||||||
|
|
||||||
if (dp == nullptr) return CMD_ERROR;
|
if (dp == nullptr) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(GetTileOwner(dp->xy));
|
ret = CheckOwnership(GetTileOwner(dp->xy));
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
|
@ -849,7 +849,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
||||||
case VEH_TRAIN: {
|
case VEH_TRAIN: {
|
||||||
if (!(wp->facilities & FACIL_TRAIN)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
if (!(wp->facilities & FACIL_TRAIN)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(wp->owner);
|
ret = CheckOwnership(wp->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
||||||
case VEH_SHIP:
|
case VEH_SHIP:
|
||||||
if (!(wp->facilities & FACIL_DOCK)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
if (!(wp->facilities & FACIL_DOCK)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||||
if (wp->owner != OWNER_NONE) {
|
if (wp->owner != OWNER_NONE) {
|
||||||
CommandCost ret = CheckOwnership(wp->owner);
|
ret = CheckOwnership(wp->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1514,7 +1514,7 @@ CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID ve
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
|
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(src->owner);
|
ret = CheckOwnership(src->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
/* Trucks can't share orders with busses (and visa versa) */
|
/* Trucks can't share orders with busses (and visa versa) */
|
||||||
|
@ -1571,7 +1571,7 @@ CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID ve
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
|
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(src->owner);
|
ret = CheckOwnership(src->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
/* Trucks can't copy all the orders from busses (and visa versa),
|
/* Trucks can't copy all the orders from busses (and visa versa),
|
||||||
|
@ -1771,12 +1771,9 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool
|
||||||
|
|
||||||
/* Go through all vehicles */
|
/* Go through all vehicles */
|
||||||
for (Vehicle *v : Vehicle::Iterate()) {
|
for (Vehicle *v : Vehicle::Iterate()) {
|
||||||
Order *order;
|
if ((v->type == VEH_AIRCRAFT && v->current_order.IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : v->current_order.GetType()) == type &&
|
||||||
|
|
||||||
order = &v->current_order;
|
|
||||||
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : order->GetType()) == type &&
|
|
||||||
(!hangar || v->type == VEH_AIRCRAFT) && v->current_order.GetDestination() == destination) {
|
(!hangar || v->type == VEH_AIRCRAFT) && v->current_order.GetDestination() == destination) {
|
||||||
order->MakeDummy();
|
v->current_order.MakeDummy();
|
||||||
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -531,7 +531,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
|
||||||
/* Disallow breaking end-of-line of someone else
|
/* Disallow breaking end-of-line of someone else
|
||||||
* so trams can still reverse on this tile. */
|
* so trams can still reverse on this tile. */
|
||||||
if (Company::IsValidID(tram_owner) && HasExactlyOneBit(tram)) {
|
if (Company::IsValidID(tram_owner) && HasExactlyOneBit(tram)) {
|
||||||
CommandCost ret = CheckOwnership(tram_owner);
|
ret = CheckOwnership(tram_owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, TileI
|
||||||
bool had_success = false;
|
bool had_success = false;
|
||||||
CommandCost last_error = CMD_ERROR;
|
CommandCost last_error = CMD_ERROR;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
CommandCost ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals);
|
ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals);
|
||||||
|
|
||||||
if (ret.Failed()) {
|
if (ret.Failed()) {
|
||||||
last_error = ret;
|
last_error = ret;
|
||||||
|
@ -1591,7 +1591,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s
|
||||||
* Tunnels and bridges have special check later */
|
* Tunnels and bridges have special check later */
|
||||||
if (tt != MP_TUNNELBRIDGE) {
|
if (tt != MP_TUNNELBRIDGE) {
|
||||||
if (!IsCompatibleRail(type, totype)) {
|
if (!IsCompatibleRail(type, totype)) {
|
||||||
CommandCost ret = IsPlainRailTile(tile) ? EnsureNoTrainOnTrackBits(tile, GetTrackBits(tile)) : EnsureNoVehicleOnGround(tile);
|
ret = IsPlainRailTile(tile) ? EnsureNoTrainOnTrackBits(tile, GetTrackBits(tile)) : EnsureNoVehicleOnGround(tile);
|
||||||
if (ret.Failed()) {
|
if (ret.Failed()) {
|
||||||
error = ret;
|
error = ret;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1675,7 +1675,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s
|
||||||
|
|
||||||
/* When not converting rail <-> el. rail, any vehicle cannot be in tunnel/bridge */
|
/* When not converting rail <-> el. rail, any vehicle cannot be in tunnel/bridge */
|
||||||
if (!IsCompatibleRail(GetRailType(tile), totype)) {
|
if (!IsCompatibleRail(GetRailType(tile), totype)) {
|
||||||
CommandCost ret = TunnelBridgeIsFree(tile, endtile);
|
ret = TunnelBridgeIsFree(tile, endtile);
|
||||||
if (ret.Failed()) {
|
if (ret.Failed()) {
|
||||||
error = ret;
|
error = ret;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -865,7 +865,7 @@ do_clear:;
|
||||||
if (HasPowerOnRoad(rt, existing_rt)) {
|
if (HasPowerOnRoad(rt, existing_rt)) {
|
||||||
rt = existing_rt;
|
rt = existing_rt;
|
||||||
} else if (HasPowerOnRoad(existing_rt, rt)) {
|
} else if (HasPowerOnRoad(existing_rt, rt)) {
|
||||||
CommandCost ret = Command<CMD_CONVERT_ROAD>::Do(flags, tile, tile, rt);
|
ret = Command<CMD_CONVERT_ROAD>::Do(flags, tile, tile, rt);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1715,7 +1715,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
/* Draw rail/PBS overlay */
|
/* Draw rail/PBS overlay */
|
||||||
bool draw_pbs = _game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasCrossingReservation(ti->tile);
|
bool draw_pbs = _game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasCrossingReservation(ti->tile);
|
||||||
if (rti->UsesOverlay()) {
|
if (rti->UsesOverlay()) {
|
||||||
PaletteID pal = draw_pbs ? PALETTE_CRASH : PAL_NONE;
|
pal = draw_pbs ? PALETTE_CRASH : PAL_NONE;
|
||||||
SpriteID rail = GetCustomRailSprite(rti, ti->tile, RTSG_CROSSING) + axis;
|
SpriteID rail = GetCustomRailSprite(rti, ti->tile, RTSG_CROSSING) + axis;
|
||||||
DrawGroundSprite(rail, pal);
|
DrawGroundSprite(rail, pal);
|
||||||
|
|
||||||
|
@ -1757,7 +1757,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
}
|
}
|
||||||
} else if (draw_pbs || tram_rti != nullptr || road_rti->UsesOverlay()) {
|
} else if (draw_pbs || tram_rti != nullptr || road_rti->UsesOverlay()) {
|
||||||
/* Add another rail overlay, unless there is only the base road sprite. */
|
/* Add another rail overlay, unless there is only the base road sprite. */
|
||||||
PaletteID pal = draw_pbs ? PALETTE_CRASH : PAL_NONE;
|
pal = draw_pbs ? PALETTE_CRASH : PAL_NONE;
|
||||||
SpriteID rail = GetCrossingRoadAxis(ti->tile) == AXIS_Y ? GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_x : GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_y;
|
SpriteID rail = GetCrossingRoadAxis(ti->tile) == AXIS_Y ? GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_x : GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_y;
|
||||||
DrawGroundSprite(rail, pal);
|
DrawGroundSprite(rail, pal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,11 +384,13 @@ static bool FixTTOEngines()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the default engine set. Many of them will be overridden later */
|
/* Load the default engine set. Many of them will be overridden later */
|
||||||
uint j = 0;
|
{
|
||||||
for (uint i = 0; i < lengthof(_orig_rail_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_TRAIN, i);
|
uint j = 0;
|
||||||
for (uint i = 0; i < lengthof(_orig_road_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_ROAD, i);
|
for (uint i = 0; i < lengthof(_orig_rail_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_TRAIN, i);
|
||||||
for (uint i = 0; i < lengthof(_orig_ship_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_SHIP, i);
|
for (uint i = 0; i < lengthof(_orig_road_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_ROAD, i);
|
||||||
for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i);
|
for (uint i = 0; i < lengthof(_orig_ship_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_SHIP, i);
|
||||||
|
for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i);
|
||||||
|
}
|
||||||
|
|
||||||
Date aging_date = std::min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1));
|
Date aging_date = std::min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1));
|
||||||
|
|
||||||
|
|
|
@ -931,7 +931,7 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
||||||
affected_vehicles.push_back(v);
|
affected_vehicles.push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommandCost ret = Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile_cur, track);
|
ret = Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile_cur, track);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
/* With flags & ~DC_EXEC CmdLandscapeClear would fail since the rail still exists */
|
/* With flags & ~DC_EXEC CmdLandscapeClear would fail since the rail still exists */
|
||||||
|
@ -1018,7 +1018,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
||||||
if (road_owner == OWNER_TOWN) {
|
if (road_owner == OWNER_TOWN) {
|
||||||
if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD);
|
if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD);
|
||||||
} else if (!_settings_game.construction.road_stop_on_competitor_road && road_owner != OWNER_NONE) {
|
} else if (!_settings_game.construction.road_stop_on_competitor_road && road_owner != OWNER_NONE) {
|
||||||
CommandCost ret = CheckOwnership(road_owner);
|
ret = CheckOwnership(road_owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
uint num_pieces = CountBits(GetRoadBits(cur_tile, RTT_ROAD));
|
uint num_pieces = CountBits(GetRoadBits(cur_tile, RTT_ROAD));
|
||||||
|
@ -1026,7 +1026,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
||||||
if (RoadTypeIsRoad(rt) && !HasPowerOnRoad(rt, road_rt)) return_cmd_error(STR_ERROR_NO_SUITABLE_ROAD);
|
if (RoadTypeIsRoad(rt) && !HasPowerOnRoad(rt, road_rt)) return_cmd_error(STR_ERROR_NO_SUITABLE_ROAD);
|
||||||
|
|
||||||
if (GetDisallowedRoadDirections(cur_tile) != DRD_NONE && road_owner != OWNER_TOWN) {
|
if (GetDisallowedRoadDirections(cur_tile) != DRD_NONE && road_owner != OWNER_TOWN) {
|
||||||
CommandCost ret = CheckOwnership(road_owner);
|
ret = CheckOwnership(road_owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
||||||
/* Disallow breaking end-of-line of someone else
|
/* Disallow breaking end-of-line of someone else
|
||||||
* so trams can still reverse on this tile. */
|
* so trams can still reverse on this tile. */
|
||||||
HasExactlyOneBit(GetRoadBits(cur_tile, RTT_TRAM)))) {
|
HasExactlyOneBit(GetRoadBits(cur_tile, RTT_TRAM)))) {
|
||||||
CommandCost ret = CheckOwnership(tram_owner);
|
ret = CheckOwnership(tram_owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
uint num_pieces = CountBits(GetRoadBits(cur_tile, RTT_TRAM));
|
uint num_pieces = CountBits(GetRoadBits(cur_tile, RTT_TRAM));
|
||||||
|
@ -1308,7 +1308,7 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
if (st != nullptr && st->train_station.tile != INVALID_TILE) {
|
if (st != nullptr && st->train_station.tile != INVALID_TILE) {
|
||||||
CommandCost ret = CanExpandRailStation(st, new_location, axis);
|
ret = CanExpandRailStation(st, new_location, axis);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,7 +1573,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
||||||
if (st == nullptr) continue;
|
if (st == nullptr) continue;
|
||||||
|
|
||||||
if (_current_company != OWNER_WATER) {
|
if (_current_company != OWNER_WATER) {
|
||||||
CommandCost ret = CheckOwnership(st->owner);
|
ret = CheckOwnership(st->owner);
|
||||||
error.AddCost(ret);
|
error.AddCost(ret);
|
||||||
if (ret.Failed()) continue;
|
if (ret.Failed()) continue;
|
||||||
}
|
}
|
||||||
|
@ -2236,13 +2236,13 @@ CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_ty
|
||||||
return_cmd_error(STR_ERROR_STATION_TOO_SPREAD_OUT);
|
return_cmd_error(STR_ERROR_STATION_TOO_SPREAD_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirportTileTableIterator iter(as->table[layout], tile);
|
AirportTileTableIterator tile_iter(as->table[layout], tile);
|
||||||
CommandCost cost = CheckFlatLandAirport(iter, flags);
|
CommandCost cost = CheckFlatLandAirport(tile_iter, flags);
|
||||||
if (cost.Failed()) return cost;
|
if (cost.Failed()) return cost;
|
||||||
|
|
||||||
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center. */
|
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center. */
|
||||||
uint dist;
|
uint dist;
|
||||||
Town *nearest = AirportGetNearestTown(as, iter, dist);
|
Town *nearest = AirportGetNearestTown(as, tile_iter, dist);
|
||||||
uint newnoise_level = GetAirportNoiseLevelForDistance(as, dist);
|
uint newnoise_level = GetAirportNoiseLevelForDistance(as, dist);
|
||||||
|
|
||||||
/* Check if local auth would allow a new airport */
|
/* Check if local auth would allow a new airport */
|
||||||
|
@ -2986,7 +2986,6 @@ draw_default_foundation:
|
||||||
|
|
||||||
/* PBS debugging, draw reserved tracks darker */
|
/* PBS debugging, draw reserved tracks darker */
|
||||||
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasStationRail(ti->tile) && HasStationReservation(ti->tile)) {
|
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasStationRail(ti->tile) && HasStationReservation(ti->tile)) {
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
|
||||||
DrawGroundSprite(GetRailStationAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH);
|
DrawGroundSprite(GetRailStationAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3033,17 +3032,17 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
|
||||||
int32 total_offset = 0;
|
int32 total_offset = 0;
|
||||||
PaletteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
PaletteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
||||||
const DrawTileSprites *t = GetStationTileLayout(st, image);
|
const DrawTileSprites *t = GetStationTileLayout(st, image);
|
||||||
const RailtypeInfo *rti = nullptr;
|
const RailtypeInfo *railtype_info = nullptr;
|
||||||
|
|
||||||
if (railtype != INVALID_RAILTYPE) {
|
if (railtype != INVALID_RAILTYPE) {
|
||||||
rti = GetRailTypeInfo(railtype);
|
railtype_info = GetRailTypeInfo(railtype);
|
||||||
total_offset = rti->GetRailtypeSpriteOffset();
|
total_offset = railtype_info->GetRailtypeSpriteOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID img = t->ground.sprite;
|
SpriteID img = t->ground.sprite;
|
||||||
RailTrackOffset overlay_offset;
|
RailTrackOffset overlay_offset;
|
||||||
if (rti != nullptr && rti->UsesOverlay() && SplitGroundSpriteForOverlay(nullptr, &img, &overlay_offset)) {
|
if (railtype_info != nullptr && railtype_info->UsesOverlay() && SplitGroundSpriteForOverlay(nullptr, &img, &overlay_offset)) {
|
||||||
SpriteID ground = GetCustomRailSprite(rti, INVALID_TILE, RTSG_GROUND);
|
SpriteID ground = GetCustomRailSprite(railtype_info, INVALID_TILE, RTSG_GROUND);
|
||||||
DrawSprite(img, PAL_NONE, x, y);
|
DrawSprite(img, PAL_NONE, x, y);
|
||||||
DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
|
DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3051,25 +3050,25 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roadtype != INVALID_ROADTYPE) {
|
if (roadtype != INVALID_ROADTYPE) {
|
||||||
const RoadTypeInfo* rti = GetRoadTypeInfo(roadtype);
|
const RoadTypeInfo *roadtype_info = GetRoadTypeInfo(roadtype);
|
||||||
if (image >= 4) {
|
if (image >= 4) {
|
||||||
/* Drive-through stop */
|
/* Drive-through stop */
|
||||||
uint sprite_offset = 5 - image;
|
uint sprite_offset = 5 - image;
|
||||||
|
|
||||||
/* Road underlay takes precedence over tram */
|
/* Road underlay takes precedence over tram */
|
||||||
if (rti->UsesOverlay()) {
|
if (roadtype_info->UsesOverlay()) {
|
||||||
SpriteID ground = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_GROUND);
|
SpriteID ground = GetCustomRoadSprite(roadtype_info, INVALID_TILE, ROTSG_GROUND);
|
||||||
DrawSprite(ground + sprite_offset, PAL_NONE, x, y);
|
DrawSprite(ground + sprite_offset, PAL_NONE, x, y);
|
||||||
|
|
||||||
SpriteID overlay = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_OVERLAY);
|
SpriteID overlay = GetCustomRoadSprite(roadtype_info, INVALID_TILE, ROTSG_OVERLAY);
|
||||||
if (overlay) DrawSprite(overlay + sprite_offset, PAL_NONE, x, y);
|
if (overlay) DrawSprite(overlay + sprite_offset, PAL_NONE, x, y);
|
||||||
} else if (RoadTypeIsTram(roadtype)) {
|
} else if (RoadTypeIsTram(roadtype)) {
|
||||||
DrawSprite(SPR_TRAMWAY_TRAM + sprite_offset, PAL_NONE, x, y);
|
DrawSprite(SPR_TRAMWAY_TRAM + sprite_offset, PAL_NONE, x, y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Drive-in stop */
|
/* Drive-in stop */
|
||||||
if (RoadTypeIsRoad(roadtype) && rti->UsesOverlay()) {
|
if (RoadTypeIsRoad(roadtype) && roadtype_info->UsesOverlay()) {
|
||||||
SpriteID ground = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_ROADSTOP);
|
SpriteID ground = GetCustomRoadSprite(roadtype_info, INVALID_TILE, ROTSG_ROADSTOP);
|
||||||
DrawSprite(ground + image, PAL_NONE, x, y);
|
DrawSprite(ground + image, PAL_NONE, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,9 +472,9 @@ int CDECL main(int argc, char *argv[])
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
printf("name\tflags\tdefault\tdescription\n");
|
printf("name\tflags\tdefault\tdescription\n");
|
||||||
for (size_t i = 0; i < lengthof(_pragmas); i++) {
|
for (size_t j = 0; j < lengthof(_pragmas); j++) {
|
||||||
printf("\"%s\"\t%s\t\"%s\"\t\"%s\"\n",
|
printf("\"%s\"\t%s\t\"%s\"\t\"%s\"\n",
|
||||||
_pragmas[i][0], _pragmas[i][1], _pragmas[i][2], _pragmas[i][3]);
|
_pragmas[j][0], _pragmas[j][1], _pragmas[j][2], _pragmas[j][3]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -877,7 +877,7 @@ static int TranslateArgumentIdx(int argidx, int offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = sum = 0; i < argidx; i++) {
|
for (int i = sum = 0; i < argidx; i++) {
|
||||||
const CmdStruct *cs = _cur_pcs.cmd[i];
|
cs = _cur_pcs.cmd[i];
|
||||||
|
|
||||||
sum += (cs != nullptr) ? cs->consumes : 1;
|
sum += (cs != nullptr) ? cs->consumes : 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -938,7 +938,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
buff = GetStringWithArgs(buff, MakeStringID(TEXT_TAB_GAMESCRIPT_START, stringid), &sub_args, last, true);
|
buff = GetStringWithArgs(buff, MakeStringID(TEXT_TAB_GAMESCRIPT_START, stringid), &sub_args, last, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 20; i++) {
|
for (i = 0; i < 20; i++) {
|
||||||
if (sub_args_need_free[i]) free((void *)sub_args.GetParam(i));
|
if (sub_args_need_free[i]) free((void *)sub_args.GetParam(i));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1044,19 +1044,19 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
|
|
||||||
case SCC_RAW_STRING_POINTER: { // {RAW_STRING}
|
case SCC_RAW_STRING_POINTER: { // {RAW_STRING}
|
||||||
if (game_script) break;
|
if (game_script) break;
|
||||||
const char *str = (const char *)(size_t)args->GetInt64(SCC_RAW_STRING_POINTER);
|
const char *raw_string = (const char *)(size_t)args->GetInt64(SCC_RAW_STRING_POINTER);
|
||||||
buff = FormatString(buff, str, args, last);
|
buff = FormatString(buff, raw_string, args, last);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCC_STRING: {// {STRING}
|
case SCC_STRING: {// {STRING}
|
||||||
StringID str = args->GetInt32(SCC_STRING);
|
StringID string_id = args->GetInt32(SCC_STRING);
|
||||||
if (game_script && GetStringTab(str) != TEXT_TAB_GAMESCRIPT_START) break;
|
if (game_script && GetStringTab(string_id) != TEXT_TAB_GAMESCRIPT_START) break;
|
||||||
/* WARNING. It's prohibited for the included string to consume any arguments.
|
/* WARNING. It's prohibited for the included string to consume any arguments.
|
||||||
* For included strings that consume argument, you should use STRING1, STRING2 etc.
|
* For included strings that consume argument, you should use STRING1, STRING2 etc.
|
||||||
* To debug stuff you can set argv to nullptr and it will tell you */
|
* To debug stuff you can set argv to nullptr and it will tell you */
|
||||||
StringParameters tmp_params(args->GetDataPointer(), args->GetDataLeft(), nullptr);
|
StringParameters tmp_params(args->GetDataPointer(), args->GetDataLeft(), nullptr);
|
||||||
buff = GetStringWithArgs(buff, str, &tmp_params, last, next_substr_case_index, game_script);
|
buff = GetStringWithArgs(buff, string_id, &tmp_params, last, next_substr_case_index, game_script);
|
||||||
next_substr_case_index = 0;
|
next_substr_case_index = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1069,14 +1069,14 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
case SCC_STRING6:
|
case SCC_STRING6:
|
||||||
case SCC_STRING7: { // {STRING1..7}
|
case SCC_STRING7: { // {STRING1..7}
|
||||||
/* Strings that consume arguments */
|
/* Strings that consume arguments */
|
||||||
StringID str = args->GetInt32(b);
|
StringID string_id = args->GetInt32(b);
|
||||||
if (game_script && GetStringTab(str) != TEXT_TAB_GAMESCRIPT_START) break;
|
if (game_script && GetStringTab(string_id) != TEXT_TAB_GAMESCRIPT_START) break;
|
||||||
uint size = b - SCC_STRING1 + 1;
|
uint size = b - SCC_STRING1 + 1;
|
||||||
if (game_script && size > args->GetDataLeft()) {
|
if (game_script && size > args->GetDataLeft()) {
|
||||||
buff = strecat(buff, "(too many parameters)", last);
|
buff = strecat(buff, "(too many parameters)", last);
|
||||||
} else {
|
} else {
|
||||||
StringParameters sub_args(*args, size);
|
StringParameters sub_args(*args, size);
|
||||||
buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
|
buff = GetStringWithArgs(buff, string_id, &sub_args, last, next_substr_case_index, game_script);
|
||||||
}
|
}
|
||||||
next_substr_case_index = 0;
|
next_substr_case_index = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1456,7 +1456,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
StringParameters tmp_params(args_array);
|
StringParameters tmp_params(args_array);
|
||||||
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
|
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
|
||||||
} else {
|
} else {
|
||||||
StringID str = st->string_id;
|
StringID string_id = st->string_id;
|
||||||
if (st->indtype != IT_INVALID) {
|
if (st->indtype != IT_INVALID) {
|
||||||
/* Special case where the industry provides the name for the station */
|
/* Special case where the industry provides the name for the station */
|
||||||
const IndustrySpec *indsp = GetIndustrySpec(st->indtype);
|
const IndustrySpec *indsp = GetIndustrySpec(st->indtype);
|
||||||
|
@ -1465,14 +1465,14 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
* thus cause very strange things. Here we check for that before we
|
* thus cause very strange things. Here we check for that before we
|
||||||
* actually set the station name. */
|
* actually set the station name. */
|
||||||
if (indsp->station_name != STR_NULL && indsp->station_name != STR_UNDEFINED) {
|
if (indsp->station_name != STR_NULL && indsp->station_name != STR_UNDEFINED) {
|
||||||
str = indsp->station_name;
|
string_id = indsp->station_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
|
uint64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
|
||||||
WChar types_array[] = {0, SCC_TOWN_NAME, SCC_NUM};
|
WChar types_array[] = {0, SCC_TOWN_NAME, SCC_NUM};
|
||||||
StringParameters tmp_params(args_array, 3, types_array);
|
StringParameters tmp_params(args_array, 3, types_array);
|
||||||
buff = GetStringWithArgs(buff, str, &tmp_params, last);
|
buff = GetStringWithArgs(buff, string_id, &tmp_params, last);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1502,9 +1502,9 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
} else {
|
} else {
|
||||||
int64 args_array[] = {wp->town->index, wp->town_cn + 1};
|
int64 args_array[] = {wp->town->index, wp->town_cn + 1};
|
||||||
StringParameters tmp_params(args_array);
|
StringParameters tmp_params(args_array);
|
||||||
StringID str = ((wp->string_id == STR_SV_STNAME_BUOY) ? STR_FORMAT_BUOY_NAME : STR_FORMAT_WAYPOINT_NAME);
|
StringID string_id = ((wp->string_id == STR_SV_STNAME_BUOY) ? STR_FORMAT_BUOY_NAME : STR_FORMAT_WAYPOINT_NAME);
|
||||||
if (wp->town_cn != 0) str++;
|
if (wp->town_cn != 0) string_id++;
|
||||||
buff = GetStringWithArgs(buff, str, &tmp_params, last);
|
buff = GetStringWithArgs(buff, string_id, &tmp_params, last);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1526,16 +1526,16 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||||
int64 args_array[] = {v->unitnumber};
|
int64 args_array[] = {v->unitnumber};
|
||||||
StringParameters tmp_params(args_array);
|
StringParameters tmp_params(args_array);
|
||||||
|
|
||||||
StringID str;
|
StringID string_id;
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
default: str = STR_INVALID_VEHICLE; break;
|
default: string_id = STR_INVALID_VEHICLE; break;
|
||||||
case VEH_TRAIN: str = STR_SV_TRAIN_NAME; break;
|
case VEH_TRAIN: string_id = STR_SV_TRAIN_NAME; break;
|
||||||
case VEH_ROAD: str = STR_SV_ROAD_VEHICLE_NAME; break;
|
case VEH_ROAD: string_id = STR_SV_ROAD_VEHICLE_NAME; break;
|
||||||
case VEH_SHIP: str = STR_SV_SHIP_NAME; break;
|
case VEH_SHIP: string_id = STR_SV_SHIP_NAME; break;
|
||||||
case VEH_AIRCRAFT: str = STR_SV_AIRCRAFT_NAME; break;
|
case VEH_AIRCRAFT: string_id = STR_SV_AIRCRAFT_NAME; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buff = GetStringWithArgs(buff, str, &tmp_params, last);
|
buff = GetStringWithArgs(buff, string_id, &tmp_params, last);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,15 +91,15 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
|
||||||
assert(v->GetNumOrders() >= 2);
|
assert(v->GetNumOrders() >= 2);
|
||||||
assert(start < v->GetNumOrders());
|
assert(start < v->GetNumOrders());
|
||||||
|
|
||||||
Ticks sum = offset;
|
|
||||||
VehicleOrderID i = start;
|
|
||||||
const Order *order = v->GetOrder(i);
|
|
||||||
|
|
||||||
/* Pre-initialize with unknown time */
|
/* Pre-initialize with unknown time */
|
||||||
for (int i = 0; i < v->GetNumOrders(); ++i) {
|
for (int i = 0; i < v->GetNumOrders(); ++i) {
|
||||||
table[i].arrival = table[i].departure = INVALID_TICKS;
|
table[i].arrival = table[i].departure = INVALID_TICKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ticks sum = offset;
|
||||||
|
VehicleOrderID i = start;
|
||||||
|
const Order *order = v->GetOrder(i);
|
||||||
|
|
||||||
/* Cyclically loop over all orders until we reach the current one again.
|
/* Cyclically loop over all orders until we reach the current one again.
|
||||||
* As we may start at the current order, do a post-checking loop */
|
* As we may start at the current order, do a post-checking loop */
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -93,7 +93,7 @@ static bool TestTownOwnsBridge(TileIndex tile, const Town *t)
|
||||||
|
|
||||||
if (!town_owned) {
|
if (!town_owned) {
|
||||||
/* Or other adjacent road */
|
/* Or other adjacent road */
|
||||||
TileIndex adjacent = tile + TileOffsByDiagDir(ReverseDiagDir(GetTunnelBridgeDirection(GetOtherTunnelBridgeEnd(tile))));
|
adjacent = tile + TileOffsByDiagDir(ReverseDiagDir(GetTunnelBridgeDirection(GetOtherTunnelBridgeEnd(tile))));
|
||||||
town_owned = IsTileType(adjacent, MP_ROAD) && IsTileOwner(adjacent, OWNER_TOWN) && GetTownIndex(adjacent) == t->index;
|
town_owned = IsTileType(adjacent, MP_ROAD) && IsTileOwner(adjacent, OWNER_TOWN) && GetTownIndex(adjacent) == t->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2656,15 +2656,15 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
|
||||||
byte construction_stage = 0;
|
byte construction_stage = 0;
|
||||||
|
|
||||||
if (_generating_world || _game_mode == GM_EDITOR) {
|
if (_generating_world || _game_mode == GM_EDITOR) {
|
||||||
uint32 r = Random();
|
uint32 construction_random = Random();
|
||||||
|
|
||||||
construction_stage = TOWN_HOUSE_COMPLETED;
|
construction_stage = TOWN_HOUSE_COMPLETED;
|
||||||
if (Chance16(1, 7)) construction_stage = GB(r, 0, 2);
|
if (Chance16(1, 7)) construction_stage = GB(construction_random, 0, 2);
|
||||||
|
|
||||||
if (construction_stage == TOWN_HOUSE_COMPLETED) {
|
if (construction_stage == TOWN_HOUSE_COMPLETED) {
|
||||||
ChangePopulation(t, hs->population);
|
ChangePopulation(t, hs->population);
|
||||||
} else {
|
} else {
|
||||||
construction_counter = GB(r, 2, 2);
|
construction_counter = GB(construction_random, 2, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1202,7 +1202,7 @@ CommandCost CmdMoveRailVehicle(DoCommandFlag flags, VehicleID src_veh, VehicleID
|
||||||
dst = Train::GetIfValid(dest_veh);
|
dst = Train::GetIfValid(dest_veh);
|
||||||
if (dst == nullptr) return CMD_ERROR;
|
if (dst == nullptr) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(dst->owner);
|
ret = CheckOwnership(dst->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
/* Do not allow appending to crashed vehicles, too */
|
/* Do not allow appending to crashed vehicles, too */
|
||||||
|
@ -1271,7 +1271,7 @@ CommandCost CmdMoveRailVehicle(DoCommandFlag flags, VehicleID src_veh, VehicleID
|
||||||
/* If the autoreplace flag is set we do not need to test for the validity
|
/* If the autoreplace flag is set we do not need to test for the validity
|
||||||
* because we are going to revert the train to its original state. As we
|
* because we are going to revert the train to its original state. As we
|
||||||
* assume the original state was correct autoreplace can skip this. */
|
* assume the original state was correct autoreplace can skip this. */
|
||||||
CommandCost ret = ValidateTrains(original_dst_head, dst_head, original_src_head, src_head, true);
|
ret = ValidateTrains(original_dst_head, dst_head, original_src_head, src_head, true);
|
||||||
if (ret.Failed()) {
|
if (ret.Failed()) {
|
||||||
/* Restore the train we had. */
|
/* Restore the train we had. */
|
||||||
RestoreTrainBackup(original_src);
|
RestoreTrainBackup(original_src);
|
||||||
|
|
|
@ -862,7 +862,7 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/* Check if you are allowed to remove the tunnel owned by a town
|
/* Check if you are allowed to remove the tunnel owned by a town
|
||||||
* Removal depends on difficulty settings */
|
* Removal depends on difficulty settings */
|
||||||
CommandCost ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
|
ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,7 +943,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/* Check if you are allowed to remove the bridge owned by a town
|
/* Check if you are allowed to remove the bridge owned by a town
|
||||||
* Removal depends on difficulty settings */
|
* Removal depends on difficulty settings */
|
||||||
CommandCost ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
|
ret = CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3226,8 +3226,8 @@ public:
|
||||||
}
|
}
|
||||||
/* The same system applies to widget WID_VV_REFIT_VEH and VVW_WIDGET_TURN_AROUND.*/
|
/* The same system applies to widget WID_VV_REFIT_VEH and VVW_WIDGET_TURN_AROUND.*/
|
||||||
if (v->IsGroundVehicle()) {
|
if (v->IsGroundVehicle()) {
|
||||||
PlaneSelections plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND;
|
plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND;
|
||||||
NWidgetStacked *nwi = this->GetWidget<NWidgetStacked>(WID_VV_SELECT_REFIT_TURN);
|
nwi = this->GetWidget<NWidgetStacked>(WID_VV_SELECT_REFIT_TURN);
|
||||||
if (nwi->shown_plane + SEL_RT_BASEPLANE != plane) {
|
if (nwi->shown_plane + SEL_RT_BASEPLANE != plane) {
|
||||||
this->SelectPlane(plane);
|
this->SelectPlane(plane);
|
||||||
this->SetWidgetDirty(WID_VV_SELECT_REFIT_TURN);
|
this->SetWidgetDirty(WID_VV_SELECT_REFIT_TURN);
|
||||||
|
|
|
@ -1120,8 +1120,8 @@ void OpenGLBackend::PopulateCursorCache()
|
||||||
if (!this->cursor_cache.Contains(sprite)) {
|
if (!this->cursor_cache.Contains(sprite)) {
|
||||||
Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, ST_NORMAL, &SimpleSpriteAlloc, this));
|
Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, ST_NORMAL, &SimpleSpriteAlloc, this));
|
||||||
if (old != nullptr) {
|
if (old != nullptr) {
|
||||||
OpenGLSprite *sprite = (OpenGLSprite *)old->data;
|
OpenGLSprite *gl_sprite = (OpenGLSprite *)old->data;
|
||||||
sprite->~OpenGLSprite();
|
gl_sprite->~OpenGLSprite();
|
||||||
free(old);
|
free(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1356,9 +1356,6 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
|
||||||
bool show_signs = HasBit(_display_opt, DO_SHOW_SIGNS) && !IsInvisibilitySet(TO_SIGNS);
|
bool show_signs = HasBit(_display_opt, DO_SHOW_SIGNS) && !IsInvisibilitySet(TO_SIGNS);
|
||||||
bool show_competitors = HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS);
|
bool show_competitors = HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS);
|
||||||
|
|
||||||
const BaseStation *st;
|
|
||||||
const Sign *si;
|
|
||||||
|
|
||||||
/* Collect all the items first and draw afterwards, to ensure layering */
|
/* Collect all the items first and draw afterwards, to ensure layering */
|
||||||
std::vector<const BaseStation *> stations;
|
std::vector<const BaseStation *> stations;
|
||||||
std::vector<const Town *> towns;
|
std::vector<const Town *> towns;
|
||||||
|
@ -1366,34 +1363,36 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
|
||||||
|
|
||||||
_viewport_sign_kdtree.FindContained(search_rect.left, search_rect.top, search_rect.right, search_rect.bottom, [&](const ViewportSignKdtreeItem & item) {
|
_viewport_sign_kdtree.FindContained(search_rect.left, search_rect.top, search_rect.right, search_rect.bottom, [&](const ViewportSignKdtreeItem & item) {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case ViewportSignKdtreeItem::VKI_STATION:
|
case ViewportSignKdtreeItem::VKI_STATION: {
|
||||||
if (!show_stations) break;
|
if (!show_stations) break;
|
||||||
st = BaseStation::Get(item.id.station);
|
const BaseStation *st = BaseStation::Get(item.id.station);
|
||||||
|
|
||||||
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
|
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
|
||||||
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
|
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
|
||||||
|
|
||||||
stations.push_back(st);
|
stations.push_back(st);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ViewportSignKdtreeItem::VKI_WAYPOINT:
|
case ViewportSignKdtreeItem::VKI_WAYPOINT: {
|
||||||
if (!show_waypoints) break;
|
if (!show_waypoints) break;
|
||||||
st = BaseStation::Get(item.id.station);
|
const BaseStation *st = BaseStation::Get(item.id.station);
|
||||||
|
|
||||||
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
|
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
|
||||||
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
|
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
|
||||||
|
|
||||||
stations.push_back(st);
|
stations.push_back(st);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ViewportSignKdtreeItem::VKI_TOWN:
|
case ViewportSignKdtreeItem::VKI_TOWN:
|
||||||
if (!show_towns) break;
|
if (!show_towns) break;
|
||||||
towns.push_back(Town::Get(item.id.town));
|
towns.push_back(Town::Get(item.id.town));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ViewportSignKdtreeItem::VKI_SIGN:
|
case ViewportSignKdtreeItem::VKI_SIGN: {
|
||||||
if (!show_signs) break;
|
if (!show_signs) break;
|
||||||
si = Sign::Get(item.id.sign);
|
const Sign *si = Sign::Get(item.id.sign);
|
||||||
|
|
||||||
/* Don't draw if sign is owned by another company and competitor signs should be hidden.
|
/* Don't draw if sign is owned by another company and competitor signs should be hidden.
|
||||||
* Note: It is intentional that also signs owned by OWNER_NONE are hidden. Bankrupt
|
* Note: It is intentional that also signs owned by OWNER_NONE are hidden. Bankrupt
|
||||||
|
@ -1402,6 +1401,7 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
|
||||||
|
|
||||||
signs.push_back(si);
|
signs.push_back(si);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
|
|
|
@ -264,7 +264,7 @@ static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/* do not check for ship on tile when company goes bankrupt */
|
/* do not check for ship on tile when company goes bankrupt */
|
||||||
if (!(flags & DC_BANKRUPT)) {
|
if (!(flags & DC_BANKRUPT)) {
|
||||||
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
ret = EnsureNoVehicleOnGround(tile);
|
||||||
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
|
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
Owner owner = GetTileOwner(tile);
|
Owner owner = GetTileOwner(tile);
|
||||||
if (owner != OWNER_WATER && owner != OWNER_NONE) {
|
if (owner != OWNER_WATER && owner != OWNER_NONE) {
|
||||||
CommandCost ret = CheckTileOwnership(tile);
|
ret = CheckTileOwnership(tile);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,11 +217,11 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis
|
||||||
|
|
||||||
/* check if we want to expand an already existing waypoint? */
|
/* check if we want to expand an already existing waypoint? */
|
||||||
if (wp->train_station.tile != INVALID_TILE) {
|
if (wp->train_station.tile != INVALID_TILE) {
|
||||||
CommandCost ret = CanExpandRailStation(wp, new_location, axis);
|
ret = CanExpandRailStation(wp, new_location, axis);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandCost ret = wp->rect.BeforeAddRect(start_tile, width, height, StationRect::ADD_TEST);
|
ret = wp->rect.BeforeAddRect(start_tile, width, height, StationRect::ADD_TEST);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
} else {
|
} else {
|
||||||
/* allocate and initialize new waypoint */
|
/* allocate and initialize new waypoint */
|
||||||
|
|
|
@ -3209,7 +3209,7 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par
|
||||||
if (fill_sub && (tp == NWID_HORIZONTAL || tp == NWID_HORIZONTAL_LTR || tp == NWID_VERTICAL || tp == NWID_MATRIX
|
if (fill_sub && (tp == NWID_HORIZONTAL || tp == NWID_HORIZONTAL_LTR || tp == NWID_VERTICAL || tp == NWID_MATRIX
|
||||||
|| tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION)) {
|
|| tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION)) {
|
||||||
NWidgetBase *sub_ptr = sub_widget;
|
NWidgetBase *sub_ptr = sub_widget;
|
||||||
int num_used = MakeWidgetTree(parts, count - total_used, &sub_ptr, biggest_index);
|
num_used = MakeWidgetTree(parts, count - total_used, &sub_ptr, biggest_index);
|
||||||
parts += num_used;
|
parts += num_used;
|
||||||
total_used += num_used;
|
total_used += num_used;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ void Window::SetWidgetHighlight(byte widget_index, TextColour highlighted_colour
|
||||||
/* If we disable a highlight, check all widgets if anyone still has a highlight */
|
/* If we disable a highlight, check all widgets if anyone still has a highlight */
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
for (uint i = 0; i < this->nested_array_size; i++) {
|
for (uint i = 0; i < this->nested_array_size; i++) {
|
||||||
NWidgetBase *nwid = this->GetWidget<NWidgetBase>(i);
|
nwid = this->GetWidget<NWidgetBase>(i);
|
||||||
if (nwid == nullptr) continue;
|
if (nwid == nullptr) continue;
|
||||||
if (!nwid->IsHighlighted()) continue;
|
if (!nwid->IsHighlighted()) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue