#pragma once #include #include #include #include #include #include #include #include #include "Client.hh" #include "Items.hh" #include "LevelTable.hh" #include "License.hh" #include "Lobby.hh" #include "Menu.hh" #include "Quest.hh" struct PortConfiguration { uint16_t port; GameVersion version; ServerBehavior behavior; }; struct ServerState { enum class RunShellBehavior { Default = 0, Always, Never, }; std::u16string name; std::unordered_map port_configuration; bool run_dns_server; RunShellBehavior run_shell_behavior; std::shared_ptr quest_index; std::shared_ptr level_table; std::shared_ptr battle_params; std::shared_ptr common_item_creator; std::shared_ptr license_manager; std::vector main_menu; std::shared_ptr> information_menu; std::shared_ptr> information_contents; size_t num_threads; rw_lock lobbies_lock; std::map> id_to_lobby; std::atomic next_lobby_id; std::set all_addresses; uint32_t local_address; uint32_t external_address; ServerState(); void add_client_to_available_lobby(std::shared_ptr c); void remove_client_from_lobby(std::shared_ptr c); void change_client_lobby(std::shared_ptr c, std::shared_ptr new_lobby); void send_lobby_join_notifications(std::shared_ptr l, std::shared_ptr joining_client); std::shared_ptr find_lobby(uint32_t lobby_id); std::vector> all_lobbies(); void add_lobby(std::shared_ptr l); void remove_lobby(uint32_t lobby_id); std::shared_ptr find_client(const char16_t* identifier = NULL, uint64_t serial_number = 0, std::shared_ptr l = NULL); uint32_t connect_address_for_client(std::shared_ptr c); };