2020-12-09 23:39:10 -07:00
|
|
|
/*****************************************************************************
|
2024-01-01 05:52:28 -06:00
|
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
2020-12-09 23:39:10 -07:00
|
|
|
*
|
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
|
*
|
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "NetworkModifyGroupAction.h"
|
|
|
|
|
|
|
|
|
|
#include "../network/network.h"
|
|
|
|
|
|
2024-07-26 09:59:58 +02:00
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
|
2020-12-13 12:10:26 -03:00
|
|
|
NetworkModifyGroupAction::NetworkModifyGroupAction(
|
|
|
|
|
ModifyGroupType type, uint8_t groupId, const std::string name, uint32_t permissionIndex, PermissionState permissionState)
|
|
|
|
|
: _type(type)
|
|
|
|
|
, _groupId(groupId)
|
|
|
|
|
, _name(name)
|
|
|
|
|
, _permissionIndex(permissionIndex)
|
|
|
|
|
, _permissionState(permissionState)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-16 22:38:45 +01:00
|
|
|
void NetworkModifyGroupAction::AcceptParameters(GameActionParameterVisitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
visitor.Visit("type", _type);
|
|
|
|
|
visitor.Visit("groupId", _groupId);
|
|
|
|
|
visitor.Visit("name", _name);
|
|
|
|
|
visitor.Visit("permissionIndex", _permissionIndex);
|
|
|
|
|
visitor.Visit("permissionState", _permissionState);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-13 12:10:26 -03:00
|
|
|
uint16_t NetworkModifyGroupAction::GetActionFlags() const
|
|
|
|
|
{
|
|
|
|
|
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-09 23:39:10 -07:00
|
|
|
void NetworkModifyGroupAction::Serialise(DataSerialiser& stream)
|
|
|
|
|
{
|
|
|
|
|
GameAction::Serialise(stream);
|
|
|
|
|
|
|
|
|
|
stream << DS_TAG(_type) << DS_TAG(_groupId) << DS_TAG(_name) << DS_TAG(_permissionIndex) << DS_TAG(_permissionState);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 23:35:08 -08:00
|
|
|
GameActions::Result NetworkModifyGroupAction::Query() const
|
2020-12-09 23:39:10 -07:00
|
|
|
{
|
2023-01-18 07:05:53 +01:00
|
|
|
return NetworkModifyGroups(GetPlayer(), _type, _groupId, _name, _permissionIndex, _permissionState, false);
|
2020-12-09 23:39:10 -07:00
|
|
|
}
|
|
|
|
|
|
2021-11-23 23:35:08 -08:00
|
|
|
GameActions::Result NetworkModifyGroupAction::Execute() const
|
2020-12-09 23:39:10 -07:00
|
|
|
{
|
2023-01-18 07:05:53 +01:00
|
|
|
return NetworkModifyGroups(GetPlayer(), _type, _groupId, _name, _permissionIndex, _permissionState, true);
|
2020-12-09 23:39:10 -07:00
|
|
|
}
|