diff options
author | Stijn Buys <ingar@osirion.org> | 2011-03-30 13:34:16 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-03-30 13:34:16 +0000 |
commit | 0936e6722a8a651a85343d42fa2fb802cfc567ef (patch) | |
tree | 8248680add89636e6c47040c03c77ff4b023c897 /src/game/base | |
parent | 6c2075993d68dbacf011756508f957cea1bde845 (diff) |
Corrected a segfault in Jumpgate::validate() if it had an invalid destination.
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/jumppoint.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc index 1f2c0a9..80c99ef 100644 --- a/src/game/base/jumppoint.cc +++ b/src/game/base/jumppoint.cc @@ -125,23 +125,30 @@ JumpGate::~JumpGate() void JumpGate::validate() { JumpPoint::validate(); - - // overwrite name and info - // overwrite name and info, remove the "system" part from the name - std::string name("Jumpgate " + zone()->name() + " -> " + target()->zone()->name()); - for (size_t pos = name.find(" system"); pos != std::string::npos; pos = name.find(" system")) { - name.erase(pos, 7); - } - set_name(name); - - core::Info *entity_info = core::Info::find(info()); - entity_info->clear_text(); - entity_info->add_text("Jumpgate to the " + target()->zone()->name()); if (target()) { set_flag(core::Entity::Dockable); + + // overwrite name and info + // overwrite name and info, remove the "system" part from the name + std::string name("Jumpgate " + zone()->name() + " -> " + target()->zone()->name()); + for (size_t pos = name.find(" system"); pos != std::string::npos; pos = name.find(" system")) { + name.erase(pos, 7); + } + set_name(name); + + core::Info *entity_info = core::Info::find(info()); + entity_info->clear_text(); + + // FIXME if 'system' was erased from the name, 'the' should not appear in the info text + // e.g. Jumpgate to Kor Telos + entity_info->add_text("Jumpgate to the " + target()->zone()->name()); + } else { unset_flag(core::Entity::Dockable); + + std::string name("Inactive Jumpgate"); + set_name(name); } } |