File: launch_spg.h

package info (click to toggle)
widelands 1%3A19%2Brepack-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 371,172 kB
  • sloc: cpp: 108,458; ansic: 18,695; python: 5,155; sh: 487; xml: 460; makefile: 229
file content (94 lines) | stat: -rw-r--r-- 2,808 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * Copyright (C) 2002-2016 by the Widelands Development Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#ifndef WL_UI_FSMENU_LAUNCH_SPG_H
#define WL_UI_FSMENU_LAUNCH_SPG_H

#include <string>

#include "logic/constants.h"
#include "ui_basic/button.h"
#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "ui_fsmenu/base.h"

struct ChatProvider;
class GameController;
struct GameSettingsProvider;
struct PlayerDescriptionGroup;
class LuaInterface;

/**
 * Fullscreen menu for setting map and mapsettings for single and multi player
 * games.
 *
 * The menu has a lot dynamic user-interfaces, that are only shown in specific
 * cases:
 *    UI::Button select_map_  - only shown if the player has the right to
 *                               change the map.
 *
 */
class FullscreenMenuLaunchSPG : public FullscreenMenuBase {
public:
	FullscreenMenuLaunchSPG(GameSettingsProvider*,
	                        GameController* = nullptr,
	                        bool autolaunch = false);
	~FullscreenMenuLaunchSPG();

	void start() override;
	void think() override;

	void refresh();

protected:
	void clicked_ok() override;
	void clicked_back() override;

private:
	LuaInterface* lua_;

	void select_map();
	void win_condition_clicked();
	void win_condition_update();
	void win_condition_load();
	void set_scenario_values();
	void switch_to_position(uint8_t);
	void safe_place_for_host(uint8_t);

	uint32_t butw_;
	uint32_t buth_;

	UI::Button select_map_, wincondition_, back_, ok_;
	UI::Button* pos_[MAX_PLAYERS];
	UI::Textarea title_, mapname_;
	UI::Textarea name_, type_, team_, tribe_, init_, wincondition_type_;
	GameSettingsProvider* settings_;
	GameController* ctrl_;  // optional
	PlayerDescriptionGroup* players_[MAX_PLAYERS];
	std::string filename_;
	std::string filename_proof_;  // local var. to check UI state
	std::string player_save_name_[MAX_PLAYERS];
	std::string player_save_tribe_[MAX_PLAYERS];
	int8_t nr_players_;
	bool is_scenario_;
	std::vector<std::string> win_condition_scripts_;
	uint8_t cur_wincondition_;
};

#endif  // end of include guard: WL_UI_FSMENU_LAUNCH_SPG_H