- Renamed FBot to DBot and made it inherit from DThinker.

- Fixed: Bots added by players other than the net arbitrator did not have their skill set.
This commit is contained in:
ChillyDoom 2014-10-14 19:57:11 +01:00
commit db323643f8
24 changed files with 356 additions and 327 deletions

View file

@ -697,7 +697,7 @@ void PlayerIsGone (int netnode, int netconsole)
// Pick a new network arbitrator
for (int i = 0; i < MAXPLAYERS; i++)
{
if (i != netconsole && playeringame[i] && !players[i].Bot.isbot)
if (i != netconsole && playeringame[i] && players[i].Bot == NULL)
{
Net_Arbitrator = i;
players[i].settings_controller = true;
@ -902,7 +902,7 @@ void GetPackets (void)
for (i = 0; i < numplayers; ++i)
{
int node = !players[playerbytes[i]].Bot.isbot ?
int node = (players[playerbytes[i]].Bot == NULL) ?
nodeforplayer[playerbytes[i]] : netnode;
SkipTicCmd (&start, nettics[node] - realstart);
@ -918,7 +918,7 @@ void GetPackets (void)
// packet.
for (i = 0; i < numplayers; ++i)
{
if (!players[playerbytes[i]].Bot.isbot)
if (players[playerbytes[i]].Bot == NULL)
{
nettics[nodeforplayer[playerbytes[i]]] = realend;
}
@ -935,10 +935,10 @@ void AdjustBots (int gameticdiv)
// be in even when gametic lags behind maketic.
for (int i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && players[i].Bot.isbot && players[i].mo)
if (playeringame[i] && players[i].Bot != NULL && players[i].mo)
{
players[i].Bot.savedyaw = players[i].mo->angle;
players[i].Bot.savedpitch = players[i].mo->pitch;
players[i].Bot->savedyaw = players[i].mo->angle;
players[i].Bot->savedpitch = players[i].mo->pitch;
for (int j = gameticdiv; j < maketic/ticdup; j++)
{
players[i].mo->angle += (netcmds[i][j%BACKUPTICS].ucmd.yaw << 16) * ticdup;
@ -952,10 +952,10 @@ void UnadjustBots ()
{
for (int i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && players[i].Bot.isbot && players[i].mo)
if (playeringame[i] && players[i].Bot != NULL && players[i].mo)
{
players[i].mo->angle = players[i].Bot.savedyaw;
players[i].mo->pitch = players[i].Bot.savedpitch;
players[i].mo->angle = players[i].Bot->savedyaw;
players[i].mo->pitch = players[i].Bot->savedpitch;
}
}
}
@ -1127,7 +1127,7 @@ void NetUpdate (void)
{
if (playeringame[j])
{
if (players[j].Bot.isbot || NetMode == NET_PacketServer)
if (players[j].Bot != NULL || NetMode == NET_PacketServer)
{
count++;
}
@ -1269,7 +1269,7 @@ void NetUpdate (void)
{
if (playeringame[j] && j != playerfornode[i] && j != consoleplayer)
{
if (players[j].Bot.isbot || NetMode == NET_PacketServer)
if (players[j].Bot != NULL || NetMode == NET_PacketServer)
{
playerbytes[l++] = j;
netbuffer[k++] = j;
@ -1308,7 +1308,7 @@ void NetUpdate (void)
}
else if (i != 0)
{
if (players[playerbytes[l]].Bot.isbot)
if (players[playerbytes[l]].Bot != NULL)
{
WriteWord (0, &cmddata); // fake consistancy word
}
@ -2250,10 +2250,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
break;
case DEM_ADDBOT:
{
BYTE num = ReadByte (stream);
bglobal.DoAddBot (num, s = ReadString (stream));
}
bglobal.DoAddBot (stream);
break;
case DEM_KILLBOTS:
@ -2709,10 +2706,13 @@ void Net_SkipCommand (int type, BYTE **stream)
switch (type)
{
case DEM_SAY:
case DEM_ADDBOT:
skip = strlen ((char *)(*stream + 1)) + 2;
break;
case DEM_ADDBOT:
skip = strlen ((char *)(*stream + 1)) + 6;
break;
case DEM_GIVECHEAT:
case DEM_TAKECHEAT:
skip = strlen ((char *)(*stream)) + 3;
@ -2874,7 +2874,7 @@ static void Network_Controller (int playernum, bool add)
return;
}
if (players[playernum].Bot.isbot)
if (players[playernum].Bot != NULL)
{
Printf ("Bots cannot be added to the controller list.\n");
return;