reset the saved frame counter on new world

this allows the plugins to function normally even after one world is
exited and a different world with a lower frame counter is loaded
develop
Myk Taylor 2023-02-02 23:44:33 -08:00
parent 76712a533c
commit 6831b1a1ae
No known key found for this signature in database
9 changed files with 10 additions and 0 deletions

@ -122,6 +122,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -158,6 +158,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -167,6 +167,7 @@ DFhackCExport command_result plugin_shutdown(color_ostream &out)
DFhackCExport command_result plugin_load_data(color_ostream &out) DFhackCExport command_result plugin_load_data(color_ostream &out)
{ {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) if (!config.isValid())

@ -96,6 +96,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -107,6 +107,7 @@ DFhackCExport command_result plugin_shutdown(color_ostream &out)
DFhackCExport command_result plugin_load_data(color_ostream &out) DFhackCExport command_result plugin_load_data(color_ostream &out)
{ {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) if (!config.isValid())

@ -162,6 +162,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -103,6 +103,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -85,6 +85,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
config = World::GetPersistentData(CONFIG_KEY); config = World::GetPersistentData(CONFIG_KEY);
if (!config.isValid()) { if (!config.isValid()) {

@ -165,6 +165,8 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
} }
DFhackCExport command_result plugin_load_data (color_ostream &out) { DFhackCExport command_result plugin_load_data (color_ostream &out) {
cycle_timestamp = 0;
world_plant_ids.clear(); world_plant_ids.clear();
for (size_t i = 0; i < world->raws.plants.all.size(); ++i) { for (size_t i = 0; i < world->raws.plants.all.size(); ++i) {
auto & plant = world->raws.plants.all[i]; auto & plant = world->raws.plants.all[i];