Add a "misc_debug" console command
Add a flag to open veh window when TrainBrakesOverheatedBreakdown called
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "string_func_extra.h"
|
||||
#include "linkgraph/linkgraphjob.h"
|
||||
#include "base_media_base.h"
|
||||
#include "debug_settings.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "safeguards.h"
|
||||
@@ -2847,6 +2848,23 @@ DEF_CONSOLE_CMD(ConRecalculateRoadCachedOneWayStates)
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConMiscDebug)
|
||||
{
|
||||
if (argc < 1 || argc > 2) {
|
||||
IConsoleHelp("Debug: misc flags. Usage: 'misc_debug [<flags>]'");
|
||||
IConsoleHelp(" 1: MDF_OVERHEAT_BREAKDOWN_OPEN_WIN");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
IConsolePrintF(CC_DEFAULT, "Misc debug flags: %X", _misc_debug_flags);
|
||||
} else {
|
||||
_misc_debug_flags = strtoul(argv[1], nullptr, 16);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConDoDisaster)
|
||||
{
|
||||
if (argc == 0) {
|
||||
@@ -3437,6 +3455,7 @@ void IConsoleStdLibRegister()
|
||||
IConsoleCmdRegister("gfx_debug", ConGfxDebug, nullptr, true);
|
||||
IConsoleCmdRegister("csleep", ConCSleep, nullptr, true);
|
||||
IConsoleCmdRegister("recalculate_road_cached_one_way_states", ConRecalculateRoadCachedOneWayStates, ConHookNoNetwork, true);
|
||||
IConsoleCmdRegister("misc_debug", ConMiscDebug, nullptr, true);
|
||||
|
||||
/* NewGRF development stuff */
|
||||
IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);
|
||||
|
@@ -60,6 +60,8 @@ std::string _loadgame_DBGL_data;
|
||||
bool _save_DBGC_data = false;
|
||||
std::string _loadgame_DBGC_data;
|
||||
|
||||
uint32 _misc_debug_flags;
|
||||
|
||||
struct DebugLevel {
|
||||
const char *name;
|
||||
int *level;
|
||||
|
@@ -23,4 +23,9 @@ inline bool HasChickenBit(ChickenBitFlags flag)
|
||||
return HasBit(_settings_game.debug.chicken_bits, flag);
|
||||
}
|
||||
|
||||
enum MiscDebugFlags {
|
||||
MDF_OVERHEAT_BREAKDOWN_OPEN_WIN,
|
||||
};
|
||||
extern uint32 _misc_debug_flags;
|
||||
|
||||
#endif /* DEBUG_SETTINGS_H */
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "scope_info.h"
|
||||
#include "scope.h"
|
||||
#include "core/checksum_func.hpp"
|
||||
#include "debug_settings.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/train_cmd.h"
|
||||
@@ -6800,6 +6801,10 @@ void TrainBrakesOverheatedBreakdown(Vehicle *v)
|
||||
Train *t = Train::From(v)->First();
|
||||
if (t->breakdown_ctr != 0 || (t->vehstatus & VS_CRASHED)) return;
|
||||
|
||||
if (unlikely(HasBit(_misc_debug_flags, MDF_OVERHEAT_BREAKDOWN_OPEN_WIN)) && !_network_dedicated) {
|
||||
ShowVehicleViewWindow(t);
|
||||
}
|
||||
|
||||
t->crash_anim_pos = std::min<uint>(1500, t->crash_anim_pos + 200);
|
||||
if (t->crash_anim_pos < 1500) return;
|
||||
|
||||
|
Reference in New Issue
Block a user