Add cmresettowngrowth command to reset growth rate of all towns to normal
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "../fileio_type.h"
|
||||
#include "../map_type.h"
|
||||
#include "../map_func.h"
|
||||
#include "../town.h"
|
||||
#include "../tree_map.h"
|
||||
|
||||
#include "../safeguards.h"
|
||||
@@ -108,4 +109,23 @@ bool ConTreeMap(byte argc, char *argv[]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void (*UpdateTownGrowthRate)(Town *t);
|
||||
|
||||
bool ConResetTownGrowth(byte argc, char *argv[]) {
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Loads heighmap-like file and plants trees according to it, values 0-256 ore scaled to 0-4 trees.");
|
||||
IConsoleHelp("Usage: 'cmtreemap <file>'");
|
||||
IConsoleHelp("Default lookup path is in scenario/heightmap in your openttd directory");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argc > 1) return false;
|
||||
|
||||
for (Town *town : Town::Iterate()) {
|
||||
ClrBit(town->flags, TOWN_CUSTOM_GROWTH);
|
||||
UpdateTownGrowthRate(town);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace citymania
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace citymania {
|
||||
bool ConStep(byte argc, char *argv[]);
|
||||
bool ConExport(byte argc, char *argv[]);
|
||||
bool ConTreeMap(byte argc, char *argv[]);
|
||||
bool ConResetTownGrowth(byte argc, char *argv[]);
|
||||
|
||||
} // namespace citymania
|
||||
|
||||
|
||||
@@ -2214,4 +2214,5 @@ void IConsoleStdLibRegister()
|
||||
IConsoleCmdRegister("cmstep", citymania::ConStep, ConHookNoNetwork);
|
||||
IConsoleCmdRegister("cmexport", citymania::ConExport);
|
||||
IConsoleCmdRegister("cmtreemap", citymania::ConTreeMap, ConHookNoNetwork);
|
||||
IConsoleCmdRegister("cmresettowngrowth", citymania::ConResetTownGrowth, ConHookNoNetwork);
|
||||
}
|
||||
|
||||
@@ -4006,3 +4006,7 @@ void ResetHouses()
|
||||
/* Reset any overrides that have been set. */
|
||||
_house_mngr.ResetOverride();
|
||||
}
|
||||
|
||||
namespace citymania {
|
||||
auto UpdateTownGrowthRate = &::UpdateTownGrowthRate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user