Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2019, 3:29:29 PM (5 years ago)
Author:
ahuwyler
Message:

fuer de jerome

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxScore.cc

    r12266 r12359  
    3535
    3636#include "core/CoreIncludes.h"
    37 #include "core/XMLPort.h"
    3837#include "util/Convert.h"
    3938
     
    4140
    4241#include "OrxoBlox.h"
    43 #include "sound/WorldSound.h" /////////////////////////////
    4442
    4543namespace orxonox
     
    5654
    5755        this->owner_ = nullptr;
    58 
    59         this->bShowName_ = true;
    60         this->bShowScore_ = true;
    61         this->bShowPlayer_ = true;
    62     }
     56        this->player_ = nullptr;
    6357
    6458    /**
     
    7064    }
    7165
    72     /**
    73     @brief
    74         Method to create a OrxoBloxScore through XML.
    75     */
    76     void OrxoBloxScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    77     {
    78         SUPER(OrxoBloxScore, XMLPort, xmlelement, mode);
    79 
    80         XMLPortParam(OrxoBloxScore, "showname",        setShowName,        getShowName,        xmlelement, mode).defaultValues(false);
    81         XMLPortParam(OrxoBloxScore, "showscore",       setShowScore,       getShowScore,       xmlelement, mode).defaultValues(false);
    82         XMLPortParam(OrxoBloxScore, "showplayer",  setShowPlayer,  getShowPlayer,  xmlelement, mode).defaultValues(false);
    83     }
    84 
     66   
    8567    /**
    8668    @brief
     
    9779        if (this->owner_ != nullptr)
    9880        {
    99             if (!this->owner_->hasEnded())
     81            std::string score("0");
     82            if(!this->owner_->hasEnded())
    10083            {
    101                 // Get the player.
    102                 //Fehlermeldung
    103                 //player1_ = this->owner_->getPlayer();
     84                //get the player
     85                player_ = this->owner_->getPlayer();
    10486            }
    10587
    106             std::string name1;
    107 
    108             std::string score1("0");
    109 
    110             // Save the name and score of each player as a string.
    111             if (player1_ != nullptr)
     88            if(this->owner_->hasStarted())
    11289            {
    113                 name1 = player1_->getName();
    114                 score1 = multi_cast<std::string>(this->owner_->getScore(player1_));
     90                // Save the name and score of each player as a string.
     91                if (player_ != nullptr)
     92                    score = multi_cast<std::string>(this->owner_->getScore(player_));
    11593            }
    116 
    117             // Assemble the strings, depending on what should all be displayed.
    118             std::string output1;
    119             if (this->bShowPlayer_)
    120             {
    121                 if (this->bShowName_ && this->bShowScore_ && player1_ != nullptr)
    122                     output1 = name1 + " - " + score1;
    123                 else if (this->bShowScore_)
    124                     output1 = score1;
    125                 else if (this->bShowName_)
    126                     output1 = name1;
    127             }
    128 
    129             std::string output("OrxoBlox");
    130             /* Keine Ahnung wofuer das gut ist.
    131 
    132             if (this->bShowName_ || this->bShowScore_)
    133             {
    134                 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
    135                     output = output1 + ':' + output2;
    136                 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
    137                     output = output1 + output2;
    138             }*/
    139 
    140             this->setCaption(output);
     94            this->setCaption(score);
    14195        }
    14296    }
Note: See TracChangeset for help on using the changeset viewer.