~armagetronad-dev/armagetronad/armagetronad-map-unified-dtd

« back to all changes in this revision

Viewing changes to src/tron/gArena.cpp

  • Committer: Luke Dashjr
  • Date: 2009-03-14 02:24:38 UTC
  • mfrom: (890.2.1 current)
  • Revision ID: luke+bzr@dashjr.org-20090314022438-cz07xxgodmroz3sm
merge fortress-respawn

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
    eWallRim::UpdateBounds();
115
115
}
116
116
 
 
117
// find the closest gSpawnPoint to a location 
 
118
gSpawnPoint * gArena::ClosestSpawnPoint(eCoord pos)
 
119
{
 
120
    gSpawnPoint *ret=NULL;
 
121
    REAL distance = -1;
 
122
 
 
123
    for(int i=0;i<spawnPoints.Len();i++)
 
124
    {
 
125
        // get the distance
 
126
        REAL tempDistance = (pos - (spawnPoints(i)->location * SizeMultiplier())).Norm();
 
127
 
 
128
        if ((tempDistance < distance) || (distance < 0))
 
129
        {
 
130
            ret = spawnPoints(i);
 
131
            distance = tempDistance;
 
132
 
 
133
            //con << "Spawn point chosen: " << spawnPoints(i)->location << " " << pos << '\n';
 
134
        }
 
135
//        else
 
136
            //con << "Spawn point not chosen: " << spawnPoints(i)->location << " " << pos << '\n';
 
137
    }
 
138
 
 
139
    if (!ret)
 
140
        tERR_ERROR("No spawnpoint available!");
 
141
 
 
142
    return ret;
 
143
 
144
 
117
145
// find the best gSpawnPoint
118
146
gSpawnPoint * gArena::LeastDangerousSpawnPoint()
119
147
{