Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AIVehicle.BuildVehicle tile validity precondition not enforced #10263

Closed
legitalk opened this issue Dec 20, 2022 · 2 comments
Closed

[Bug]: AIVehicle.BuildVehicle tile validity precondition not enforced #10263

legitalk opened this issue Dec 20, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@legitalk
Copy link

Version of OpenTTD

Nightly 20221214

Steps to reproduce

I was rising terrain.

Crash screenshots:
2022-12-20 11_48_10-Error!
2022-12-20 11_48_32-Fatal Application Failure

Upload crash files

OpenTTD.zip

@glx22
Copy link
Contributor

glx22 commented Dec 20, 2022

 	[Code externe]	
>	openttd.exe!raise(int signum) Ligne 547	C++
 	openttd.exe!abort() Ligne 71	C++
 	openttd.exe!error(const char * s, ...) Ligne 149	C++
 	[Cadre en ligne] openttd.exe!GetTileType(TileIndex) Ligne 98	C++
 	[Cadre en ligne] openttd.exe!IsTileType(TileIndex) Ligne 152	C++
 	[Cadre en ligne] openttd.exe!IsRailDepotTile(TileIndex) Ligne 107	C++
 	openttd.exe!IsDepotTile(TileIndex tile) Ligne 43	C++
 	openttd.exe!CmdBuildVehicle(DoCommandFlag flags, TileIndex tile, unsigned short eid, bool use_free_vehicles, unsigned char cargo, ClientID client_id) Ligne 90	C++
 	[Cadre en ligne] openttd.exe!std::invoke(std::tuple<CommandCost,unsigned int,unsigned int,unsigned short>(*)(DoCommandFlag, TileIndex, unsigned short, bool, unsigned char, ClientID)) Ligne 1572	C++
 	[Cadre en ligne] openttd.exe!std::_Apply_impl(std::tuple<CommandCost,unsigned int,unsigned int,unsigned short>(*)(DoCommandFlag, TileIndex, unsigned short, bool, unsigned char, ClientID)) Ligne 880	C++
 	[Cadre en ligne] openttd.exe!std::apply(std::tuple<CommandCost,unsigned int,unsigned int,unsigned short>(*)(DoCommandFlag, TileIndex, unsigned short, bool, unsigned char, ClientID)) Ligne 887	C++
 	openttd.exe!CommandHelper<31,std::tuple<CommandCost,unsigned int,unsigned int,unsigned short> (__cdecl*)(enum DoCommandFlag,TileIndex,unsigned short,bool,unsigned char,enum ClientID),1>::Execute(unsigned int err_message, void(*)(Commands, const CommandCost &, TileIndex) callback, bool estimate_only, bool network_command, bool tile, TileIndex args, std::tuple<TileIndex,unsigned short,bool,unsigned char,enum ClientID>) Ligne 398	C++
 	[Cadre en ligne] openttd.exe!CommandHelper<31,std::tuple<CommandCost,unsigned int,unsigned int,unsigned short> (__cdecl*)(enum DoCommandFlag,TileIndex,unsigned short,bool,unsigned char,enum ClientID),1>::Unsafe(unsigned int) Ligne 266	C++
 	openttd.exe!ScriptObject::ScriptDoCommandHelper<31,std::tuple<CommandCost,unsigned int,unsigned int,unsigned short> (__cdecl*)(enum DoCommandFlag,TileIndex,unsigned short,bool,unsigned char,enum ClientID)>::Execute(void(*)(ScriptInstance *) args, std::tuple<TileIndex,unsigned short,bool,unsigned char,enum ClientID>) Ligne 348	C++
 	[Cadre en ligne] openttd.exe!ScriptObject::ScriptDoCommandHelper<31,std::tuple<CommandCost,unsigned int,unsigned int,unsigned short> (__cdecl*)(enum DoCommandFlag,TileIndex,unsigned short,bool,unsigned char,enum ClientID)>::Do(void(*)(ScriptInstance *) <args_0>, TileIndex <args_1>, unsigned short <args_2>, bool <args_3>, unsigned char <args_4>, ClientID) Ligne 90	C++
 	openttd.exe!ScriptVehicle::_BuildVehicleInternal(TileIndex depot, unsigned short engine_id, unsigned char cargo) Ligne 75	C++
 	[Cadre en ligne] openttd.exe!SQConvert::HelperT<unsigned int (__cdecl*)(TileIndex,unsigned short)>::SQCall(void *) Ligne 155	C++
 	[Cadre en ligne] openttd.exe!SQConvert::HelperT<unsigned int (__cdecl*)(TileIndex,unsigned short)>::SQCall(void * func, unsigned int(*)(TileIndex, unsigned short)) Ligne 141	C++
 	openttd.exe!SQConvert::DefSQStaticCallback<ScriptVehicle,unsigned int (__cdecl*)(TileIndex,unsigned short)>(SQVM * vm) Ligne 306	C++
 	openttd.exe!SQVM::CallNative(SQNativeClosure * nclosure, __int64 nargs, __int64 stackbase, SQObjectPtr & retval, bool & suspend) Ligne 1188	C++
 	openttd.exe!SQVM::Execute(SQObjectPtr & closure, __int64 target, __int64 nargs, __int64 stackbase, SQObjectPtr & outres, unsigned __int64 raiseerror, SQVM::ExecutionType et) Ligne 798	C++
 	openttd.exe!sq_resumecatch(SQVM * v, int suspend) Ligne 1023	C++
 	openttd.exe!Squirrel::Resume(int suspend) Ligne 402	C++
 	openttd.exe!ScriptInstance::GameLoop() Ligne 247	C++
 	openttd.exe!AI::GameLoop() Ligne 82	C++
 	openttd.exe!StateGameLoop() Ligne 1408	C++
 	openttd.exe!GameLoop() Ligne 1499	C++
 	openttd.exe!VideoDriver::GameLoop() Ligne 37	C++
 	openttd.exe!VideoDriver::GameThread() Ligne 46	C++
 	openttd.exe!StartNewThread::__l3::<lambda>(const char * name, void(*)(VideoDriver *) && F, VideoDriver * && <A_0>) Ligne 65	C++
 	[Code externe]	
 	openttd.exe!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Ligne 97	C++
 	[Code externe]	

@James103
Copy link
Contributor

James103 commented Dec 20, 2022

Map size is 1024 x 1024 (0x100000) from the savegame, but the AI is trying to build a vehicle from a depot at tile 0xFFFFFFFF.

There is no EnforcePrecondition for if the tile is a valid depot tile for the AIVehicle.BuildVehicle command.

Minimal reproduction AI: test-10263.zip
Crash files: crash20221220184441.zip

@2TallTyler 2TallTyler added good first issue Good for newcomers bug Something isn't working labels Dec 20, 2022
@2TallTyler 2TallTyler changed the title [Crash]: Assertion failed [Crash]: AIVehicle.BuildVehicle tile validity precondition not enforced Dec 20, 2022
@2TallTyler 2TallTyler changed the title [Crash]: AIVehicle.BuildVehicle tile validity precondition not enforced [Bug]: AIVehicle.BuildVehicle tile validity precondition not enforced Dec 20, 2022
glx22 added a commit to glx22/OpenTTD that referenced this issue Dec 21, 2022
glx22 added a commit to glx22/OpenTTD that referenced this issue Dec 21, 2022
glx22 added a commit to glx22/OpenTTD that referenced this issue Dec 21, 2022
@glx22 glx22 closed this as completed in c179c10 Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants