Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2010, 11:26:05 PM (14 years ago)
Author:
jo
Message:

Finally using the right branch - already compiling, but with memory-leak.

Location:
code/branches/lastmanstanding2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo

    r7697 r7699  
    11<Template name="LastteamstandingHUD">
    2   <OverlayGroup name="DynamicmatcHUD" scale = "1, 1">
     2  <OverlayGroup name="LastteamstandingHUD" scale = "1, 1">
    33
    44<GametypeFadingMessage
     
    3030
    3131     showlives     = true
    32      showplayers     = false
     32     showteams     = false
    3333    />
    3434
     
    4040     colour    = "1.0, 1.0, 1.0, 1.0"
    4141     align     = "left"
    42      caption   = "Players: "
     42     caption   = "Teams: "
    4343    />
    4444
     
    5252
    5353     showlives     = false
    54      showplayers     = true
     54     showteams     = true
    5555    />
    5656
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc

    r7697 r7699  
    5252        this->bHardPunishment=false;
    5353        this->punishDamageRate=0.4f;
    54         this->setHUDTemplate("LastTeamStandingHUD");
     54        this->setHUDTemplate("LastTeamStandingHUD");//tolowercase:-)
    5555        this->eachTeamsPlayers = new int[teams_];
     56        this->bMinPlayersReached = false;
    5657    }
    5758   
    58     void LastTeamStanding::~LastTeamStanding()
     59    LastTeamStanding::~LastTeamStanding()
    5960    {
    6061        delete[] this->eachTeamsPlayers;
     
    138139    }
    139140
    140     void LastTeamStanding::end()
     141    void LastTeamStanding::end()//TODO!
    141142    {
    142143        Gametype::end();
     
    171172        if (!player)// only for safety
    172173            return;
    173         Deathmatch::playerEntered(player);
     174        TeamDeathmatch::playerEntered(player);
    174175        if (teamsAlive<=1)
    175176            playerLives_[player]=lives;
     
    180181            this->teamsAlive++;
    181182        this->eachTeamsPlayers[getTeam(player)]++;
    182        
     183        if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
     184            bMinPlayersReached=true;
    183185        this->timeToAct_[player]=timeRemaining;
    184186        this->playerDelayTime_[player]=respawnDelay;
     
    188190    bool LastTeamStanding::playerLeft(PlayerInfo* player)
    189191    {
    190         bool valid_player = Deathmatch::playerLeft(player);
     192        bool valid_player = TeamDeathmatch::playerLeft(player);
    191193        if (valid_player)
    192194        {
     
    255257        if(this->hasStarted()&&(!this->hasEnded()))
    256258        {
    257             if ((this->hasStarted()&&(teamsAlive<=1)))//last team remaining
     259            if (bMinPlayersReached &&(this->hasStarted()&&(teamsAlive<=1)))//last team remaining
    258260            {
    259261                this->end();
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h

    r7697 r7699  
    3535
    3636#include "OrxonoxPrereqs.h"
    37 #include "Deathmatch.h"
     37#include "TeamDeathmatch.h"
    3838#include <map>
    3939#include <vector>
     40
     41//TODO: Hud doesn load; problem with destructor; teams are not assigned properly;
    4042
    4143namespace orxonox
     
    6365            virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
    6466            virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
    65             unsigned int * eachTeamsPlayers; //!<Each teams player's alive.
     67            int * eachTeamsPlayers; //!<Each teams player's alive.
     68            bool bMinPlayersReached;
    6669
    6770        public:
Note: See TracChangeset for help on using the changeset viewer.