Gamerules: Make sure player is always passed as type 'base_player' via
parameters instead of just 'entity'.
This commit is contained in:
parent
43dceb7c5a
commit
c100554dcc
17 changed files with 43 additions and 50 deletions
|
@ -270,7 +270,7 @@ CSGameRules::LevelNewParms(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CSGameRules::PlayerConnect(entity pl)
|
CSGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -291,7 +291,7 @@ CSGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CSGameRules::PlayerDisconnect(entity pl)
|
CSGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
class CSGameRules:CGameRules
|
class CSGameRules:CGameRules
|
||||||
{
|
{
|
||||||
virtual void(entity) PlayerConnect;
|
virtual void(base_player) PlayerConnect;
|
||||||
virtual void(entity) PlayerDisconnect;
|
virtual void(base_player) PlayerDisconnect;
|
||||||
virtual void(base_player) PlayerKill;
|
virtual void(base_player) PlayerKill;
|
||||||
virtual void(base_player) PlayerPostFrame;
|
virtual void(base_player) PlayerPostFrame;
|
||||||
virtual void(base_player) PlayerDeath;
|
virtual void(base_player) PlayerDeath;
|
||||||
|
|
|
@ -32,18 +32,22 @@ void StartFrame(void)
|
||||||
|
|
||||||
void ClientConnect(float csqc_active)
|
void ClientConnect(float csqc_active)
|
||||||
{
|
{
|
||||||
g_grMode.PlayerConnect(self);
|
/* make sure you never change the classname. ever. */
|
||||||
|
if (self.classname != "player") {
|
||||||
|
spawnfunc_player();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_grMode.PlayerConnect((base_player)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDisconnect(void)
|
void ClientDisconnect(void)
|
||||||
{
|
{
|
||||||
g_grMode.PlayerDisconnect(self);
|
g_grMode.PlayerDisconnect((base_player)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientKill(void)
|
void ClientKill(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
g_grMode.PlayerKill((base_player)self);
|
||||||
g_grMode.PlayerKill(pl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectatorThink(void)
|
void SpectatorThink(void)
|
||||||
|
@ -61,15 +65,7 @@ void SpectatorDisconnect(void)
|
||||||
|
|
||||||
void PutClientInServer(void)
|
void PutClientInServer(void)
|
||||||
{
|
{
|
||||||
player pl;
|
g_grMode.PlayerSpawn((base_player)self);
|
||||||
|
|
||||||
/* make sure you never change the classname. ever. */
|
|
||||||
if (self.classname != "player") {
|
|
||||||
spawnfunc_player();
|
|
||||||
}
|
|
||||||
|
|
||||||
pl = (player)self;
|
|
||||||
g_grMode.PlayerSpawn(pl);
|
|
||||||
|
|
||||||
/* activate all game_playerspawn entities */
|
/* activate all game_playerspawn entities */
|
||||||
for (entity a = world; (a = find(a, ::targetname, "game_playerspawn"));) {
|
for (entity a = world; (a = find(a, ::targetname, "game_playerspawn"));) {
|
||||||
|
@ -82,14 +78,12 @@ void PutClientInServer(void)
|
||||||
|
|
||||||
void PlayerPreThink(void)
|
void PlayerPreThink(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
g_grMode.PlayerPreFrame((base_player)self);
|
||||||
g_grMode.PlayerPreFrame(pl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerPostThink(void)
|
void PlayerPostThink(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
g_grMode.PlayerPostFrame((base_player)self);
|
||||||
g_grMode.PlayerPostFrame(pl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetNewParms(void)
|
void SetNewParms(void)
|
||||||
|
@ -101,8 +95,7 @@ void SetNewParms(void)
|
||||||
void SetChangeParms(void)
|
void SetChangeParms(void)
|
||||||
{
|
{
|
||||||
iprint("Setting Level-Change Parameters");
|
iprint("Setting Level-Change Parameters");
|
||||||
player pl = (player)self;
|
g_grMode.LevelChangeParms((base_player)self);
|
||||||
g_grMode.LevelChangeParms(pl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_RunClientCommand(void)
|
void SV_RunClientCommand(void)
|
||||||
|
|
|
@ -35,12 +35,12 @@ CGameRules::ConsoleCommand(base_player pl, string cmd)
|
||||||
|
|
||||||
/* client */
|
/* client */
|
||||||
void
|
void
|
||||||
CGameRules::PlayerConnect(entity pl)
|
CGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
//print("ClientConnect!\n");
|
//print("ClientConnect!\n");
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
CGameRules::PlayerDisconnect(entity pl)
|
CGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
//print("ClientDisconnect!\n");
|
//print("ClientDisconnect!\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ class CGameRules
|
||||||
virtual float(base_player,string) ConsoleCommand;
|
virtual float(base_player,string) ConsoleCommand;
|
||||||
|
|
||||||
/* client */
|
/* client */
|
||||||
virtual void(entity) PlayerConnect;
|
virtual void(base_player) PlayerConnect;
|
||||||
virtual void(entity) PlayerDisconnect;
|
virtual void(base_player) PlayerDisconnect;
|
||||||
virtual void(base_player) PlayerKill;
|
virtual void(base_player) PlayerKill;
|
||||||
virtual void(base_player) PlayerSpawn;
|
virtual void(base_player) PlayerSpawn;
|
||||||
virtual void(base_player) PlayerPreFrame;
|
virtual void(base_player) PlayerPreFrame;
|
||||||
|
|
|
@ -232,7 +232,7 @@ HLGameRules::LevelChangeParms(base_player pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerConnect(entity pl)
|
HLGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -253,7 +253,7 @@ HLGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerDisconnect(entity pl)
|
HLGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ Called whenever a new client connect to the game
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Plugin_PlayerConnect(entity cl)
|
Plugin_PlayerConnect(base_player cl)
|
||||||
{
|
{
|
||||||
int rval;
|
int rval;
|
||||||
int tval;
|
int tval;
|
||||||
|
@ -242,7 +242,7 @@ Called whenever a client leaves the game
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Plugin_PlayerDisconnect(entity cl)
|
Plugin_PlayerDisconnect(base_player cl)
|
||||||
{
|
{
|
||||||
int rval;
|
int rval;
|
||||||
int tval;
|
int tval;
|
||||||
|
|
|
@ -23,6 +23,6 @@ void Plugin_Shutdown(void);
|
||||||
void Plugin_InitEnts(void);
|
void Plugin_InitEnts(void);
|
||||||
int Plugin_RunClientCommand(void);
|
int Plugin_RunClientCommand(void);
|
||||||
int Plugin_ParseClientCommand(string);
|
int Plugin_ParseClientCommand(string);
|
||||||
int Plugin_PlayerConnect(entity);
|
int Plugin_PlayerConnect(base_player);
|
||||||
int Plugin_PlayerDisconnect(entity);
|
int Plugin_PlayerDisconnect(base_player);
|
||||||
void Plugin_PlayerObituary(entity, entity, int, int, int);
|
void Plugin_PlayerObituary(entity, entity, int, int, int);
|
||||||
|
|
|
@ -195,7 +195,7 @@ HLGameRules::LevelChangeParms(base_player pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerConnect(entity pl)
|
HLGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -216,7 +216,7 @@ HLGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerDisconnect(entity pl)
|
HLGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ HLGameRules::PlayerPostFrame(base_player pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerConnect(entity pl)
|
HLGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -231,7 +231,7 @@ HLGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerDisconnect(entity pl)
|
HLGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ SHMultiplayerRules::PlayerPostFrame(base_player pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SHMultiplayerRules::PlayerConnect(entity pl)
|
SHMultiplayerRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -354,7 +354,7 @@ SHMultiplayerRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SHMultiplayerRules::PlayerDisconnect(entity pl)
|
SHMultiplayerRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ class SHMultiplayerRules:CGameRules
|
||||||
{
|
{
|
||||||
/* client */
|
/* client */
|
||||||
virtual void(base_player) PlayerSpawn;
|
virtual void(base_player) PlayerSpawn;
|
||||||
virtual void(entity) PlayerConnect;
|
virtual void(base_player) PlayerConnect;
|
||||||
virtual void(entity) PlayerDisconnect;
|
virtual void(base_player) PlayerDisconnect;
|
||||||
virtual void(base_player) PlayerKill;
|
virtual void(base_player) PlayerKill;
|
||||||
virtual void(base_player) PlayerDeath;
|
virtual void(base_player) PlayerDeath;
|
||||||
virtual void(base_player) PlayerPostFrame;
|
virtual void(base_player) PlayerPostFrame;
|
||||||
|
|
|
@ -128,7 +128,7 @@ TFCGameRules::LevelNewParms(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFCGameRules::PlayerConnect(entity pl)
|
TFCGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||||
|
@ -149,7 +149,7 @@ TFCGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFCGameRules::PlayerDisconnect(entity pl)
|
TFCGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
class TFCGameRules:CGameRules
|
class TFCGameRules:CGameRules
|
||||||
{
|
{
|
||||||
virtual void(entity) PlayerConnect;
|
virtual void(base_player) PlayerConnect;
|
||||||
virtual void(entity) PlayerDisconnect;
|
virtual void(base_player) PlayerDisconnect;
|
||||||
virtual void(base_player) PlayerPostFrame;
|
virtual void(base_player) PlayerPostFrame;
|
||||||
virtual void(base_player) PlayerSpawn;
|
virtual void(base_player) PlayerSpawn;
|
||||||
virtual void(base_player) PlayerKill;
|
virtual void(base_player) PlayerKill;
|
||||||
|
|
|
@ -209,7 +209,7 @@ HLGameRules::PlayerPostFrame(base_player pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerConnect(entity pl)
|
HLGameRules::PlayerConnect(base_player pl)
|
||||||
{
|
{
|
||||||
entity a;
|
entity a;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ HLGameRules::PlayerConnect(entity pl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HLGameRules::PlayerDisconnect(entity pl)
|
HLGameRules::PlayerDisconnect(base_player pl)
|
||||||
{
|
{
|
||||||
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
class HLGameRules:CGameRules
|
class HLGameRules:CGameRules
|
||||||
{
|
{
|
||||||
virtual void(entity) PlayerConnect;
|
virtual void(base_player) PlayerConnect;
|
||||||
virtual void(entity) PlayerDisconnect;
|
virtual void(base_player) PlayerDisconnect;
|
||||||
virtual void(base_player) PlayerKill;
|
virtual void(base_player) PlayerKill;
|
||||||
virtual void(base_player) PlayerPostFrame;
|
virtual void(base_player) PlayerPostFrame;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue