Add debug console command to merge all linkgraph jobs ASAP

This commit is contained in:
Jonathan G Rennison
2020-07-06 19:31:58 +01:00
parent cd89b246a7
commit 4ac30471a3

View File

@@ -47,6 +47,7 @@
#include "town.h"
#include "industry.h"
#include "string_func_extra.h"
#include "linkgraph/linkgraphjob.h"
#include <time.h>
#include "safeguards.h"
@@ -2022,6 +2023,17 @@ DEF_CONSOLE_CMD(ConResetBlockedHeliports)
return true;
}
DEF_CONSOLE_CMD(ConMergeLinkgraphJobsAsap)
{
if (argc == 0) {
IConsoleHelp("Merge linkgraph jobs asap, for single-player use only.");
return true;
}
for (LinkGraphJob *lgj : LinkGraphJob::Iterate()) lgj->ShiftJoinDate((((_date * DAY_TICKS) + _date_fract) - lgj->JoinDateTicks()) / DAY_TICKS);
return true;
}
DEF_CONSOLE_CMD(ConDumpCommandLog)
{
if (argc == 0) {
@@ -2677,4 +2689,5 @@ void IConsoleStdLibRegister()
/* Bug workarounds */
IConsoleCmdRegister("jgrpp_bug_workaround_unblock_heliports", ConResetBlockedHeliports, ConHookNoNetwork, true);
IConsoleCmdRegister("merge_linkgraph_jobs_asap", ConMergeLinkgraphJobsAsap, ConHookNoNetwork, true);
}