You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/Multiplayer/Code/Source/NetworkInput/NetworkInputHistory.h

41 lines
1.1 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <Multiplayer/NetworkInput/NetworkInput.h>
#include <AzCore/std/containers/deque.h>
namespace Multiplayer
{
//! @class NetworkInputHistory
//! @brief A list of input commands, used for bookkeeping on the client.
class NetworkInputHistory final
{
public:
AZStd::size_t Size() const;
const NetworkInput& operator[](AZStd::size_t index) const;
NetworkInput& operator[](AZStd::size_t index);
void PushBack(NetworkInput& networkInput);
void PopFront();
const NetworkInput& Front() const;
private:
struct Wrapper // Strictly a workaround to deal with the private constructor of NetworkInput
{
Wrapper() : m_networkInput() {}
Wrapper(const NetworkInput& networkInput) : m_networkInput(networkInput) {}
NetworkInput m_networkInput;
};
AZStd::deque<Wrapper> m_history;
};
}