Leviathan  0.8.0.0
Leviathan game engine
Leviathan::StateCreationSystem< UsedComponent, ComponentState > Class Template Reference

Base class for all systems that create states from changed components. More...

#include <System.h>

Public Member Functions

void Run (GameWorld &world, std::unordered_map< ObjectID, UsedComponent *> &index, StateHolder< ComponentState > &heldstates, int worldtick)
 

Detailed Description

template<class UsedComponent, class ComponentState>
class Leviathan::StateCreationSystem< UsedComponent, ComponentState >

Base class for all systems that create states from changed components.

Definition at line 193 of file System.h.

Member Function Documentation

◆ Run()

template<class UsedComponent, class ComponentState>
void Leviathan::StateCreationSystem< UsedComponent, ComponentState >::Run ( GameWorld world,
std::unordered_map< ObjectID, UsedComponent *> &  index,
StateHolder< ComponentState > &  heldstates,
int  worldtick 
)
inline

Definition at line 195 of file System.h.

197  {
198  // TODO: find a better way (see the comment a few lines down why this is here)
199  if(!world.GetNetworkSettings().DoInterpolation)
200  return;
201 
202  const bool authoritative = world.GetNetworkSettings().IsAuthoritative;
203 
204  for(auto iter = index.begin(); iter != index.end(); ++iter) {
205  auto& component = *iter->second;
206 
207  if(!component.Marked)
208  continue;
209 
210  // And only for locally controlled entities
211  if(!authoritative && !world.IsUnderOurLocalControl(iter->first))
212  continue;
213 
214  // Ignore creating states on the server when using local control as that causes
215  // issues Actually this whole system is disabled when interpolating isn't needed
216 
217  // Needs a new state //
218  if(heldstates.CreateStateIfChanged(iter->first, component, worldtick)) {
219 
220  component.StateMarked = true;
221  }
222 
223  component.Marked = false;
224  }
225  }

The documentation for this class was generated from the following file: