Simplify Patches

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
gagarin
Engineer
Engineer
Posts: 57
Joined: 26 Feb 2006 18:52
Location: Berlin, Germany

Simplify Patches

Post by gagarin »

What do you think of making a function like

vehiclemayenter(tile, vehicle)

or so

which containbs all checks whether a vehicle could or could not enter a tile (like track, bridge, station, depot, ...).
So you have to change only one function instead of ifs in multiple files.
This would make live (coding) a lot easier, specially for the subsidiaries patch.

Greetings,
gagarin
Hazelrah
Traffic Manager
Traffic Manager
Posts: 196
Joined: 13 Apr 2005 05:41

Post by Hazelrah »

I wonder how hard that would be... have you tried to make one yourself yet? Who knows, if you make a patch for it, maybe the devs will throw it in for you! :)

What are you thinking this would entail. Any type of vehicle at all? What about for trains at a stop light, busses waiting for terminals, airplanes trying to land a busy airports. Would this return True or False?

-Hazerlah
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1791
Joined: 30 Mar 2005 09:43

Post by peter1138 »

VehicleEnterTile() already does this...
He's like, some kind of OpenTTD developer.
gagarin
Engineer
Engineer
Posts: 57
Joined: 26 Feb 2006 18:52
Location: Berlin, Germany

Post by gagarin »

I haven't tried it yet, because i'm short on time.
I think I can do this within a week or so.

I thought it as a replace ment for the Owner an railtype checks.
So for airplanes it would check if they are allowed to land on the airport, not if it is full or not.

the special things like full bus-stops and stop lights should be left in the functions for each vehicle type.

My function would only do the general checks.
This is mostly intended to simplify the maintenance of the subsidiaries Patch. In te if-construct for checking the tile owner and so on were a lot of changes and eveyrytime you got a lot of rejects when patching the subsidiaries patch in.
with this single function you have only to change one file and there hopefully not more than 3 lines.

This could make it simplier for anyone else how ist changing those things, too.
gagarin
Engineer
Engineer
Posts: 57
Joined: 26 Feb 2006 18:52
Location: Berlin, Germany

Post by gagarin »

To clarify my approach:

I would like to replace all calls to IsTileOwner on vehicle-concerned functions by a function, that you can change without changing IsTileOwner.
So that you can change the behavior without too much changes in the code.

@peter1138
could you have a wuick look at the latest subsidiaries-patch send post what has to be done to get it in the trunk (I know it is on the roadmap vor 0.6 but it would be easier to get it in the trunk then, when someone (maybe me) could prepare it as early as possible)

greetings
gagarin
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests