Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F133446
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/rounddice.cpp b/rounddice.cpp
index 692d622..f1cd7d7 100644
--- a/rounddice.cpp
+++ b/rounddice.cpp
@@ -1,76 +1,76 @@
#include "rounddice.h"
RoundDice::RoundDice(PlayerHud (&players)[4])
{
playersHud = players;
diceResult = 1;
diceResultSix = 6;
diceSize = 150;
if (!sfxDiceBuffer.loadFromFile("assets/audio/dice.ogg"))
std::exit(1);
if (!textureDices.loadFromFile("assets/img/dicesWhite.png"))
std::exit(1);
spriteDice.setTexture(textureDices);
sfxDice.setBuffer(sfxDiceBuffer);
sfxDice.setVolume(12);
spriteDice.setPosition(1140,550);
setDiceTexture();
}
void RoundDice::setDiceTexture(){
sf::IntRect diceRect(diceSize*diceResultSix, 0, diceSize, diceSize);
spriteDice.setTextureRect(diceRect);
}
void RoundDice::setColor(int playerNumber){
sf::Color color(efc::playersColors[playerNumber]);
spriteDice.setColor(color);
}
void RoundDice::setDiceTexture(int diceResult){
this->diceResultSix = diceResult;
setDiceTexture();
}
std::string RoundDice::drawRound(){
throwDice();
if (diceResult<33)
{
return "end_of_round_extra_grow";
} else if (diceResult<66)
{
return "end_of_round_extra_energy";
} else
{
eventExtraCash();
return "end_of_round_extra_cash";
}
return "end_of_round_"+std::to_string(diceResult);
}
int RoundDice::throwDice(){
sfxDice.play();
- int result = random()%100;
+ int result = rand()%100;
diceResult = result;
return result;
}
int RoundDice::throwDiceSix(){
sfxDice.play();
- int result = random()%6;
+ int result = rand()%6;
diceResultSix = result;
setDiceTexture();
return result+1;
}
void RoundDice::eventExtraCash(){
// for (int i=0;i<4;i++)
// {
// playersHud[i].cash += 20;
// playersHud[i].updateTxt();
// }
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jun 16, 1:50 AM (2 w, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71233
Default Alt Text
(1 KB)
Attached To
Mode
R82 deerportal
Attached
Detach File
Event Timeline