Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-05 19:04:47 +0000
committerStijn Buys <ingar@osirion.org>2013-11-05 19:04:47 +0000
commiteb7873a10d1827df6317065be71d18de69047fdd (patch)
treef81b6b13897207ab0a925c92eedeebeadd4a9703 /src/core
parentb123eb709355b94a7c25ec1ec12ff7a428f7c186 (diff)
Support the 'infoname' key in zone ini files.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/parser.cc38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/core/parser.cc b/src/core/parser.cc
index ab280e4..a260c19 100644
--- a/src/core/parser.cc
+++ b/src/core/parser.cc
@@ -13,7 +13,25 @@
namespace core
{
-bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
+Info *get_entity_info(Entity *entity)
+{
+ Info *info = Info::find(entity->info());
+
+ if (!info) {
+ std::string labelstr;
+ if (entity->zone()) {
+ labelstr.append(entity->zone()->label());
+ labelstr += ':';
+ }
+ labelstr.append(entity->label());
+ info = new Info(Entity::infotype(), labelstr.c_str());
+ entity->set_info(info);
+ }
+
+ return info;
+}
+
+bool Parser::got_entity_key(filesystem::IniFile &inifile, Entity *entity)
{
if (!entity)
return false;
@@ -50,20 +68,14 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
} else if (inifile.got_key_string("info", strval)) {
- Info *info = Info::find(entity->info());
- if (!info) {
- std::string labelstr;
- if (entity->zone()) {
- labelstr.append(entity->zone()->label());
- labelstr += ':';
- }
- labelstr.append(entity->label());
- info = new Info(Entity::infotype(), labelstr.c_str());
- entity->set_info(info);
- }
-
+ Info *info = get_entity_info(entity);
info->add_text(strval);
+ return true;
+
+ } else if (inifile.got_key_string("infoname", strval)) {
+ Info *info = get_entity_info(entity);
+ info->set_name(strval);
return true;
} else if (inifile.got_key_label("label", strval)) {