Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7338 in orxonox.OLD for trunk/src/world_entities/playable.cc


Ignore:
Timestamp:
Apr 19, 2006, 1:25:07 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: some Playable-stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/playable.cc

    r7337 r7338  
    3939
    4040Playable::Playable()
    41   : weaponMan(this)
     41    : weaponMan(this),
     42    supportedPlaymodes(Playable::Full3D),
     43    playmode(Playable::Full3D)
    4244{
    4345  this->setClassID(CL_PLAYABLE, "Playable");
     
    9092  this->weaponMan.removeWeapon(weapon);
    9193
    92     this->weaponConfigChanged();
     94  this->weaponConfigChanged();
    9395}
    9496
     
    9799{
    98100  this->weaponMan.nextWeaponConfig();
    99     this->weaponConfigChanged();
     101  this->weaponConfigChanged();
    100102}
    101103
     
    104106{
    105107  this->weaponMan.previousWeaponConfig();
    106     this->weaponConfigChanged();
     108  this->weaponConfigChanged();
    107109}
    108110
     
    119121 */
    120122void Playable::setCameraMode(unsigned int cameraMode)
    121 {
    122 
     123{}
     124
     125/**
     126 * @brief sets the Playmode
     127 * @param playmode the Playmode
     128 * @returns true on success, false otherwise
     129 */
     130bool Playable::setPlayMode(Playable::Playmode playmode)
     131{
     132  if (!this->playmodeSupported(playmode))
     133    return false;
     134  else
     135    this->playmode = playmode;
    123136}
    124137
     
    155168  if( this->getOwner() % 2 == 0)
    156169  {
    157 //     this->toList(OM_GROUP_00);
     170    //     this->toList(OM_GROUP_00);
    158171    this->setAbsCoor(213.37, 57.71, -47.98);
    159172    this->setAbsDir(0, 0, 1, 0);
     
    161174  else
    162175  { // red team
    163 //     this->toList(OM_GROUP_01);
     176    //     this->toList(OM_GROUP_01);
    164177    this->setAbsCoor(-314.450, 40.701, 83.554);
    165178    this->setAbsDir(1.0, -0.015, -0.012, 0.011);
     
    179192  {
    180193    PRINTF(0)("Playable dies\n");
    181   // only if this is the spaceship of the player
     194    // only if this is the spaceship of the player
    182195    if (State::isOnline())
    183196    {
     
    185198        State::getGameRules()->onPlayerDeath();
    186199
    187 //     this->toList(OM_GROUP_05);
    188   //HACK: moves the entity to an unknown place far far away: in the future, GameRules will look for that
     200      //     this->toList(OM_GROUP_05);
     201      //HACK: moves the entity to an unknown place far far away: in the future, GameRules will look for that
    189202      this->setAbsCoor(-2000.0, -2000.0, -2000.0);
    190203
    191   //explosion hack
     204      //explosion hack
    192205
    193206    }
     
    216229    // unsubscibe all events.
    217230    EventHandler* evh = EventHandler::getInstance();
    218     std::list<int>::iterator ev;
     231    std::vector<int>::iterator ev;
    219232    for (ev = this->events.begin(); ev != events.end(); ev++)
    220233      evh->unsubscribe( ES_GAME, (*ev));
     
    242255    /*EventHandler*/
    243256    EventHandler* evh = EventHandler::getInstance();
    244     std::list<int>::iterator ev;
     257    std::vector<int>::iterator ev;
    245258    for (ev = this->events.begin(); ev != events.end(); ev++)
    246259      evh->subscribe(player, ES_GAME, (*ev));
     
    256269bool Playable::pickup(PowerUp* powerUp)
    257270{
    258   if(powerUp->isA(CL_WEAPON_POWER_UP)) {
     271  if(powerUp->isA(CL_WEAPON_POWER_UP))
     272  {
    259273    return dynamic_cast<WeaponPowerUp*>(powerUp)->process(&this->getWeaponManager());
    260274  }
    261   else if(powerUp->isA(CL_PARAM_POWER_UP)) {
     275  else if(powerUp->isA(CL_PARAM_POWER_UP))
     276  {
    262277    ParamPowerUp* ppu = dynamic_cast<ParamPowerUp*>(powerUp);
    263     switch(ppu->getType()) {
     278    switch(ppu->getType())
     279    {
    264280      case POWERUP_PARAM_HEALTH:
    265281        this->increaseHealth(ppu->getValue());
     
    291307void Playable::unregisterEvent(int eventType)
    292308{
    293   this->events.remove(eventType);
     309  std::vector<int>::iterator rmEvent = std::find(this->events.begin(), this->events.end(), eventType);
     310  this->events.erase(rmEvent);
    294311
    295312  if (this->currentPlayer != NULL)
     
    338355
    339356void  Playable::detachCamera()
    340 {
    341 }
     357{}
    342358
    343359#define DATA_FLAGS    1
Note: See TracChangeset for help on using the changeset viewer.