Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:58:47 AM (15 years ago)
Author:
dafrick
Message:

Reverted to revision 2906 (because I'm too stupid to merge correctly, 2nd try will follow shortly. ;))

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.cc

    r2907 r2908  
    3030#include "HumanPlayer.h"
    3131
    32 #include "core/GameMode.h"
     32#include "core/Core.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/ConfigValueIncludes.h"
     
    4747        RegisterObject(HumanPlayer);
    4848
    49         this->server_initialized_ = GameMode::isMaster();
     49        this->server_initialized_ = Core::isMaster();
    5050        this->client_initialized_ = false;
    5151
    5252        this->bHumanPlayer_ = true;
    5353        this->defaultController_ = Class(HumanController);
    54 
    55         this->humanHud_ = 0;
    56         this->gametypeHud_ = 0;
    5754
    5855        this->setConfigValues();
     
    6259    HumanPlayer::~HumanPlayer()
    6360    {
    64         if (this->BaseObject::isInitialized())
    65         {
    66             if (this->humanHud_)
    67                 delete this->humanHud_;
    68 
    69             if (this->gametypeHud_)
    70                 delete this->gametypeHud_;
    71         }
    7261    }
    7362
     
    9382            this->synchronize_nick_ = this->nick_;
    9483
    95             if (GameMode::isMaster())
     84            if (Core::isMaster())
    9685                this->setName(this->nick_);
    9786        }
     
    10089    void HumanPlayer::configvaluecallback_changedHUDTemplate()
    10190    {
    102         this->setHumanHUDTemplate(this->hudtemplate_);
     91        this->changedController();
    10392    }
    10493
     
    116105            this->client_initialized_ = true;
    117106
    118             if (!GameMode::isMaster())
     107            if (!Core::isMaster())
    119108                this->setObjectMode(objectDirection::bidirectional);
    120109            else
     
    122111
    123112            this->createController();
    124             this->updateHumanHUD();
    125113        }
    126114    }
     
    158146    }
    159147
    160     void HumanPlayer::changedGametype()
     148    void HumanPlayer::changedController()
    161149    {
    162         PlayerInfo::changedGametype();
     150        if (this->getController())
     151        {
     152            this->getController()->setHUDTemplate(this->hudtemplate_);
    163153
    164         if (this->isInitialized() && this->isLocalPlayer())
    165             if (this->getGametype()->getHUDTemplate() != "")
    166                 this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
    167     }
    168 
    169     void HumanPlayer::changedControllableEntity()
    170     {
    171         PlayerInfo::changedControllableEntity();
    172 
    173         if (this->humanHud_)
    174             this->humanHud_->setOwner(this->getControllableEntity());
    175     }
    176 
    177     void HumanPlayer::updateHumanHUD()
    178     {
    179         if (this->humanHud_)
    180         {
    181             delete this->humanHud_;
    182             this->humanHud_ = 0;
    183         }
    184 
    185         if (this->isLocalPlayer() && this->humanHudTemplate_ != "")
    186         {
    187             this->humanHud_ = new OverlayGroup(this);
    188             this->humanHud_->addTemplate(this->humanHudTemplate_);
    189             this->humanHud_->setOwner(this->getControllableEntity());
    190         }
    191     }
    192 
    193     void HumanPlayer::updateGametypeHUD()
    194     {
    195         if (this->gametypeHud_)
    196         {
    197             delete this->gametypeHud_;
    198             this->gametypeHud_ = 0;
    199         }
    200 
    201         if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "")
    202         {
    203             this->gametypeHud_ = new OverlayGroup(this);
    204             this->gametypeHud_->addTemplate(this->gametypeHudTemplate_);
    205             this->gametypeHud_->setOwner(this->getGametype());
     154            if (this->getController() && this->getController()->getHUD())
     155                this->getController()->getHUD()->setOwner(this->getControllableEntity());
    206156        }
    207157    }
Note: See TracChangeset for help on using the changeset viewer.