16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 06:29:18 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-06-30 18:45:58 +02:00
37 changed files with 672 additions and 498 deletions

View File

@@ -124,7 +124,6 @@ basic_cell::update_events() {
void
basic_cell::update_sounds() {
auto const deltatime = Timer::GetDeltaRenderTime();
for( auto *sound : m_sounds ) {
sound->play_event();
}
@@ -361,6 +360,7 @@ basic_cell::insert( sound_source *Sound ) {
m_active = true;
m_sounds.emplace_back( Sound );
// NOTE: sound sources are virtual 'points' hence they don't ever expand cell range
}
// adds provided sound instance to the cell
@@ -374,6 +374,16 @@ basic_cell::insert( TEventLauncher *Launcher ) {
enclose_area( Launcher );
}
// adds provided memory cell to the cell
void
basic_cell::insert( TMemCell *Memorycell ) {
m_active = true;
m_memorycells.emplace_back( Memorycell );
// NOTE: memory cells are virtual 'points' hence they don't ever expand cell range
}
// registers provided path in the lookup directory of the cell
void
basic_cell::register_end( TTrack *Path ) {
@@ -1133,7 +1143,6 @@ basic_region::insert_lines( lines_node Lines, scratch_data &Scratchpad ) {
// inserts provided track in the region
void
basic_region::insert_path( TTrack *Path, const scratch_data &Scratchpad ) {
// NOTE: bounding area isn't present/filled until track class and wrapper refactoring is done
auto location = Path->location();
@@ -1155,7 +1164,6 @@ basic_region::insert_path( TTrack *Path, const scratch_data &Scratchpad ) {
// inserts provided track in the region
void
basic_region::insert_traction( TTraction *Traction, scratch_data &Scratchpad ) {
// NOTE: bounding area isn't present/filled until track class and wrapper refactoring is done
auto location = Traction->location();
@@ -1177,7 +1185,6 @@ basic_region::insert_traction( TTraction *Traction, scratch_data &Scratchpad ) {
// inserts provided instance of 3d model in the region
void
basic_region::insert_instance( TAnimModel *Instance, scratch_data &Scratchpad ) {
// NOTE: bounding area isn't present/filled until track class and wrapper refactoring is done
auto location = Instance->location();
@@ -1210,7 +1217,6 @@ basic_region::insert_sound( sound_source *Sound, scratch_data &Scratchpad ) {
// inserts provided event launcher in the region
void
basic_region::insert_launcher( TEventLauncher *Launcher, scratch_data &Scratchpad ) {
// NOTE: bounding area isn't present/filled until track class and wrapper refactoring is done
auto location = Launcher->location();
@@ -1224,6 +1230,22 @@ basic_region::insert_launcher( TEventLauncher *Launcher, scratch_data &Scratchpa
}
}
// inserts provided memory cell in the region
void
basic_region::insert_memorycell( TMemCell *Memorycell, scratch_data &Scratchpad ) {
// NOTE: bounding area isn't present/filled until track class and wrapper refactoring is done
auto location = Memorycell->location();
if( point_inside( location ) ) {
// NOTE: nodes placed outside of region boundaries are discarded
section( location ).insert( Memorycell );
}
else {
// tracks are guaranteed to hava a name so we can skip the check
ErrorLog( "Bad scenario: memory cell \"" + Memorycell->name() + "\" placed in location outside region bounds (" + to_string( location ) + ")" );
}
}
// find a vehicle located neares to specified location, within specified radius, optionally discarding vehicles without drivers
std::tuple<TDynamicObject *, float>
basic_region::find_vehicle( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) {