- Removed p_leader.

This commit is contained in:
ChillyDoom 2014-10-21 19:31:11 +01:00
parent fafb0a672c
commit c9bc9b427c
2 changed files with 15 additions and 19 deletions

View file

@ -125,6 +125,7 @@ private:
//(B_Func.c) //(B_Func.c)
bool Reachable (AActor *actor, AActor *target); bool Reachable (AActor *actor, AActor *target);
void Dofire (AActor *actor, ticcmd_t *cmd); void Dofire (AActor *actor, ticcmd_t *cmd);
bool IsLeader (player_t *player);
AActor *Choose_Mate (AActor *bot); AActor *Choose_Mate (AActor *bot);
AActor *Find_enemy (AActor *bot); AActor *Find_enemy (AActor *bot);
void SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum); void SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum);

View file

@ -270,6 +270,19 @@ shootmissile:
//actor->angle = R_PointToAngle2(actor->x, actor->y, actor->player->enemy->x, actor->player->enemy->y); //actor->angle = R_PointToAngle2(actor->x, actor->y, actor->player->enemy->x, actor->player->enemy->y);
} }
bool FCajunMaster::IsLeader (player_t *player)
{
for (int count = 0; count < MAXPLAYERS; count++)
{
if (players[count].Bot != NULL
&& players[count].Bot->mate == player->mo)
{
return true;
}
}
return false;
}
//This function is called every //This function is called every
//tick (for each bot) to set //tick (for each bot) to set
@ -277,11 +290,9 @@ shootmissile:
AActor *FCajunMaster::Choose_Mate (AActor *bot) AActor *FCajunMaster::Choose_Mate (AActor *bot)
{ {
int count; int count;
int count2;
fixed_t closest_dist, test; fixed_t closest_dist, test;
AActor *target; AActor *target;
AActor *observer; AActor *observer;
bool p_leader[MAXPLAYERS];
//is mate alive? //is mate alive?
if (bot->player->Bot->mate) if (bot->player->Bot->mate)
@ -299,22 +310,6 @@ AActor *FCajunMaster::Choose_Mate (AActor *bot)
if (bot->player->Bot->last_mate->health <= 0) if (bot->player->Bot->last_mate->health <= 0)
bot->player->Bot->last_mate = NULL; bot->player->Bot->last_mate = NULL;
for (count = 0; count < MAXPLAYERS; count++)
{
if (!playeringame[count])
continue;
p_leader[count] = false;
for (count2 = 0; count2 < MAXPLAYERS; count2++)
{
if (players[count2].Bot != NULL
&& players[count2].Bot->mate == players[count].mo)
{
p_leader[count] = true;
break;
}
}
}
target = NULL; target = NULL;
closest_dist = FIXED_MAX; closest_dist = FIXED_MAX;
if (bot_observer) if (bot_observer)
@ -334,7 +329,7 @@ AActor *FCajunMaster::Choose_Mate (AActor *bot)
&& client->mo->health > 0 && client->mo->health > 0
&& client->mo != observer && client->mo != observer
&& ((bot->health/2) <= client->mo->health || !deathmatch) && ((bot->health/2) <= client->mo->health || !deathmatch)
&& !p_leader[count]) //taken? && !IsLeader(client)) //taken?
{ {
if (P_CheckSight (bot, client->mo, SF_IGNOREVISIBILITY)) if (P_CheckSight (bot, client->mo, SF_IGNOREVISIBILITY))
{ {