summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-10 19:23:25 +0000
committersmatz <smatz@openttd.org>2009-06-10 19:23:25 +0000
commit83e2df5b724f5ca9daa49990c5baf192d0ccef96 (patch)
tree2fd8af8cc67eff87954d9a30b6551da24dfe4957
parent35635c62482bb7955d3f3633b5e22712a2039ce7 (diff)
downloadopenttd-83e2df5b724f5ca9daa49990c5baf192d0ccef96.tar.xz
(svn r16556) -Codechange [NoAI]: use accessor for AIInstance::is_dead
-rw-r--r--src/ai/ai_instance.cpp4
-rw-r--r--src/ai/ai_instance.hpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index 2edb7db42..6d264abea 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -272,7 +272,7 @@ void AIInstance::Died()
void AIInstance::GameLoop()
{
- if (this->is_dead) return;
+ if (this->IsDead()) return;
if (this->engine->HasScriptCrashed()) {
/* The script crashed during saving, kill it here. */
this->Died();
@@ -338,7 +338,7 @@ void AIInstance::GameLoop()
void AIInstance::CollectGarbage()
{
- if (this->is_started && !this->is_dead) this->engine->CollectGarbage();
+ if (this->is_started && !this->IsDead()) this->engine->CollectGarbage();
}
/* static */ void AIInstance::DoCommandReturn(AIInstance *instance)
diff --git a/src/ai/ai_instance.hpp b/src/ai/ai_instance.hpp
index 3ae3aa152..2730e9bd9 100644
--- a/src/ai/ai_instance.hpp
+++ b/src/ai/ai_instance.hpp
@@ -81,6 +81,11 @@ public:
class AIController *GetController() { return controller; }
/**
+ * Return the "this AI died" value
+ */
+ inline bool IsDead() { return this->is_dead; }
+
+ /**
* Call the AI Save function and save all data in the savegame.
*/
void Save();