OpenTTD

Tasklist

FS#5222 - Order of checks in commands need verification

Attached to Project: OpenTTD
Opened by Kogut (Kogut) - Tuesday, 26 June 2012, 19:16 GMT
Last edited by Alberth (Alberth) - Saturday, 07 July 2012, 09:28 GMT
Type Work in progress
Category Core
Status Waiting on reporter
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

if somebody attempts adding rail that is impossible due to terrain, on tile occupied by train reported error will be "train in the way" instead of "land sloped in wrong direction"

from http://www.tt-forums.net/viewtopic.php?f=32&t=61426
This task depends upon

Comment by Alberth (Alberth) - Saturday, 07 July 2012, 09:27 GMT
In general, checks are ordered to make failure as cheap as possible. Easy and fast checks are performed first so failure does not waste a lot of CPU time.

I verified this instance, and it seems to make sense in this case to swap the checks (patch attached).
That in turn means our code is not optimal in this respect. All commands should be verified for the order of checks.
Can you please find out which checks are in the wrong order? (In terms of increasing CPU costs.)

Loading...