Line data Source code
1 : /* Copyright (C) 2017 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #include "precompiled.h"
19 :
20 : #include "LocalTurnManager.h"
21 :
22 0 : CLocalTurnManager::CLocalTurnManager(CSimulation2& simulation, IReplayLogger& replay)
23 0 : : CTurnManager(simulation, DEFAULT_TURN_LENGTH, COMMAND_DELAY_SP, 0, replay)
24 : {
25 0 : }
26 :
27 0 : void CLocalTurnManager::PostCommand(player_id_t playerid, JS::HandleValue data)
28 : {
29 0 : AddCommand(m_ClientId, playerid, data, m_CurrentTurn + m_CommandDelay);
30 0 : }
31 :
32 0 : void CLocalTurnManager::PostCommand(JS::HandleValue data)
33 : {
34 0 : AddCommand(m_ClientId, m_PlayerId, data, m_CurrentTurn + m_CommandDelay);
35 0 : }
36 :
37 0 : void CLocalTurnManager::NotifyFinishedOwnCommands(u32 turn)
38 : {
39 0 : FinishedAllCommands(turn, m_TurnLength);
40 0 : }
41 :
42 0 : void CLocalTurnManager::NotifyFinishedUpdate(u32 UNUSED(turn))
43 : {
44 : #if 0 // this hurts performance and is only useful for verifying log replays
45 : std::string hash;
46 : {
47 : PROFILE3("state hash check");
48 : ENSURE(m_Simulation2.ComputeStateHash(hash));
49 : }
50 : m_Replay.Hash(hash);
51 : #endif
52 0 : }
53 :
54 0 : void CLocalTurnManager::OnSimulationMessage(CSimulationMessage* UNUSED(msg))
55 : {
56 0 : debug_warn(L"This should never be called");
57 0 : }
|