News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Coding assistance sought - teleporting to depots

Started by jamespetts, November 03, 2011, 12:47:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I wonder whether anyone can assist: on my running-powers Github branch, I have pushed some code that is intended to send convoys to depot if they have been in the "no route" state for too long. The idea of this is to prevent there from being stuck vehicles persisting for a long time in multi-player games where access rights to another player's ways are withdrawn when a payer whose vehicles are using the way is away. Further, vehicles teleport to a suitable depot if there is no route to their depot.

The code for sending vehicles to the depot normally works without problem, but the teleporting code does not: perhaps because I do not fully understand the movement code. Errors include the vehicle appearing graphically over the depot, appearing to emerge multiple times from the depot when set to leave the depot again, and accelerating too fast on leaving the depot (as if it were weightless).

Any assistance would be much appreciated!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

IN standard there is a routine to be called for entering into depots (betrete_depot). That should take care of that.

Dwachs

It looks like a combination of convoi_t::betrete_depot and depot_t::convoi_arrived should work, allowing you to remove great parts of the unreserving etc code in your patch. I suspect the calls
+            v->set_pos(home_depot);
+            v->betrete_feld();

are the faulty parts. Vehicles in depot are _not_ on the map, ie calling betrete_feld is wrong here.
Parsley, sage, rosemary, and maggikraut.

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.