[Orxonox-commit 6547] r11188 - code/branches/bindermFS16/src/orxonox
binderm at orxonox.net
binderm at orxonox.net
Thu May 19 13:34:34 CEST 2016
Author: binderm
Date: 2016-05-19 13:34:34 +0200 (Thu, 19 May 2016)
New Revision: 11188
Modified:
code/branches/bindermFS16/src/orxonox/LevelManager.cc
code/branches/bindermFS16/src/orxonox/LevelStatus.cc
code/branches/bindermFS16/src/orxonox/LevelStatus.h
Log:
Modified: code/branches/bindermFS16/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/bindermFS16/src/orxonox/LevelManager.cc 2016-05-12 14:08:32 UTC (rev 11187)
+++ code/branches/bindermFS16/src/orxonox/LevelManager.cc 2016-05-19 11:34:34 UTC (rev 11188)
@@ -32,6 +32,7 @@
*/
#include "LevelManager.h"
+#include "LevelStatus.h"
#include <map>
@@ -50,85 +51,9 @@
namespace orxonox
{
-//Mission endmission true
- //check if index level is activated...
- int LevelManager::missionactivate(int index)
- {
- updateAllLevelStatus();
- int activated = allLevelStatus_[index].activated;
- return activated;
- }
- void LevelManager::updatewon(int lastwon)
- {
- allLevelStatus_[lastwon].won=true;
- }
- void LevelManager::updateAllLevelStatus()
- {
- for(unsigned int i =0;i<allLevelStatus_.size();i++)
- {
- if(allLevelStatus_[i].won)
- {
- allLevelStatus_[i].activated=1;
- std::vector<int> nextLevels=allLevelStatus_[i].nextLevels;
- for(unsigned int j=i+1;j<allLevelStatus_.size();j++)
- {
- allLevelStatus_[j].activated=nextLevels[j];
- }
- }
- }
- }
-
- //updates the won variable of the corresponding LevelStatus in allLevelStatus_
- void LevelManager::setLevelStatus(const std::string& LevelWon)
- {
- ModifyConfigValue(lastWonMission_, set, LevelWon);
- }
-
-
- //build up allLevelStatus
- //has to be done once per game (not per level)
- //all connections between the levels are saved in here
- void LevelManager::buildallLevelStatus()
- {
- LevelStatus level;
- allLevelStatus_.assign (campaignMissions_.size(),level);
- allLevelStatus_[0].activated=1;
- //allLevelStatus_[0].won=true;
-
-
- allLevelStatus_[0].nextLevels.push_back(1);
- allLevelStatus_[0].nextLevels.push_back(1);
- allLevelStatus_[0].nextLevels.push_back(0);
- allLevelStatus_[0].nextLevels.push_back(0);
- allLevelStatus_[0].nextLevels.push_back(0);
- allLevelStatus_[0].nextLevels.push_back(0);
- allLevelStatus_[0].nextLevels.push_back(0);
-
- allLevelStatus_[1].nextLevels.push_back(1);
- allLevelStatus_[1].nextLevels.push_back(2);
- allLevelStatus_[1].nextLevels.push_back(1);
- allLevelStatus_[1].nextLevels.push_back(0);
- allLevelStatus_[1].nextLevels.push_back(0);
- allLevelStatus_[1].nextLevels.push_back(0);
- allLevelStatus_[1].nextLevels.push_back(0);
-
- allLevelStatus_[2].nextLevels.push_back(2);
- allLevelStatus_[2].nextLevels.push_back(1);
- allLevelStatus_[2].nextLevels.push_back(0);
- allLevelStatus_[2].nextLevels.push_back(0);
- allLevelStatus_[2].nextLevels.push_back(1);
- allLevelStatus_[2].nextLevels.push_back(0);
- allLevelStatus_[2].nextLevels.push_back(0);
-
-
-
- }
-
-
-
SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
ManageScopedSingleton(LevelManager, ScopeID::ROOT, false);
@@ -179,8 +104,8 @@
.description("The last finished mission of a campaign");
SetConfigValue(campaignMissions_, std::vector<std::string>())
.description("The list of missions in the campaign");
- SetConfigValue(test_, std::vector<int>())
- .description("The list of missions and their statuses");
+ //SetConfigValue(test_, std::vector<int>())
+ // .description("The list of missions and their statuses");
}
@@ -407,4 +332,84 @@
{
//TODO: Implement some kind of update?
}
+
+
+//Mission endmission true
+ //check if index level is activated...
+ int LevelManager::missionactivate(int index)
+ {
+ updateAllLevelStatus();
+ int activated = allLevelStatus_[index].activated;
+ return activated;
+ }
+
+ void LevelManager::updatewon(int lastwon)
+ {
+ allLevelStatus_[lastwon].won=true;
+
+ }
+
+ void LevelManager::updateAllLevelStatus()
+ {
+ for(unsigned int i =0;i<allLevelStatus_.size();i++)
+ {
+ if(allLevelStatus_[i].won)
+ {
+ allLevelStatus_[i].activated=1;
+ std::vector<int> nextLevels=allLevelStatus_[i].nextLevels;
+ for(unsigned int j=i+1;j<allLevelStatus_.size();j++)
+ {
+ allLevelStatus_[j].activated=nextLevels[j];
+ }
+ }
+ }
+ }
+
+ //updates the won variable of the corresponding LevelStatus in allLevelStatus_
+ void LevelManager::setLevelStatus(const std::string& LevelWon)
+ {
+ ModifyConfigValue(lastWonMission_, set, LevelWon);
+ }
+
+
+ //build up allLevelStatus
+ //has to be done once per game (not per level)
+ //all connections between the levels are saved in here
+ void LevelManager::buildallLevelStatus()
+ {
+ LevelStatus* level = new LevelStatus(this->getContext());
+
+ /*LevelStatus level;
+ allLevelStatus_.assign (campaignMissions_.size(),level);
+ allLevelStatus_[0].activated=1;
+ //allLevelStatus_[0].won=true;
+
+
+ allLevelStatus_[0].nextLevels.push_back(1);
+ allLevelStatus_[0].nextLevels.push_back(1);
+ allLevelStatus_[0].nextLevels.push_back(0);
+ allLevelStatus_[0].nextLevels.push_back(0);
+ allLevelStatus_[0].nextLevels.push_back(0);
+ allLevelStatus_[0].nextLevels.push_back(0);
+ allLevelStatus_[0].nextLevels.push_back(0);
+
+ allLevelStatus_[1].nextLevels.push_back(1);
+ allLevelStatus_[1].nextLevels.push_back(2);
+ allLevelStatus_[1].nextLevels.push_back(1);
+ allLevelStatus_[1].nextLevels.push_back(0);
+ allLevelStatus_[1].nextLevels.push_back(0);
+ allLevelStatus_[1].nextLevels.push_back(0);
+ allLevelStatus_[1].nextLevels.push_back(0);
+
+ allLevelStatus_[2].nextLevels.push_back(2);
+ allLevelStatus_[2].nextLevels.push_back(1);
+ allLevelStatus_[2].nextLevels.push_back(0);
+ allLevelStatus_[2].nextLevels.push_back(0);
+ allLevelStatus_[2].nextLevels.push_back(1);
+ allLevelStatus_[2].nextLevels.push_back(0);
+ allLevelStatus_[2].nextLevels.push_back(0);*/
+
+
+
+ }
}
Modified: code/branches/bindermFS16/src/orxonox/LevelStatus.cc
===================================================================
--- code/branches/bindermFS16/src/orxonox/LevelStatus.cc 2016-05-12 14:08:32 UTC (rev 11187)
+++ code/branches/bindermFS16/src/orxonox/LevelStatus.cc 2016-05-19 11:34:34 UTC (rev 11188)
@@ -19,7 +19,7 @@
{
RegisterClass(LevelStatus);
- LevelStatus::LevelStatus()
+ LevelStatus::LevelStatus(Context* context) : BaseObject(context)
{
RegisterObject(LevelStatus);
this->won = false;
Modified: code/branches/bindermFS16/src/orxonox/LevelStatus.h
===================================================================
--- code/branches/bindermFS16/src/orxonox/LevelStatus.h 2016-05-12 14:08:32 UTC (rev 11187)
+++ code/branches/bindermFS16/src/orxonox/LevelStatus.h 2016-05-19 11:34:34 UTC (rev 11188)
@@ -55,13 +55,12 @@
class _OrxonoxExport LevelStatus : public BaseObject
{
public:
- LevelStatus();
+ LevelStatus(Context* context);
virtual ~LevelStatus();
bool won; //if the Level is won or not
std::vector<int> nextLevels; //in this vector at the index i is saved if the ith level should be activated =1, visible but not activated =2, or not activated =0
int activated; //0 not activated, 1 activated, 2 visible
-
};
}
More information about the Orxonox-commit
mailing list