- Handle level in bot code

This commit is contained in:
Christoph Oelckers 2019-01-29 04:27:21 +01:00
parent 14971c8c3a
commit 06e5dd1d86
6 changed files with 14 additions and 14 deletions

View file

@ -120,8 +120,8 @@ public:
void Init ();
void End();
bool SpawnBot (const char *name, int color = NOCOLOR);
void TryAddBot (uint8_t **stream, int player);
void RemoveAllBots (bool fromlist);
void TryAddBot (FLevelLocals *Level, uint8_t **stream, int player);
void RemoveAllBots (FLevelLocals *Level, bool fromlist);
bool LoadBots ();
void ForgetBots ();
@ -153,7 +153,7 @@ public:
private:
//(b_game.cpp)
bool DoAddBot (uint8_t *info, botskill_t skill);
bool DoAddBot (FLevelLocals *Level, uint8_t *info, botskill_t skill);
protected:
bool ctf;

View file

@ -340,7 +340,7 @@ bool FCajunMaster::SpawnBot (const char *name, int color)
return true;
}
void FCajunMaster::TryAddBot (uint8_t **stream, int player)
void FCajunMaster::TryAddBot (FLevelLocals *Level, uint8_t **stream, int player)
{
int botshift = ReadByte (stream);
char *info = ReadString (stream);
@ -363,7 +363,7 @@ void FCajunMaster::TryAddBot (uint8_t **stream, int player)
}
}
if (DoAddBot ((uint8_t *)info, skill))
if (DoAddBot (Level,(uint8_t *)info, skill))
{
//Increment this.
botnum++;
@ -384,7 +384,7 @@ void FCajunMaster::TryAddBot (uint8_t **stream, int player)
delete[] info;
}
bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
bool FCajunMaster::DoAddBot (FLevelLocals *Level, uint8_t *info, botskill_t skill)
{
int bnum;
@ -405,7 +405,7 @@ bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
D_ReadUserInfoStrings (bnum, &info, false);
multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
players[bnum].Bot = level.CreateThinker<DBot>();
players[bnum].Bot = Level->CreateThinker<DBot>();
players[bnum].Bot->player = &players[bnum];
players[bnum].Bot->skill = skill;
playeringame[bnum] = true;
@ -417,11 +417,11 @@ bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
else
Printf ("%s joined the game\n", players[bnum].userinfo.GetName());
level.DoReborn (bnum, true);
Level->DoReborn (bnum, true);
return true;
}
void FCajunMaster::RemoveAllBots (bool fromlist)
void FCajunMaster::RemoveAllBots (FLevelLocals *Level, bool fromlist)
{
int i, j;

View file

@ -954,7 +954,7 @@ void D_Display ()
void D_ErrorCleanup ()
{
savegamerestore = false;
bglobal.RemoveAllBots (true);
bglobal.RemoveAllBots (&level, true);
D_QuitNetGame ();
if (demorecording || demoplayback)
G_CheckDemoStatus ();

View file

@ -2230,11 +2230,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
break;
case DEM_ADDBOT:
bglobal.TryAddBot (stream, player);
bglobal.TryAddBot (&level, stream, player);
break;
case DEM_KILLBOTS:
bglobal.RemoveAllBots (true);
bglobal.RemoveAllBots (&level, true);
Printf ("Removed all bots\n");
break;

View file

@ -1893,7 +1893,7 @@ void G_DoLoadGame ()
// Read intermission data for hubs
G_SerializeHub(arc);
bglobal.RemoveAllBots(true);
bglobal.RemoveAllBots(&level, true);
FString cvar;
arc("importantcvars", cvar);

View file

@ -1161,7 +1161,7 @@ void FLevelLocals::WorldDone (void)
//Added by mc
if (deathmatch)
{
bglobal.RemoveAllBots(consoleplayer != Net_Arbitrator);
bglobal.RemoveAllBots(this, consoleplayer != Net_Arbitrator);
}
if (flags & LEVEL_CHANGEMAPCHEAT)