| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) RedWolf Design |
| 5 | * Copyright (c) 2020-2021, The LegacyClonk Team and contributors |
| 6 | * |
| 7 | * Distributed under the terms of the ISC license; see accompanying file |
| 8 | * "COPYING" for details. |
| 9 | * |
| 10 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 11 | * See accompanying file "TRADEMARK" for details. |
| 12 | * |
| 13 | * To redistribute this file separately, substitute the full license texts |
| 14 | * for the above references. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include "C4Constants.h" |
| 20 | |
| 21 | #include <map> |
| 22 | #include <string> |
| 23 | #include <type_traits> |
| 24 | |
| 25 | namespace C4NetworkRestartInfos |
| 26 | { |
| 27 | enum RestoreInfo |
| 28 | { |
| 29 | None = 0, |
| 30 | ScriptPlayers = 0x1, // includes teams of script players |
| 31 | PlayerTeams = 0x2 // for normal players |
| 32 | }; |
| 33 | |
| 34 | struct Player |
| 35 | { |
| 36 | const std::string name; |
| 37 | const C4PlayerType type; |
| 38 | const int32_t team; |
| 39 | const uint32_t color; |
| 40 | |
| 41 | Player(const std::string &name, const C4PlayerType type, const uint32_t color, const int32_t team) : name{name}, type{type}, team{team}, color{color} { } |
| 42 | }; |
| 43 | |
| 44 | struct Infos |
| 45 | { |
| 46 | std::underlying_type_t<RestoreInfo> What{None}; |
| 47 | std::map<std::string, Player> Players; |
| 48 | void Clear() |
| 49 | { |
| 50 | *this = Infos{}; |
| 51 | } |
| 52 | }; |
| 53 | } |
| 54 | |