-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathLuaInterfaceSettings.h
More file actions
53 lines (45 loc) · 1.72 KB
/
Copy pathLuaInterfaceSettings.h
File metadata and controls
53 lines (45 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "LuaInterfaceGameBase.h"
#include <string>
#include <vector>
class LuaServerPlayer;
class IGameLobbyController;
class ILocalGameState;
enum class AddonId;
struct AddonIdWrapper;
class LuaInterfaceSettings : public LuaInterfaceGameBase
{
public:
LuaInterfaceSettings(IGameLobbyController& lobbyServerController, const ILocalGameState& localGameState);
virtual ~LuaInterfaceSettings();
static void Register(kaguya::State& state);
// Interface for C++
/// Called when settings are entered. Returns whether script should be executed
bool EventSettingsInit(bool isSinglePlayer, bool isSavegame);
// Other events are only called for the host
/// Called when the settings screen is ready
void EventSettingsReady();
void EventPlayerJoined(unsigned playerIdx);
void EventPlayerLeft(unsigned playerIdx);
void EventPlayerReady(unsigned playerIdx);
/// Return whether the named change is allowed
bool IsChangeAllowed(const std::string& name, bool defaultVal = false);
/// Get addons that are allowed to be changed
std::vector<AddonId> GetAllowedAddons();
bool IsMapPreviewEnabled();
unsigned GetNumPlayersFromScript();
private:
IGameLobbyController& lobbyServerController_;
kaguya::LuaRef GetAllowedChanges();
// Callable from Lua
unsigned GetNumPlayers() const;
LuaServerPlayer GetPlayer(int idx);
void SetAddon(AddonIdWrapper id, unsigned value);
void SetBoolAddon(AddonIdWrapper id, bool value); // Alias
void ResetAddons();
void ResetGameSettings();
void SetGameSettings(const kaguya::LuaTable& settings);
};