Merge branch 'jgrpp' into jgrpp-nrt
This commit is contained in:
@@ -370,7 +370,7 @@ struct CheatWindow : Window {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* Take whatever the function returns */
|
/* Take whatever the function returns */
|
||||||
value = ce->proc(value + ((x >= 20 + SETTING_BUTTON_WIDTH / 2) ? 1 : -1), (x >= 10 + this->box_width + SETTING_BUTTON_WIDTH / 2) ? 1 : -1);
|
value = ce->proc(value + ((x >= 10 + this->box_width + SETTING_BUTTON_WIDTH / 2) ? 1 : -1), (x >= 10 + this->box_width + SETTING_BUTTON_WIDTH / 2) ? 1 : -1);
|
||||||
|
|
||||||
/* The first cheat (money), doesn't return a different value. */
|
/* The first cheat (money), doesn't return a different value. */
|
||||||
if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + ((x >= 10 + this->box_width + SETTING_BUTTON_WIDTH / 2) != rtl ? 1 : 0);
|
if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + ((x >= 10 + this->box_width + SETTING_BUTTON_WIDTH / 2) != rtl ? 1 : 0);
|
||||||
|
@@ -343,7 +343,7 @@ char *CrashLog::LogGamelog(char *buffer, const char *last) const
|
|||||||
char *CrashLog::LogRecentNews(char *buffer, const char *last) const
|
char *CrashLog::LogRecentNews(char *buffer, const char *last) const
|
||||||
{
|
{
|
||||||
uint total = 0;
|
uint total = 0;
|
||||||
for (NewsItem *news = _latest_news; news != nullptr; news = news->next) {
|
for (NewsItem *news = _latest_news; news != nullptr; news = news->prev) {
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
uint show = min<uint>(total, 32);
|
uint show = min<uint>(total, 32);
|
||||||
|
@@ -193,6 +193,8 @@ Industry::~Industry()
|
|||||||
for (Station *st : this->stations_near) {
|
for (Station *st : this->stations_near) {
|
||||||
st->industries_near.erase(this);
|
st->industries_near.erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_game_mode == GM_NORMAL) RegisterGameEvents(GEF_INDUSTRY_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1872,6 +1874,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
|||||||
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
|
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
|
||||||
|
|
||||||
if (!_generating_world) PopulateStationsNearby(i);
|
if (!_generating_world) PopulateStationsNearby(i);
|
||||||
|
if (_game_mode == GM_NORMAL) RegisterGameEvents(GEF_INDUSTRY_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1839,5 +1839,8 @@ char *DumpGameEventFlags(GameEventFlags events, char *b, const char *last)
|
|||||||
dump('t', GEF_TBTR_REPLACEMENT);
|
dump('t', GEF_TBTR_REPLACEMENT);
|
||||||
dump('D', GEF_DISASTER_VEH);
|
dump('D', GEF_DISASTER_VEH);
|
||||||
dump('c', GEF_TRAIN_CRASH);
|
dump('c', GEF_TRAIN_CRASH);
|
||||||
|
dump('i', GEF_INDUSTRY_CREATE);
|
||||||
|
dump('j', GEF_INDUSTRY_DELETE);
|
||||||
|
dump('v', GEF_VIRT_TRAIN);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,9 @@ enum GameEventFlags : uint32 {
|
|||||||
GEF_TBTR_REPLACEMENT = 1 << 3, ///< (t) CMD_TEMPLATE_REPLACE_VEHICLE has been called
|
GEF_TBTR_REPLACEMENT = 1 << 3, ///< (t) CMD_TEMPLATE_REPLACE_VEHICLE has been called
|
||||||
GEF_DISASTER_VEH = 1 << 4, ///< (D) A disaster vehicle exists or has been created
|
GEF_DISASTER_VEH = 1 << 4, ///< (D) A disaster vehicle exists or has been created
|
||||||
GEF_TRAIN_CRASH = 1 << 5, ///< (c) A train crash has occurred
|
GEF_TRAIN_CRASH = 1 << 5, ///< (c) A train crash has occurred
|
||||||
|
GEF_INDUSTRY_CREATE = 1 << 6, ///< (i) An industry has been created (in game)
|
||||||
|
GEF_INDUSTRY_DELETE = 1 << 7, ///< (j) An industry has been deleted (in game)
|
||||||
|
GEF_VIRT_TRAIN = 1 << 8, ///< (v) A virtual train has been created
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(GameEventFlags)
|
DECLARE_ENUM_AS_BIT_SET(GameEventFlags)
|
||||||
|
|
||||||
|
@@ -1926,9 +1926,11 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
|
|||||||
auto check_reservation = [&](TileIndex t) {
|
auto check_reservation = [&](TileIndex t) {
|
||||||
if (HasAcrossTunnelBridgeReservation(t)) {
|
if (HasAcrossTunnelBridgeReservation(t)) {
|
||||||
Train *v = GetTrainForReservation(t, FindFirstTrack(GetAcrossTunnelBridgeReservationTrackBits(t)));
|
Train *v = GetTrainForReservation(t, FindFirstTrack(GetAcrossTunnelBridgeReservationTrackBits(t)));
|
||||||
if (v != nullptr) FreeTrainTrackReservation(v);
|
if (v != nullptr) {
|
||||||
|
FreeTrainTrackReservation(v);
|
||||||
re_reserve_trains.push_back(v);
|
re_reserve_trains.push_back(v);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
check_reservation(tile);
|
check_reservation(tile);
|
||||||
check_reservation(end);
|
check_reservation(end);
|
||||||
|
@@ -5255,6 +5255,8 @@ Train* CmdBuildVirtualRailVehicle(EngineID eid, StringID &error)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterGameEvents(GEF_VIRT_TRAIN);
|
||||||
|
|
||||||
if (rvi->railveh_type == RAILVEH_WAGON) {
|
if (rvi->railveh_type == RAILVEH_WAGON) {
|
||||||
return CmdBuildVirtualRailWagon(e);
|
return CmdBuildVirtualRailWagon(e);
|
||||||
}
|
}
|
||||||
@@ -5446,6 +5448,8 @@ CommandCost CmdTemplateReplaceVehicle(TileIndex tile, DoCommandFlag flags, uint3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (need_replacement || (need_refit && use_refit)) RegisterGameEvents(GEF_TBTR_REPLACEMENT);
|
||||||
|
|
||||||
/* define replacement behavior */
|
/* define replacement behavior */
|
||||||
bool reuseDepot = tv->IsSetReuseDepotVehicles();
|
bool reuseDepot = tv->IsSetReuseDepotVehicles();
|
||||||
bool keepRemainders = tv->IsSetKeepRemainingVehicles();
|
bool keepRemainders = tv->IsSetKeepRemainingVehicles();
|
||||||
|
@@ -1388,8 +1388,6 @@ void CallVehicleTicks()
|
|||||||
bool leaveDepot = it->second;
|
bool leaveDepot = it->second;
|
||||||
_vehicles_to_autoreplace.erase(it);
|
_vehicles_to_autoreplace.erase(it);
|
||||||
|
|
||||||
RegisterGameEvents(GEF_TBTR_REPLACEMENT);
|
|
||||||
|
|
||||||
/* Store the position of the effect as the vehicle pointer will become invalid later */
|
/* Store the position of the effect as the vehicle pointer will become invalid later */
|
||||||
int x = t->x_pos;
|
int x = t->x_pos;
|
||||||
int y = t->y_pos;
|
int y = t->y_pos;
|
||||||
|
@@ -147,10 +147,10 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||||||
|
|
||||||
Vehicle *v = nullptr;
|
Vehicle *v = nullptr;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_SHIP: value.AddCost(CmdBuildShip (tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
case VEH_SHIP: value.AddCost(CmdBuildShip (tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_AIRCRAFT: value.AddCost(CmdBuildAircraft (tile, subflags, e, GB(p1, 24, 8), &v)); break;
|
case VEH_AIRCRAFT: value.AddCost(CmdBuildAircraft (tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
||||||
default: NOT_REACHED(); // Safe due to IsDepotTile()
|
default: NOT_REACHED(); // Safe due to IsDepotTile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1110,6 +1110,7 @@ enum TileHighlightType {
|
|||||||
THT_WHITE,
|
THT_WHITE,
|
||||||
THT_BLUE,
|
THT_BLUE,
|
||||||
THT_RED,
|
THT_RED,
|
||||||
|
THT_LIGHT_BLUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Station *_viewport_highlight_station; ///< Currently selected station for coverage area highlight
|
const Station *_viewport_highlight_station; ///< Currently selected station for coverage area highlight
|
||||||
@@ -1123,7 +1124,7 @@ const Town *_viewport_highlight_town; ///< Currently selected town for cov
|
|||||||
static TileHighlightType GetTileHighlightType(TileIndex t)
|
static TileHighlightType GetTileHighlightType(TileIndex t)
|
||||||
{
|
{
|
||||||
if (_viewport_highlight_station != nullptr) {
|
if (_viewport_highlight_station != nullptr) {
|
||||||
if (IsTileType(t, MP_STATION) && GetStationIndex(t) == _viewport_highlight_station->index) return THT_WHITE;
|
if (IsTileType(t, MP_STATION) && GetStationIndex(t) == _viewport_highlight_station->index) return THT_LIGHT_BLUE;
|
||||||
if (_viewport_highlight_station->TileIsInCatchment(t)) return THT_BLUE;
|
if (_viewport_highlight_station->TileIsInCatchment(t)) return THT_BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,6 +1162,7 @@ static void DrawTileHighlightType(const TileInfo *ti, TileHighlightType tht)
|
|||||||
case THT_WHITE: DrawTileSelectionRect(ti, PAL_NONE); break;
|
case THT_WHITE: DrawTileSelectionRect(ti, PAL_NONE); break;
|
||||||
case THT_BLUE: DrawTileSelectionRect(ti, PALETTE_SEL_TILE_BLUE); break;
|
case THT_BLUE: DrawTileSelectionRect(ti, PALETTE_SEL_TILE_BLUE); break;
|
||||||
case THT_RED: DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING); break;
|
case THT_RED: DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING); break;
|
||||||
|
case THT_LIGHT_BLUE: DrawTileSelectionRect(ti, SPR_ZONING_INNER_HIGHLIGHT_LIGHT_BLUE); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user