Changeset 10074 for code/branches/pickupsFS14/src/modules/jump/JumpScore.cc
- Timestamp:
- May 22, 2014, 3:05:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpScore.cc
r10050 r10074 55 55 RegisterObject(JumpScore); 56 56 57 this->owner_ = NULL; 58 57 owner_ = NULL; 58 showScore_ = false; 59 showMessages_ = false; 59 60 } 60 61 … … 75 76 { 76 77 SUPER(JumpScore, XMLPort, xmlelement, mode); 78 79 XMLPortParam(JumpScore, "showScore", setShowScore, getShowScore, xmlelement, mode); 80 XMLPortParam(JumpScore, "showMessages", setShowMessages, getShowMessages, xmlelement, mode); 81 XMLPortParam(JumpScore, "gameOverText", setGameOverText, getGameOverText, xmlelement, mode); 77 82 } 78 83 … … 92 97 if (this->owner_ != NULL) 93 98 { 94 /*95 if (!this->owner_->hasEnded())96 {97 // Get the two players.98 player1_ = this->owner_->getPlayer();99 }100 101 std::string name1;102 103 std::string score1("0");104 105 // Save the name and score of each player as a string.106 if (player1_ != NULL)107 {108 name1 = player1_->getName();109 score1 = multi_cast<std::string>(this->owner_->getScore(player1_));110 }111 112 // Assemble the strings, depending on what should all be displayed.113 std::string output1;114 if (this->bShowLeftPlayer_)115 {116 if (this->bShowName_ && this->bShowScore_ && player1_ != NULL)117 output1 = name1 + " - " + score1;118 else if (this->bShowScore_)119 output1 = score1;120 else if (this->bShowName_)121 output1 = name1;122 }123 124 std::string output("JUMP");125 if (this->bShowName_ || this->bShowScore_)126 {127 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)128 output = output1 + ':' + output2;129 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)130 output = output1 + output2;131 }132 133 this->setCaption(output);*/134 135 136 137 138 99 if (!owner_->hasEnded()) 139 100 { … … 142 103 if (player_ != NULL) 143 104 { 144 int score = owner_->getScore(player_); 105 if (showScore_ == true) 106 { 107 int score = owner_->getScore(player_); 145 108 146 std::string str = multi_cast<std::string>(score); 147 setCaption(str); 109 std::string str = multi_cast<std::string>(score); 110 setCaption(str); 111 } 112 else if (showMessages_ == true) 113 { 114 115 setCaption(owner_->getDead(player_) == true ? gameOverText_ : ""); 116 } 148 117 } 149 118 }
Note: See TracChangeset
for help on using the changeset viewer.