Strip trailing whitespace from network code.

This was SVN commit r17524.
This commit is contained in:
elexis 2015-12-21 13:58:32 +00:00
parent 72dcd7422d
commit b790403c87
12 changed files with 49 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -91,7 +91,7 @@ public: \
* @param _netsz The number of bytes that should be serialized. If the variable
* has a value larger than the maximum value of the specified network size,
* higher order bytes will be discarded.
*/
*/
#define NMT_FIELD_INT(_nm, _hosttp, _netsz) \
_hosttp _nm;

View File

@ -75,7 +75,7 @@ CNetClient::CNetClient(CGame* game) :
m_Game->SetTurnManager(NULL); // delete the old local turn manager so we don't accidentally use it
void* context = this;
JS_AddExtraGCRootsTracer(GetScriptInterface().GetJSRuntime(), CNetClient::Trace, this);
// Set up transitions for session
@ -193,7 +193,7 @@ void CNetClient::GuiPoll(JS::MutableHandleValue ret)
}
void CNetClient::PushGuiMessage(const JS::HandleValue message)
{
{
ENSURE(!message.isUndefined());
m_GuiMessageQueue.push_back(JS::Heap<JS::Value>(message));
@ -203,7 +203,7 @@ std::string CNetClient::TestReadGuiMessages()
{
JSContext* cx = GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
std::string r;
JS::RootedValue msg(cx);
while (true)
@ -225,7 +225,7 @@ void CNetClient::PostPlayerAssignmentsToScript()
{
JSContext* cx = GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
JS::RootedValue msg(cx);
GetScriptInterface().Eval("({'type':'players', 'hosts':{}})", &msg);
@ -262,7 +262,7 @@ void CNetClient::HandleDisconnect(u32 reason)
{
JSContext* cx = GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
JS::RootedValue msg(cx);
GetScriptInterface().Eval("({'type':'netstatus','status':'disconnected'})", &msg);
GetScriptInterface().SetProperty(msg, "reason", (int)reason, false);
@ -342,7 +342,7 @@ void CNetClient::LoadFinished()
{
JSContext* cx = GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
if (!m_JoinSyncBuffer.empty())
{
// We're rejoining a game, and just finished loading the initial map,
@ -432,7 +432,7 @@ bool CNetClient::OnAuthenticate(void* context, CFsmEvent* event)
ENSURE(event->GetType() == (uint)NMT_AUTHENTICATE_RESULT);
CNetClient* client = (CNetClient*)context;
JSContext* cx = client->GetScriptInterface().GetContext();
JSAutoRequest rq(cx);

View File

@ -68,10 +68,10 @@ public:
CNetClient(CGame* game);
virtual ~CNetClient();
/**
* We assume that adding a tracing function that's only called
* during GC is better for performance than using a
* during GC is better for performance than using a
* PersistentRooted<T> where each value needs to be added to
* the root set.
*/
@ -79,9 +79,9 @@ public:
{
reinterpret_cast<CNetClient*>(data)->TraceMember(trc);
}
void TraceMember(JSTracer *trc);
/**
* Set the user's name that will be displayed to all players.
* This must not be called after the connection setup.
@ -177,7 +177,7 @@ public:
void LoadFinished();
void SendChatMessage(const std::wstring& text);
void SendReadyMessage(const int status);
/**

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -46,8 +46,8 @@ public:
NetMessageType GetType() const { return m_Type; }
/**
* Serialize the message into the specified buffer parameter. The size
* required by the buffer parameter can be found by a call to
* Serialize the message into the specified buffer parameter. The size
* required by the buffer parameter can be found by a call to
* GetSerializedLength method. The information contained within the message
* must be serialized before the message is sent. By default only the
* message type and its size are serialized in the buffer parameter.
@ -116,7 +116,7 @@ public:
CSimulationMessage(ScriptInterface& scriptInterface);
CSimulationMessage(ScriptInterface& scriptInterface, u32 client, i32 player, u32 turn, JS::HandleValue data);
/** The compiler can't create a copy constructor because of the PersistentRooted member,
/** The compiler can't create a copy constructor because of the PersistentRooted member,
* so we have to write it manually.
* NOTE: It doesn't clone the m_Data member and the copy will reference the same JS::Value!
*/

View File

@ -33,7 +33,7 @@
// Defines the list of message types. The order of the list must not change.
// The message types having a negative value are used internally and not sent
// over the network. The message types used for network communication have
// over the network. The message types used for network communication have
// positive values.
enum NetMessageType
{

View File

@ -315,7 +315,7 @@ void* CNetServerWorker::SetupUPnP(void*)
// Make sure everything is properly freed.
if (allocatedUrls)
FreeUPNPUrls(&urls);
freeUPNPDevlist(devlist);
return NULL;
@ -366,7 +366,7 @@ void CNetServerWorker::Run()
{
// The script runtime uses the profiler and therefore the thread must be registered before the runtime is created
g_Profiler2.RegisterCurrentThread("Net server");
// To avoid the need for JS_SetContextThread, we create and use and destroy
// the script interface entirely within this network thread
m_ScriptInterface = new ScriptInterface("Engine", "Net server", ScriptInterface::CreateRuntime(g_ScriptRuntime));
@ -384,7 +384,7 @@ void CNetServerWorker::Run()
// Update profiler stats
m_Stats->LatchHostState(m_Host);
}
// Clear roots before deleting their context
m_GameAttributes.clear();
m_SavedCommands.clear();
@ -397,9 +397,9 @@ bool CNetServerWorker::RunStep()
// Check for messages from the game thread.
// (Do as little work as possible while the mutex is held open,
// to avoid performance problems and deadlocks.)
m_ScriptInterface->GetRuntime()->MaybeIncrementalGC(0.5f);
JSContext* cx = m_ScriptInterface->GetContext();
JSAutoRequest rq(cx);
@ -1029,7 +1029,7 @@ bool CNetServerWorker::OnJoinSyncingLoadedGame(void* context, CFsmEvent* event)
// The simulation may have progressed since then, so send any subsequent
// commands to them and set them as an active player so they can participate
// in all future turns.
//
//
// (TODO: if it takes a long time for them to receive and execute all these
// commands, the other players will get frozen for that time and may be unhappy;
// we could try repeating this process a few times until the client converges

View File

@ -122,7 +122,7 @@ public:
* The changes will be asynchronously propagated to all clients.
*/
void AssignPlayer(int playerID, const CStr& guid);
/**
* Call from the GUI to update the player readiness.
* The changes will be asynchronously propagated to all clients.
@ -255,7 +255,7 @@ private:
void AddPlayer(const CStr& guid, const CStrW& name);
void RemovePlayer(const CStr& guid);
void SetPlayerReady(const CStr& guid, const int ready);
void SetPlayerReady(const CStr& guid, const int ready);
void SendPlayerAssignments();
void ClearAllPlayerReady();

View File

@ -351,7 +351,7 @@ void CNetTurnManager::RewindTimeWarp()
void CNetTurnManager::QuickSave()
{
TIMER(L"QuickSave");
std::stringstream stream;
if (!m_Simulation2.SerializeState(stream))
{

View File

@ -74,7 +74,7 @@ public:
* Advance the simulation by a certain time. If this brings us past the current
* turn length, the next turns are processed and the function returns true.
* Otherwise, nothing happens and it returns false.
*
*
* @param simFrameLength Length of the previous frame, in simulation seconds
* @param maxTurns Maximum number of turns to simulate at once
*/
@ -212,7 +212,7 @@ public:
virtual void OnSimulationMessage(CSimulationMessage* msg);
virtual void PostCommand(JS::HandleValue data);
/**
* Notifiy the server that all commands are sent to prepare the connection for termination.
*/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -83,7 +83,7 @@ public:
virtual size_t GetSerializedLength() const = 0;
/**
* Serialize the object into the passed buffer.
*
*
* @return a pointer to the location in the buffer right after the
* serialized object
*/
@ -95,7 +95,7 @@ public:
*
* @param buffer A pointer pointing to the start of the serialized data.
* @param end A pointer to the end of the message.
*
*
* @returns a pointer to the location in the buffer right after the
* serialized object, or NULL if there was a data format error
*/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -269,7 +269,7 @@ CFsmEvent* CFsm::AddEvent( unsigned int eventType )
// Name: AddTransition()
// Desc: Adds a new transistion to the state machine
//-----------------------------------------------------------------------------
CFsmTransition* CFsm::AddTransition(
CFsmTransition* CFsm::AddTransition(
unsigned int state,
unsigned int eventType,
unsigned int nextState )
@ -306,7 +306,7 @@ CFsmTransition* CFsm::AddTransition(
// Name: AddTransition()
// Desc: Adds a new transition to the state machine
//-----------------------------------------------------------------------------
CFsmTransition* CFsm::AddTransition(
CFsmTransition* CFsm::AddTransition(
unsigned int state,
unsigned int eventType,
unsigned int nextState,
@ -315,7 +315,7 @@ CFsmTransition* CFsm::AddTransition(
{
CFsmTransition* pTransition = AddTransition( state, eventType, nextState );
if ( !pTransition ) return NULL;
// If action specified, register it
if ( pAction )
pTransition->RegisterAction( pAction, pContext );
@ -402,7 +402,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam )
// Lookup transition
CFsmTransition* pTransition = GetTransition( m_CurrState, eventType );
if ( !pTransition )
if ( !pTransition )
return false;
// Setup event parameter
@ -414,7 +414,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam )
}
// Valid transition?
if ( !pTransition->ApplyConditions() )
if ( !pTransition->ApplyConditions() )
return false;
// Save the default state transition (actions might call SetNextState
@ -422,7 +422,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam )
SetNextState( pTransition->GetNextState() );
// Run transition actions
if ( !pTransition->RunActions() )
if ( !pTransition->RunActions() )
return false;
// Switch state
@ -430,7 +430,7 @@ bool CFsm::Update( unsigned int eventType, void* pEventParam )
// Reset the next state since it's no longer valid
SetNextState( FSM_INVALID_STATE );
return true;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -34,7 +34,7 @@ typedef bool ( *CONDITION ) ( void* pContext );
typedef bool ( *ACTION ) ( void* pContext, const CFsmEvent* pEvent );
typedef struct
{
{
void* pFunction;
void* pContext;
@ -79,11 +79,11 @@ public:
CFsmTransition( unsigned int state );
~CFsmTransition( void );
void RegisterAction (
void RegisterAction (
void* pAction,
void* pContext );
void RegisterCondition (
void* pCondition,
void RegisterCondition (
void* pCondition,
void* pContext );
void SetEvent ( CFsmEvent* pEvent );
CFsmEvent* GetEvent ( void ) const { return m_Event; }
@ -91,7 +91,7 @@ public:
unsigned int GetNextState ( void ) const { return m_NextState; }
unsigned int GetCurrState ( void ) const { return m_CurrState; }
const CallbackList& GetActions ( void ) const { return m_Actions; }
const CallbackList& GetConditions ( void ) const { return m_Conditions; }
const CallbackList& GetConditions ( void ) const { return m_Conditions; }
bool ApplyConditions ( void ) const;
bool RunActions ( void ) const;
@ -135,7 +135,7 @@ public:
void AddState ( unsigned int state );
CFsmEvent* AddEvent ( unsigned int eventType );
CFsmTransition* AddTransition (
CFsmTransition* AddTransition (
unsigned int state,
unsigned int eventType,
unsigned int nextState );
@ -145,7 +145,7 @@ public:
unsigned int nextState,
void* pAction,
void* pContext );
CFsmTransition* GetTransition (
CFsmTransition* GetTransition (
unsigned int state,
unsigned int eventType ) const;
CFsmTransition* GetEventTransition ( unsigned int eventType ) const;