ddnet/src/game/server/gamemodes/DDRace.cpp

49 lines
1.5 KiB
C++
Raw Normal View History

/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
2010-10-29 21:28:15 +00:00
/*Based on rajh's, Redix's & Sushi Tee's, DDRace mod stuff and tweaked byt btd and GreYFoX@GTi with STL to fit our DDRace needs*/
#include <engine/server.h>
#include <game/mapitems.h>
#include <game/server/entities/character.h>
#include <game/server/player.h>
#include <game/server/gamecontext.h>
#include "DDRace.h"
#include "gamemode.h"
CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) : IGameController(pGameServer), m_Teams(pGameServer)
{
m_pGameType = GAME_NAME;
InitTeleporter();
}
CGameControllerDDRace::~CGameControllerDDRace()
{
//Nothing to clean
}
void CGameControllerDDRace::Tick()
{
IGameController::Tick();
}
void CGameControllerDDRace::InitTeleporter()
{
if(!GameServer()->Collision()->Layers()->TeleLayer()) return;
int Width = GameServer()->Collision()->Layers()->TeleLayer()->m_Width;
int Height = GameServer()->Collision()->Layers()->TeleLayer()->m_Height;
2010-10-04 07:59:16 +00:00
for(int i = 0; i < Width*Height; i++)
{
if(GameServer()->Collision()->TeleLayer()[i].m_Number > 0)
{
if(GameServer()->Collision()->TeleLayer()[i].m_Type == TILE_TELEOUT)
{
m_TeleOuts[GameServer()->Collision()->TeleLayer()[i].m_Number-1].push_back(vec2(i % Width*32+16, i/Width*32+16));
}
else if(GameServer()->Collision()->TeleLayer()[i].m_Type == TILE_TELECHECKOUT)
{
m_TeleCheckOuts[GameServer()->Collision()->TeleLayer()[i].m_Number-1].push_back(vec2(i % Width*32+16, i/Width*32+16));
}
}
}
}