Fixed merge conflicts. Scoreboard updates team when a team is picked. Fixed some code standard violations and misspellings.

This commit is contained in:
William Moberg
2016-03-13 14:23:56 +01:00
parent 4f99f6ef74
commit ac20e41a5d
7 changed files with 30 additions and 15 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef ECaptured_h__
#define ECaptured_h__
#ifndef Events_Captured_h__
#define Events_Captured_h__
#include "EventBroker.h"
#include "../Core/Entity.h"
+2 -2
View File
@@ -52,9 +52,9 @@ private:
char readBuffer[BUFFERSIZE] = { 0 };
size_t bytesRead = 0;
// time for previouse message
double previousePingMessage = 0;
double previousPingMessage = 0;
double previousSnapshotMessage = 0;
double timOutTimer = 0;
double timeOutTimer = 0;
// How often we send messages (seconds)
double pingInterval = 1;
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef Reset_h__
#define Reset_h__
#ifndef Events_Reset_h__
#define Events_Reset_h__
#include "Core/EventBroker.h"
#include "Core/EntityWrapper.h"
+3
View File
@@ -9,6 +9,7 @@
#include "Network/EPlayerConnected.h"
#include "Network/EPlayerDisconnected.h"
#include "Game/Events/EReset.h"
#include "Engine/Input/EInputCommand.h"
#include "GLM.h"
class ScoreScreenSystem : public PureSystem
@@ -28,6 +29,8 @@ public:
bool OnPlayerDisconnected(const Events::PlayerDisconnected& e);
EventRelay<ScoreScreenSystem, Events::Reset> m_EReset;
bool OnReset(const Events::Reset& e);
EventRelay<ScoreScreenSystem, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
private:
struct PlayerData {
+7 -7
View File
@@ -94,17 +94,17 @@ void Server::Update(double dt)
previousSnapshotMessage = 0;
}
// Send pings each
previousePingMessage += dt;
if (pingInterval < previousePingMessage) {
previousPingMessage += dt;
if (pingInterval < previousPingMessage) {
sendPing();
previousePingMessage = 0;
previousPingMessage = 0;
}
// Time out logic
timOutTimer += dt;
if (checkTimeOutInterval < timOutTimer) {
timeOutTimer += dt;
if (checkTimeOutInterval < timeOutTimer) {
checkForTimeOuts();
timOutTimer = 0;
timeOutTimer = 0;
}
m_EventBroker->Process<Server>();
if (isReadingData) {
@@ -117,7 +117,7 @@ void Server::Update(double dt)
// Take the first CapturePointGameMode component found.
ComponentWrapper& modeComponent = *pool->begin();
// Decrease timer.
double& timer = (double&)modeComponent["ResetCountdown"];
Field<double> timer = modeComponent["ResetCountdown"];
timer -= dt;
if (timer < 0) {
resetMap();
+2 -2
View File
@@ -10,9 +10,9 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
EVENT_SUBSCRIBE_MEMBER(m_EReset, &CapturePointSystem::OnReset);
Init();
}
EVENT_SUBSCRIBE_MEMBER(m_EReset, &CapturePointSystem::OnReset);
Init();
}
void CapturePointSystem::Init()
+12
View File
@@ -10,6 +10,7 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_EPlayerConnected, &ScoreScreenSystem::OnPlayerConnected);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected);
EVENT_SUBSCRIBE_MEMBER(m_EReset, &ScoreScreenSystem::OnReset);
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &ScoreScreenSystem::OnInputCommand);
}
void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt)
@@ -168,3 +169,14 @@ bool ScoreScreenSystem::OnReset(const Events::Reset & e)
}
return true;
}
bool ScoreScreenSystem::OnInputCommand(const Events::InputCommand & e)
{
if (e.Command != "PickTeam" || e.PlayerID == -1 || e.Value == 0) {
return false;
}
m_PlayerIdentities.at(e.PlayerID).Team = e.Value;
return true;
}