[Orxonox-commit 7528] r12134 - in code/branches/wagnis_HS18: data/overlays src/modules/wagnis

stadlero at orxonox.net stadlero at orxonox.net
Sun Dec 2 22:47:00 CET 2018


Author: stadlero
Date: 2018-12-02 22:47:00 +0100 (Sun, 02 Dec 2018)
New Revision: 12134

Modified:
   code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
   code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.h
Log:
Troop count is visible in the HUD

Modified: code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo
===================================================================
--- code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo	2018-12-02 15:08:26 UTC (rev 12133)
+++ code/branches/wagnis_HS18/data/overlays/WagnisHUD.oxo	2018-12-02 21:47:00 UTC (rev 12134)
@@ -6,8 +6,10 @@
      correctaspect = true
      font          = "Monofur"
      textsize      = 0.02
-     navMarkerSize = 0.03
+     navMarkerSize = 0.05
      aimMarkerSize = 0.02
+     healthMarkerSize = 0
+     healthLevelMarkerSize = 0
     />
 
   </OverlayGroup>

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	2018-12-02 15:08:26 UTC (rev 12133)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	2018-12-02 21:47:00 UTC (rev 12134)
@@ -1,9 +1,6 @@
 
 
 
-
-
-
 #include "WagnisPlayer.h"
 #include <vector>
 #include <string>
@@ -63,8 +60,8 @@
                     {   
                         if (checkMove(SET_TROOPS_INITIAL)){
                             this->target_province->owner_ID = this->Player_ID;
-                            this->target_province->troops += 1;
-                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
+                            this->target_province->setTroops(this->target_province->getTroops()+1);
+                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
                             master->playerFinishedStageCallback(this);
                         }else{
                             orxout()<<"Sorry, someone already owns this provice"<<endl;
@@ -76,8 +73,8 @@
                     case REINFORCEMENT_STAGE:
                     {
                         if (checkMove(SET_TROOPS)){
-                            this->target_province->troops += 1;
-                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->troops<<endl;
+                            this->target_province->setTroops(this->target_province->getTroops()+1);
+                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
                         }
                             
                         break;
@@ -86,19 +83,19 @@
 
                         if (checkMove(ATTACK))
                         {
-                            while ((this->origin_province->troops > 1) && (this->target_province->troops > 0)) //still troops available
+                            while ((this->origin_province->getTroops() > 1) && (this->target_province->getTroops() > 0)) //still troops available
                             {
-                                while ((this->origin_province->troops >= 4) && (this->target_province->troops >= 2))
+                                while ((this->origin_province->getTroops() >= 4) && (this->target_province->getTroops() >= 2))
                                 {
                                     //normal fight, 3 attackers, 2 defenders
                                 }
 
-                                if ((this->origin_province->troops == 3) && (this->target_province->troops >= 2))
+                                if ((this->origin_province->getTroops() == 3) && (this->target_province->getTroops() >= 2))
                                 {
                                     //2 attackers, 2 defenders
                                 }
 
-                                if((this->origin_province->troops == 2) && (this->target_province->troops >= 2))
+                                if((this->origin_province->getTroops() == 2) && (this->target_province->getTroops() >= 2))
                                 {
                                     //1 attacker, 2 defenders
                                 }
@@ -106,11 +103,11 @@
                                 //TODO: implement other cases
                             }
 
-                            if (this->target_province->troops == 0) //attacker won
+                            if (this->target_province->getTroops() == 0) //attacker won
                             {
                                 this->target_province->owner_ID = this->Player_ID;
-                                this->target_province->troops = (this->origin_province->troops - 1);
-                                this->origin_province->troops = 1;
+                                this->target_province->setTroops(this->origin_province->getTroops() - 1);
+                                this->origin_province->setTroops(1);
                             }
                         }
                         
@@ -120,8 +117,8 @@
 
                         if (checkMove(MOVE))
                         {
-                            this->target_province->troops += ((this->origin_province->troops) - 1);
-                            this->origin_province->troops = 1;
+                            this->target_province->setTroops(this->origin_province->getTroops()-1);
+                            this->origin_province->setTroops(1);
                         }
                         break;
                     }

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	2018-12-02 15:08:26 UTC (rev 12133)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	2018-12-02 21:47:00 UTC (rev 12134)
@@ -38,7 +38,6 @@
 
 
 
-        //void (Wagnis::*finishedStageCallback) (WagnisPlayer*);
         Wagnis* master;
         GameStage gameStage;
         bool province_selection_changed;

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-02 15:08:26 UTC (rev 12133)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc	2018-12-02 21:47:00 UTC (rev 12134)
@@ -1,10 +1,6 @@
 
 
 #include "WagnisProvince.h"
-#include "core/CoreIncludes.h"
-#include "BulletDynamics/Dynamics/btRigidBody.h"
-#include "worldentities/StaticEntity.h"
-#include <vector>
 
 #define WAGNIS_PROVINCE_MAX_HEALTH 1000000.0f
 
@@ -23,10 +19,10 @@
         RegisterObject(WagnisProvince);
         this->owner_ID = -1;
         this->troops = 0;
+        this->setRadarName(std::to_string(0));
         this->ID = -1;
         this->continent = -1;
         this->neighbors = std::vector<WagnisProvince*>();
-        this->markerBillboard = nullptr;
         
         this->initialHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
         this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
@@ -41,23 +37,13 @@
     void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
         SUPER(WagnisProvince, XMLPort, xmlelement, mode);
 
-        XMLPortObject(WagnisProvince, Billboard, "MarkerBillboard", addMarkerBillboard, getMarkerBillboard, xmlelement, mode);
         XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
         XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
     }
 
-    void WagnisProvince::addMarkerBillboard(Billboard* billi){
-        this->markerBillboard = billi;
-        attach(billi);
-    }
-    Billboard* WagnisProvince::getMarkerBillboard(unsigned int i) const{
-        if(i != 0) return nullptr;
-        return this->markerBillboard;
-    }
 
 
 
-
     //SET()
 
     //set owner_ID
@@ -67,6 +53,13 @@
     //set troops
     void WagnisProvince::setTroops(int troops){
         this->troops = troops;
+        this->setRadarName(std::to_string(troops));
+        //TEST
+        if(troops == 5){
+            Ogre::ColourValue cv = colour({255,255,255}, 100.0f);
+            this->setRadarObjectColour(cv);
+        }
+        
     }
     //set ID
     void WagnisProvince::setID(int id){
@@ -101,8 +94,4 @@
     void WagnisProvince::addNeighbor(WagnisProvince* prov){
         neighbors.push_back(prov);
     }
-
-    void WagnisProvince::setBillbardVisibility(bool b){
-        //TODO set visibility of billboard
-    }
 }

Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.h	2018-12-02 15:08:26 UTC (rev 12133)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.h	2018-12-02 21:47:00 UTC (rev 12134)
@@ -10,8 +10,10 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "worldentities/pawns/Pawn.h"
-#include "graphics/Billboard.h"
+#include "tools/OgreBulletUtils.h"
 #include <vector>
+#include <OgreColourValue.h>
+#include "tools/ToolsPrereqs.h"
 
 
 namespace orxonox
@@ -24,8 +26,6 @@
 
 
         virtual void XMLPort(Element&,XMLPort::Mode);
-        void addMarkerBillboard(Billboard*);
-        Billboard* getMarkerBillboard(unsigned int) const;
 
         void setOwner_ID(int);
         void setTroops(int);
@@ -38,16 +38,16 @@
         int getContinent() const;
 
         void addNeighbor(WagnisProvince*);
-        void setBillbardVisibility(bool);
 
 
         std::vector<WagnisProvince*> neighbors;
         int owner_ID;
-        int troops;
         int ID;
         int continent;
-        
-        Billboard* markerBillboard;
+
+        private:
+        int troops;
+
     };
 }
 



More information about the Orxonox-commit mailing list