Page 1 of 1
Saveload.cpp problems
Posted: 23 Dec 2007 06:48
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?
Re: Saveload.cpp problems
Posted: 23 Dec 2007 07:13
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.
Re: Saveload.cpp problems
Posted: 23 Dec 2007 09:12
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
Re: Saveload.cpp problems
Posted: 23 Dec 2007 10:25
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.
Re: Saveload.cpp problems
Posted: 23 Dec 2007 11:51
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.
Re: Saveload.cpp problems
Posted: 23 Dec 2007 15:52
by Draakon
So you say DayLenght Patch causes these problems?
Re: Saveload.cpp problems
Posted: 23 Dec 2007 16:38
by CMircea
Draakon wrote:So you say DayLenght Patch causes these problems?
Yes, he does.
Re: Saveload.cpp problems
Posted: 23 Dec 2007 16:54
by Wolf01
yes he does, for sure
/me hides
increase the savegame variable
Re: Saveload.cpp problems
Posted: 23 Dec 2007 17:04
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

Re: Saveload.cpp problems
Posted: 23 Dec 2007 23:07
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.
Re: Saveload.cpp problems
Posted: 24 Dec 2007 11:18
by dihedral
Draakon wrote:1. Don't be rude
he's not - you will really KNOW when he is
Re: Saveload.cpp problems[SLOVED]
Posted: 25 Dec 2007 17:09
by Draakon
ok i think problem sloved, daylenght patch caused this problem.