1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See https://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef __MAP_DIALOGUE_OPTIONS_HEADER__
12 #define __MAP_DIALOGUE_OPTIONS_HEADER__
13 
14 #include "common/dialogue.h"
15 
16 namespace vt_map
17 {
18 
19 namespace private_map
20 {
21 
22 /** ***************************************************************************************
23 *** \brief A container class for option sets presented during a map dialogue
24 ***
25 *** When the player reads a dialogue, they may be presented with a small number of options to
26 *** select from when coming to a particular line. The selected option determines the next line
27 *** that will follow. Optionally, each particular option may trigger a different map event when
28 *** it is selected.
29 *** **************************************************************************************/
30 class MapDialogueOptions : public vt_common::DialogueOptions
31 {
32 public:
MapDialogueOptions()33     MapDialogueOptions()
34     {}
35 
~MapDialogueOptions()36     virtual ~MapDialogueOptions() override
37     {}
38 
39     /** \brief Adds a new option to the set of options
40     *** \param text The text for the new option
41     ***
42     *** The following option properties are set when using this call:
43     *** - proceed to next sequential line, no event
44     **/
45     void AddOption(const std::string &text) override;
46 
47     /** \brief Adds a new option to the set of options
48     *** \param text The text for the new option
49     *** \param next_line An integer index of the next line of dialogue should this option be selected.
50     ***
51     *** The following option properties are set when using this call:
52     *** - no event
53     **/
54     void AddOption(const std::string &text, int32_t next_line) override;
55 
56     /** \brief Adds a new option to the set of options with the addition of a map event to be executed
57     *** \param text The text for the new option
58     *** \param event_id The ID of the event to execute should this option be selected
59     ***
60     *** The following option properties are set when using this call:
61     *** - proceed to next sequential line
62     **/
63     void AddOptionEvent(const std::string &text, const std::string &event_id);
64 
65     /** \brief Adds a new option to the set of options with the addition of a map event to be executed
66     *** \param text The text for the new option
67     *** \param next_line An integer index of the next line of dialogue should this option be selected.
68     *** \param event_id The ID of the event to execute should this option be selected
69     **/
70     void AddOptionEvent(const std::string &text, int32_t next_line, const std::string &event_id);
71 
72     //! \name Methods for retrieving properties of a specific line
73     std::string GetOptionEvent(uint32_t option) const;
74 
75     //! \brief Returns the number of options stored by this class
GetNumberOptions()76     uint32_t GetNumberOptions() const {
77         return _text.size();
78     }
79 
80 private:
81     //! \brief An optional MapEvent that may occur as a result of selecting each option
82     std::vector<std::string> _events;
83 };
84 
85 } // namespace private_map
86 
87 } // namespace vt_map
88 
89 #endif // __MAP_DIALOGUE_OPTIONS_HEADER__
90