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

« back to all changes in this revision

Viewing changes to src/tron/gGame.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:
2995
2995
}
2996
2996
#endif
2997
2997
 
 
2998
void sg_RespawnPlayer(eGrid * grid, gArena * arena, tCoord & pos, tCoord & dir, ePlayerNetID * p) {
 
2999
    eGameObject *e=p->Object();
 
3000
 
 
3001
    if ( ( !e || !e->Alive()) && sn_GetNetState() != nCLIENT )
 
3002
    {
 
3003
#ifdef DEBUG
 
3004
        //                std::cout << "spawning player " << pni->name << '\n';
 
3005
#endif
 
3006
        gCycle * cycle = new gCycle(grid, pos, dir, p);
 
3007
        p->ControlObject(cycle);
 
3008
 
 
3009
        sg_Timestamp();
 
3010
    }
 
3011
}
 
3012
 
 
3013
void sg_RespawnPlayer(eGrid * grid, gArena * arena, tCoord & near, ePlayerNetID * p) {
 
3014
    eGameObject *e=p->Object();
 
3015
 
 
3016
    if ( ( !e || !e->Alive()) && sn_GetNetState() != nCLIENT )
 
3017
    {
 
3018
        tCoord pos,dir;
 
3019
        arena->ClosestSpawnPoint(near)->Spawn( pos, dir );
 
3020
 
 
3021
#ifdef DEBUG
 
3022
        //                std::cout << "spawning player " << pni->name << '\n';
 
3023
#endif
 
3024
        gCycle * cycle = new gCycle(grid, pos, dir, p);
 
3025
        p->ControlObject(cycle);
 
3026
 
 
3027
        sg_Timestamp();
 
3028
    }
 
3029
}
 
3030
 
 
3031
void sg_RespawnPlayer(eGrid * grid, gArena * arena, tCoord * near, ePlayerNetID * p) {
 
3032
    if (near)
 
3033
        sg_RespawnPlayer(grid, arena, *near, p);
 
3034
    else
 
3035
        sg_RespawnPlayer(grid, arena, p);
 
3036
}
 
3037
 
 
3038
void sg_RespawnPlayer(eGameObject & near, ePlayerNetID * p) {
 
3039
    // FIXME: how to get arena info from object?
 
3040
    tCoord npos = near.Position();
 
3041
    sg_RespawnPlayer(near.Grid(), &Arena, npos, p);
 
3042
}
 
3043
 
 
3044
void sg_RespawnPlayer(eGrid * grid, gArena * arena, eGameObject * near, ePlayerNetID * p) {
 
3045
    if (near)
 
3046
    {
 
3047
        tCoord npos = near->Position();
 
3048
        sg_RespawnPlayer(near->Grid(), arena, npos, p);
 
3049
    }
 
3050
    else
 
3051
        sg_RespawnPlayer(grid, arena, p);
 
3052
}
 
3053
 
2998
3054
void sg_RespawnPlayer(eGrid *grid, gArena *arena, ePlayerNetID *p)
2999
3055
{
3000
3056
    eGameObject *e=p->Object();