maintenance: event code refactoring

This commit is contained in:
tmj-fstate
2018-09-18 03:57:32 +02:00
parent 4da8b300e8
commit 40afc461fa
23 changed files with 2451 additions and 1644 deletions

View File

@@ -244,15 +244,14 @@ void
state_serializer::deserialize_event( cParser &Input, scene::scratch_data &Scratchpad ) {
// TODO: refactor event class and its de/serialization. do offset and rotation after deserialization is done
auto *event = new TEvent();
Math3D::vector3 offset = (
Scratchpad.location.offset.empty() ?
Math3D::vector3() :
Math3D::vector3(
Scratchpad.location.offset.top().x,
Scratchpad.location.offset.top().y,
Scratchpad.location.offset.top().z ) );
event->Load( &Input, offset );
auto *event = make_event( Input, Scratchpad );
if( event == nullptr ) {
// something went wrong at initial stage, move on
skip_until( Input, "endevent" );
return;
}
event->deserialize( Input, Scratchpad );
if( true == simulation::Events.insert( event ) ) {
scene::Groups.insert( scene::Groups.handle(), event );