Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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)) {