1 /*
2  * Copyright (C) 2002-2020 by the Widelands Development Team
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  */
19 
20 #ifndef WL_LOGIC_OBJECTIVE_H
21 #define WL_LOGIC_OBJECTIVE_H
22 
23 #include "base/i18n.h"
24 
25 namespace Widelands {
26 
27 // A Map (or scenario) objective is an objective that has to be fulfilled to
28 // end a scenario successfully.
29 class Objective {
30 public:
Objective(const std::string & init_name)31 	explicit Objective(const std::string& init_name)
32 	   : name_(init_name),
33 	     descname_(init_name),
34 	     descr_(_("This objective has no description.")),
35 	     visible_(true),
36 	     done_(false) {
37 	}
38 
39 	// Unique internal name of the objective.
name()40 	const std::string& name() const {
41 		return name_;
42 	}
43 
44 	// User facing (translated) descriptive name.
descname()45 	const std::string& descname() const {
46 		return descname_;
47 	}
set_descname(const std::string & new_name)48 	void set_descname(const std::string& new_name) {
49 		descname_ = new_name;
50 	}
51 
52 	// Description text of this name.
descr()53 	const std::string& descr() const {
54 		return descr_;
55 	}
set_descr(const std::string & new_descr)56 	void set_descr(const std::string& new_descr) {
57 		descr_ = new_descr;
58 	}
59 
60 	// True, if this objective is fulfilled.
done()61 	bool done() const {
62 		return done_;
63 	}
64 
set_done(bool t)65 	void set_done(bool t) {
66 		done_ = t;
67 	}
68 
69 	// True, if this objective is visible to the user.
visible()70 	bool visible() const {
71 		return visible_;
72 	}
set_visible(const bool t)73 	void set_visible(const bool t) {
74 		visible_ = t;
75 	}
76 
77 private:
78 	const std::string name_;
79 	std::string descname_;
80 	std::string descr_;
81 	bool visible_;
82 	bool done_;
83 };
84 }  // namespace Widelands
85 
86 #endif  // end of include guard: WL_LOGIC_OBJECTIVE_H
87