[Orxonox-commit 3288] r7978 - in code/branches/usability/src: modules/objects/triggers modules/pickup modules/questsystem/effects orxonox/gamestates

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Feb 27 03:11:43 CET 2011


Author: rgrieder
Date: 2011-02-27 03:11:42 +0100 (Sun, 27 Feb 2011)
New Revision: 7978

Modified:
   code/branches/usability/src/modules/objects/triggers/DistanceMultiTrigger.cc
   code/branches/usability/src/modules/objects/triggers/DistanceTrigger.cc
   code/branches/usability/src/modules/objects/triggers/DistanceTrigger.h
   code/branches/usability/src/modules/pickup/PickupRepresentation.cc
   code/branches/usability/src/modules/questsystem/effects/AddQuestHint.cc
   code/branches/usability/src/modules/questsystem/effects/ChangeQuestStatus.cc
   code/branches/usability/src/orxonox/gamestates/GSLevel.cc
   code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc
   code/branches/usability/src/orxonox/gamestates/GSMainMenu.h
Log:
Increased code readability by replacing some BLANKSTRING with plain old "".

Modified: code/branches/usability/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- code/branches/usability/src/modules/objects/triggers/DistanceMultiTrigger.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/objects/triggers/DistanceMultiTrigger.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -53,7 +53,7 @@
         RegisterObject(DistanceMultiTrigger);
 
         this->distance_ = 100.0f;
-        this->targetName_ = BLANKSTRING;
+        this->targetName_ = "";
         this->singleTargetMode_ = false;
     }
 
@@ -180,7 +180,7 @@
     void DistanceMultiTrigger::setTargetName(const std::string& targetname)
     {
         // If the targetname is no blank string single-target mode is enabled.
-        if(targetname.compare(BLANKSTRING) != 0)
+        if(targetname != "")
             this->singleTargetMode_ = true;
         else
             this->singleTargetMode_ = false;

Modified: code/branches/usability/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/branches/usability/src/modules/objects/triggers/DistanceTrigger.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/objects/triggers/DistanceTrigger.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -49,7 +49,7 @@
 
     this->distance_ = 100;
     this->targetMask_.exclude(Class(BaseObject));
-    this->targetName_ = BLANKSTRING;
+    this->targetName_ = "";
     this->singleTargetMode_ = false;
   }
 

Modified: code/branches/usability/src/modules/objects/triggers/DistanceTrigger.h
===================================================================
--- code/branches/usability/src/modules/objects/triggers/DistanceTrigger.h	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/objects/triggers/DistanceTrigger.h	2011-02-27 02:11:42 UTC (rev 7978)
@@ -69,7 +69,7 @@
       void removeTargets(const std::string& targets);
 
       inline void setTargetName(const std::string& targetname)
-        { if(targetname.compare(BLANKSTRING) != 0) this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; }
+        { if(targetname != "") this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; }
       inline const std::string& getTargetName(void)
         { return this->targetName_; }
 

Modified: code/branches/usability/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/branches/usability/src/modules/pickup/PickupRepresentation.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/pickup/PickupRepresentation.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -155,7 +155,7 @@
         if(this->spawnerRepresentation_ == NULL)
         {
             COUT(4) << "PickupRepresentation: No spawner representation found." << std::endl;
-            if(this->spawnerTemplate_ == BLANKSTRING)
+            if(this->spawnerTemplate_ == "")
             {
                 COUT(4) << "PickupRepresentation: Spawner template is empty." << std::endl;
                 // If neither spawnerRepresentation nor spawnerTemplate was specified

Modified: code/branches/usability/src/modules/questsystem/effects/AddQuestHint.cc
===================================================================
--- code/branches/usability/src/modules/questsystem/effects/AddQuestHint.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/questsystem/effects/AddQuestHint.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -85,7 +85,7 @@
     */
     bool AddQuestHint::setHintId(const std::string & id)
     {
-        if(id.compare(BLANKSTRING) == 0)
+        if(id == "")
         {
             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
             return false;

Modified: code/branches/usability/src/modules/questsystem/effects/ChangeQuestStatus.cc
===================================================================
--- code/branches/usability/src/modules/questsystem/effects/ChangeQuestStatus.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/modules/questsystem/effects/ChangeQuestStatus.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -80,7 +80,7 @@
     */
     bool ChangeQuestStatus::setQuestId(const std::string & id)
     {
-        if(id.compare(BLANKSTRING) == 0)
+        if(id == "")
         {
             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
             return false;

Modified: code/branches/usability/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/usability/src/orxonox/gamestates/GSLevel.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/orxonox/gamestates/GSLevel.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -54,7 +54,7 @@
     static const std::string __CC_changeGame_name = "changeGame";
 
     SetConsoleCommand(__CC_startMainMenu_name, &GSLevel::startMainMenu).deactivate();
-    SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues(BLANKSTRING).deactivate();
+    SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues("").deactivate();
 
     GSLevel::GSLevel(const GameStateInfo& info)
         : GameState(info)
@@ -201,7 +201,7 @@
     */
     /*static*/ void GSLevel::changeGame(const std::string& level)
     {
-        if(level != BLANKSTRING)
+        if(level != "")
             LevelManager::getInstance().setDefaultLevel(level);
 
         // HACK

Modified: code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc	2011-02-27 02:11:42 UTC (rev 7978)
@@ -56,10 +56,10 @@
     static const std::string __CC_startDedicated_name       = "startDedicated";
     static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath";
 
-    SetConsoleCommand(__CC_startStandalone_name,      &GSMainMenu::startStandalone).defaultValues(BLANKSTRING).deactivate();
-    SetConsoleCommand(__CC_startServer_name,          &GSMainMenu::startServer    ).defaultValues(BLANKSTRING).deactivate();
-    SetConsoleCommand(__CC_startClient_name,          &GSMainMenu::startClient    ).defaultValues(BLANKSTRING).deactivate();
-    SetConsoleCommand(__CC_startDedicated_name,       &GSMainMenu::startDedicated ).defaultValues(BLANKSTRING).deactivate();
+    SetConsoleCommand(__CC_startStandalone_name,      &GSMainMenu::startStandalone).defaultValues("").deactivate();
+    SetConsoleCommand(__CC_startServer_name,          &GSMainMenu::startServer    ).defaultValues("").deactivate();
+    SetConsoleCommand(__CC_startClient_name,          &GSMainMenu::startClient    ).defaultValues("").deactivate();
+    SetConsoleCommand(__CC_startDedicated_name,       &GSMainMenu::startDedicated ).defaultValues("").deactivate();
     SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide();
 
     GSMainMenu::GSMainMenu(const GameStateInfo& info)
@@ -175,7 +175,7 @@
     */
     void GSMainMenu::startStandalone(const std::string& level)
     {
-        if(level != BLANKSTRING)
+        if(level != "")
             LevelManager::getInstance().setDefaultLevel(level);
 
         // HACK
@@ -191,7 +191,7 @@
     */
     void GSMainMenu::startServer(const std::string& level)
     {
-        if(level != BLANKSTRING)
+        if(level != "")
             LevelManager::getInstance().setDefaultLevel(level);
 
         // HACK
@@ -207,7 +207,7 @@
     */
     void GSMainMenu::startClient(const std::string& destination)
     {
-        if(destination != BLANKSTRING)
+        if(destination != "")
             Client::getInstance()->setDestination(destination, NETWORK_PORT);
 
         // HACK
@@ -223,7 +223,7 @@
     */
     void GSMainMenu::startDedicated(const std::string& level)
     {
-        if(level != BLANKSTRING)
+        if(level != "")
             LevelManager::getInstance().setDefaultLevel(level);
 
         // HACK

Modified: code/branches/usability/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/branches/usability/src/orxonox/gamestates/GSMainMenu.h	2011-02-27 00:32:30 UTC (rev 7977)
+++ code/branches/usability/src/orxonox/gamestates/GSMainMenu.h	2011-02-27 02:11:42 UTC (rev 7978)
@@ -52,10 +52,10 @@
         const std::string& getMainMenuSoundPath();
         void setMainMenuSoundPath(const std::string& path);
 
-        static void startStandalone(const std::string& level = BLANKSTRING); //!< Start a level in standalone mode.
-        static void startServer(const std::string& level = BLANKSTRING); //!< Start a level in server mode.
-        static void startClient(const std::string& destination = BLANKSTRING); //!< Connect to a game as client.
-        static void startDedicated(const std::string& level = BLANKSTRING); //!< Start a level in dedicated mode.
+        static void startStandalone(const std::string& level = ""); //!< Start a level in standalone mode.
+        static void startServer(const std::string& level = ""); //!< Start a level in server mode.
+        static void startClient(const std::string& destination = ""); //!< Connect to a game as client.
+        static void startDedicated(const std::string& level = ""); //!< Start a level in dedicated mode.
         static void startIOConsole();
 
     private:




More information about the Orxonox-commit mailing list