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

network improvements

This commit is contained in:
milek7
2019-02-05 00:07:34 +01:00
parent 85ad17af3c
commit 5a0bb610db
10 changed files with 157 additions and 94 deletions

View File

@@ -35,7 +35,7 @@ basic_cell::on_click( TAnimModel const *Instance ) {
if( ( launcher->name() == Instance->name() )
&& ( glm::length2( launcher->location() - Instance->location() ) < launcher->dRadius )
&& ( true == launcher->check_conditions() ) ) {
launch_event( launcher );
launch_event( launcher, true );
}
}
}
@@ -123,11 +123,13 @@ basic_cell::update_events() {
// event launchers
for( auto *launcher : m_eventlaunchers ) {
if( ( true == ( launcher->check_activation() && launcher->check_conditions() ) )
&& ( SquareMagnitude( launcher->location() - Global.pCamera.Pos ) < launcher->dRadius ) ) {
launch_event( launcher );
}
if (launcher->check_conditions()
&& SquareMagnitude( launcher->location() - Global.pCamera.Pos ) < launcher->dRadius) {
if (launcher->check_activation())
launch_event(launcher, false);
if (launcher->check_activation_key())
launch_event(launcher, true);
}
}
}
@@ -616,16 +618,18 @@ void basic_cell::create_map_geometry(std::vector<gfx::basic_vertex> &Bank)
// executes event assigned to specified launcher
void
basic_cell::launch_event( TEventLauncher *Launcher ) {
WriteLog( "Eventlauncher " + Launcher->name() );
if( ( true == Global.shiftState )
&& ( Launcher->Event2 != nullptr ) ) {
simulation::Events.AddToQuery( Launcher->Event2, nullptr );
}
else if( Launcher->Event1 ) {
simulation::Events.AddToQuery( Launcher->Event1, nullptr );
}
basic_cell::launch_event( TEventLauncher *Launcher, bool local_only ) {
WriteLog( "Eventlauncher: " + Launcher->name() );
if (!local_only) {
if( Launcher->Event1 ) {
simulation::Events.AddToQuery( Launcher->Event1, nullptr );
}
} else {
if (Global.shiftState && Launcher->Event2 != nullptr)
m_relay.post(user_command::queueevent, (double)simulation::Events.GetEventId(Launcher->Event2), 0.0, GLFW_PRESS, 0);
else if (Launcher->Event1)
m_relay.post(user_command::queueevent, (double)simulation::Events.GetEventId(Launcher->Event1), 0.0, GLFW_PRESS, 0);
}
}
// adjusts cell bounding area to enclose specified node