diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-12 00:14:38 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-12 00:14:38 -0500 |
commit | 19be2ac58b09c5240a32e6a4f41cd9f6cda03d07 (patch) | |
tree | 2899673572cdb25645f425c733c57bb9c719d5b7 /src/message_system.cpp | |
parent | 81d1afa871c947ec6ba44e11cd6041fe16ed5756 (diff) | |
download | tanetane-19be2ac58b09c5240a32e6a4f41cd9f6cda03d07.tar.gz tanetane-19be2ac58b09c5240a32e6a4f41cd9f6cda03d07.tar.bz2 tanetane-19be2ac58b09c5240a32e6a4f41cd9f6cda03d07.zip |
Added message bullets
Diffstat (limited to 'src/message_system.cpp')
-rw-r--r-- | src/message_system.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/message_system.cpp b/src/message_system.cpp index a969427..98b5f83 100644 --- a/src/message_system.cpp +++ b/src/message_system.cpp | |||
@@ -124,6 +124,12 @@ void MessageSystem::displayMessage(std::string_view msg, std::string speakerName | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | bool bulleted = false; | ||
128 | if (text.substr(0, 2) == "* ") { | ||
129 | text.erase(0, 2); | ||
130 | bulleted = true; | ||
131 | } | ||
132 | |||
127 | auto words = splitStr<std::list<std::string>>(text, " "); | 133 | auto words = splitStr<std::list<std::string>>(text, " "); |
128 | 134 | ||
129 | std::string curLine; | 135 | std::string curLine; |
@@ -145,9 +151,10 @@ void MessageSystem::displayMessage(std::string_view msg, std::string speakerName | |||
145 | } | 151 | } |
146 | 152 | ||
147 | if (nextWidth > MESSAGE_TEXT_WIDTH) { | 153 | if (nextWidth > MESSAGE_TEXT_WIDTH) { |
148 | lines_.push_back({.text = curLine}); | 154 | lines_.push_back({.text = curLine, .bulleted = bulleted}); |
149 | curLine = word; | 155 | curLine = word; |
150 | curWidth = wordWidth + game_.getFont().getCharacterWidth(' '); | 156 | curWidth = wordWidth + game_.getFont().getCharacterWidth(' '); |
157 | bulleted = false; | ||
151 | 158 | ||
152 | if (shouldAddBlank) { | 159 | if (shouldAddBlank) { |
153 | shouldAddBlank = false; | 160 | shouldAddBlank = false; |
@@ -166,7 +173,7 @@ void MessageSystem::displayMessage(std::string_view msg, std::string speakerName | |||
166 | firstWord = false; | 173 | firstWord = false; |
167 | } | 174 | } |
168 | 175 | ||
169 | lines_.push_back({.text = curLine}); | 176 | lines_.push_back({.text = curLine, .bulleted = bulleted}); |
170 | 177 | ||
171 | if (shouldAddBlank) { | 178 | if (shouldAddBlank) { |
172 | shouldAddBlank = false; | 179 | shouldAddBlank = false; |