RigsofRods
Soft-body Physics Simulation
SimData.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-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 #include "SimData.h"
23 
24 #include "Actor.h"
25 #include "CacheSystem.h"
26 #include "TuneupFileFormat.h"
27 
28 using namespace RoR;
29 
31 {
32  // Constructs `CacheEntryPtr` - doesn't compile without `#include CacheSystem.h` - not pretty if in header (even if auto-generated by C++).
33  // Also `TuneupDefPtr` which needs `#include TuneupFileFormat.h`
34 }
35 
37 {
38  // Destructs `CacheEntryPtr` - doesn't compile without `#include CacheSystem.h` - not pretty if in header (even if auto-generated by C++).
39  // Also `TuneupDefPtr` which needs `#include TuneupFileFormat.h`
40 }
41 
43 {
44  // Constructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
45 }
46 
48 {
49  // Destructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
50 }
51 
53 {
54  // Constructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
55 }
56 
58 {
59  // Destructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
60 }
61 
63 {
64  // Constructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
65 
66  // Bitfields cannot be initialized in-class (C++ limitation).
67  ti_no_self_lock = false;
68  ti_tied = false;
69  ti_tying = false;
70 }
71 
73 {
74  // Destructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
75 }
76 
78 {
79  // Constructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
80 }
81 
83 {
84  // Destructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
85 }
86 
88 {
89  // Constructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
90 }
91 
93 {
94  // Destructs `ActorPtr` - doesn't compile without `#include Actor.h` - not pretty if in header (even if auto-generated by C++).
95 }
96 
98 {
99  // Constructs `CacheEntryPtr` which is a `RefCountingObjectPtr<>` so it doesn't compile without `#include "TuneupFileFormat.h"` and thus should not be in header.
100 }
101 
103 {
104  // Destructs `CacheEntryPtr` which is a `RefCountingObjectPtr<>` so it doesn't compile without `#include "TuneupFileFormat.h"` and thus should not be in header.
105 }
106 
108 {
109  switch (attr)
110  {
111  case ACTORSIMATTR_NONE: return "NONE";
112 
113  // TractionControl
114  case ACTORSIMATTR_TC_RATIO: return "TC_RATIO";
115  case ACTORSIMATTR_TC_PULSE_TIME: return "TC_PULSE_TIME";
116  case ACTORSIMATTR_TC_WHEELSLIP_CONSTANT: return "TC_WHEELSLIP_CONSTANT";
117 
118  // Engine
119  case ACTORSIMATTR_ENGINE_SHIFTDOWN_RPM: return "ENGINE_SHIFTDOWN_RPM";
120  case ACTORSIMATTR_ENGINE_SHIFTUP_RPM: return "ENGINE_SHIFTUP_RPM";
121  case ACTORSIMATTR_ENGINE_TORQUE: return "ENGINE_TORQUE";
122  case ACTORSIMATTR_ENGINE_DIFF_RATIO: return "ENGINE_DIFF_RATIO";
123  case ACTORSIMATTR_ENGINE_GEAR_RATIOS_ARRAY: return "ENGINE_GEAR_RATIOS_ARRAY";
124 
125  // Engoption
126  case ACTORSIMATTR_ENGOPTION_ENGINE_INERTIA: return "ENGOPTION_ENGINE_INERTIA";
127  case ACTORSIMATTR_ENGOPTION_ENGINE_TYPE: return "ENGOPTION_ENGINE_TYPE";
128  case ACTORSIMATTR_ENGOPTION_CLUTCH_FORCE: return "ENGOPTION_CLUTCH_FORCE";
129  case ACTORSIMATTR_ENGOPTION_SHIFT_TIME: return "ENGOPTION_SHIFT_TIME";
130  case ACTORSIMATTR_ENGOPTION_CLUTCH_TIME: return "ENGOPTION_CLUTCH_TIME";
131  case ACTORSIMATTR_ENGOPTION_POST_SHIFT_TIME: return "ENGOPTION_POST_SHIFT_TIME";
132  case ACTORSIMATTR_ENGOPTION_STALL_RPM: return "ENGOPTION_STALL_RPM";
133  case ACTORSIMATTR_ENGOPTION_IDLE_RPM: return "ENGOPTION_IDLE_RPM";
134  case ACTORSIMATTR_ENGOPTION_MAX_IDLE_MIXTURE: return "ENGOPTION_MAX_IDLE_MIXTURE";
135  case ACTORSIMATTR_ENGOPTION_MIN_IDLE_MIXTURE: return "ENGOPTION_MIN_IDLE_MIXTURE";
136  case ACTORSIMATTR_ENGOPTION_BRAKING_TORQUE: return "ENGOPTION_BRAKING_TORQUE";
137 
138  // Engturbo2 (actually 'engturbo' with type=2)
139  case ACTORSIMATTR_ENGTURBO2_INERTIA_FACTOR: return "ENGTURBO2_INERTIA_FACTOR";
140  case ACTORSIMATTR_ENGTURBO2_NUM_TURBOS: return "ENGTURBO2_NUM_TURBOS";
141  case ACTORSIMATTR_ENGTURBO2_MAX_RPM: return "ENGTURBO2_MAX_RPM";
142  case ACTORSIMATTR_ENGTURBO2_ENGINE_RPM_OP: return "ENGTURBO2_ENGINE_RPM_OP";
143  case ACTORSIMATTR_ENGTURBO2_BOV_ENABLED: return "ENGTURBO2_BOV_ENABLED";
144  case ACTORSIMATTR_ENGTURBO2_BOV_MIN_PSI: return "ENGTURBO2_BOV_MIN_PSI";
145  case ACTORSIMATTR_ENGTURBO2_WASTEGATE_ENABLED: return "ENGTURBO2_WASTEGATE_ENABLED";
146  case ACTORSIMATTR_ENGTURBO2_WASTEGATE_MAX_PSI: return "ENGTURBO2_WASTEGATE_MAX_PSI";
147  case ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_N: return "ENGTURBO2_WASTEGATE_THRESHOLD_N";
148  case ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_P: return "ENGTURBO2_WASTEGATE_THRESHOLD_P";
149  case ACTORSIMATTR_ENGTURBO2_ANTILAG_ENABLED: return "ENGTURBO2_ANTILAG_ENABLED";
150  case ACTORSIMATTR_ENGTURBO2_ANTILAG_CHANCE: return "ENGTURBO2_ANTILAG_CHANCE";
151  case ACTORSIMATTR_ENGTURBO2_ANTILAG_MIN_RPM: return "ENGTURBO2_ANTILAG_MIN_RPM";
152  case ACTORSIMATTR_ENGTURBO2_ANTILAG_POWER: return "ENGTURBO2_ANTILAG_POWER";
153 
154  default: return "";
155  }
156 }
RoR::ACTORSIMATTR_ENGOPTION_POST_SHIFT_TIME
@ ACTORSIMATTR_ENGOPTION_POST_SHIFT_TIME
Time (in seconds) until full torque is transferred - Param #6 of 'engoption'.
Definition: SimData.h:942
RoR::ACTORSIMATTR_ENGINE_DIFF_RATIO
@ ACTORSIMATTR_ENGINE_DIFF_RATIO
Differential ratio (aka global gear ratio) - Param #4 of 'engine'.
Definition: SimData.h:933
RoR::soundsource_t::soundsource_t
soundsource_t()
Definition: SimData.cpp:87
RoR::ActorModifyRequest::ActorModifyRequest
ActorModifyRequest()
Definition: SimData.cpp:97
RoR::ACTORSIMATTR_ENGOPTION_MIN_IDLE_MIXTURE
@ ACTORSIMATTR_ENGOPTION_MIN_IDLE_MIXTURE
Min throttle to maintain idle RPM - Param #10 of 'engoption'.
Definition: SimData.h:946
RoR::ACTORSIMATTR_NONE
@ ACTORSIMATTR_NONE
Definition: SimData.h:922
RoR::ActorModifyRequest::~ActorModifyRequest
~ActorModifyRequest()
Definition: SimData.cpp:102
RoR::soundsource_t::~soundsource_t
~soundsource_t()
Definition: SimData.cpp:92
RoR::hook_t::hook_t
hook_t()
Definition: SimData.cpp:77
RoR::ACTORSIMATTR_ENGOPTION_BRAKING_TORQUE
@ ACTORSIMATTR_ENGOPTION_BRAKING_TORQUE
How much engine brakes on zero throttle - Param #11 of 'engoption'.
Definition: SimData.h:947
RoR::ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_N
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_N
1 - WgThreshold ~ calculated from Param #10 of 'engturbo2'
Definition: SimData.h:958
RoR::ACTORSIMATTR_ENGTURBO2_BOV_ENABLED
@ ACTORSIMATTR_ENGTURBO2_BOV_ENABLED
Blow-off valve - Param #6 of 'engturbo2'.
Definition: SimData.h:954
TuneupFileFormat.h
The vehicle tuning system; applies addonparts and user overrides to vehicles.
RoR::tie_t::ti_tying
bool ti_tying
State.
Definition: SimData.h:534
RoR::ACTORSIMATTR_ENGTURBO2_MAX_RPM
@ ACTORSIMATTR_ENGTURBO2_MAX_RPM
MaxPSI * 10000 ~ calculated from Param #4 of 'engturbo2'.
Definition: SimData.h:952
Actor.h
RoR::ACTORSIMATTR_ENGTURBO2_NUM_TURBOS
@ ACTORSIMATTR_ENGTURBO2_NUM_TURBOS
Number of turbos - Param #3 of 'engturbo2'.
Definition: SimData.h:951
RoR::tie_t::ti_tied
bool ti_tied
State.
Definition: SimData.h:533
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::ACTORSIMATTR_ENGOPTION_ENGINE_INERTIA
@ ACTORSIMATTR_ENGOPTION_ENGINE_INERTIA
Definition: SimData.h:937
CacheSystem.h
A database of user-installed content alias 'mods' (vehicles, terrains...)
RoR::ACTORSIMATTR_ENGTURBO2_INERTIA_FACTOR
@ ACTORSIMATTR_ENGTURBO2_INERTIA_FACTOR
Time to spool up - Param #2 of 'engturbo2'.
Definition: SimData.h:950
RoR::ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_P
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_THRESHOLD_P
1 + WgThreshold ~ calculated from Param #10 of 'engturbo2'
Definition: SimData.h:959
RoR::ACTORSIMATTR_ENGINE_TORQUE
@ ACTORSIMATTR_ENGINE_TORQUE
Engine torque in newton-meters (N/m) - Param #3 of 'engine'.
Definition: SimData.h:932
RoR::ACTORSIMATTR_ENGOPTION_STALL_RPM
@ ACTORSIMATTR_ENGOPTION_STALL_RPM
RPM where engine stalls - Param #7 of 'engoption'.
Definition: SimData.h:943
RoR::ACTORSIMATTR_TC_PULSE_TIME
@ ACTORSIMATTR_TC_PULSE_TIME
Pulse duration in seconds, safe values <0.00005 - 1>
Definition: SimData.h:926
RoR::ACTORSIMATTR_ENGTURBO2_WASTEGATE_MAX_PSI
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_MAX_PSI
Definition: SimData.h:957
RoR::beam_t::beam_t
beam_t()
Definition: SimData.cpp:42
RoR::ACTORSIMATTR_ENGINE_GEAR_RATIOS_ARRAY
@ ACTORSIMATTR_ENGINE_GEAR_RATIOS_ARRAY
Gearbox - Format: "<reverse_gear> <neutral_gear> <forward_gear 1> [<forward gear 2>]....
Definition: SimData.h:934
RoR::tie_t::~tie_t
~tie_t()
Definition: SimData.cpp:72
RoR::ACTORSIMATTR_ENGTURBO2_WASTEGATE_ENABLED
@ ACTORSIMATTR_ENGTURBO2_WASTEGATE_ENABLED
Definition: SimData.h:956
RoR::ActorSimAttr
ActorSimAttr
Parameter to Actor::setSimAttribute() and Actor::getSimAttribute(); allows advanced users to tweak ph...
Definition: SimData.h:920
RoR::ACTORSIMATTR_ENGOPTION_CLUTCH_FORCE
@ ACTORSIMATTR_ENGOPTION_CLUTCH_FORCE
Definition: SimData.h:939
RoR::ACTORSIMATTR_ENGTURBO2_BOV_MIN_PSI
@ ACTORSIMATTR_ENGTURBO2_BOV_MIN_PSI
Blow-off valve PSI threshold - Param #7 of 'engturbo2'.
Definition: SimData.h:955
RoR::tie_t::tie_t
tie_t()
Definition: SimData.cpp:62
RoR::hook_t::~hook_t
~hook_t()
Definition: SimData.cpp:82
RoR::ACTORSIMATTR_ENGTURBO2_ANTILAG_CHANCE
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_CHANCE
Definition: SimData.h:961
RoR::ACTORSIMATTR_ENGOPTION_SHIFT_TIME
@ ACTORSIMATTR_ENGOPTION_SHIFT_TIME
Definition: SimData.h:940
RoR::ACTORSIMATTR_ENGTURBO2_ANTILAG_MIN_RPM
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_MIN_RPM
Definition: SimData.h:962
RoR::rope_t::rope_t
rope_t()
Definition: SimData.cpp:52
RoR::ActorSpawnRequest::ActorSpawnRequest
ActorSpawnRequest()
Definition: SimData.cpp:30
RoR::beam_t::~beam_t
~beam_t()
Definition: SimData.cpp:47
RoR::ACTORSIMATTR_ENGTURBO2_ENGINE_RPM_OP
@ ACTORSIMATTR_ENGTURBO2_ENGINE_RPM_OP
Engine RPM threshold for turbo to operate - Param #5 of 'engturbo2'.
Definition: SimData.h:953
RoR::tie_t::ti_no_self_lock
bool ti_no_self_lock
Attribute.
Definition: SimData.h:532
RoR::ACTORSIMATTR_ENGINE_SHIFTDOWN_RPM
@ ACTORSIMATTR_ENGINE_SHIFTDOWN_RPM
Automatic transmission - Param #1 of 'engine'.
Definition: SimData.h:930
RoR::ACTORSIMATTR_ENGOPTION_ENGINE_TYPE
@ ACTORSIMATTR_ENGOPTION_ENGINE_TYPE
Definition: SimData.h:938
RoR::rope_t::~rope_t
~rope_t()
Definition: SimData.cpp:57
RoR::ACTORSIMATTR_TC_RATIO
@ ACTORSIMATTR_TC_RATIO
Regulating force, safe values: <1 - 20>
Definition: SimData.h:925
RoR::ACTORSIMATTR_ENGOPTION_MAX_IDLE_MIXTURE
@ ACTORSIMATTR_ENGOPTION_MAX_IDLE_MIXTURE
Max throttle to maintain idle RPM - Param #9 of 'engoption'.
Definition: SimData.h:945
RoR::ACTORSIMATTR_ENGTURBO2_ANTILAG_POWER
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_POWER
Definition: SimData.h:963
RoR::ACTORSIMATTR_ENGOPTION_IDLE_RPM
@ ACTORSIMATTR_ENGOPTION_IDLE_RPM
Target idle RPM - Param #8 of 'engoption'.
Definition: SimData.h:944
RoR::ACTORSIMATTR_ENGTURBO2_ANTILAG_ENABLED
@ ACTORSIMATTR_ENGTURBO2_ANTILAG_ENABLED
Definition: SimData.h:960
RoR::ActorSimAttrToString
const char * ActorSimAttrToString(ActorSimAttr attr)
Definition: SimData.cpp:107
RoR
Definition: AppContext.h:36
RoR::ACTORSIMATTR_TC_WHEELSLIP_CONSTANT
@ ACTORSIMATTR_TC_WHEELSLIP_CONSTANT
Minimum wheel slip threshold, safe value = 0.25.
Definition: SimData.h:927
RoR::ACTORSIMATTR_ENGINE_SHIFTUP_RPM
@ ACTORSIMATTR_ENGINE_SHIFTUP_RPM
Automatic transmission - Param #2 of 'engine'.
Definition: SimData.h:931
RoR::ActorSpawnRequest::~ActorSpawnRequest
~ActorSpawnRequest()
Definition: SimData.cpp:36
RoR::ACTORSIMATTR_ENGOPTION_CLUTCH_TIME
@ ACTORSIMATTR_ENGOPTION_CLUTCH_TIME
Definition: SimData.h:941