Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2010, 4:57:26 PM (14 years ago)
Author:
stmathia
Message:

Changes in level files. Addition to TemaDeathmatch, should now be able to only use active SpawnPoints (at least if there are active ones), not fully working, yet, though.

Location:
code/branches/presentation3
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/orxonox/gametypes/TeamDeathmatch.cc

    r6417 r6920  
    137137        }
    138138
     139        SpawnPoint* fallbackSpawnPoint = NULL;
     140
    139141        if (teamSpawnPoints.size() > 0)
    140142        {
     
    144146            {
    145147                if (index == randomspawn)
     148                {
     149                    fallbackSpawnPoint = (*it);
     150                    break;
     151                }
     152
     153                ++index;
     154            }
     155
     156            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
     157            {
     158                if (!(*it)->isActive())
     159                {
     160                    COUT(1) << "MUP" << std::endl;
     161                    teamSpawnPoints.erase(it++);
     162                    continue;
     163                }
     164
     165                ++it;
     166            }
     167
     168            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
     169            index = 0;
     170            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     171            {
     172                if (index == randomspawn)
    146173                    return (*it);
    147174
    148175                ++index;
    149176            }
     177
     178            return fallbackSpawnPoint;
    150179        }
    151180
Note: See TracChangeset for help on using the changeset viewer.