xoreos  0.0.5
waypoint.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/common/util.h"
26 #include "src/common/maths.h"
27 
28 #include "src/aurora/locstring.h"
29 #include "src/aurora/gff3file.h"
30 
32 
34 
35 namespace Engines {
36 
37 namespace Jade {
38 
40  _hasMapNote(false), _displayMapNote(false) {
41 
42  load(waypoint);
43 }
44 
46  hide();
47 }
48 
49 void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
50  // Tag
51 
52  _tag = waypoint.getString("Tag", _tag);
53 
54  loadPositional(waypoint);
55 
56  // Map note
57 
58  _hasMapNote = waypoint.getBool("MapNoteEnabled", _hasMapNote);
59  _displayMapNote = waypoint.getBool("MapNoteDisplay", _displayMapNote);
60  _mapNoteType = waypoint.getSint("MapNoteType");
61  if (waypoint.hasField("MapNote")) {
62  _mapNote = waypoint.getString("MapNote");
63  }
64 }
65 
66 bool Waypoint::hasMapNote() const {
67  return _hasMapNote && _displayMapNote;
68 }
69 
71  return _mapNote;
72 }
73 
74 void Waypoint::enableMapNote(bool enabled) {
75  _hasMapNote = enabled;
76 }
77 
78 void Waypoint::enableMapNoteDisplay(bool enabled) {
79  _displayMapNote = enabled;
80 }
81 
82 } // End of namespace Jade
83 
84 } // End of namespace Engines
int64 getSint(const Common::UString &field, int64 def=0) const
Definition: gff3file.cpp:473
Handling version V3.2/V3.3 of BioWare&#39;s GFFs (generic file format).
bool getBool(const Common::UString &field, bool def=false) const
Definition: gff3file.cpp:510
A class holding an UTF-8 string.
Definition: ustring.h:48
void loadPositional(const Aurora::GFF3Struct &gff)
Load the object&#39;s positional gff struct which contains the position and orientation.
Definition: object.cpp:212
bool _displayMapNote
Does this waypoint show the map note?
Definition: waypoint.h:61
A waypoint in a Jade Empire area.
void enableMapNote(bool enabled)
Enable/Disable the waypoint&#39;s map note.
Definition: waypoint.cpp:74
bool hasField(const Common::UString &field) const
Does this specific field exist?
Definition: gff3file.cpp:400
Mathematical helpers.
Utility templates and functions.
int _mapNoteType
Type of map note.
Definition: waypoint.h:62
Handling BioWare&#39;s localized strings.
An object within a Jade area.
Definition: object.h:53
void load(const Aurora::GFF3Struct &waypoint)
Load from a waypoint instance.
Definition: waypoint.cpp:49
void enableMapNoteDisplay(bool enabled)
Enable/Disable the display of the waypoint&#39;s map note.
Definition: waypoint.cpp:78
A struct within a GFF3.
Definition: gff3file.h:164
Common::UString _mapNote
The waypoint&#39;s map note text.
Definition: waypoint.h:63
virtual void hide()
Hide the object&#39;s model(s).
Definition: object.cpp:71
Common::UString _tag
Definition: object.h:56
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
Definition: gff3file.cpp:527
bool _hasMapNote
Does this waypoint have a map note?
Definition: waypoint.h:60
Generic Aurora engines utility functions.
bool hasMapNote() const
Does this waypoint have a map note?
Definition: waypoint.cpp:66
Common::UString getMapNote() const
Return the waypoint&#39;s map note text.
Definition: waypoint.cpp:70
Waypoint(const Aurora::GFF3Struct &waypoint)
Load from a waypoint instance.
Definition: waypoint.cpp:39