Refactored System constructor to take a struct instead of a bunch of parameters to reduce future pain and to be able to extend it with IsClient and IsServer flags.

This commit is contained in:
2016-02-08 13:32:00 +01:00
parent 3a2b124cae
commit 2b4e00e4b0
37 changed files with 109 additions and 132 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
#include "Systems/CapturePointSystem.h"
#include <algorithm>
CapturePointSystem::CapturePointSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
CapturePointSystem::CapturePointSystem(SystemParams params)
: System(params)
, PureSystem("CapturePoint")
{
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/HealthSystem.h"
HealthSystem::HealthSystem(World* m_World, EventBroker* eventBroker)
: System(m_World, eventBroker)
HealthSystem::HealthSystem(SystemParams params)
: System(params)
, PureSystem("Health")
{
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/InterpolationSystem.h"
InterpolationSystem::InterpolationSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
InterpolationSystem::InterpolationSystem(SystemParams params)
: System(params)
, PureSystem("Transform")
{
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
@@ -1,21 +1,6 @@
#include "Game/Systems/PlayerHUD.h"
#include "Game/Systems/PlayerHUDSystem.h"
PlayerHUD::PlayerHUD(World* world, EventBroker* eventBrokerer)
:System(world, eventBrokerer)
, m_World(world)
, m_EventBroker(eventBrokerer)
{
}
PlayerHUD::~PlayerHUD()
{
}
void PlayerHUD::Update(double dt)
void PlayerHUDSystem::Update(double dt)
{
auto healthHUDs = m_World->GetComponents("HealthHUD");
if (healthHUDs == nullptr) {
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/PlayerMovementSystem.h"
PlayerMovementSystem::PlayerMovementSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
PlayerMovementSystem::PlayerMovementSystem(SystemParams params)
: System(params)
, PureSystem("Player")
{
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned);
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/PlayerSpawnSystem.h"
PlayerSpawnSystem::PlayerSpawnSystem(World* m_World, EventBroker* eventBroker)
: System(m_World, eventBroker)
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/SpawnerSystem.h"
SpawnerSystem::SpawnerSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
SpawnerSystem::SpawnerSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_OnSpawnerSpawn, &SpawnerSystem::OnSpawnerSpawn);
}
+2 -2
View File
@@ -1,7 +1,7 @@
#include "Systems/WeaponSystem.h"
WeaponSystem::WeaponSystem(World* world, EventBroker* eventBroker, IRenderer* renderer)
: System(world, eventBroker)
WeaponSystem::WeaponSystem(SystemParams params, IRenderer* renderer)
: System(params)
, ImpureSystem()
, m_Renderer(renderer)
{