New cargos experimental test version - a55vcs4
Posted: 15 Jul 2005 20:13
Hi everyone!
Those who are regular on IRC may already know that Mek has sent me his unfinished code for the newcargos feature some time ago. Since the release of alpha 54, I have been working on his code, and today it reached the stage when it works well enough to release a test version of it.
Please note: To make this feature possible, I had to change a lot of code written for the existing switches. Therefore, if something works strangely or differently from previous versions, please report it here, it's possible that I broke it accidentally. It may have become broken even with newcargos off. The affected switches are: loadtime, gradualloading, feederservice, fifoloading, selectgoods and newstations.
WARNIG: To make more cargos possible, the handling of station data has been changed. Old savegames are automatically converted to the new format while loading, but once you saved the game again, going back to the old scheme is very difficult. Therefore, please back up your important savegames before trying the test version, just in case something goes wrong.
Compiled binaries (2.0.1 alpha 55 vcs 4):
DOS version (compiled blindly)
Windows version
Diffs for a55vcs against alpha 55
Diffs for a55vcs2 against alpha 55vcs
Diffs for a55vcs3 against alpha 55vcs2
Diffs for a55vcs4 against alpha 55vcs3
Diffs for a55vcs4 against alpha 55
Demo GRF (source) (version 2)
This GRF adds a new cargo named "Chemicals" into the game. Oil wells produce it in addition to oil, and refineries accept them as well. There's one rail chemical tanker added (really the tropic water tanker "refitted" for chemicals) so you can try the actual transporting as well.
Yes, I know it's unrealistic, I know it doesn't make too much sense, but it's only a demo after all. You aren't meant to play with it seriously, I hope some GRF coders will provide "real" new cargos soon. Oh, and it works on temperate only.
[edit] Now that the AI doesn't crash the game with newcargos on, it can be "taught" to use the new cargo types. This GRF contains a demonstration that allows AI players to transport chemicals with the chemical tanker. If it tries transporting chemicals via road vehicles, it will still fail, though.
Moreindustriesperclimate replacement GRF (Source)
From this version on, enabling either newindustries or newcargos will automatically disable moreindustriesperclimate. My code and Oskar's code don't play nicely together, but now this doesn't matter, since the same functionality can be provided by a custom GRF instead. Paper.grf adds the paper cargo to the temperate climate and enables paper mills and printing works as well. If it has 1 for its first parameter, it will try to work exactly as moreindustriesperclimate: that is, the new industries won't be built on the map, they will only be accessible by manually funding them. If the parameter isn't 1, these will be built on random maps, and they default colors are changed slightly so you can make difference between steel mills and paper mills, or factories and printing works.
It should be safe for existing savegames to migrate from moreindustriesperclimate to paper.grf as long as paper.grf is the first newindustry-grf in your newgrf.cfg (that is, it's the first GRF that touches industries).
Known limitations of the switch:
- You can't have more than 12 different types of cargo in a station. You can have 32 in total, but no single station can have more than 12 simultaneously.
- The cargo payment graph window doesn't access the extra slots yet, so you can't view the graphs for the new types. Solving this one will be tricky, since the graph-drawing routine of TTD can't handle more than 16 graphs drawn in the same coordinate system.
Notice for GRF coders: I'm open to suggestions about improving or changing the format. To make this process easier, I'm reserving the right of modifying the current format without maintaining backwards compatibility. Once the format has been finalized, backward compatibility will be provided as usual.
All changes in alpha 55 vcs:
- New switch: newcargos
- Devel: Restructured load/unload code to a single proc instead of a myriad of small patches
- Industry colors must always be specified from the DOS palette from now on. The Windows version translates colors automatically.
- Added variable 1A, which is always FFFFFFFF, to help specifying constants for action 2 calculations
- Added multiply, and, or and xor to the available operations for action 2
- Added warning if a loaded scenario doesn't contain any towns.
(hotfix 1)
- Made gradualloading and fulloadany compatible again
- Fixed feederservice bug that caused negative profit for vehicles
(hotfix 2)
- Bugfix: Industry tile prop. 10 didn't work
(hotfix 3)
- Bugfix: New industry tiles didn't work correctly for water industries
- Bugfix: The game no longer crashes when an AI player tries transporting a new cargo type. It still needs to be "taught" what vehicles to use for the new cargos, though.
All changes in alpha 55 vcs 2:
- Special industry tile type FF now works on land as well (it used to always check for water)
- It's now possible for houses to accept any cargo by setting new house property 1E or using callback 2A. (Wiki will be updated soon)
- Fixed station trigger 2 (it was broken with newcargos on)
- Ctrl-built buoys now should work correctly
- Fixed newcargos breaking fifoloading
- Station action 3 wasn't working correctly with newcargos
- "Cht: ReloadIndustries" to reload all industry data to existing industries.
- Fixed sorting veh. lists by cargo type (broken since a55vcs)
- Fixed a possible crash with DCxx textIDs
All changes in alpha 55 vcs 3:
- Support for house/industry tiles consisting more sprites. (Wiki will be updated soon)
- Support for parametrized variables (6x) that accept a byte parameter.
- Fixed random station trigger 1 (it was broken for DOS since a55vcs and it seems Windows versions were broken before a55vcs as well)
- Two new parametrized house variables 60 and 61 to count houses other than the current
- Fixed bug with newcargos messing up waiting cargo amount reported to GRFs
- New parametrized variables (60..64) to get data about a cargo type waiting without directly reading the station struct
(hotfix 1)
- Fixed bug with multi-sprite tiles not working correctly with the larger spritelimit enabled
- Added variable 48 for stations: bit mask of accepted cargos
(hotfix 2)
- Fixed incorrect re-applying industry data after loading a game
- Two new callbacks, 2B and 2C to decide industry tile acceptance
(hotfix 3)
- Industry properties 0C..0E were broken
(hotfix 4)
- Fixed crash while TTD tries to build an oil rig
All changes in alpha 55 vcs 4:
- New callback 2D to select vehicle recoloring independently from the owner
- With newcargos on, there can be up to 65535 units waiting from each cargo type from now on, although the display will be incorrect if more than 32767 units are waiting. (The old limit was 4095 units)
- The industry funding window now displays the map colors of industries. Until someone comes up with a good way to fix the map legend, this list can be used to identify industries on the map.
- Fixed crash with Cht: ResetStation if newcargos was on.
Those who are regular on IRC may already know that Mek has sent me his unfinished code for the newcargos feature some time ago. Since the release of alpha 54, I have been working on his code, and today it reached the stage when it works well enough to release a test version of it.
Please note: To make this feature possible, I had to change a lot of code written for the existing switches. Therefore, if something works strangely or differently from previous versions, please report it here, it's possible that I broke it accidentally. It may have become broken even with newcargos off. The affected switches are: loadtime, gradualloading, feederservice, fifoloading, selectgoods and newstations.
WARNIG: To make more cargos possible, the handling of station data has been changed. Old savegames are automatically converted to the new format while loading, but once you saved the game again, going back to the old scheme is very difficult. Therefore, please back up your important savegames before trying the test version, just in case something goes wrong.
Compiled binaries (2.0.1 alpha 55 vcs 4):
DOS version (compiled blindly)
Windows version
Diffs for a55vcs against alpha 55
Diffs for a55vcs2 against alpha 55vcs
Diffs for a55vcs3 against alpha 55vcs2
Diffs for a55vcs4 against alpha 55vcs3
Diffs for a55vcs4 against alpha 55
Demo GRF (source) (version 2)
This GRF adds a new cargo named "Chemicals" into the game. Oil wells produce it in addition to oil, and refineries accept them as well. There's one rail chemical tanker added (really the tropic water tanker "refitted" for chemicals) so you can try the actual transporting as well.
Yes, I know it's unrealistic, I know it doesn't make too much sense, but it's only a demo after all. You aren't meant to play with it seriously, I hope some GRF coders will provide "real" new cargos soon. Oh, and it works on temperate only.
[edit] Now that the AI doesn't crash the game with newcargos on, it can be "taught" to use the new cargo types. This GRF contains a demonstration that allows AI players to transport chemicals with the chemical tanker. If it tries transporting chemicals via road vehicles, it will still fail, though.
Moreindustriesperclimate replacement GRF (Source)
From this version on, enabling either newindustries or newcargos will automatically disable moreindustriesperclimate. My code and Oskar's code don't play nicely together, but now this doesn't matter, since the same functionality can be provided by a custom GRF instead. Paper.grf adds the paper cargo to the temperate climate and enables paper mills and printing works as well. If it has 1 for its first parameter, it will try to work exactly as moreindustriesperclimate: that is, the new industries won't be built on the map, they will only be accessible by manually funding them. If the parameter isn't 1, these will be built on random maps, and they default colors are changed slightly so you can make difference between steel mills and paper mills, or factories and printing works.
It should be safe for existing savegames to migrate from moreindustriesperclimate to paper.grf as long as paper.grf is the first newindustry-grf in your newgrf.cfg (that is, it's the first GRF that touches industries).
Known limitations of the switch:
- You can't have more than 12 different types of cargo in a station. You can have 32 in total, but no single station can have more than 12 simultaneously.
- The cargo payment graph window doesn't access the extra slots yet, so you can't view the graphs for the new types. Solving this one will be tricky, since the graph-drawing routine of TTD can't handle more than 16 graphs drawn in the same coordinate system.
Notice for GRF coders: I'm open to suggestions about improving or changing the format. To make this process easier, I'm reserving the right of modifying the current format without maintaining backwards compatibility. Once the format has been finalized, backward compatibility will be provided as usual.
All changes in alpha 55 vcs:
- New switch: newcargos
- Devel: Restructured load/unload code to a single proc instead of a myriad of small patches
- Industry colors must always be specified from the DOS palette from now on. The Windows version translates colors automatically.
- Added variable 1A, which is always FFFFFFFF, to help specifying constants for action 2 calculations
- Added multiply, and, or and xor to the available operations for action 2
- Added warning if a loaded scenario doesn't contain any towns.
(hotfix 1)
- Made gradualloading and fulloadany compatible again
- Fixed feederservice bug that caused negative profit for vehicles
(hotfix 2)
- Bugfix: Industry tile prop. 10 didn't work
(hotfix 3)
- Bugfix: New industry tiles didn't work correctly for water industries
- Bugfix: The game no longer crashes when an AI player tries transporting a new cargo type. It still needs to be "taught" what vehicles to use for the new cargos, though.
All changes in alpha 55 vcs 2:
- Special industry tile type FF now works on land as well (it used to always check for water)
- It's now possible for houses to accept any cargo by setting new house property 1E or using callback 2A. (Wiki will be updated soon)
- Fixed station trigger 2 (it was broken with newcargos on)
- Ctrl-built buoys now should work correctly
- Fixed newcargos breaking fifoloading
- Station action 3 wasn't working correctly with newcargos
- "Cht: ReloadIndustries" to reload all industry data to existing industries.
- Fixed sorting veh. lists by cargo type (broken since a55vcs)
- Fixed a possible crash with DCxx textIDs
All changes in alpha 55 vcs 3:
- Support for house/industry tiles consisting more sprites. (Wiki will be updated soon)
- Support for parametrized variables (6x) that accept a byte parameter.
- Fixed random station trigger 1 (it was broken for DOS since a55vcs and it seems Windows versions were broken before a55vcs as well)
- Two new parametrized house variables 60 and 61 to count houses other than the current
- Fixed bug with newcargos messing up waiting cargo amount reported to GRFs
- New parametrized variables (60..64) to get data about a cargo type waiting without directly reading the station struct
(hotfix 1)
- Fixed bug with multi-sprite tiles not working correctly with the larger spritelimit enabled
- Added variable 48 for stations: bit mask of accepted cargos
(hotfix 2)
- Fixed incorrect re-applying industry data after loading a game
- Two new callbacks, 2B and 2C to decide industry tile acceptance
(hotfix 3)
- Industry properties 0C..0E were broken
(hotfix 4)
- Fixed crash while TTD tries to build an oil rig
All changes in alpha 55 vcs 4:
- New callback 2D to select vehicle recoloring independently from the owner
- With newcargos on, there can be up to 65535 units waiting from each cargo type from now on, although the display will be incorrect if more than 32767 units are waiting. (The old limit was 4095 units)
- The industry funding window now displays the map colors of industries. Until someone comes up with a good way to fix the map legend, this list can be used to identify industries on the map.
- Fixed crash with Cht: ResetStation if newcargos was on.