From 66fd5337bda32d0ef04fff7514a8249ecb5c3b15 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Dec 2012 23:09:12 +0000 Subject: Improved info text parsing, added specifications to the weapon info, expanded ship specifications info. --- src/core/info.cc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/core/info.cc') diff --git a/src/core/info.cc b/src/core/info.cc index dbe4c76..dde1b20 100644 --- a/src/core/info.cc +++ b/src/core/info.cc @@ -146,13 +146,38 @@ void Info::clear_timestamp() info_timestamp = 0; } -void Info::add_text(const char *text) +void Info::add_line(const std::string & text) +{ + add_line(text.c_str()); +} + +void Info::add_line(const char *text) { std::string str(text); aux::strip_quotes(str); info_text.push_back(str); } +void Info::add_text(const char *text) +{ + std::string str(text); + aux::strip_quotes(str); + + if (!info_text.size()) { + info_text.push_back(str); + + } else if (str.size()) { + if ((*info_text.rbegin()).size()) { + (*info_text.rbegin()) += ' '; + (*info_text.rbegin()).append(str); + } else { + info_text.push_back(str); + } + } else { + info_text.push_back(str); + } +} + void Info::add_text(const std::string & text) { add_text(text.c_str()); -- cgit v1.2.3