Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2194 in orxonox.OLD for orxonox/branches/chris/src/player.cc


Ignore:
Timestamp:
Jul 18, 2004, 12:03:57 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: Implemented is_a() query for WorldEntities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/player.cc

    r2192 r2194  
    2222using namespace std;
    2323
     24// initialize the pointers used for is_a identification
     25bool (*Player::basefunc)(char*) = WorldEntity::is_a;
     26char *Player::is = "Player";
    2427
    2528Player::Player(bool isFree) : WorldEntity(isFree)
     
    8891        glEnd();
    8992       
     93        printf("Player is a Player: %d\n", is_a("Player"));
     94        printf("Player is a WorldEntity: %d\n", is_a("WorldEntity"));
     95        printf("Player is a Banana: %d\n", is_a("Banana"));
    9096        printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);
    9197}
     
    128134}
    129135
    130 
    131 
    132 
    133 
    134 
    135 
    136 
    137 
    138 
    139 
    140 
    141 
    142 
    143 
    144 
    145 
    146 
     136bool Player::is_a(char* name)
     137{
     138        if( !strcmp( name, is)) return true;
     139        else return basefunc (name);
     140}
Note: See TracChangeset for help on using the changeset viewer.