[colobot] 48/100: Fix aliens being selectable by default (#900)
Didier Raboud
odyx at moszumanska.debian.org
Thu Jun 1 18:10:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 7fadf7bad54b2c5211d057cc7edb61e12e8045e8
Author: krzys-h <krzys_h at interia.pl>
Date: Sat Jan 28 12:53:28 2017 +0100
Fix aliens being selectable by default (#900)
Broken in 6a382830a95a36a2e643193729433ddba266c420
This change also allows you to make selectable insects with selectable=1 in scene file
---
src/object/old_object.cpp | 16 +++++++++++++++-
src/object/old_object.h | 6 ++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp
index 1f2f6e2..c7200c8 100644
--- a/src/object/old_object.cpp
+++ b/src/object/old_object.cpp
@@ -1041,7 +1041,7 @@ void COldObject::Read(CLevelParserLine* line)
SetAnimateOnReset(line->GetParam("reset")->AsBool(false));
if (Implements(ObjectInterfaceType::Controllable))
{
- SetSelectable(line->GetParam("selectable")->AsBool(true));
+ SetSelectable(line->GetParam("selectable")->AsBool(IsSelectableByDefault(m_type)));
}
if (Implements(ObjectInterfaceType::JetFlying))
{
@@ -3174,3 +3174,17 @@ float COldObject::GetLightningHitProbability()
}
return 0.0f;
}
+
+bool COldObject::IsSelectableByDefault(ObjectType type)
+{
+ if ( type == OBJECT_MOTHER ||
+ type == OBJECT_ANT ||
+ type == OBJECT_SPIDER ||
+ type == OBJECT_BEE ||
+ type == OBJECT_WORM ||
+ type == OBJECT_MOBILEtg )
+ {
+ return false;
+ }
+ return true;
+}
diff --git a/src/object/old_object.h b/src/object/old_object.h
index 5b85c28..ff96fcf 100644
--- a/src/object/old_object.h
+++ b/src/object/old_object.h
@@ -302,6 +302,12 @@ protected:
void TransformCrashSphere(Math::Sphere &crashSphere) override;
void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override;
+ /**
+ * \brief Check if given object type should be selectable by default
+ * \note This is a default value for the selectable= parameter and can still be overriden in the scene file or using the \a selectinsect cheat
+ */
+ static bool IsSelectableByDefault(ObjectType type);
+
protected:
Gfx::CEngine* m_engine;
Gfx::CLightManager* m_lightMan;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list