Ticket #4095: rename_CNetTurnManager.patch

File rename_CNetTurnManager.patch, 9.0 KB (added by Sandarac, 8 years ago)

Not exactly sure how to reword the comment.

  • source/network/NetTurnManager.cpp

     
    5858    return str.str();
    5959}
    6060
    61 CNetTurnManager::CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) :
     61CTurnManager::CTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) :
    6262    m_Simulation2(simulation), m_CurrentTurn(0), m_ReadyTurn(1), m_TurnLength(defaultTurnLength), m_DeltaSimTime(0),
    6363    m_PlayerId(-1), m_ClientId(clientId), m_HasSyncError(false), m_Replay(replay),
    6464    m_TimeWarpNumTurns(0), m_FinalTurn(std::numeric_limits<u32>::max())
     
    7272    m_QueuedCommands.resize(COMMAND_DELAY + 1);
    7373}
    7474
    75 void CNetTurnManager::ResetState(u32 newCurrentTurn, u32 newReadyTurn)
     75void CTurnManager::ResetState(u32 newCurrentTurn, u32 newReadyTurn)
    7676{
    7777    m_CurrentTurn = newCurrentTurn;
    7878    m_ReadyTurn = newReadyTurn;
     
    8282    m_QueuedCommands.resize(queuedCommandsSize);
    8383}
    8484
    85 void CNetTurnManager::SetPlayerID(int playerId)
     85void CTurnManager::SetPlayerID(int playerId)
    8686{
    8787    m_PlayerId = playerId;
    8888}
    8989
    90 bool CNetTurnManager::WillUpdate(float simFrameLength)
     90bool CTurnManager::WillUpdate(float simFrameLength)
    9191{
    9292    // Keep this in sync with the return value of Update()
    9393
     
    103103    return true;
    104104}
    105105
    106 bool CNetTurnManager::Update(float simFrameLength, size_t maxTurns)
     106bool CTurnManager::Update(float simFrameLength, size_t maxTurns)
    107107{
    108108    if (m_CurrentTurn > m_FinalTurn)
    109109        return false;
     
    191191    return true;
    192192}
    193193
    194 bool CNetTurnManager::UpdateFastForward()
     194bool CTurnManager::UpdateFastForward()
    195195{
    196196    m_DeltaSimTime = 0;
    197197
     
    229229    return true;
    230230}
    231231
    232 void CNetTurnManager::OnSyncError(u32 turn, const CStr& expectedHash, std::vector<CSyncErrorMessage::S_m_PlayerNames>& playerNames)
     232void CTurnManager::OnSyncError(u32 turn, const CStr& expectedHash, std::vector<CSyncErrorMessage::S_m_PlayerNames>& playerNames)
    233233{
    234234    NETTURN_LOG((L"OnSyncError(%d, %hs)\n", turn, Hexify(expectedHash).c_str()));
    235235
     
    252252    DisplayOOSError(turn, hash, expectedHashHex, false, &playerNames, &path);
    253253}
    254254
    255 void CNetTurnManager::DisplayOOSError(u32 turn, const CStr& hash, const CStr& expectedHash, bool isReplay, std::vector<CSyncErrorMessage::S_m_PlayerNames>* playerNames = NULL, OsPath* path = NULL)
     255void CTurnManager::DisplayOOSError(u32 turn, const CStr& hash, const CStr& expectedHash, bool isReplay, std::vector<CSyncErrorMessage::S_m_PlayerNames>* playerNames = NULL, OsPath* path = NULL)
    256256{
    257257    m_HasSyncError = true;
    258258
     
    277277        g_GUI->DisplayMessageBox(600, 350, L"Sync error", wstring_from_utf8(msg.str()));
    278278}
    279279
    280 void CNetTurnManager::Interpolate(float simFrameLength, float realFrameLength)
     280void CTurnManager::Interpolate(float simFrameLength, float realFrameLength)
    281281{
    282282    // TODO: using m_TurnLength might be a bit dodgy when length changes - maybe
    283283    // we need to save the previous turn length?
     
    291291    m_Simulation2.Interpolate(simFrameLength, offset, realFrameLength);
    292292}
    293293
    294 void CNetTurnManager::AddCommand(int client, int player, JS::HandleValue data, u32 turn)
     294void CTurnManager::AddCommand(int client, int player, JS::HandleValue data, u32 turn)
    295295{
    296296    NETTURN_LOG((L"AddCommand(client=%d player=%d turn=%d)\n", client, player, turn));
    297297
     
    305305    m_QueuedCommands[turn - (m_CurrentTurn+1)][client].emplace_back(player, m_Simulation2.GetScriptInterface().GetContext(), data);
    306306}
    307307
    308 void CNetTurnManager::FinishedAllCommands(u32 turn, u32 turnLength)
     308void CTurnManager::FinishedAllCommands(u32 turn, u32 turnLength)
    309309{
    310310    NETTURN_LOG((L"FinishedAllCommands(%d, %d)\n", turn, turnLength));
    311311
     
    314314    m_TurnLength = turnLength;
    315315}
    316316
    317 bool CNetTurnManager::TurnNeedsFullHash(u32 turn)
     317bool CTurnManager::TurnNeedsFullHash(u32 turn)
    318318{
    319319    // Check immediately for errors caused by e.g. inconsistent game versions
    320320    // (The hash is computed after the first sim update, so we start at turn == 1)
     
    330330    return false;
    331331}
    332332
    333 void CNetTurnManager::EnableTimeWarpRecording(size_t numTurns)
     333void CTurnManager::EnableTimeWarpRecording(size_t numTurns)
    334334{
    335335    m_TimeWarpStates.clear();
    336336    m_TimeWarpNumTurns = numTurns;
    337337}
    338338
    339 void CNetTurnManager::RewindTimeWarp()
     339void CTurnManager::RewindTimeWarp()
    340340{
    341341    if (m_TimeWarpStates.empty())
    342342        return;
     
    352352    ResetState(0, 1);
    353353}
    354354
    355 void CNetTurnManager::QuickSave()
     355void CTurnManager::QuickSave()
    356356{
    357357    TIMER(L"QuickSave");
    358358
     
    373373
    374374}
    375375
    376 void CNetTurnManager::QuickLoad()
     376void CTurnManager::QuickLoad()
    377377{
    378378    TIMER(L"QuickLoad");
    379379
     
    401401
    402402
    403403CNetClientTurnManager::CNetClientTurnManager(CSimulation2& simulation, CNetClient& client, int clientId, IReplayLogger& replay) :
    404     CNetTurnManager(simulation, DEFAULT_TURN_LENGTH_MP, clientId, replay), m_NetClient(client)
     404    CTurnManager(simulation, DEFAULT_TURN_LENGTH_MP, clientId, replay), m_NetClient(client)
    405405{
    406406}
    407407
     
    471471
    472472
    473473CNetLocalTurnManager::CNetLocalTurnManager(CSimulation2& simulation, IReplayLogger& replay) :
    474     CNetTurnManager(simulation, DEFAULT_TURN_LENGTH_SP, 0, replay)
     474    CTurnManager(simulation, DEFAULT_TURN_LENGTH_SP, 0, replay)
    475475{
    476476}
    477477
  • source/network/NetTurnManager.h

     
    3636class IReplayLogger;
    3737
    3838/*
    39  * This file deals with the logic of the network turn system. The basic idea is as in
     39 * This file deals with the logic of the turn system. The basic idea is as in
    4040 * http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_288_network_.php?print=1
    4141 *
    4242 * Each player performs the simulation for turn N.
     
    5555/**
    5656 * Common network turn system (used by clients and offline games).
    5757 */
    58 class CNetTurnManager
     58class CTurnManager
    5959{
    60     NONCOPYABLE(CNetTurnManager);
     60    NONCOPYABLE(CTurnManager);
    6161public:
    6262    /**
    6363     * Construct for a given network session ID.
    6464     */
    65     CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay);
     65    CTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay);
    6666
    67     virtual ~CNetTurnManager() { }
     67    virtual ~CTurnManager() { }
    6868
    6969    void ResetState(u32 newCurrentTurn, u32 newReadyTurn);
    7070
     
    205205
    206206
    207207/**
    208  * Implementation of CNetTurnManager for network clients.
     208 * Implementation of CTurnManager for network clients.
    209209 */
    210 class CNetClientTurnManager : public CNetTurnManager
     210class CNetClientTurnManager : public CTurnManager
    211211{
    212212public:
    213213    CNetClientTurnManager(CSimulation2& simulation, CNetClient& client, int clientId, IReplayLogger& replay);
     
    230230};
    231231
    232232/**
    233  * Implementation of CNetTurnManager for offline games.
     233 * Implementation of CTurnManager for offline games.
    234234 */
    235 class CNetLocalTurnManager : public CNetTurnManager
     235class CNetLocalTurnManager : public CTurnManager
    236236{
    237237public:
    238238    CNetLocalTurnManager(CSimulation2& simulation, IReplayLogger& replay);
     
    250250
    251251
    252252/**
    253  * Implementation of CNetTurnManager for replay games.
     253 * Implementation of CTurnManager for replay games.
    254254 */
    255255class CNetReplayTurnManager : public CNetLocalTurnManager
    256256{
  • source/network/tests/test_Net.h

     
    310310        wait(clients, 100);
    311311
    312312        // (This SetTurnLength thing doesn't actually detect errors unless you change
    313         // CNetTurnManager::TurnNeedsFullHash to always return true)
     313        // CTurnManager::TurnNeedsFullHash to always return true)
    314314
    315315        {
    316316            JS::RootedValue cmd(cx);
  • source/ps/Game.cpp

     
    110110    delete m_ReplayStream;
    111111}
    112112
    113 void CGame::SetTurnManager(CNetTurnManager* turnManager)
     113void CGame::SetTurnManager(CTurnManager* turnManager)
    114114{
    115115    if (m_TurnManager)
    116116        delete m_TurnManager;
  • source/ps/Game.h

     
    2727class CWorld;
    2828class CSimulation2;
    2929class CGameView;
    30 class CNetTurnManager;
     30class CTurnManager;
    3131class IReplayLogger;
    3232struct CColor;
    3333
     
    7777     */
    7878    player_id_t m_ViewedPlayerID;
    7979
    80     CNetTurnManager* m_TurnManager;
     80    CTurnManager* m_TurnManager;
    8181
    8282public:
    8383    CGame(bool disableGraphics = false, bool replayLog = true);
     
    185185     * Replace the current turn manager.
    186186     * This class will take ownership of the pointer.
    187187     */
    188     void SetTurnManager(CNetTurnManager* turnManager);
     188    void SetTurnManager(CTurnManager* turnManager);
    189189
    190     CNetTurnManager* GetTurnManager() const
     190    CTurnManager* GetTurnManager() const
    191191    {   return m_TurnManager; }
    192192
    193193    IReplayLogger& GetReplayLogger() const