ddnet/src/game/server/srv_tdm.cpp

44 lines
968 B
C++
Raw Normal View History

2007-11-25 19:42:40 +00:00
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#include <engine/config.h>
#include "srv_common.h"
#include "srv_tdm.h"
gameobject_tdm::gameobject_tdm()
{
is_teamplay = true;
}
2007-11-26 19:18:49 +00:00
int gameobject_tdm::on_player_death(class player *victim, class player *killer, int weapon)
{
gameobject::on_player_death(victim, killer, weapon);
if(weapon >= 0)
{
// do team scoring
if(killer == victim)
teamscore[killer->team&1]--; // klant arschel
else
teamscore[killer->team&1]++; // good shit
}
return 0;
}
void gameobject_tdm::tick()
{
2007-11-26 19:18:49 +00:00
if(game_over_tick == -1 && !warmup)
{
// check score win condition
2007-10-03 21:32:02 +00:00
if((config.scorelimit > 0 && (teamscore[0] >= config.scorelimit || teamscore[1] >= config.scorelimit)) ||
(config.timelimit > 0 && (server_tick()-round_start_tick) >= config.timelimit*server_tickspeed()*60))
{
2007-11-26 19:18:49 +00:00
if(teamscore[0] != teamscore[0])
endround();
else
sudden_death = 1;
}
}
2007-10-04 23:58:22 +00:00
gameobject::tick();
}