Closed ohlidalp closed 1 year ago
In destructor ‘RefCountingObject<T>::~RefCountingObject() [with T = RoR::Terrain]’,
inlined from ‘void RefCountingObject<T>::Release() [with T = RoR::Terrain]’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObject.h:46:13,
inlined from ‘void RefCountingObject<T>::Release() [with T = RoR::Terrain]’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObject.h:40:10,
inlined from ‘void RefCountingObjectPtr<T>::ReleaseHandle() [with T = RoR::Terrain]’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObjectPtr.h:217:23,
inlined from ‘void RefCountingObjectPtr<T>::Set(T*) [with T = RoR::Terrain]’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObjectPtr.h:247:18,
inlined from ‘RefCountingObjectPtr<T>& RefCountingObjectPtr<T>::operator=(const RefCountingObjectPtr<T>&) [with T = RoR::Terrain]’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObjectPtr.h:237:8,
inlined from ‘bool RoR::GameContext::LoadTerrain(const std::string&)’ at /home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/GameContext.cpp:141:71:
/home/babis/Downloads/ror-dependencies/rigs-of-rods/source/main/utils/memory/RefCountingObject.h:32:5: warning: ‘void operator delete(void*)’ called on pointer ‘((RefCountingObjectPtr<RoR::Terrain>*)this)[9].RefCountingObjectPtr<RoR::Terrain>::m_ref’ with nonzero offset 8 [-Wfree-nonheap-object]
32 | }
warning remains it seems
Copy pasting doesn't work here so i will leave that for others to test. So far no crashes though :+1:
Commands work fine here:
At the moment, it doesn't do anything useful, but it will become a base for terrain editing capabilities very soon. I decided to create a separate PR for it, to promote it and enable early testing.
To test it, open in-game console (using tilde hotkey or from top menubar) and copy/paste any of these lines:
Documentation will appear at https://developer.rigsofrods.org/d4/d07/group___script2_game.html after this PR is merged.
I realize we already have a lot of terrain-related functions in the
GameScriptClass
(global objectgame
), see https://developer.rigsofrods.org/dc/d63/class_script2_game_1_1_game_script_class.html, but under the hood those are serviced byRoR::Terrain
anyway, see https://developer.rigsofrods.org/d4/d4d/group___terrain.html, and I want to keep things organized.Please mind the additional
getHandle()
function in the code snippets - that's a necessary evil to manage AngelScript reference counting simply and safely using https://github.com/only-a-ptr/RefCountingObject-AngelScript. Without it, adding new script feats is either laborous and bug-prone, or unsafe.