Bugs with larger airports - READ
Posted: 06 Jun 2004 13:19
Recently some people have contacted me on IRC having bugs with airports since using savegames through several nightly builds.
I would like to give a brief statement about it, the cause of these problems, and a possible solution for the technical savvy ones.
Of course, using nightly builds, you accept that things can break, but we don't like that, that's why I tried to solve the people who contacted me with their problems (regarding airports).
Background
When a airport is built, it is given an index which is saved in Station *st->airport_type. This index tells the game what type of airport it is.
In the good old days without bigger airports, the code was as follows:
In the initial release of bigger airports, the indexes were as follows:
Unfortunately in the first release of larger airports, I forgot to update HELIPORT from 2-4 and OILFIELD from 3-5 (possible bug #1).
I then realized, why screw up the index, so I changed it back (OILRIG is 5, cause, well, it's special):
This combined with the infinity possibility of building new airports across multiple nightly builds is possible bug #3
Solution
For those of you that have programming knowledge, this can be easily solved. I added a concept fix for this, you can get it at http://darkvater.no-ip.com/temp/ottd/airportsvn_fix.c. Add this function to aircraft_cmd.c, somewhere just above AirportGoToNextPosition() (line 1800). Start the game WITHOUT the title screen, load the game, and see how this function is called exactly once. All code that actually does something is commented out, since it is custom which one to use. When done, and all seems ok, save the game, remove the function(call) and happily enjoy an unbugged game again.
To find out what to change: _stations[v->u.air.targetairport].airport_type This tells what type of airport the airplane accepts. So if target airport is a metropolitan one, it should be 3, and you should uncomment the appropiate line. Hopefully you won't have too much to fix. If you have many airplanes, uncomment return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT); on line 393 of aircraft_cmd.c to be able to pause all airplanes mid-air, and concentrate on a single one.
Solution for the non-programmer
If you really cannot live without your savegame, send it to me, and I'll see what I can do. Please no test-games, and the such, cause those are not worth the trouble and time I have to put in it to solve it.
All games started with an SVN version after 1 june, should not have any bugs for this.
In accordance with this, I have decided to release nightly builds with code-checking still in it. This means that if you get a bug, you will most likely not be able to play further, but it will result in the discovery of bugs a lot sooner
I would like to give a brief statement about it, the cause of these problems, and a possible solution for the technical savvy ones.
Of course, using nightly builds, you accept that things can break, but we don't like that, that's why I tried to solve the people who contacted me with their problems (regarding airports).
Background
When a airport is built, it is given an index which is saved in Station *st->airport_type. This index tells the game what type of airport it is.
In the good old days without bigger airports, the code was as follows:
Code: Select all
AT_SMALL = 0,
AT_LARGE = 1,
AT_HELIPORT = 2,
AT_OILFIELD = 3,
Code: Select all
AT_SMALL = 0,
AT_LARGE = 1,
AT_METROPOLITAN = 2,
AT_INTERNATIONAL = 3,
AT_HELIPORT = 4,
AT_OILFIELD = 5,
I then realized, why screw up the index, so I changed it back (OILRIG is 5, cause, well, it's special):
Code: Select all
AT_SMALL = 0,
AT_LARGE = 1,
AT_HELIPORT = 2,
AT_METROPOLITAN = 3,
AT_INTERNATIONAL = 4,
AT_OILRIG = 5
Solution
For those of you that have programming knowledge, this can be easily solved. I added a concept fix for this, you can get it at http://darkvater.no-ip.com/temp/ottd/airportsvn_fix.c. Add this function to aircraft_cmd.c, somewhere just above AirportGoToNextPosition() (line 1800). Start the game WITHOUT the title screen, load the game, and see how this function is called exactly once. All code that actually does something is commented out, since it is custom which one to use. When done, and all seems ok, save the game, remove the function(call) and happily enjoy an unbugged game again.
To find out what to change: _stations[v->u.air.targetairport].airport_type This tells what type of airport the airplane accepts. So if target airport is a metropolitan one, it should be 3, and you should uncomment the appropiate line. Hopefully you won't have too much to fix. If you have many airplanes, uncomment return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT); on line 393 of aircraft_cmd.c to be able to pause all airplanes mid-air, and concentrate on a single one.
Solution for the non-programmer
If you really cannot live without your savegame, send it to me, and I'll see what I can do. Please no test-games, and the such, cause those are not worth the trouble and time I have to put in it to solve it.
All games started with an SVN version after 1 june, should not have any bugs for this.
In accordance with this, I have decided to release nightly builds with code-checking still in it. This means that if you get a bug, you will most likely not be able to play further, but it will result in the discovery of bugs a lot sooner