News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

[Q] Vehicle replacement and vehikel_search

Started by z9999, November 19, 2008, 04:45:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

Well, this is not a bug report nor an extension request, but just a question that these are known issue or not.

- aircraft_t don't call vehikel_search, so they can't be replaced
- tender can't be replaced because of target_freight==NULL and target_weight==0
- each vehicle don't know first car or not, thus "ist_erstes" is always false. As a result. buses and trucks are not well replaced
- AI calls with target_speed argument, but this argument is not used for buses, trucks, ships and airplanes

Is these are known issue ? Thank you.

prissi

One more issue: There is a randomizer for the replacement too.

This replacement during load time is an emergency measure and is more there to prevent crashes. Giving the order in a convoi should be easy fixable.

But the vehicle selection for AI should be better, i.e. return a list of vehicle_besch_t and leave the selection to the AI. There is room for improvements.

z9999

#2
Thank you for explain it.

But current code is powerless to avoid crash.
If matching vehicle can't be found, the code below always causes crash because of wrong file pointer and can't continue loading a game.


// no matching vehicle found?
if(v->gib_besch()==NULL) {
// will create orphan object, but better than crashing at deletion ...
dbg->error("convoi_t::convoi_t()","Can't load vehicle and no replacement found!");
i --;
continue;
}


So, to prevent crashes (because this is the purpose of replacement), it must find something whether it is good one or not.

This is what I wanted to say. I don't need better vehikel_search but need crashless loading with missing vehicles.

prissi