RigsofRods
Soft-body Physics Simulation
LocalStorageAngelscript.cpp
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2022 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "LocalStorage.h"
23 #include "AngelScriptBindings.h"
24 
25 #include <angelscript.h>
26 
27 using namespace AngelScript;
28 using namespace RoR;
29 
30 static LocalStorage* LocalStorageFactory(std::string filename, const std::string& section_name, const std::string& rg_name)
31 {
32  return new LocalStorage(filename, section_name, rg_name);
33 }
34 
35 void RoR::RegisterLocalStorage(asIScriptEngine *engine)
36 {
37  LocalStorage::RegisterRefCountingObject(engine, "LocalStorageClass");
38  LocalStoragePtr::RegisterRefCountingObjectPtr(engine, "LocalStorageClassPtr", "LocalStorageClass");
39 
40  int r;
41  r = engine->RegisterObjectBehaviour("LocalStorageClass", asBEHAVE_FACTORY, "LocalStorageClass@+ f(string, const string&in = \"common\", const string&in = \"Cache\")", asFUNCTION(LocalStorageFactory), asCALL_CDECL); ROR_ASSERT(r >= 0);
42 
43  r = engine->RegisterObjectMethod("LocalStorageClass", "void copyFrom(LocalStorageClassPtr@)", asMETHOD(LocalStorage,copyFrom), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
44  r = engine->RegisterObjectMethod("LocalStorageClass", "void changeSection(const string &in)", asMETHOD(LocalStorage,changeSection), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
45 
46  r = engine->RegisterObjectMethod("LocalStorageClass", "string get(string)", asMETHODPR(LocalStorage,get,(std::string), std::string), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
47  r = engine->RegisterObjectMethod("LocalStorageClass", "string getString(string)", asMETHODPR(LocalStorage,get,(std::string), std::string), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
48  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const string &in)", asMETHODPR(LocalStorage,set,(std::string, const std::string&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
49  r = engine->RegisterObjectMethod("LocalStorageClass", "void setString(string, const string &in)", asMETHODPR(LocalStorage,set,(std::string, const std::string&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
50 
51  r = engine->RegisterObjectMethod("LocalStorageClass", "float getFloat(string)", asMETHODPR(LocalStorage,getFloat,(std::string), float), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
52  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, float)", asMETHODPR(LocalStorage,set,(std::string, const float),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
53  r = engine->RegisterObjectMethod("LocalStorageClass", "void setFloat(string, float)", asMETHODPR(LocalStorage,set,(std::string, const float),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
54 
55  r = engine->RegisterObjectMethod("LocalStorageClass", "vector3 getVector3(string)", asMETHODPR(LocalStorage,getVector3,(std::string), Ogre::Vector3), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
56  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const vector3 &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Vector3&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
57  r = engine->RegisterObjectMethod("LocalStorageClass", "void setVector3(string, const vector3 &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Vector3&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
58 
59  r = engine->RegisterObjectMethod("LocalStorageClass", "radian getRadian(string)", asMETHODPR(LocalStorage,getRadian,(std::string), Ogre::Radian), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
60  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const radian &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Radian&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
61  r = engine->RegisterObjectMethod("LocalStorageClass", "void setRadian(string, const radian &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Radian&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
62 
63  r = engine->RegisterObjectMethod("LocalStorageClass", "degree getDegree(string)", asMETHODPR(LocalStorage,getDegree,(std::string), Ogre::Degree), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
64  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const degree &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Degree&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
65  r = engine->RegisterObjectMethod("LocalStorageClass", "void setDegree(string, const degree &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Degree&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
66 
67  r = engine->RegisterObjectMethod("LocalStorageClass", "quaternion getQuaternion(string)", asMETHODPR(LocalStorage,getQuaternion,(std::string), Ogre::Quaternion), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
68  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const quaternion &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Quaternion&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
69  r = engine->RegisterObjectMethod("LocalStorageClass", "void setQuaternion(string, const quaternion &in)", asMETHODPR(LocalStorage,set,(std::string, const Ogre::Quaternion&),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
70 
71  r = engine->RegisterObjectMethod("LocalStorageClass", "bool getBool(string)", asMETHODPR(LocalStorage,getBool,(std::string), bool), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
72  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, const bool &in)", asMETHODPR(LocalStorage,set,(std::string, const bool),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
73  r = engine->RegisterObjectMethod("LocalStorageClass", "void setBool(string, const bool &in)", asMETHODPR(LocalStorage,set,(std::string, const bool),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
74 
75  r = engine->RegisterObjectMethod("LocalStorageClass", "int getInt(string)", asMETHODPR(LocalStorage,getInt,(std::string), int), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
76  r = engine->RegisterObjectMethod("LocalStorageClass", "int getInteger(string)", asMETHODPR(LocalStorage,getInt,(std::string), int), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
77  r = engine->RegisterObjectMethod("LocalStorageClass", "void set(string, int)", asMETHODPR(LocalStorage,set,(std::string, const int),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
78  r = engine->RegisterObjectMethod("LocalStorageClass", "void setInt(string, int)", asMETHODPR(LocalStorage,set,(std::string, const int),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
79  r = engine->RegisterObjectMethod("LocalStorageClass", "void setInteger(string, int)", asMETHODPR(LocalStorage,set,(std::string, const int),void), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
80 
81  r = engine->RegisterObjectMethod("LocalStorageClass", "void save()", asMETHOD(LocalStorage,saveDict), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
82  r = engine->RegisterObjectMethod("LocalStorageClass", "bool reload()", asMETHOD(LocalStorage,loadDict), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
83 
84  r = engine->RegisterObjectMethod("LocalStorageClass", "bool exists(string &in) const", asMETHOD(LocalStorage,exists), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
85  r = engine->RegisterObjectMethod("LocalStorageClass", "void delete(string &in)", asMETHOD(LocalStorage,eraseKey), asCALL_THISCALL); ROR_ASSERT( r >= 0 );
86 
87 }
ROR_ASSERT
#define ROR_ASSERT(_EXPR)
Definition: Application.h:40
set
set(SOURCE_FILES main.cpp Application.{h, cpp} ForwardDeclarations.h AppContext.{h, cpp} GameContext.{h, cpp} audio/MumbleIntegration.{h, cpp} audio/Sound.{h, cpp} audio/SoundManager.{h, cpp} audio/SoundScriptManager.{h, cpp} gameplay/AutoPilot.{h, cpp} gameplay/Character.{h, cpp} gameplay/CharacterFactory.{h, cpp} gameplay/ChatSystem.{h, cpp} gameplay/CruiseControl.cpp gameplay/EngineSim.{h, cpp} gameplay/Landusemap.{h, cpp} gameplay/RaceSystem.{h, cpp} gameplay/RepairMode.{h, cpp} gameplay/Replay.{h, cpp} gameplay/SceneMouse.{h, cpp} gameplay/ScriptEvents.h gameplay/TorqueCurve.{h, cpp} gameplay/TyrePressure.{h, cpp} gameplay/VehicleAI.{h, cpp} gfx/AdvancedScreen.h gfx/ColoredTextAreaOverlayElement.{h, cpp} gfx/ColoredTextAreaOverlayElementFactory.h gfx/DustPool.{h, cpp} gfx/EnvironmentMap.{h, cpp} gfx/GfxActor.{h, cpp} gfx/GfxData.{h, cpp} gfx/GfxScene.{h, cpp} gfx/HydraxWater.{h, cpp} gfx/IWater.h gfx/MovableText.{h, cpp} gfx/Renderdash.{h, cpp} gfx/ShadowManager.{h, cpp} gfx/SimBuffers.{h, cpp} gfx/Skidmark.{h, cpp} gfx/SkyManager.{h, cpp} gfx/SkyXManager.{h, cpp} gfx/SurveyMapTextureCreator.{h, cpp} gfx/Water.{h, cpp} gfx/camera/CameraManager.{h, cpp} gfx/camera/PerVehicleCameraContext.h gfx/hydrax/CfgFileManager.{h, cpp} gfx/hydrax/DecalsManager.{h, cpp} gfx/hydrax/Enums.{h, cpp} gfx/hydrax/FFT.{h, cpp} gfx/hydrax/GodRaysManager.{h, cpp} gfx/hydrax/GPUNormalMapManager.{h, cpp} gfx/hydrax/Help.{h, cpp} gfx/hydrax/Hydrax.{h, cpp} gfx/hydrax/Image.{h, cpp} gfx/hydrax/MaterialManager.{h, cpp} gfx/hydrax/Mesh.{h, cpp} gfx/hydrax/Module.{h, cpp} gfx/hydrax/Noise.{h, cpp} gfx/hydrax/Perlin.{h, cpp} gfx/hydrax/Prerequisites.{h, cpp} gfx/hydrax/PressurePoint.{h, cpp} gfx/hydrax/ProjectedGrid.{h, cpp} gfx/hydrax/RadialGrid.{h, cpp} gfx/hydrax/Real.{h, cpp} gfx/hydrax/RttManager.{h, cpp} gfx/hydrax/SimpleGrid.{h, cpp} gfx/hydrax/TextureManager.{h, cpp} gfx/hydrax/Wave.{h, cpp} gfx/particle/ExtinguishableFireAffector.{h, cpp} gfx/particle/ExtinguishableFireAffectorFactory.h gfx/particle/FireExtinguisherAffector.{h, cpp} gfx/particle/FireExtinguisherAffectorFactory.h gfx/particle/OgreParticleCustomParam.h gfx/particle/OgreShaderParticleRenderer.{h, cpp} gfx/skyx/AtmosphereManager.{h, cpp} gfx/skyx/BasicController.{h, cpp} gfx/skyx/CloudsManager.{h, cpp} gfx/skyx/ColorGradient.{h, cpp} gfx/skyx/Controller.h gfx/skyx/GPUManager.{h, cpp} gfx/skyx/MeshManager.{h, cpp} gfx/skyx/MoonManager.{h, cpp} gfx/skyx/Prerequisites.{h, cpp} gfx/skyx/SCfgFileManager.{h, cpp} gfx/skyx/SkyX.{h, cpp} gfx/skyx/VCloudsManager.{h, cpp} gfx/skyx/VClouds/DataManager.{h, cpp} gfx/skyx/VClouds/Ellipsoid.{h, cpp} gfx/skyx/VClouds/FastFakeRandom.{h, cpp} gfx/skyx/VClouds/GeometryBlock.{h, cpp} gfx/skyx/VClouds/GeometryManager.{h, cpp} gfx/skyx/VClouds/Lightning.{h, cpp} gfx/skyx/VClouds/LightningManager.{h, cpp} gfx/skyx/VClouds/VClouds.{h, cpp} gui/DashBoardManager.{h, cpp} gui/GUIManager.{h, cpp} gui/GUIUtils.{h, cpp} gui/OverlayWrapper.{h, cpp} gui/RTTLayer.{h, cpp} gui/imgui/imgui.{h, cpp} gui/imgui/imgui_demo.cpp gui/imgui/imgui_draw.cpp gui/imgui/imgui_widgets.cpp gui/imgui/OgreImGuiOverlay.{h, cpp} gui/imgui/OgreImGui.{h, cpp} gui/imgui/imconfig.h gui/imgui/imgui_internal.h gui/imgui/imstb_rectpack.h gui/imgui/imstb_textedit.h gui/imgui/imstb_truetype.h gui/panels/GUI_AngelScriptExamples.{h, cpp} gui/panels/GUI_CollisionsDebug.{h, cpp} gui/panels/GUI_ConsoleView.{h, cpp} gui/panels/GUI_ConsoleWindow.{h, cpp} gui/panels/GUI_DirectionArrow.{h, cpp} gui/panels/GUI_LoadingWindow.{h, cpp} gui/panels/GUI_FlexbodyDebug.{h, cpp} gui/panels/GUI_FrictionSettings.{h, cpp} gui/panels/GUI_TopMenubar.{h, cpp} gui/panels/GUI_TextureToolWindow.{h, cpp} gui/panels/GUI_RepositorySelector.{h, cpp} gui/panels/GUI_GameControls.{h, cpp} gui/panels/GUI_GameAbout.{h, cpp} gui/panels/GUI_GameChatBox.{h, cpp} gui/panels/GUI_GameMainMenu.{h, cpp} gui/panels/GUI_GameSettings.{h, cpp} gui/panels/GUI_MainSelector.{h, cpp} gui/panels/GUI_MessageBox.{h, cpp} gui/panels/GUI_MultiplayerSelector.{h, cpp} gui/panels/GUI_MultiplayerClientList.{h, cpp} gui/panels/GUI_NodeBeamUtils.{h, cpp} gui/panels/GUI_VehicleInfoTPanel.{h, cpp} gui/panels/GUI_ScriptMonitor.{h, cpp} gui/panels/GUI_SimPerfStats.{h, cpp} gui/panels/GUI_SurveyMap.{h, cpp} network/CurlHelpers.{h, cpp} network/DiscordRpc.{h, cpp} network/Network.{h, cpp} network/OutGauge.{h, cpp} network/RoRnet.h physics/Actor.{h, cpp} physics/ApproxMath.h physics/ActorForcesEuler.cpp physics/ActorManager.{h, cpp} physics/ActorSlideNode.cpp physics/ActorSpawner.{h, cpp} physics/ActorSpawnerFlow.cpp physics/CmdKeyInertia.{h, cpp} physics/Differentials.{h, cpp} physics/Savegame.cpp physics/SimConstants.h physics/SimData.{h, cpp} physics/SlideNode.{h, cpp} physics/air/AeroEngine.h physics/air/AirBrake.{h, cpp} physics/air/Airfoil.{h, cpp} physics/air/TurboJet.{h, cpp} physics/air/TurboProp.{h, cpp} physics/collision/CartesianToTriangleTransform.h physics/collision/Collisions.{h, cpp} physics/collision/DynamicCollisions.{h, cpp} physics/collision/PointColDetector.{h, cpp} physics/collision/Triangle.h physics/flex/Flexable.h physics/flex/FlexAirfoil.{h, cpp} physics/flex/FlexBody.{h, cpp} physics/flex/FlexFactory.{h, cpp} physics/flex/FlexMesh.{h, cpp} physics/flex/FlexMeshWheel.{h, cpp} physics/flex/FlexObj.{h, cpp} physics/flex/Locator_t.h physics/water/Buoyance.{h, cpp} physics/water/ScrewProp.{h, cpp} resources/CacheSystem.{h, cpp} resources/ContentManager.{h, cpp} resources/addonpart_fileformat/AddonPartFileFormat.{h, cpp} resources/otc_fileformat/OTCFileFormat.{h, cpp} resources/odef_fileformat/ODefFileFormat.{h, cpp} resources/rig_def_fileformat/RigDef_File.{h, cpp} resources/rig_def_fileformat/RigDef_Node.{h, cpp} resources/rig_def_fileformat/RigDef_Parser.{h, cpp} resources/rig_def_fileformat/RigDef_Prerequisites.h resources/rig_def_fileformat/RigDef_Regexes.h resources/rig_def_fileformat/RigDef_SequentialImporter.{h, cpp} resources/rig_def_fileformat/RigDef_Serializer.{h, cpp} resources/rig_def_fileformat/RigDef_Validator.{h, cpp} resources/skin_fileformat/SkinFileFormat.{h, cpp} resources/terrn2_fileformat/Terrn2FileFormat.{h, cpp} resources/tobj_fileformat/TObjFileFormat.{h, cpp} resources/tuneup_fileformat/TuneupFileFormat.{h, cpp} system/AppCommandLine.cpp system/AppConfig.cpp system/Console.{h, cpp} system/ConsoleCmd.{h, cpp} system/CVar.{h, cpp} terrain/OgreTerrainPSSMMaterialGenerator.{h, cpp} terrain/ProceduralManager.{h, cpp} terrain/ProceduralRoad.{h, cpp} terrain/SurveyMapEntity.h terrain/TerrainEditor.{h, cpp} terrain/TerrainGeometryManager.{h, cpp} terrain/Terrain.{h, cpp} terrain/TerrainObjectManager.{h, cpp} threadpool/ThreadPool.h utils/ConfigFile.{h, cpp} utils/ErrorUtils.{h, cpp} utils/ForceFeedback.{h, cpp} utils/GenericFileFormat.{h, cpp} utils/ImprovedConfigFile.h utils/InputEngine.{h, cpp} utils/InterThreadStoreVector.h utils/Language.{h, cpp} utils/MeshObject.{h, cpp} utils/PlatformUtils.{h, cpp} utils/SHA1.{h, cpp} utils/Utils.{h, cpp} utils/WriteTextToTexture.{h, cpp} utils/memory/RefCountingObject.h utils/memory/RefCountingObjectPtr.h) if(ROR_USE_ANGELSCRIPT) list(APPEND SOURCE_FILES scripting/GameScript.
Definition: CMakeLists.txt:5
RoR::RegisterLocalStorage
void RegisterLocalStorage(AngelScript::asIScriptEngine *engine)
Registers RoR::LocalStorage, defined in LocalStorageAngelscript.cpp.
AngelScriptBindings.h
RoR::LocalStorage
A class that allows scripts to store data persistently.
Definition: LocalStorage.h:38
LocalStorageFactory
static LocalStorage * LocalStorageFactory(std::string filename, const std::string &section_name, const std::string &rg_name)
Definition: LocalStorageAngelscript.cpp:30
LocalStorage.h
RoR
Definition: AppContext.h:36