Debug: Add experimental command to switch baseset
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include "industry.h"
|
||||
#include "string_func_extra.h"
|
||||
#include "linkgraph/linkgraphjob.h"
|
||||
#include "base_media_base.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "safeguards.h"
|
||||
@@ -2810,6 +2811,27 @@ DEF_CONSOLE_CMD(ConRailTypeMapColourCtl)
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConSwitchBaseset)
|
||||
{
|
||||
if (argc != 2) {
|
||||
IConsoleHelp("Debug: Try to switch baseset and reload NewGRFs. Usage: 'switch_baseset <baseset-name>'");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BaseGraphics::GetNumSets(); i++) {
|
||||
const GraphicsSet *basegfx = BaseGraphics::GetSet(i);
|
||||
if (argv[1] == basegfx->name) {
|
||||
extern std::string _switch_baseset;
|
||||
_switch_baseset = basegfx->name;
|
||||
_check_special_modes = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
IConsolePrintF(CC_WARNING, "No such baseset: %s.", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
/******************
|
||||
* debug commands
|
||||
@@ -3031,6 +3053,7 @@ void IConsoleStdLibRegister()
|
||||
IConsoleCmdRegister("delete_company", ConDeleteCompany, ConHookNewGRFDeveloperTool, true);
|
||||
IConsoleCmdRegister("road_type_flag_ctl", ConRoadTypeFlagCtl, ConHookNewGRFDeveloperTool, true);
|
||||
IConsoleCmdRegister("rail_type_map_colour_ctl", ConRailTypeMapColourCtl, ConHookNewGRFDeveloperTool, true);
|
||||
IConsoleCmdRegister("switch_baseset", ConSwitchBaseset, ConHookNewGRFDeveloperTool, true);
|
||||
|
||||
/* Bug workarounds */
|
||||
IConsoleCmdRegister("jgrpp_bug_workaround_unblock_heliports", ConResetBlockedHeliports, ConHookNoNetwork, true);
|
||||
|
@@ -245,6 +245,7 @@ static void OnNewMonth()
|
||||
{
|
||||
if (_settings_client.gui.autosave != 0 && (_cur_date_ymd.month % _autosave_months[_settings_client.gui.autosave]) == 0) {
|
||||
_do_autosave = true;
|
||||
_check_special_modes = true;
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
}
|
||||
|
||||
|
@@ -47,11 +47,13 @@ bool _right_button_down; ///< Is right mouse button pressed?
|
||||
bool _right_button_clicked; ///< Is right mouse button clicked?
|
||||
DrawPixelInfo _screen;
|
||||
bool _screen_disable_anim = false; ///< Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
|
||||
bool _check_special_modes;
|
||||
bool _exit_game;
|
||||
GameMode _game_mode;
|
||||
SwitchMode _switch_mode; ///< The next mainloop command.
|
||||
PauseMode _pause_mode;
|
||||
Palette _cur_palette;
|
||||
std::string _switch_baseset;
|
||||
|
||||
static byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth()
|
||||
DrawPixelInfo *_cur_dpi;
|
||||
|
@@ -1889,6 +1889,28 @@ static void DoAutosave()
|
||||
}
|
||||
}
|
||||
|
||||
void GameLoopSpecial()
|
||||
{
|
||||
/* autosave game? */
|
||||
if (_do_autosave) {
|
||||
DoAutosave();
|
||||
_do_autosave = false;
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
}
|
||||
|
||||
extern std::string _switch_baseset;
|
||||
if (!_switch_baseset.empty()) {
|
||||
if (BaseGraphics::GetUsedSet()->name != _switch_baseset) {
|
||||
BaseGraphics::SetSet(_switch_baseset);
|
||||
|
||||
ReloadNewGRFData();
|
||||
}
|
||||
_switch_baseset.clear();
|
||||
}
|
||||
|
||||
_check_special_modes = false;
|
||||
}
|
||||
|
||||
void GameLoop()
|
||||
{
|
||||
if (_game_mode == GM_BOOTSTRAP) {
|
||||
@@ -1900,12 +1922,7 @@ void GameLoop()
|
||||
|
||||
ProcessAsyncSaveFinish();
|
||||
|
||||
/* autosave game? */
|
||||
if (_do_autosave) {
|
||||
DoAutosave();
|
||||
_do_autosave = false;
|
||||
SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
}
|
||||
if (unlikely(_check_special_modes)) GameLoopSpecial();
|
||||
|
||||
/* switch game mode? */
|
||||
if (_switch_mode != SM_NONE && !HasModalProgress()) {
|
||||
|
@@ -55,6 +55,7 @@ enum ExtraDisplayOptions {
|
||||
|
||||
extern GameMode _game_mode;
|
||||
extern SwitchMode _switch_mode;
|
||||
extern bool _check_special_modes;
|
||||
extern bool _exit_game;
|
||||
|
||||
/** Modes of pausing we've got */
|
||||
|
Reference in New Issue
Block a user