Saveload.cpp problems

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Saveload.cpp problems

Post by Draakon »

Hello, i have a problem with saveload.cpp after applying some patches.

Using r11642 i have applied these patches: Copy&Paste, Daylenght, No Aircrashes, No Localauthority, No Random Industries, and No hill and curve slowdown patches.

Compling went wine, but after making some trains and saving, i get this error:

Code: Select all

Assertion Failed!

C:\Program Files\Openttd\Openttd.exe
File:C:\BuildOTTD\Msys\home\trunk\src\saveload.cpp
Line:460

Expression x >= 0 && x <= 65535

For information on how your program can cause an assertion failure, see Visual C++ documentation on asserts.

(Press Retry to debug the application - JIT must be enabled)
And that means if i press ignore, it saves but on loading it says invalid chunk size.

Any help?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Saveload.cpp problems

Post by DaleStan »

Then figure out which patch causes the problem, and complain to the author of that patch. This is the place for problems with stock builds of OpenTTD, not patched builds.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Saveload.cpp problems

Post by Draakon »

1. Don't be rude
2. Im no expert
3. Every of those patches modify saveload.cpp
4. None of those patches modify Line 460 of saveload.cpp
User avatar
CMircea
Chairman
Chairman
Posts: 887
Joined: 29 Dec 2006 14:05

Re: Saveload.cpp problems

Post by CMircea »

Draakon wrote:1. Don't be rude
2. Im no expert
3. Every of those patches modify saveload.cpp
4. None of those patches modify Line 460 of saveload.cpp
They don't need to. IF x gets a value outside those limits (greater than zero, and smaller than 65535) then the expression will be false, which probably isn't intended, thus the assertion comes up. If you reproduce it in the latest nightly build then it's a bug, else it's a bug in one of those patches.
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Saveload.cpp problems

Post by andrewas »

Draakon wrote: 2. Im no expert
Doesn't take an expert to try patches one by one to find which one causes the crash. If possible, getting a backtrace out of a debugger will tell us a lot more about the crash, but I dont know how one would go about that under Visual C++. Check the help, see if you can find out how to set a breakpoint on the assert function, then trace when the breakpoint is hit.
3. Every of those patches modify saveload.cpp
Daylength doesn't, and thats the patch which causes this, or at least, thats the patch which is giving me this problem.
4. None of those patches modify Line 460 of saveload.cpp
Its actually pretty rare for an error to come directly from patch code. In this case, something is throwing a value out of range, the game works correctly except for when trying to save or load it. Assuming you're getting the same crash I am, the problem is to do with _date_desc, which makes sense given that daylength makes days longer and some tick counters now go higher. I think I can update the save code to cope.
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Saveload.cpp problems

Post by Draakon »

So you say DayLenght Patch causes these problems?
User avatar
CMircea
Chairman
Chairman
Posts: 887
Joined: 29 Dec 2006 14:05

Re: Saveload.cpp problems

Post by CMircea »

Draakon wrote:So you say DayLenght Patch causes these problems?
Yes, he does.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Saveload.cpp problems

Post by Wolf01 »

yes he does, for sure

/me hides

increase the savegame variable
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Saveload.cpp problems

Post by pavel1269 »

how is possible that he cause that error? what kind of error this is? :? i play with daylength all time, and i didnt get this error at all ;)
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Saveload.cpp problems

Post by andrewas »

Actually, I said that daylength causes similar problems for me, but the other patches may also cause it. Its not a specific error message.

Also, I don't understand why daylength causes this problem, I can only see one reason for failure - the time for the next AI to start can be more than 65535 if the daylength factor is high enough - but that should be intermittent, and only appear at high daylengths.

Still, after limited testing (approx two minutes), the fix appears to work. Edit saveload.cpp and increment the savegame version to 83. Then edit misc.cpp and change the _save_desc description so that _next_competitor_start is saved as UINT32 for save versions greated than 82. It may be necessary to do the same for _cur_player_tick_index, I just changed them both since I don't know anything about what that variable is used for.
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: Saveload.cpp problems

Post by dihedral »

Draakon wrote:1. Don't be rude
he's not - you will really KNOW when he is
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Saveload.cpp problems[SLOVED]

Post by Draakon »

ok i think problem sloved, daylenght patch caused this problem.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 49 guests