mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed line endings in some files
This commit is contained in:
parent
4d8c4ffadb
commit
0e36b772d4
|
@ -1,48 +1,48 @@
|
|||
#ifndef ENGINE_SERVER_REGISTER_H
|
||||
#define ENGINE_SERVER_REGISTER_H
|
||||
|
||||
class CRegister
|
||||
{
|
||||
enum
|
||||
{
|
||||
REGISTERSTATE_START=0,
|
||||
REGISTERSTATE_UPDATE_ADDRS,
|
||||
REGISTERSTATE_QUERY_COUNT,
|
||||
REGISTERSTATE_HEARTBEAT,
|
||||
REGISTERSTATE_REGISTERED,
|
||||
REGISTERSTATE_ERROR
|
||||
};
|
||||
|
||||
struct CMasterserverInfo
|
||||
{
|
||||
NETADDR m_Addr;
|
||||
int m_Count;
|
||||
int m_Valid;
|
||||
int64 m_LastSend;
|
||||
};
|
||||
|
||||
class CNetServer *m_pNetServer;
|
||||
class IEngineMasterServer *m_pMasterServer;
|
||||
|
||||
int m_RegisterState;
|
||||
int64 m_RegisterStateStart;
|
||||
int m_RegisterFirst;
|
||||
int m_RegisterCount;
|
||||
|
||||
class CMasterserverInfo m_aMasterserverInfo[IMasterServer::MAX_MASTERSERVERS];
|
||||
int m_RegisterRegisteredServer;
|
||||
|
||||
void RegisterNewState(int State);
|
||||
void RegisterSendFwcheckresponse(NETADDR *pAddr);
|
||||
void RegisterSendHeartbeat(NETADDR Addr);
|
||||
void RegisterSendCountRequest(NETADDR Addr);
|
||||
void RegisterGotCount(class CNetChunk *pChunk);
|
||||
|
||||
public:
|
||||
CRegister();
|
||||
void Init(class CNetServer *pNetServer, class IEngineMasterServer *pMasterServer);
|
||||
void RegisterUpdate();
|
||||
int RegisterProcessPacket(class CNetChunk *pPacket);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class CRegister
|
||||
{
|
||||
enum
|
||||
{
|
||||
REGISTERSTATE_START=0,
|
||||
REGISTERSTATE_UPDATE_ADDRS,
|
||||
REGISTERSTATE_QUERY_COUNT,
|
||||
REGISTERSTATE_HEARTBEAT,
|
||||
REGISTERSTATE_REGISTERED,
|
||||
REGISTERSTATE_ERROR
|
||||
};
|
||||
|
||||
struct CMasterserverInfo
|
||||
{
|
||||
NETADDR m_Addr;
|
||||
int m_Count;
|
||||
int m_Valid;
|
||||
int64 m_LastSend;
|
||||
};
|
||||
|
||||
class CNetServer *m_pNetServer;
|
||||
class IEngineMasterServer *m_pMasterServer;
|
||||
|
||||
int m_RegisterState;
|
||||
int64 m_RegisterStateStart;
|
||||
int m_RegisterFirst;
|
||||
int m_RegisterCount;
|
||||
|
||||
class CMasterserverInfo m_aMasterserverInfo[IMasterServer::MAX_MASTERSERVERS];
|
||||
int m_RegisterRegisteredServer;
|
||||
|
||||
void RegisterNewState(int State);
|
||||
void RegisterSendFwcheckresponse(NETADDR *pAddr);
|
||||
void RegisterSendHeartbeat(NETADDR Addr);
|
||||
void RegisterSendCountRequest(NETADDR Addr);
|
||||
void RegisterGotCount(class CNetChunk *pChunk);
|
||||
|
||||
public:
|
||||
CRegister();
|
||||
void Init(class CNetServer *pNetServer, class IEngineMasterServer *pMasterServer);
|
||||
void RegisterUpdate();
|
||||
int RegisterProcessPacket(class CNetChunk *pPacket);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// copyright (c) 2007 magnus auvinen, see licence.txt for more info
|
||||
#include "mod.h"
|
||||
|
||||
CGameControllerMOD::CGameControllerMOD(class CGameContext *pGameServer)
|
||||
: IGameController(pGameServer)
|
||||
{
|
||||
// Exchange this to a string that identifies your game mode.
|
||||
// DM, TDM and CTF are reserved for teeworlds original modes.
|
||||
m_pGameType = "MOD";
|
||||
|
||||
//m_GameFlags = GAMEFLAG_TEAMS; // GAMEFLAG_TEAMS makes it a two-team gamemode
|
||||
}
|
||||
|
||||
void CGameControllerMOD::Tick()
|
||||
{
|
||||
// this is the main part of the gamemode, this function is run every tick
|
||||
DoPlayerScoreWincheck(); // checks for winners, no teams version
|
||||
//DoTeamScoreWincheck(); // checks for winners, two teams version
|
||||
|
||||
IGameController::Tick();
|
||||
}
|
||||
#include "mod.h"
|
||||
|
||||
CGameControllerMOD::CGameControllerMOD(class CGameContext *pGameServer)
|
||||
: IGameController(pGameServer)
|
||||
{
|
||||
// Exchange this to a string that identifies your game mode.
|
||||
// DM, TDM and CTF are reserved for teeworlds original modes.
|
||||
m_pGameType = "MOD";
|
||||
|
||||
//m_GameFlags = GAMEFLAG_TEAMS; // GAMEFLAG_TEAMS makes it a two-team gamemode
|
||||
}
|
||||
|
||||
void CGameControllerMOD::Tick()
|
||||
{
|
||||
// this is the main part of the gamemode, this function is run every tick
|
||||
DoPlayerScoreWincheck(); // checks for winners, no teams version
|
||||
//DoTeamScoreWincheck(); // checks for winners, two teams version
|
||||
|
||||
IGameController::Tick();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef GAME_SERVER_GAMEMODES_MOD_H
|
||||
#define GAME_SERVER_GAMEMODES_MOD_H
|
||||
#include <game/server/gamecontroller.h>
|
||||
|
||||
// you can subclass GAMECONTROLLER_CTF, GAMECONTROLLER_TDM etc if you want
|
||||
// todo a modification with their base as well.
|
||||
class CGameControllerMOD : public IGameController
|
||||
{
|
||||
public:
|
||||
CGameControllerMOD(class CGameContext *pGameServer);
|
||||
virtual void Tick();
|
||||
// add more virtual functions here if you wish
|
||||
};
|
||||
#include <game/server/gamecontroller.h>
|
||||
|
||||
// you can subclass GAMECONTROLLER_CTF, GAMECONTROLLER_TDM etc if you want
|
||||
// todo a modification with their base as well.
|
||||
class CGameControllerMOD : public IGameController
|
||||
{
|
||||
public:
|
||||
CGameControllerMOD(class CGameContext *pGameServer);
|
||||
virtual void Tick();
|
||||
// add more virtual functions here if you wish
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
// copyright (c) 2007 magnus auvinen, see licence.txt for more info
|
||||
#include <base/system.h>
|
||||
|
||||
#include <engine/shared/network.h>
|
||||
|
||||
#include "versionsrv.h"
|
||||
|
||||
static CNetClient g_NetOp; // main
|
||||
|
||||
void SendVer(NETADDR *pAddr)
|
||||
{
|
||||
CNetChunk p;
|
||||
unsigned char aData[sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)];
|
||||
|
||||
mem_copy(aData, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION));
|
||||
mem_copy(aData + sizeof(VERSIONSRV_VERSION), VERSION_DATA, sizeof(VERSION_DATA));
|
||||
|
||||
p.m_ClientID = -1;
|
||||
p.m_Address = *pAddr;
|
||||
p.m_Flags = NETSENDFLAG_CONNLESS;
|
||||
p.m_pData = aData;
|
||||
p.m_DataSize = sizeof(aData);
|
||||
|
||||
g_NetOp.Send(&p);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) // ignore_convention
|
||||
{
|
||||
NETADDR BindAddr;
|
||||
|
||||
dbg_logger_stdout();
|
||||
net_init();
|
||||
|
||||
mem_zero(&BindAddr, sizeof(BindAddr));
|
||||
BindAddr.port = VERSIONSRV_PORT;
|
||||
g_NetOp.Open(BindAddr, 0);
|
||||
|
||||
dbg_msg("versionsrv", "started");
|
||||
|
||||
while(1)
|
||||
{
|
||||
g_NetOp.Update();
|
||||
|
||||
// process packets
|
||||
CNetChunk Packet;
|
||||
while(g_NetOp.Recv(&Packet))
|
||||
{
|
||||
if(Packet.m_DataSize == sizeof(VERSIONSRV_GETVERSION) &&
|
||||
mem_comp(Packet.m_pData, VERSIONSRV_GETVERSION, sizeof(VERSIONSRV_GETVERSION)) == 0)
|
||||
{
|
||||
SendVer(&Packet.m_Address);
|
||||
}
|
||||
}
|
||||
|
||||
// be nice to the CPU
|
||||
thread_sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <base/system.h>
|
||||
|
||||
#include <engine/shared/network.h>
|
||||
|
||||
#include "versionsrv.h"
|
||||
|
||||
static CNetClient g_NetOp; // main
|
||||
|
||||
void SendVer(NETADDR *pAddr)
|
||||
{
|
||||
CNetChunk p;
|
||||
unsigned char aData[sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)];
|
||||
|
||||
mem_copy(aData, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION));
|
||||
mem_copy(aData + sizeof(VERSIONSRV_VERSION), VERSION_DATA, sizeof(VERSION_DATA));
|
||||
|
||||
p.m_ClientID = -1;
|
||||
p.m_Address = *pAddr;
|
||||
p.m_Flags = NETSENDFLAG_CONNLESS;
|
||||
p.m_pData = aData;
|
||||
p.m_DataSize = sizeof(aData);
|
||||
|
||||
g_NetOp.Send(&p);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) // ignore_convention
|
||||
{
|
||||
NETADDR BindAddr;
|
||||
|
||||
dbg_logger_stdout();
|
||||
net_init();
|
||||
|
||||
mem_zero(&BindAddr, sizeof(BindAddr));
|
||||
BindAddr.port = VERSIONSRV_PORT;
|
||||
g_NetOp.Open(BindAddr, 0);
|
||||
|
||||
dbg_msg("versionsrv", "started");
|
||||
|
||||
while(1)
|
||||
{
|
||||
g_NetOp.Update();
|
||||
|
||||
// process packets
|
||||
CNetChunk Packet;
|
||||
while(g_NetOp.Recv(&Packet))
|
||||
{
|
||||
if(Packet.m_DataSize == sizeof(VERSIONSRV_GETVERSION) &&
|
||||
mem_comp(Packet.m_pData, VERSIONSRV_GETVERSION, sizeof(VERSIONSRV_GETVERSION)) == 0)
|
||||
{
|
||||
SendVer(&Packet.m_Address);
|
||||
}
|
||||
}
|
||||
|
||||
// be nice to the CPU
|
||||
thread_sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef VERSIONSRV_VERSIONSRV_H
|
||||
#define VERSIONSRV_VERSIONSRV_H
|
||||
static const int VERSIONSRV_PORT = 8302;
|
||||
|
||||
static const unsigned char VERSION_DATA[] = {0x00, 0, 5, 1};
|
||||
|
||||
static const unsigned char VERSIONSRV_GETVERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 'g'};
|
||||
static const unsigned char VERSIONSRV_VERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 's'};
|
||||
static const int VERSIONSRV_PORT = 8302;
|
||||
|
||||
static const unsigned char VERSION_DATA[] = {0x00, 0, 5, 1};
|
||||
|
||||
static const unsigned char VERSIONSRV_GETVERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 'g'};
|
||||
static const unsigned char VERSIONSRV_VERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 's'};
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue