The International Simutrans Forum

Development => Extension Requests => Topic started by: z9999 on November 19, 2008, 04:45:46 PM

Title: [Q] Vehicle replacement and vehikel_search
Post by: z9999 on November 19, 2008, 04:45:46 PM
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.
Title: Re: [Q] Vehicle replacement and vehikel_search
Post by: prissi on November 19, 2008, 09:19:09 PM
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.
Title: Re: [Q] Vehicle replacement and vehikel_search
Post by: z9999 on November 20, 2008, 05:39:57 AM
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.

Code: [Select]
// 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.
Title: Re: [Q] Vehicle replacement and vehikel_search
Post by: prissi on November 20, 2008, 09:22:31 PM
Probably working now better.