Rigs of Rods
2023.09
Soft-body Physics Simulation
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
source
main
gameplay
RaceSystem.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 2015-2020 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
23
24
#include "
RaceSystem.h
"
25
26
#include "
AppContext.h
"
27
#include "
GameContext.h
"
28
29
using namespace
RoR
;
30
31
void
RaceSystem::UpdateDirectionArrow
(
char
* text, Ogre::Vector3 position)
32
{
33
if
(text ==
nullptr
)
34
{
35
m_dir_arrow_visible
=
false
;
36
m_dir_arrow_target
= Ogre::Vector3::ZERO;
37
}
38
else
39
{
40
m_dir_arrow_visible
=
true
;
41
m_dir_arrow_text
= text;
42
m_dir_arrow_target
= position;
43
}
44
}
31
void
RaceSystem::UpdateDirectionArrow
(
char
* text, Ogre::Vector3 position) {
…
}
45
46
void
RaceSystem::StartRaceTimer
(
int
id
)
47
{
48
m_race_start_time
=
App::GetGameContext
()->
GetActorManager
()->
GetTotalTime
();
49
m_race_time_diff
= 0.0f;
50
m_race_id
= id;
51
}
46
void
RaceSystem::StartRaceTimer
(
int
id
) {
…
}
52
53
void
RaceSystem::StopRaceTimer
()
54
{
55
m_race_start_time
= 0.0f;
56
m_race_id
= -1;
57
}
53
void
RaceSystem::StopRaceTimer
() {
…
}
58
59
float
RaceSystem::GetRaceTime
()
const
60
{
61
return
App::GetGameContext
()->
GetActorManager
()->
GetTotalTime
() -
m_race_start_time
;
62
}
59
float
RaceSystem::GetRaceTime
()
const
{
…
}
63
64
void
RaceSystem::ResetRaceUI
()
65
{
66
this->
StopRaceTimer
();
67
this->
UpdateDirectionArrow
(
nullptr
, Ogre::Vector3::ZERO);
// hide arrow
68
}
64
void
RaceSystem::ResetRaceUI
() {
…
}
AppContext.h
System integration layer; inspired by OgreBites::ApplicationContext.
GameContext.h
Game state manager and message-queue provider.
RaceSystem.h
Counterpart to Neorej16's race system script.
RoR::ActorManager::GetTotalTime
float GetTotalTime() const
Definition
ActorManager.h:91
RoR::GameContext::GetActorManager
ActorManager * GetActorManager()
Definition
GameContext.h:127
RoR::RaceSystem::StopRaceTimer
void StopRaceTimer()
Definition
RaceSystem.cpp:53
RoR::RaceSystem::GetRaceTime
float GetRaceTime() const
Definition
RaceSystem.cpp:59
RoR::RaceSystem::m_race_id
int m_race_id
Definition
RaceSystem.h:57
RoR::RaceSystem::m_dir_arrow_visible
bool m_dir_arrow_visible
Definition
RaceSystem.h:53
RoR::RaceSystem::m_race_start_time
float m_race_start_time
Definition
RaceSystem.h:60
RoR::RaceSystem::m_dir_arrow_target
Ogre::Vector3 m_dir_arrow_target
Definition
RaceSystem.h:55
RoR::RaceSystem::UpdateDirectionArrow
void UpdateDirectionArrow(char *text, Ogre::Vector3 position)
Definition
RaceSystem.cpp:31
RoR::RaceSystem::StartRaceTimer
void StartRaceTimer(int id)
Definition
RaceSystem.cpp:46
RoR::RaceSystem::ResetRaceUI
void ResetRaceUI()
Definition
RaceSystem.cpp:64
RoR::RaceSystem::m_race_time_diff
float m_race_time_diff
Definition
RaceSystem.h:58
RoR::RaceSystem::m_dir_arrow_text
std::string m_dir_arrow_text
Definition
RaceSystem.h:54
RoR::App::GetGameContext
GameContext * GetGameContext()
Definition
Application.cpp:299
RoR
Definition
AppContext.h:36
Generated on Fri Jan 2 2026 09:37:02 for Rigs of Rods by
1.9.8