Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-03-30 13:34:16 +0000
committerStijn Buys <ingar@osirion.org>2011-03-30 13:34:16 +0000
commit0936e6722a8a651a85343d42fa2fb802cfc567ef (patch)
tree8248680add89636e6c47040c03c77ff4b023c897 /src/game/base
parent6c2075993d68dbacf011756508f957cea1bde845 (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.cc31
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);
}
}