[Orxonox-commit 6342] r10999 - in code/branches/cpp11_v2/src/modules: jump mini4dgame objects overlays towerdefense
landauf at orxonox.net
landauf at orxonox.net
Wed Dec 30 14:31:14 CET 2015
Author: landauf
Date: 2015-12-30 14:31:14 +0100 (Wed, 30 Dec 2015)
New Revision: 10999
Modified:
code/branches/cpp11_v2/src/modules/jump/Jump.cc
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.h
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.cc
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.h
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.cc
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.h
code/branches/cpp11_v2/src/modules/objects/ForceField.cc
code/branches/cpp11_v2/src/modules/objects/ForceField.h
code/branches/cpp11_v2/src/modules/objects/Script.h
code/branches/cpp11_v2/src/modules/overlays/OverlayText.cc
code/branches/cpp11_v2/src/modules/overlays/OverlayText.h
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.cc
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.h
Log:
using strongly typed enum classes in various modules
Modified: code/branches/cpp11_v2/src/modules/jump/Jump.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/jump/Jump.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/jump/Jump.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -609,14 +609,14 @@
const int numI = 6;
const int numJ = 4;
- enum PlatformType
+ enum class PlatformType
{
- PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE
+ EMPTY, STATIC, HMOVE, VMOVE, DISAPPEAR, TIMER, FAKE
};
- enum ItemType
+ enum class ItemType
{
- ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
+ NOTHING, SPRING, PROPELLER, ROCKET, BOOTS, SHIELD
};
struct PlatformMatrix
@@ -630,33 +630,33 @@
{
for (int j = 0; j < numJ; ++j)
{
- matrix[i][j].type = PLATFORM_EMPTY;
+ matrix[i][j].type = PlatformType::EMPTY;
matrix[i][j].done = false;
}
}
PlatformType platformtype1;
PlatformType platformtype2;
- ItemType itemType = ITEM_NOTHING;
+ ItemType itemType = ItemType::NOTHING;
if (rand()%2 == 0)
{
- itemType = ITEM_SPRING;
+ itemType = ItemType::SPRING;
}
else if (rand()%2 == 0 && sectionNumber_ > 3)
{
switch(rand()%4)
{
case 0:
- itemType = ITEM_PROPELLER;
+ itemType = ItemType::PROPELLER;
break;
case 1:
- itemType = ITEM_ROCKET;
+ itemType = ItemType::ROCKET;
break;
case 2:
- itemType = ITEM_BOOTS;
+ itemType = ItemType::BOOTS;
break;
case 3:
- itemType = ITEM_SHIELD;
+ itemType = ItemType::SHIELD;
break;
default:
break;
@@ -666,124 +666,124 @@
switch((sectionNumber_ > 28) ? rand()%29 : rand()%(sectionNumber_+1))
{
case 0:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::STATIC;
break;
case 1:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::STATIC;
break;
case 2:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::HMOVE;
break;
case 3:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 4:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::VMOVE;
break;
case 5:
- platformtype1 = PLATFORM_STATIC;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::STATIC;
+ platformtype2 = PlatformType::TIMER;
break;
case 6:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::STATIC;
break;
case 7:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::HMOVE;
break;
case 8:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::HMOVE;
break;
case 9:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 10:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::VMOVE;
break;
case 11:
- platformtype1 = PLATFORM_HMOVE;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::HMOVE;
+ platformtype2 = PlatformType::TIMER;
break;
case 12:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::STATIC;
break;
case 13:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::HMOVE;
break;
case 14:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 15:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 16:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::VMOVE;
break;
case 17:
- platformtype1 = PLATFORM_DISAPPEAR;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::DISAPPEAR;
+ platformtype2 = PlatformType::TIMER;
break;
case 18:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::STATIC;
break;
case 19:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::HMOVE;
break;
case 20:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 21:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::VMOVE;
break;
case 22:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::VMOVE;
break;
case 23:
- platformtype1 = PLATFORM_VMOVE;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::VMOVE;
+ platformtype2 = PlatformType::TIMER;
break;
case 24:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_STATIC;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::STATIC;
break;
case 25:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_HMOVE;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::HMOVE;
break;
case 26:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_DISAPPEAR;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::DISAPPEAR;
break;
case 27:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_VMOVE;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::VMOVE;
break;
case 28:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::TIMER;
break;
default:
- platformtype1 = PLATFORM_TIMER;
- platformtype2 = PLATFORM_TIMER;
+ platformtype1 = PlatformType::TIMER;
+ platformtype2 = PlatformType::TIMER;
break;
}
@@ -806,8 +806,8 @@
if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
// Delete some planned platforms or replace them with fake platforms
@@ -815,57 +815,57 @@
{
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
}
else if (sectionNumber_ > 10)
{
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
}
else if (sectionNumber_ > 15)
{
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
if (rand()%2 == 0)
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
}
else
{
- matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
}
}
@@ -888,36 +888,36 @@
switch(matrix[i][j].type)
{
- case PLATFORM_EMPTY:
+ case PlatformType::EMPTY:
matrix[i][j].done = true;
break;
- case PLATFORM_STATIC:
+ case PlatformType::STATIC:
xPosition = randomXPosition(numJ, j);
zPosition = sectionBegin + i*sectionLength/numI;
platformList.push_back(addPlatformStatic(xPosition, zPosition));
matrix[i][j].done = true;
break;
- case PLATFORM_FAKE:
+ case PlatformType::FAKE:
xPosition = randomXPosition(numJ, j);
zPosition = sectionBegin + i*sectionLength/numI;
platformList.push_back(addPlatformFake(xPosition, zPosition));
matrix[i][j].done = true;
break;
- case PLATFORM_TIMER:
+ case PlatformType::TIMER:
xPosition = randomXPosition(numJ, j);
zPosition = sectionBegin + i*sectionLength/numI;
platformList.push_back(addPlatformTimer(xPosition, zPosition, 12.0, 1.5));
matrix[i][j].done = true;
break;
- case PLATFORM_DISAPPEAR:
+ case PlatformType::DISAPPEAR:
xPosition = randomXPosition(numJ, j);
zPosition = sectionBegin + i*sectionLength/numI;
platformList.push_back(addPlatformDisappear(xPosition, zPosition));
matrix[i][j].done = true;
break;
- case PLATFORM_HMOVE:
+ case PlatformType::HMOVE:
xVelocity = randomSpeed();
- if (j <= numJ-3 && matrix[i][j+1].type == PLATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)
+ if (j <= numJ-3 && matrix[i][j+1].type == PlatformType::HMOVE && matrix[i][j+2].type == PlatformType::HMOVE && rand()%2 == 0)
{
leftBoundary = randomXPositionLeft(numJ, j);
rightBoundary = randomXPositionRight(numJ, j+2);
@@ -928,7 +928,7 @@
matrix[i][j+1].done = true;
matrix[i][j+2].done = true;
}
- else if (j <= numJ-2 && matrix[i][j+1].type == PLATFORM_HMOVE && rand()%2 == 0)
+ else if (j <= numJ-2 && matrix[i][j+1].type == PlatformType::HMOVE && rand()%2 == 0)
{
leftBoundary = randomXPositionLeft(numJ, j);
rightBoundary = randomXPositionRight(numJ, j+1);
@@ -948,9 +948,9 @@
matrix[i][j].done = true;
}
break;
- case PLATFORM_VMOVE:
+ case PlatformType::VMOVE:
zVelocity = randomSpeed();
- if (i <= numI-3 && matrix[i+1][j].type == PLATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)
+ if (i <= numI-3 && matrix[i+1][j].type == PlatformType::VMOVE && matrix[i+2][j].type == PlatformType::VMOVE && rand()%2 == 0)
{
lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
upperBoundary = randomZPositionUpper(numI, i+2, sectionBegin, sectionEnd);
@@ -961,7 +961,7 @@
matrix[i+1][j].done = true;
matrix[i+2][j].done = true;
}
- else if (i <= numI-2 && matrix[i+1][j].type == PLATFORM_VMOVE && rand()%2 == 0)
+ else if (i <= numI-2 && matrix[i+1][j].type == PlatformType::VMOVE && rand()%2 == 0)
{
lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
upperBoundary = randomZPositionUpper(numI, i+1, sectionBegin, sectionEnd);
@@ -999,16 +999,16 @@
{
switch (itemType)
{
- case ITEM_ROCKET:
+ case ItemType::ROCKET:
addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
break;
- case ITEM_PROPELLER:
+ case ItemType::PROPELLER:
addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
break;
- case ITEM_BOOTS:
+ case ItemType::BOOTS:
addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
break;
- case ITEM_SHIELD:
+ case ItemType::SHIELD:
addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
break;
default:
@@ -1019,16 +1019,16 @@
{
switch (itemType)
{
- case ITEM_ROCKET:
+ case ItemType::ROCKET:
addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
break;
- case ITEM_PROPELLER:
+ case ItemType::PROPELLER:
addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
break;
- case ITEM_BOOTS:
+ case ItemType::BOOTS:
addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
break;
- case ITEM_SHIELD:
+ case ItemType::SHIELD:
addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
break;
default:
@@ -1044,19 +1044,19 @@
switch (itemType)
{
- case ITEM_SPRING:
+ case ItemType::SPRING:
addSpring(itemPlatform);
break;
- case ITEM_ROCKET:
+ case ItemType::ROCKET:
addRocket(itemPlatform);
break;
- case ITEM_PROPELLER:
+ case ItemType::PROPELLER:
addPropeller(itemPlatform);
break;
- case ITEM_BOOTS:
+ case ItemType::BOOTS:
addBoots(itemPlatform);
break;
- case ITEM_SHIELD:
+ case ItemType::SHIELD:
addShield(itemPlatform);
break;
default:
Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.h
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -40,18 +40,6 @@
namespace orxonox
{
-
- namespace mini4DgamePlayerColor
- {
- enum color
- {
- none,
- red,
- blue,
- green
- };
- }
-
/**
@brief
Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -103,7 +103,7 @@
for(int j=0;j<4;j++){
for(int k=0;k<4;k++){
for(int l=0;l<4;l++){
- if (this->board_[i][j][k][l]==mini4DgamePlayerColor::none)
+ if (this->board_[i][j][k][l]==Mini4DgamePlayerColor::none)
possibleMoves.push_back(Vector4(i,j,k,l));
}
}
Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.h
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameAI.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -87,7 +87,7 @@
std::list<Vector4> getPossibleMoves();
void copyBoard();
- mini4DgamePlayerColor::color board_[4][4][4][4];
+ Mini4DgamePlayerColor board_[4][4][4][4];
};
}
Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -62,7 +62,7 @@
for(int j=0;j<4;j++){
for(int k=0;k<4;k++){
for(int l=0;l<4;l++){
- this->board[i][j][k][l]=mini4DgamePlayerColor::none;
+ this->board[i][j][k][l]=Mini4DgamePlayerColor::none;
this->blinkingBillboards[i][j][k][l] = nullptr;
}
}
@@ -87,14 +87,14 @@
{
return (move.x<4 && move.y<4 && move.z<4 && move.w<4
&& move.x>=0 && move.y>=0 && move.z>=0 && move.w>=0
- && this->board[move.x][move.y][move.z][move.w] == mini4DgamePlayerColor::none);
+ && this->board[move.x][move.y][move.z][move.w] == Mini4DgamePlayerColor::none);
}
void Mini4DgameBoard::undoMove()
{
const Mini4DgamePosition& move = moves.back();
moves.pop_back();
- this->board[move.x][move.y][move.z][move.w] = mini4DgamePlayerColor::none;
+ this->board[move.x][move.y][move.z][move.w] = Mini4DgamePlayerColor::none;
this->blinkingBillboards[move.x][move.y][move.z][move.w]->destroy();
this->blinkingBillboards[move.x][move.y][move.z][move.w] = nullptr;
if(player_toggle_){
@@ -123,16 +123,16 @@
}
moves.push_back(move);
- mini4DgamePlayerColor::color playerColor = mini4DgamePlayerColor::none;
+ Mini4DgamePlayerColor playerColor = Mini4DgamePlayerColor::none;
if(player_toggle_){
- playerColor = mini4DgamePlayerColor::blue;
+ playerColor = Mini4DgamePlayerColor::blue;
this->player_toggle_ = false;
}else{
- playerColor = mini4DgamePlayerColor::green;
+ playerColor = Mini4DgamePlayerColor::green;
this->player_toggle_ = true;
}
- this->board[move.x][move.y][move.z][move.w] = (mini4DgamePlayerColor::color) playerColor;
+ this->board[move.x][move.y][move.z][move.w] = playerColor;
BlinkingBillboard* bb = new BlinkingBillboard(this->getContext());
bb->setFrequency(0.3);
@@ -154,11 +154,11 @@
}
switch(playerColor){
- case mini4DgamePlayerColor::red:
+ case Mini4DgamePlayerColor::red:
bb->setColour(ColourValue(1,0,0)); break;
- case mini4DgamePlayerColor::green:
+ case Mini4DgamePlayerColor::green:
bb->setColour(ColourValue(0,1,0)); break;
- case mini4DgamePlayerColor::blue:
+ case Mini4DgamePlayerColor::blue:
bb->setColour(ColourValue(0,0,1)); break;
default: break;
}
@@ -168,7 +168,7 @@
Mini4DgameWinner winner = this->getWinner();
- if(winner.color_ != mini4DgamePlayerColor::none)
+ if(winner.color_ != Mini4DgamePlayerColor::none)
{
orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl;
for(int i=0;i<4;i++){
@@ -196,12 +196,12 @@
Mini4DgameWinner Mini4DgameBoard::getWinner()
{
Mini4DgameWinner winner;
- winner.color_ = mini4DgamePlayerColor::none;
+ winner.color_ = Mini4DgamePlayerColor::none;
//check diagonals rows-columns-height-numbers
for(int i=1; i<4; i++)
{
- if(this->board[i][i][i][i]==mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i])
+ if(this->board[i][i][i][i]==Mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i])
break;
if(i==3)
{
@@ -217,7 +217,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][i][i]==mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i])
+ if(this->board[3-i][i][i][i]==Mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i])
break;
if(i==3)
{
@@ -233,7 +233,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][3-i][i][i]==mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i])
+ if(this->board[i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i])
break;
if(i==3)
{
@@ -249,7 +249,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][i][3-i][i]==mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i])
+ if(this->board[i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i])
break;
if(i==3)
{
@@ -265,7 +265,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][i][i][3-i]==mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i])
+ if(this->board[i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i])
break;
if(i==3)
{
@@ -281,7 +281,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][3-i][i][i]==mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i])
+ if(this->board[3-i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i])
break;
if(i==3)
{
@@ -297,7 +297,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][3-i][i]==mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i])
+ if(this->board[3-i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i])
break;
if(i==3)
{
@@ -313,7 +313,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][i][3-i]==mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i])
+ if(this->board[3-i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i])
break;
if(i==3)
{
@@ -333,7 +333,7 @@
{
for(int i=1; i<4; i++)
{
- if(this->board[i][i][i][l]==mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l])
+ if(this->board[i][i][i][l]==Mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l])
break;
if(i==3)
{
@@ -349,7 +349,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][i][l]==mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l])
+ if(this->board[3-i][i][i][l]==Mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l])
break;
if(i==3)
{
@@ -365,7 +365,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][3-i][i][l]==mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l])
+ if(this->board[i][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l])
break;
if(i==3)
{
@@ -381,7 +381,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][i][3-i][l]==mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l])
+ if(this->board[i][i][3-i][l]==Mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l])
break;
if(i==3)
{
@@ -402,7 +402,7 @@
{
for(int i=1; i<4; i++)
{
- if(this->board[i][i][l][i]==mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i])
+ if(this->board[i][i][l][i]==Mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i])
break;
if(i==3)
{
@@ -418,7 +418,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][l][i]==mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i])
+ if(this->board[3-i][i][l][i]==Mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i])
break;
if(i==3)
{
@@ -434,7 +434,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][3-i][l][i]==mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i])
+ if(this->board[i][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i])
break;
if(i==3)
{
@@ -450,7 +450,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][i][l][3-i]==mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i])
+ if(this->board[i][i][l][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i])
break;
if(i==3)
{
@@ -471,7 +471,7 @@
{
for(int i=1; i<4; i++)
{
- if(this->board[i][l][i][i]==mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i])
+ if(this->board[i][l][i][i]==Mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i])
break;
if(i==3)
{
@@ -487,7 +487,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][l][i][i]==mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i])
+ if(this->board[3-i][l][i][i]==Mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i])
break;
if(i==3)
{
@@ -503,7 +503,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][l][3-i][i]==mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i])
+ if(this->board[i][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i])
break;
if(i==3)
{
@@ -519,7 +519,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[i][l][i][3-i]==mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i])
+ if(this->board[i][l][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i])
break;
if(i==3)
{
@@ -540,7 +540,7 @@
{
for(int i=1; i<4; i++)
{
- if(this->board[l][i][i][i]==mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i])
+ if(this->board[l][i][i][i]==Mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i])
break;
if(i==3)
{
@@ -556,7 +556,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[l][3-i][i][i]==mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i])
+ if(this->board[l][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i])
break;
if(i==3)
{
@@ -572,7 +572,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[l][i][3-i][i]==mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i])
+ if(this->board[l][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i])
break;
if(i==3)
{
@@ -588,7 +588,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[l][i][i][3-i]==mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i])
+ if(this->board[l][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i])
break;
if(i==3)
{
@@ -610,7 +610,7 @@
//rows-columns
for(int i=1; i<4; i++)
{
- if(this->board[i][i][k][l]==mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l])
+ if(this->board[i][i][k][l]==Mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l])
break;
if(i==3)
{
@@ -626,7 +626,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][i][k][l]==mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l])
+ if(this->board[3-i][i][k][l]==Mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l])
break;
if(i==3)
{
@@ -643,7 +643,7 @@
//rows-height
for(int i=1; i<4; i++)
{
- if(this->board[i][k][i][l]==mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l])
+ if(this->board[i][k][i][l]==Mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l])
break;
if(i==3)
{
@@ -659,7 +659,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][k][i][l]==mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l])
+ if(this->board[3-i][k][i][l]==Mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l])
break;
if(i==3)
{
@@ -676,7 +676,7 @@
//rows-numbers
for(int i=1; i<4; i++)
{
- if(this->board[i][k][l][i]==mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i])
+ if(this->board[i][k][l][i]==Mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i])
break;
if(i==3)
{
@@ -692,7 +692,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[3-i][k][l][i]==mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i])
+ if(this->board[3-i][k][l][i]==Mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i])
break;
if(i==3)
{
@@ -709,7 +709,7 @@
//column-height
for(int i=1; i<4; i++)
{
- if(this->board[k][i][i][l]==mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l])
+ if(this->board[k][i][i][l]==Mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l])
break;
if(i==3)
{
@@ -725,7 +725,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[k][3-i][i][l]==mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l])
+ if(this->board[k][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l])
break;
if(i==3)
{
@@ -742,7 +742,7 @@
//column-numbers
for(int i=1; i<4; i++)
{
- if(this->board[k][i][l][i]==mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i])
+ if(this->board[k][i][l][i]==Mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i])
break;
if(i==3)
{
@@ -758,7 +758,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[k][3-i][l][i]==mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i])
+ if(this->board[k][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i])
break;
if(i==3)
{
@@ -775,7 +775,7 @@
//height-numbers
for(int i=1; i<4; i++)
{
- if(this->board[k][l][i][i]==mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i])
+ if(this->board[k][l][i][i]==Mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i])
break;
if(i==3)
{
@@ -791,7 +791,7 @@
}
for(int i=1; i<4; i++)
{
- if(this->board[k][l][3-i][i]==mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i])
+ if(this->board[k][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i])
break;
if(i==3)
{
@@ -812,7 +812,7 @@
for(int j=0;j<4;j++){
for(int k=0;k<4;k++){
for(int l=0;l<4;l++){
- if(this->board[0][j][k][l]!= mini4DgamePlayerColor::none
+ if(this->board[0][j][k][l]!= Mini4DgamePlayerColor::none
&& this->board[0][j][k][l]==this->board[1][j][k][l]
&& this->board[1][j][k][l]==this->board[2][j][k][l]
&& this->board[2][j][k][l]==this->board[3][j][k][l])
@@ -834,7 +834,7 @@
for(int i=0;i<4;i++){
for(int k=0;k<4;k++){
for(int l=0;l<4;l++){
- if(this->board[i][0][k][l]!= mini4DgamePlayerColor::none
+ if(this->board[i][0][k][l]!= Mini4DgamePlayerColor::none
&& this->board[i][0][k][l]==this->board[i][1][k][l]
&& this->board[i][1][k][l]==this->board[i][2][k][l]
&& this->board[i][2][k][l]==this->board[i][3][k][l])
@@ -856,7 +856,7 @@
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
for(int l=0;l<4;l++){
- if(this->board[i][j][0][l]!= mini4DgamePlayerColor::none
+ if(this->board[i][j][0][l]!= Mini4DgamePlayerColor::none
&& this->board[i][j][0][l]==this->board[i][j][1][l]
&& this->board[i][j][1][l]==this->board[i][j][2][l]
&& this->board[i][j][2][l]==this->board[i][j][3][l])
@@ -878,7 +878,7 @@
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
for(int k=0;k<4;k++){
- if(this->board[i][j][k][0]!= mini4DgamePlayerColor::none
+ if(this->board[i][j][k][0]!= Mini4DgamePlayerColor::none
&& this->board[i][j][k][0]==this->board[i][j][k][1]
&& this->board[i][j][k][1]==this->board[i][j][k][2]
&& this->board[i][j][k][2]==this->board[i][j][k][3])
Modified: code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.h
===================================================================
--- code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/mini4dgame/Mini4DgameBoard.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -41,6 +41,13 @@
namespace orxonox
{
+ enum class Mini4DgamePlayerColor
+ {
+ none,
+ red,
+ blue,
+ green
+ };
struct Mini4DgamePosition
{
@@ -57,7 +64,7 @@
int winningColumn[4];
int winningHeight[4];
int winningNumber[4];
- int color_;
+ Mini4DgamePlayerColor color_;
};
/**
@@ -87,7 +94,7 @@
std::vector<Mini4DgamePosition> moves;
bool player_toggle_;
BlinkingBillboard* blinkingBillboards[4][4][4][4];
- int board[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number]
+ Mini4DgamePlayerColor board[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number]
};
}
Modified: code/branches/cpp11_v2/src/modules/objects/ForceField.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/objects/ForceField.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/objects/ForceField.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -66,7 +66,7 @@
this->setDiameter(500);
this->setMassDiameter(0); //! We allow point-masses
this->setLength(2000);
- this->mode_ = forceFieldMode::tube;
+ this->mode_ = ForceFieldMode::tube;
this->registerVariables();
}
@@ -114,7 +114,7 @@
*/
void ForceField::tick(float dt)
{
- if(this->mode_ == forceFieldMode::tube)
+ if(this->mode_ == ForceFieldMode::tube)
{
// Iterate over all objects that could possibly be affected by the ForceField.
for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
@@ -142,7 +142,7 @@
mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
}
}
- else if(this->mode_ == forceFieldMode::sphere)
+ else if(this->mode_ == ForceFieldMode::sphere)
{
// Iterate over all objects that could possibly be affected by the ForceField.
for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
@@ -158,7 +158,7 @@
}
}
}
- else if(this->mode_ == forceFieldMode::invertedSphere)
+ else if(this->mode_ == ForceFieldMode::invertedSphere)
{
// Iterate over all objects that could possibly be affected by the ForceField.
for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
@@ -175,7 +175,7 @@
}
}
}
- else if(this->mode_ == forceFieldMode::newtonianGravity)
+ else if(this->mode_ == ForceFieldMode::newtonianGravity)
{
// Iterate over all objects that could possibly be affected by the ForceField.
for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
@@ -200,7 +200,7 @@
}
}
}
- else if(this->mode_ == forceFieldMode::homogen)
+ else if(this->mode_ == ForceFieldMode::homogen)
{
// Iterate over all objects that could possibly be affected by the ForceField.
for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
@@ -226,21 +226,21 @@
void ForceField::setMode(const std::string& mode)
{
if(mode == ForceField::modeTube_s)
- this->mode_ = forceFieldMode::tube;
+ this->mode_ = ForceFieldMode::tube;
else if(mode == ForceField::modeSphere_s)
- this->mode_ = forceFieldMode::sphere;
+ this->mode_ = ForceFieldMode::sphere;
else if(mode == ForceField::modeInvertedSphere_s)
- this->mode_ = forceFieldMode::invertedSphere;
+ this->mode_ = ForceFieldMode::invertedSphere;
else if(mode == ForceField::modeNewtonianGravity_s)
- this->mode_ = forceFieldMode::newtonianGravity;
+ this->mode_ = ForceFieldMode::newtonianGravity;
else if(mode == ForceField::modeHomogen_s)
- this->mode_ = forceFieldMode::homogen;
+ this->mode_ = ForceFieldMode::homogen;
else
{
orxout(internal_warning) << "Wrong mode '" << mode << "' in ForceField. Setting to 'tube'." << endl;
- this->mode_ = forceFieldMode::tube;
+ this->mode_ = ForceFieldMode::tube;
}
}
@@ -254,16 +254,16 @@
{
switch(this->mode_)
{
- case forceFieldMode::tube:
+ case ForceFieldMode::tube:
return ForceField::modeTube_s;
- case forceFieldMode::sphere:
+ case ForceFieldMode::sphere:
return ForceField::modeSphere_s;
- case forceFieldMode::invertedSphere:
+ case ForceFieldMode::invertedSphere:
return ForceField::modeInvertedSphere_s;
- case forceFieldMode::newtonianGravity:
+ case ForceFieldMode::newtonianGravity:
return ForceField::modeNewtonianGravity_s;
- case forceFieldMode::homogen:
+ case ForceFieldMode::homogen:
return ForceField::modeHomogen_s;
default:
Modified: code/branches/cpp11_v2/src/modules/objects/ForceField.h
===================================================================
--- code/branches/cpp11_v2/src/modules/objects/ForceField.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/objects/ForceField.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -51,16 +51,13 @@
@ingroup Objects
*/
- namespace forceFieldMode
- {
- enum Value {
- tube, //!< The ForceField has a tube shape.
- sphere, //!< The ForceField has a spherical shape.
- invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
- newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
- homogen //!< Local homogenous Force field with changeable direction for the Space Station
- };
- }
+ enum class ForceFieldMode {
+ tube, //!< The ForceField has a tube shape.
+ sphere, //!< The ForceField has a spherical shape.
+ invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
+ newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
+ homogen //!< Local homogenous Force field with changeable direction for the Space Station
+ };
/**
@brief
@@ -171,7 +168,7 @@
float radius_; //!< The radius of the ForceField.
float massRadius_; //!< The radius of the stellar body for the Newtonian ForceField.
float halfLength_; //!< Half of the length of the ForceField.
- int mode_; //!< The mode of the ForceField.
+ ForceFieldMode mode_; //!< The mode of the ForceField.
//! Gravitational constant for Newtonian ForceFields.
static const float gravConstant_;
Modified: code/branches/cpp11_v2/src/modules/objects/Script.h
===================================================================
--- code/branches/cpp11_v2/src/modules/objects/Script.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/objects/Script.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -50,14 +50,11 @@
/**
@brief The mode a specific @ref orxonox::Script "Script" is in.
*/
- namespace ScriptMode
+ enum class ScriptMode
{
- enum Value
- {
- normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor".
- lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua.
- };
- }
+ normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor".
+ lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua.
+ };
/**
@brief
@@ -177,7 +174,7 @@
static const int INF;
std::string code_; //!< The code that is executed by this Script.
- ScriptMode::Value mode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua.
+ ScriptMode mode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua.
std::string modeStr_; //!< The mode the Script is in, as a string. Is used for networking purposes.
bool onLoad_; //!< Whether the Scripts code is executed upon loading (creation) of this Script.
int times_; //!< The number of times the Scripts code is executed at the most. -1 denotes infinity.
@@ -192,7 +189,7 @@
@brief Sets the mode of the Script.
@param mode The mode of the Script.
*/
- inline void setMode(ScriptMode::Value mode)
+ inline void setMode(ScriptMode mode)
{ this->mode_ = mode; }
};
}
Modified: code/branches/cpp11_v2/src/modules/overlays/OverlayText.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/overlays/OverlayText.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/overlays/OverlayText.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -41,9 +41,9 @@
{
RegisterClass(OverlayText);
- static_assert((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Left, "check enum");
- static_assert((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Center, "check enum");
- static_assert((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Right, "check enum");
+ static_assert((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Alignment::Left, "check enum");
+ static_assert((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Alignment::Center, "check enum");
+ static_assert((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Alignment::Right, "check enum");
OverlayText::OverlayText(Context* context)
: OrxonoxOverlay(context)
@@ -84,11 +84,11 @@
void OverlayText::setAlignmentString(const std::string& alignment)
{
if (alignment == "right")
- this->setAlignment(OverlayText::Right);
+ this->setAlignment(OverlayText::Alignment::Right);
else if (alignment == "center")
- this->setAlignment(OverlayText::Center);
+ this->setAlignment(OverlayText::Alignment::Center);
else // "left" and default
- this->setAlignment(OverlayText::Left);
+ this->setAlignment(OverlayText::Alignment::Left);
}
std::string OverlayText::getAlignmentString() const
Modified: code/branches/cpp11_v2/src/modules/overlays/OverlayText.h
===================================================================
--- code/branches/cpp11_v2/src/modules/overlays/OverlayText.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/overlays/OverlayText.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -41,7 +41,7 @@
class _OverlaysExport OverlayText : public OrxonoxOverlay
{
public:
- enum Alignment
+ enum class Alignment
{
Left,
Right,
Modified: code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -354,7 +354,7 @@
fields_[i][j]->setPosition(coord.get3dcoordinate());
fields_[i][j]->create(fields.at(pos), fields.at(pos+1));
pos += 2;
- if (fields_[i][j]->getType() == START)
+ if (fields_[i][j]->getType() == TowerDefenseFieldType::START)
{
startCoord.Set(i,j);
waypoints_.push_back(fields_[i][j]);
@@ -378,7 +378,7 @@
TowerDefenseField* thisField = fields_[thisCoord->GetX()][thisCoord->GetY()];
TDCoordinate* nextCoord = new TDCoordinate(0,0);
- if (thisField->getType() != STREET && thisField->getType() != START)
+ if (thisField->getType() != TowerDefenseFieldType::STREET && thisField->getType() != TowerDefenseFieldType::START)
{
return nullptr;
}
Modified: code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.cc 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.cc 2015-12-30 13:31:14 UTC (rev 10999)
@@ -49,7 +49,7 @@
RegisterObject(TowerDefenseField);
tower_ = nullptr;
- type_ = FREE;
+ type_ = TowerDefenseFieldType::FREE;
center_ = nullptr;
upgrade_ = 0;
setPosition(0,0,0);
@@ -185,7 +185,7 @@
{
modelGround_->setMeshSource("TD_F1.mesh");
tower_ = nullptr;
- type_ = FREE;
+ type_ = TowerDefenseFieldType::FREE;
setUpgrade(0);
setAngle(orientation);
}
@@ -194,7 +194,7 @@
{
modelGround_->setMeshSource("TD_S5.mesh");
tower_ = nullptr;
- type_ = START;
+ type_ = TowerDefenseFieldType::START;
setUpgrade(0);
setAngle(orientation);
}
@@ -204,7 +204,7 @@
{
modelGround_->setMeshSource("TD_S4.mesh");
tower_ = nullptr;
- type_ = END;
+ type_ = TowerDefenseFieldType::END;
setUpgrade(0);
setAngle(orientation);
}
@@ -213,7 +213,7 @@
{
modelGround_->setMeshSource("TD_S1.mesh");
tower_ = nullptr;
- type_ = STREET;
+ type_ = TowerDefenseFieldType::STREET;
setUpgrade(0);
setAngle(orientation);
}
@@ -222,7 +222,7 @@
{
modelGround_->setMeshSource("TD_S2.mesh");
tower_ = nullptr;
- type_ = STREET;
+ type_ = TowerDefenseFieldType::STREET;
setUpgrade(0);
setAngle(orientation);
}
@@ -231,7 +231,7 @@
{
modelGround_->setMeshSource("TD_S3.mesh");
tower_ = nullptr;
- type_ = STREET;
+ type_ = TowerDefenseFieldType::STREET;
setUpgrade(0);
setAngle(orientation);
}
@@ -241,7 +241,7 @@
modelGround_->setMeshSource("TD_F1.mesh");
modelObject_->setMeshSource("TD_O1.mesh");
tower_ = nullptr;
- type_ = OBSTACLE;
+ type_ = TowerDefenseFieldType::OBSTACLE;
setUpgrade(0);
setAngle(orientation);
}
@@ -253,7 +253,7 @@
modelGround_->setMeshSource("TD_F1.mesh");
tower_ = new TowerDefenseTower(center_->getContext());
attach(tower_);
- type_ = TOWER;
+ type_ = TowerDefenseFieldType::TOWER;
setUpgrade(upgrade);
if (upgrade_ > 0 && modelObject_ != nullptr)
{
Modified: code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.h
===================================================================
--- code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.h 2015-12-30 12:59:38 UTC (rev 10998)
+++ code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseField.h 2015-12-30 13:31:14 UTC (rev 10999)
@@ -45,7 +45,7 @@
namespace orxonox
{
- enum TowerDefenseFieldType
+ enum class TowerDefenseFieldType
{
FREE,
STREET,
@@ -63,7 +63,7 @@
virtual ~TowerDefenseField() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
const bool isFree() const
- { return type_==FREE; }
+ { return type_==TowerDefenseFieldType::FREE; }
virtual void create(char object, char param);
virtual void setCenterpoint(TowerDefenseCenterpoint* center);
virtual void upgrade();
More information about the Orxonox-commit
mailing list