make episode an enum class

This commit is contained in:
Martin Michelsen
2023-03-04 11:41:37 -08:00
parent a35d835f31
commit 159f80cce3
18 changed files with 341 additions and 183 deletions
+17 -12
View File
@@ -11,21 +11,23 @@
#include <phosg/Encoding.hh>
#include "Client.hh"
#include "Player.hh"
#include "Map.hh"
#include "RareItemSet.hh"
#include "Text.hh"
#include "Quest.hh"
#include "Items.hh"
#include "Episode3/BattleRecord.hh"
#include "Episode3/Server.hh"
#include "Items.hh"
#include "Map.hh"
#include "Player.hh"
#include "Quest.hh"
#include "RareItemSet.hh"
#include "StaticGameData.hh"
#include "Text.hh"
struct Lobby : public std::enable_shared_from_this<Lobby> {
enum Flag {
GAME = 0x00000001,
EPISODE_3_ONLY = 0x00000002,
NON_V1_ONLY = 0x00000004, // DC NTE and DCv1 not allowed
PERSISTENT = 0x00000008,
NON_V1_ONLY = 0x00000002, // DC NTE and DCv1 not allowed
PERSISTENT = 0x00000004,
// Flags used only for games
CHEATS_ENABLED = 0x00000100,
@@ -33,7 +35,7 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
BATTLE_IN_PROGRESS = 0x00000400,
JOINABLE_QUEST_IN_PROGRESS = 0x00000800,
ITEM_TRACKING_ENABLED = 0x00001000,
IS_SPECTATOR_TEAM = 0x00002000, // EPISODE_3_ONLY must also be set
IS_SPECTATOR_TEAM = 0x00002000, // episode must be EP3 also
SPECTATORS_FORBIDDEN = 0x00004000,
BATTLE_MODE = 0x00008000,
CHALLENGE_MODE = 0x00010000,
@@ -68,8 +70,8 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
// Game config
GameVersion version;
uint8_t section_id;
uint8_t episode; // 1 = Ep1, 2 = Ep2, 3 = Ep4, 0xFF = Ep3
uint8_t difficulty;
Episode episode;
uint8_t difficulty; // 0-3
std::u16string password;
std::u16string name;
// This seed is also sent to the client for rare enemy generation
@@ -113,6 +115,9 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
inline bool is_game() const {
return this->flags & Flag::GAME;
}
inline bool is_ep3() const {
return this->episode == Episode::EP3;
}
void reassign_leader_on_client_departure(size_t leaving_client_id);
size_t count_clients() const;