MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / RestoreNetState

Method RestoreNetState

ogsr_engine/xrGame/Car.cpp:318–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316void CCar::SwitchLights() { m_lights.SwitchHeadLights(); }
317
318void CCar::RestoreNetState(CSE_PHSkeleton* /*po*/)
319{
320 auto obj = PPhysicsShellHolder();
321 if (!obj)
322 return;
323 auto se_obj = obj->alife_object();
324 if (!se_obj)
325 return;
326
327 auto po = smart_cast<CSE_PHSkeleton*>(se_obj);
328 ASSERT_FMT(po, "[%s]: %s is not CSE_PHSkeleton", __FUNCTION__, obj->Name_script());
329 if (!po->_flags.test(CSE_PHSkeleton::flSavedData))
330 return;
331 CPHSkeleton::RestoreNetState(po);
332
333 CSE_ALifeCar* co = smart_cast<CSE_ALifeCar*>(se_obj);
334 ASSERT_FMT(co, "[%s]: %s is not CSE_ALifeCar", __FUNCTION__, obj->Name_script());
335 if (co->door_states.size() == m_doors.size())
336 {
337 /* восстановление состояния дверей отключено, пусть в дефолтном состоянии
338 всегда будут
339
340 int i = 0;
341 for ( auto& it : m_doors ) {
342 const auto& ds = co->door_states.at( i++ );
343 it.second.RestoreNetState( ds );
344 }
345 */
346 }
347 else
348 Msg("~ [%s]: [%s] has different state in m_doors[%u] door_states[%u] Visual[%s]", __FUNCTION__, obj->Name_script(), m_doors.size(), co->door_states.size(),
349 obj->cNameVisual().c_str());
350 co->door_states.clear();
351
352 if (co->wheel_states.size() == m_wheels_map.size())
353 {
354 /* восстановление состояния колес отключено, пусть в дефолтном состоянии
355 всегда будут
356
357 int i = 0;
358 for ( auto& it : m_wheels_map ) {
359 const auto& ws = co->wheel_states.at( i++ );
360 it.second.RestoreNetState( ws );
361 }
362 */
363 }
364 else
365 Msg("~ [%s]: [%s] has different state in m_wheels_map[%u] wheel_states[%u] Visual[%s]", __FUNCTION__, obj->Name_script(), m_wheels_map.size(), co->wheel_states.size(),
366 obj->cNameVisual().c_str());
367 co->wheel_states.clear();
368
369 // as later may kill diable/enable state save it;
370 bool enable = PPhysicsShell()->isEnabled();
371
372 Fmatrix restored_form;
373 PPhysicsShell()->GetGlobalTransformDynamic(&restored_form);
374
375 Fmatrix inv, replace, sof;

Callers

nothing calls this directly

Calls 15

MsgFunction · 0.85
PKinematicsFunction · 0.85
VisualFunction · 0.85
get_boxFunction · 0.85
XFORMFunction · 0.85
setXYZMethod · 0.80
DisableCollisionMethod · 0.80
PositionMethod · 0.80
EnableCollisionMethod · 0.80
PPhysicsShellHolderFunction · 0.70
alife_objectMethod · 0.45

Tested by

no test coverage detected