Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2011, 4:16:24 PM (13 years ago)
Author:
jo
Message:

Adding some variables.

Location:
code/branches/gamecontent/src/orxonox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamecontent/src/orxonox/gametypes/Gametype.cc

    r8858 r8930  
    8585        this->dedicatedKillBots_ = createConsoleCommand( "dedicatedKillBots", createExecutor( createFunctor(&Gametype::killBots, this) ) );
    8686        /* HACK HACK HACK */
     87        //this->numberOfPlayers_ = 0;
    8788    }
    8889
  • code/branches/gamecontent/src/orxonox/gametypes/Gametype.h

    r8904 r8930  
    155155            virtual void resetTimer();
    156156            virtual void resetTimer(float t);
     157            inline unsigned int getNumberOfPlayers()
     158              { return this->gtinfo_->getNumberOfPlayers(); }
    157159
    158160        protected:
     
    192194            ConsoleCommand* dedicatedKillBots_;
    193195            /* HACK HACK HACK */
     196
    194197    };
    195198}
  • code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc

    r8923 r8930  
    3131#include "core/CoreIncludes.h"
    3232#include "core/ConfigValueIncludes.h"
     33#include "infos/PlayerInfo.h"
    3334#include "interfaces/TeamColourable.h"
    3435#include "worldentities/TeamSpawnPoint.h"
     
    4546        this->teams_ = 2;
    4647        this->allowFriendlyFire_ = false;
    47 
     48        //this->playersPerTeam_ = 0;
     49        this->maxPlayers_ = 0;
    4850        this->setConfigValues();
    4951    }
     
    104106    }
    105107
     108    void TeamGametype::spawnDeadPlayersIfRequested()
     109    {
     110        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end();
     111++it)
     112        if (it->second.state_ == PlayerState::Dead)
     113        {
     114         if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
     115            {
     116               this->spawnPlayer(it->first);
     117            }
     118        }
     119    }
     120
     121
    106122    bool TeamGametype::allowPawnHit(Pawn* victim, Pawn* originator)
    107123    {// hit allowed: if victim & originator are foes or if originator doesnot exist or if friendlyfire is allowed
  • code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h

    r8923 r8930  
    4949            virtual void findAndSetTeam(PlayerInfo* player);
    5050            virtual bool playerLeft(PlayerInfo* player);
     51            virtual void spawnDeadPlayersIfRequested(); //!< Prevents players to respawn.
    5152
    5253            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
     
    5556
    5657            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
     58
    5759
    5860            int getTeam(PlayerInfo* player);
     
    6870            std::map<PlayerInfo*, int> teamnumbers_;
    6971            std::vector<ColourValue> teamcolours_;
    70             unsigned int teams_;
     72            unsigned int teams_; //<! Number  of teams. Value 0 : no teams!
     73            //unsigned int playersPerTeam_; //<! Defines Maximum for players per team. Value 0: no maximum!
     74            unsigned int maxPlayers_;  //<! Defines Maximum for number of players. Value 0 : no maximum!
    7175    };
    7276}
  • code/branches/gamecontent/src/orxonox/infos/GametypeInfo.h

    r8706 r8930  
    119119            inline const std::string& getHUDTemplate() const
    120120                { return this->hudtemplate_; }
     121           
     122            inline unsigned int getNumberOfPlayers() const
     123                {  return this->spawnedPlayers_.size(); }
    121124
    122125            void sendAnnounceMessage(const std::string& message);
Note: See TracChangeset for help on using the changeset viewer.