Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
AddonPartFileFormat.h
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-2023 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#pragma once
23
24#include "Application.h"
25#include "GenericFileFormat.h"
26#include "RefCountingObject.h"
27#include "RigDef_File.h" // Document
28
29#include <OgreResourceManager.h>
30
31#include <memory>
32#include <string>
33#include <unordered_set>
34#include <vector>
35
36namespace RoR {
37
39{
42 std::string atc_keyword;
44
45 AddonPartConflict(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, std::string keyword, int element_id):
46 atc_addonpart1(addonpart1),
47 atc_addonpart2(addonpart2),
49 atc_element_id(element_id)
50 {}
51};
52
53typedef std::vector<AddonPartConflict> AddonPartConflictVec;
54
57{
58public:
59 AddonPartUtility(bool silent_mode = false);
61
64 std::shared_ptr<RigDef::Document::Module> TransformToRigDefModule(CacheEntryPtr& addonpart_entry);
65
68 void ResolveUnwantedAndTweakedElements(TuneupDefPtr& tuneup, CacheEntryPtr& addonpart_entry);
69
71
72 static void RecordAddonpartConflicts(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, AddonPartConflictVec& conflicts);
73
74 static bool CheckForAddonpartConflict(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, AddonPartConflictVec& conflicts);
75
76 static bool DoubleCheckForAddonpartConflict(ActorPtr target_actor, CacheEntryPtr addonpart_entry);
77
78private:
79 // Helpers of `TransformToRigDefModule()`, they expect `m_context` to be in position:
82 void ProcessProp();
83 void ProcessFlexbody();
84 void ProcessFlare();
85 void ProcessFlare2();
86
87 // Helpers of `ResolveUnwantedAndTweakedElements()`, they expect `m_context` to be in position:
88 void ProcessTweakWheel();
89 void ProcessTweakNode();
92 void ProcessTweakProp();
99
100 void Log(const std::string& text);
101
102 // Shared state:
106 // TransformToRigDefModule() state:
107 std::shared_ptr<RigDef::Document::Module> m_module;
109 // ResolveUnwantedAndTweakedElements() state:
111 bool m_silent_mode = false;
112};
113
114}; // namespace RoR
quaternion Log() const
Central state/object manager and communications hub.
Generic text file parser.
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...
NOTE: Modcache processes this format directly using RoR::GenericDocument, see RoR::CacheSystem::FillA...
static bool CheckForAddonpartConflict(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, AddonPartConflictVec &conflicts)
static void RecordAddonpartConflicts(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, AddonPartConflictVec &conflicts)
bool m_silent_mode
To block logging during conflict resolution (which works by generating dummy tuneups - would confuse ...
GenericDocContextPtr m_context
std::shared_ptr< RigDef::Document::Module > TransformToRigDefModule(CacheEntryPtr &addonpart_entry)
transforms the addonpart to RigDef::File::Module (fake 'section/end_section') used for spawning.
GenericDocumentPtr m_document
std::shared_ptr< RigDef::Document::Module > m_module
RigDef::ManagedMaterialsOptions m_managedmaterials_options
void ResolveUnwantedAndTweakedElements(TuneupDefPtr &tuneup, CacheEntryPtr &addonpart_entry)
Evaluates 'addonpart_unwanted_*' elements, respecting 'protected_*' directives in the tuneup.
static void ResetUnwantedAndTweakedElements(TuneupDefPtr &tuneup)
static bool DoubleCheckForAddonpartConflict(ActorPtr target_actor, CacheEntryPtr addonpart_entry)
std::vector< AddonPartConflict > AddonPartConflictVec
< Conflict between two addonparts tweaking the same element
AddonPartConflict(CacheEntryPtr addonpart1, CacheEntryPtr addonpart2, std::string keyword, int element_id)