From 6d9e718a958756884b8d916bc1e1adabd3d229a8 Mon Sep 17 00:00:00 2001 From: milek7 Date: Tue, 31 Oct 2017 20:25:17 +0100 Subject: [PATCH] fixes --- CMakeLists.txt | 4 ---- Event.cpp | 2 ++ simulation.cpp | 7 ++++++- sound.cpp | 2 -- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8165b52..268511df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,3 @@ target_link_libraries(${PROJECT_NAME} ${LUAJIT_LIBRARIES}) find_package(libserialport REQUIRED) include_directories(${libserialport_INCLUDE_DIR}) target_link_libraries(${PROJECT_NAME} ${libserialport_LIBRARY}) - -if (UNIX) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") -endif() diff --git a/Event.cpp b/Event.cpp index b363bedc..81a3bd68 100644 --- a/Event.cpp +++ b/Event.cpp @@ -1018,6 +1018,8 @@ event_manager::CheckQuery() { return false; } case tp_Sound: { + if (m_workevent->Params[ 9 ].tsTextSound == nullptr) + break; switch( m_workevent->Params[ 0 ].asInt ) { // trzy możliwe przypadki: case 0: { diff --git a/simulation.cpp b/simulation.cpp index 97a355d7..84fc3394 100644 --- a/simulation.cpp +++ b/simulation.cpp @@ -846,7 +846,12 @@ state_manager::deserialize_sound( cParser &Input, scene::scratch_data &Scratchpa auto const soundname { Input.getToken() }; auto *sound = sound_man->create_text_sound(soundname); - sound->position((glm::vec3)location).dist(Nodedata.range_max); + sound->position((glm::vec3)location); + if (Nodedata.range_max != -1.0) + sound->dist(Nodedata.range_max); + else + sound->set_mode(sound::global); + skip_until( Input, "endsound" ); return sound; diff --git a/sound.cpp b/sound.cpp index 6d61badd..5baed1a3 100644 --- a/sound.cpp +++ b/sound.cpp @@ -350,8 +350,6 @@ sound& sound::position(glm::vec3 p) glm::vec3 sound::location() { - if (mode == global) - throw std::runtime_error("sound: bad state, no position"); return pos; }