From b460b3193e54b7364bb75ff26ce6f999887e454b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 12 Nov 2010 16:24:17 +0000 Subject: moved global entity info type to core::Entity::infotype(), automatic generation of jumppoint and jumpgate names and descriptions, prepared game code for the seperation of Entity::radius() and Model::radius() --- src/game/base/jumppoint.cc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/game/base/jumppoint.cc') diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc index 82ed489..8af39b0 100644 --- a/src/game/base/jumppoint.cc +++ b/src/game/base/jumppoint.cc @@ -71,9 +71,22 @@ void JumpPoint::validate() } jumppoint_target = static_cast(targetentity); + + // overwrite name and info, remove the "system" part from the name + std::string name("Jumppoint " + 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); + + if (!info()) { + set_info(new core::Info(core::Entity::infotype(), label().c_str())); + } + info()->clear_text(); + info()->add_text("Jumppoint to the " + target()->zone()->name()); + - con_debug << " jumppoint to " << targetzone->label() << std::endl; - //con_debug << " Jumppoint " << zone->label() << ":" << label() << " with target " << targetlabel() << std::endl; + con_debug << " " << label() << " jumppoint to " << target()->zone()->label() << ":" << target()->label() << std::endl; } /* ---- class JumpGate --------------------------------------------- */ @@ -97,6 +110,18 @@ 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); + + info()->clear_text(); + info()->add_text("Jumpgate to the " + target()->zone()->name()); + if (target()) { set_flag(core::Entity::Dockable); } else { -- cgit v1.2.3