Changed the way to know if a GameObject is some type.

This commit is contained in:
spartanj@gmail.com
2011-08-22 19:36:50 -03:00
parent d94d27b5f9
commit 4e70877ef1
14 changed files with 38 additions and 17 deletions

View File

@@ -229,6 +229,15 @@ namespace EE {
typedef unsigned int eeUint;
typedef signed int eeInt;
#if SOPHIST_has_64
typedef SOPHIST_uint64 Uint64;
typedef SOPHIST_int64 Int64;
#else
typedef SOPHIST_uint32 Uint64; // Fallback to a 32 bit int
typedef SOPHIST_int32 Int64; // All the desktop platforms support 64bit ints, so this should not happend.
#warning 64bit ints represented with 32bit ints because the compiler or platform doesnt support it.
#endif
#define EE_PI 3.14159265358979323846
#define EE_PI2 6.28318530717958647692
const eeFloat EE_PI_180 = EE_PI / 180;

View File

@@ -17,14 +17,6 @@ bool cGameObject::IsType( const Uint32& type ) {
return type == Type();
}
bool cGameObject::InheritsFrom( const Uint32& Type ) {
return false;
}
bool cGameObject::IsTypeOrInheritsFrom( const Uint32& Type ) {
return IsType( Type ) || InheritsFrom( Type );
}
const Uint32& cGameObject::Flags() const {
return mFlags;
}

View File

@@ -32,11 +32,7 @@ class EE_API cGameObject {
virtual Uint32 Type() const;
bool IsType( const Uint32& type );
virtual bool InheritsFrom( const Uint32& Type );
bool IsTypeOrInheritsFrom( const Uint32& Type );
virtual bool IsType( const Uint32& type );
const Uint32& Flags() const;

View File

@@ -21,6 +21,10 @@ Uint32 cGameObjectShape::Type() const {
return GAMEOBJECT_TYPE_SHAPE;
}
bool cGameObjectShape::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
}
void cGameObjectShape::Draw() {
if ( NULL != mShape ) {
if ( mLayer->Map()->LightsEnabled() && mLayer->LightsEnabled() ) {

View File

@@ -33,6 +33,8 @@ class EE_API cGameObjectShape : public cGameObject {
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type );
virtual Uint32 DataId();
virtual void DataId( Uint32 Id );

View File

@@ -27,6 +27,10 @@ Uint32 cGameObjectShapeEx::Type() const {
return GAMEOBJECT_TYPE_SHAPEEX;
}
bool cGameObjectShapeEx::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObjectShape::IsType( type );
}
void cGameObjectShapeEx::Draw() {
if ( NULL != mShape ) {
if ( mLayer->Map()->LightsEnabled() && mLayer->LightsEnabled() ) {

View File

@@ -16,6 +16,8 @@ class EE_API cGameObjectShapeEx : public cGameObjectShape {
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type );
virtual void FlagSet( const Uint32& Flag );
protected:
EE_PRE_BLEND_FUNC mBlend;

View File

@@ -23,6 +23,10 @@ Uint32 cGameObjectSprite::Type() const {
return GAMEOBJECT_TYPE_SPRITE;
}
bool cGameObjectSprite::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
}
void cGameObjectSprite::Draw() {
if ( NULL != mSprite ) {
mSprite->Angle( GetAngle() );

View File

@@ -33,6 +33,8 @@ class EE_API cGameObjectSprite : public cGameObject {
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type );
virtual void FlagSet( const Uint32& Flag );
virtual Uint32 DataId();

View File

@@ -37,6 +37,10 @@ Uint32 cGameObjectVirtual::Type() const {
return GAMEOBJECT_TYPE_VIRTUAL;
}
bool cGameObjectVirtual::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
}
Uint32 cGameObjectVirtual::RealType() const {
return mType;
}

View File

@@ -28,6 +28,8 @@ class EE_API cGameObjectVirtual : public cGameObject {
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type );
virtual Uint32 RealType() const;
virtual Uint32 DataId();

View File

@@ -1209,7 +1209,7 @@ cGameObject * cMap::IsTypeInTilePos( const Uint32& Type, const eeVector2i& TileP
cGameObject * tObj = NULL;
if ( ( tObj = tLayer->GetGameObject( TilePos ) ) ) {
if ( tObj->Type() == Type ) {
if ( tObj->IsType( Type ) ) {
return tObj;
}
}

View File

@@ -4,7 +4,7 @@ namespace EE { namespace UI {
cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) :
cUIWindow( Params ),
mType( Params.Type )
mMsgBoxType( Params.Type )
{
cUIPushButton::CreateParams ButtonParams;
ButtonParams.Parent( Container() );
@@ -31,7 +31,7 @@ cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) :
mTextBox->Text( Params.Message );
switch ( mType ) {
switch ( mMsgBoxType ) {
case MSGBOX_OKCANCEL:
{
mButtonOK->Text( "OK" );

View File

@@ -37,7 +37,7 @@ class EE_API cUIMessageBox : public cUIWindow {
cUIPushButton * ButtonCancel() const;
protected:
UI_MSGBOX_TYPE mType;
UI_MSGBOX_TYPE mMsgBoxType;
cUITextBox * mTextBox;
cUIPushButton * mButtonOK;
cUIPushButton * mButtonCancel;