Would it be feasible for the pathfinding/routefinding code to check for each tile it "follows" whether a "restiction" bit is set; and if so to only treat the tile as crossable if the vehicle for which the routefinder is currently operating satisfies a requirement encoded in a seperate table.
A binary tree based upon the tile's coordinates could be looked up, to lookup the requirement object, if the tile's bit is set.
This would eliminate the need for another landscape array with indexes to the appropiate restriction object.
Restrictions which I am thinking of are:
- Train length/number of carriages
Current destination
Vehicle horsepower
Vehicle max speed
Vehicle ID
Vehicle Type (Train: steam,diesel,electric,mono,maglev...)
<,>,<=,>=,==,!=
Possibly any combination of the above using logical operators:
or,and,xor.
As in the following pseudocode.
Btree
WORD xycoord
WORD restriction object id
DWORD PTR less
DWORD PTR more
Restriction Object
BYTE type (enum: 0-unused,1-5 rules: <,>,<=,>=,==,!=, 6-8 logical operators: and,or,xor.)
BYTE variable id
union {
WORD var1 (vehicle id/value/etc)
WORD restriction object id 1
}
union {
WORD var2
WORD restriction object id 2
}
ID's looked up via table
In pathfinder/routefinder:
test BYTE [array],bit
jnz checkrule
checkruleallowed:
save registers and perform check Somehere Else,
UI could be using a window similar to the route window.
However, as I'm not currently on my home machine, I will have to set up the environment before I could start coding, (with possibly a starter).
Finally,where would the best location in the executable for a patch to be inserted, or would it be possible to modify existing pathfinder modification patches, (pathsig.asm?)
Just a suggestion, I could code it if it is feasible.