Skip to content

Commit

Permalink
Moved for loop varaible to top of function for qvm
Browse files Browse the repository at this point in the history
  • Loading branch information
SpookyScaryDev committed Sep 16, 2024
1 parent 74a0e8c commit 8eae078
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bot_botgoals.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void UpdateGoalEntity(gedict_t *item, gedict_t *taker)
static qbool GoalLeaveForTeammate(gedict_t *self, gedict_t *goal_entity)
{
gedict_t* plr;
int item;

if ((g_globalvars.time < goal_entity->fb.touchPlayerTime) && goal_entity->fb.touchPlayer
&& (goal_entity->fb.touchPlayer != self))
Expand All @@ -80,9 +81,9 @@ static qbool GoalLeaveForTeammate(gedict_t *self, gedict_t *goal_entity)
{ "item_artifact_invulnerability", "item_artifact_invisibility",
"item_artifact_super_damage", "item_flag_team1", "item_flag_team2" };

for (int i = 0; i < sizeof(ignore) / sizeof(ignore[0]); ++i)
for (item = 0; item < sizeof(ignore) / sizeof(ignore[0]); ++item)
{
if (streq(goal_entity->classname, ignore[i])) return false;
if (streq(goal_entity->classname, ignore[item])) return false;
}

// Let the bot with the highest desire take the item, if the bots can see each other.
Expand Down

0 comments on commit 8eae078

Please sign in to comment.