http://rbijker.net/openttd/cd/0000-Feat ... inks.patch
Deadlock may be a bit unclear in this context.What if the loading time is huge (e.g. way too long train), is that going to trigger deadlocks?
The vehicle is going to some station and could load cargo also going to that station. However, if the vehicle has not visited the station yet, there might not be a link, yet. Thus we add the links here so that in the next link graph run (while the vehicle may still be loaded) cargo can be sent to the vehicle's next stop. This is unrelated to vehicle length or loading time.
The elses are there for clarity. I find that explicit depiction of alternatives much more readable. I'll change them for you, though.No need for else if you return from the if statements.
GetNext never returns NULL if there is a valid station in the list. As the given "next" is already valid and a station in the list, weWhat if this next yields NULL? In the 'true' case you explicitly check for it
don't have to check for NULL here.
That could be done, but requires more code and more review work. I tried to minimize the code volume. It's not so bad if a bogus link occurs from time to time. The link will be removed when it times out. The cargo will then be rescheduled and the problem solves itself.In my opinion these averages should be removed when a station is removed, not when RunAverages is ran. As in this manner it could create a non-existing link between (two) just removed and constructed (possibly by another player) stations
That is not really a problem either. The averages are not so very accurate anyway. Handling that case would increase code complexity for little gain.The tick counter overflows ever 65536 ticks. So every 2.5 years half of the stations are missing one RunAverages call.
It cannot go through the normal procedure because of the weird mail_capacity thing with DetermineCapacity() a few lines above. You cannot separately refit the shadow or the rotor.Not quite true. It's actually two or three (rotor), but bailing out might be better yes. However, can't it just go through the normal procedures?
http://rbijker.net/openttd/cd/0001-Add- ... raph.patch
Actually not. The last_component member of GoodsEntry is updated in the process. So station cannot be const.Station * could be const Station * as far as I could see. It shows the intention you do not change anything and the compiler can use that for optimisations
This involves either another "friend" declaration or an extra public method for this purpose. Is that worth it?Wouldn't this "corner case" belong in the savegame loading code? Or can't it be placed there in a nice manner?
The component ids are the same bit length as the station ids. There cannot be more components than stations for a given cargo and so as long as the station IDs don't overflow, the component IDs can't overflow, either.What ways are there to prevent an onverflow in the component_id? If there is one, is that a problem?
Because the joining and spawning itself may be noticable on slow computers. I'm trying to space them apart as far as possible in order to not make the lags induced by them appear as one big lag.Why aren't threads spawned and joined in the same tick, or maybe one tick apart? In the current method you "lose" roughly half a game day of processing power per recalc_interval
If it's not given the setting is shown in the "advanced" category. I found that adequate.The "cat" seems to be missing, compared to trunk settings.ini. Not sure how important it is as it's new for me