Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat May 25, 2019 12:05 pm

All times are UTC




Post new topic  Reply to topic  [ 26 posts ]  Go to page Previous 1 2
Author Message
PostPosted: Tue Apr 02, 2019 12:41 am 
Offline
Engineer
Engineer

Joined: Fri Mar 15, 2019 7:56 pm
Posts: 22
I have found a bug (I believe):

The time elapsed is reset when you load your saved game. Can you confirm?


Top
   
PostPosted: Tue Apr 02, 2019 8:53 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 1161
HapticTactic wrote:
The time elapsed is reset when you load your saved game. Can you confirm?

Yes, it is a bug, but I have no idea, how to fix it. I have variable for starting year saved:
Code:
function GSToyHelper::Save() {
   local save_table = {};
   save_table.town_data_table <- {};
   if (firsttime_start) {
      save_table.town_data_table <- ::TownDataTable;
   } else {
      foreach (i, town in this.towns)
         {
            save_table.town_data_table[town.id] <- town.SavingTownData();
         }
      save_table.gamestart_year <- this.gamestart_year;
   }
   return save_table;
}

and loaded:
Code:
function GSToyHelper::Load(version, saved_data)
{
   firsttime_start = false;
   foreach (townid, town_data in saved_data.town_data_table) {
      ::TownDataTable[townid] <- town_data;
   }
   this.gamestart_year = saved_data.gamestart_year;
}

but it doesn't work, I have to little knowledge of squirrel to found out what is wrong.

_________________
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.


Top
   
PostPosted: Tue Apr 02, 2019 9:31 am 
Offline
Engineer
Engineer

Joined: Fri Mar 15, 2019 7:56 pm
Posts: 22
Well, that's too bad. My programming skills for OTTD are non-existent.

What is the actual effect of this bug? Does it only mean that the script becomes easier in difficulty every time the time is reset because the global economy index grows?


Top
   
PostPosted: Tue Apr 02, 2019 12:59 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 1161
HapticTactic wrote:
What is the actual effect of this bug? Does it only mean that the script becomes easier in difficulty every time the time is reset because the global economy index grows?

Exactly yes. In case of multiplayer server, there is usually no problem due to lack of save/load procedures. In case of singleplayer, you can just pause game instead of quit.


Top
   
PostPosted: Tue Apr 02, 2019 7:36 pm 
Offline
Engineer
Engineer

Joined: Fri Mar 15, 2019 7:56 pm
Posts: 22
McZapkie wrote:
HapticTactic wrote:
What is the actual effect of this bug? Does it only mean that the script becomes easier in difficulty every time the time is reset because the global economy index grows?

Exactly yes. In case of multiplayer server, there is usually no problem due to lack of save/load procedures. In case of singleplayer, you can just pause game instead of quit.


Well, I am currently using the script in a multiplayer game that we have saved and loaded numerous times (because the game is long).


Top
   
PostPosted: Mon Apr 15, 2019 2:37 pm 
Offline
Engineer
Engineer

Joined: Wed May 24, 2017 12:51 pm
Posts: 45
Location: East Texas
I'm just guessing but do you need to save gamestart_year on the first run? Maybe you can move that line out of the if() like so...

Code:
function GSToyHelper::Save() {
   local save_table = {};
   save_table.town_data_table <- {};
   if (firsttime_start) {
      save_table.town_data_table <- ::TownDataTable;
   } else {
      foreach (i, town in this.towns)
         {
            save_table.town_data_table[town.id] <- town.SavingTownData();
         }
      //save_table.gamestart_year <- this.gamestart_year;
   }
   save_table.gamestart_year <- this.gamestart_year;
   return save_table;
}


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 26 posts ]  Go to page Previous 1 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.