From 580c5899b09ffd526a71c59e7e88f1f03a95db3f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 31 Oct 2003 03:54:46 +0000 Subject: [PATCH] Add AutoActor::IsLoaded. Don't dereference an unloaded AutoActor. Add const accessors. --- stepmania/src/ActorUtil.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stepmania/src/ActorUtil.h b/stepmania/src/ActorUtil.h index d8b70603b2..e2a115355b 100644 --- a/stepmania/src/ActorUtil.h +++ b/stepmania/src/ActorUtil.h @@ -54,9 +54,12 @@ class AutoActor public: AutoActor() { m_pActor = NULL; } ~AutoActor() { Unload(); } - operator Actor* () { return m_pActor; } - Actor *operator->() { return m_pActor; } + operator const Actor* () const { ASSERT(m_pActor); return m_pActor; } + operator Actor* () { ASSERT(m_pActor); return m_pActor; } + const Actor *operator->() const { ASSERT(m_pActor); return m_pActor; } + Actor *operator->() { ASSERT(m_pActor); return m_pActor; } void Unload() { if(m_pActor) { delete m_pActor; m_pActor=NULL; } } + bool IsLoaded() const { return m_pActor != NULL; } void Load( CString sPath ) { Unload();