MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AIGetTeam

Function AIGetTeam

Descent3/AImain.cpp:5656–5688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5654}
5655
5656int AIGetTeam(object *obj) {
5657 int t_team;
5658
5659 if (obj->type == OBJ_PLAYER) {
5660 if (Num_teams > 1 || ((Game_mode & GM_MULTI) && Num_teams <= 1 && !(Netgame.flags & NF_DAMAGE_FRIENDLY))) {
5661 t_team = AIF_TEAM_REBEL + PlayerGetTeam(obj->id) + 1;
5662 //@@t_team = AIF_TEAM_REBEL + Players[obj->id].team + 1;
5663 } else {
5664 t_team = AIF_TEAM_REBEL + obj->id + 1;
5665 }
5666 } else {
5667 if (obj->ai_info->flags & AIF_ACT_AS_NEUTRAL_UNTIL_SHOT) {
5668 t_team = AIF_TEAM_NEUTRAL;
5669 } else {
5670 t_team = obj->ai_info->flags & AIF_TEAM_MASK;
5671
5672 if (t_team == AIF_TEAM_REBEL) {
5673 object *p = ObjGet(obj->parent_handle);
5674
5675 if (p && (p->type == OBJ_PLAYER || p->type == OBJ_GHOST)) {
5676 if (Num_teams > 1) {
5677 t_team += PlayerGetTeam(p->id) + 1;
5678 //@@t_team += Players[p->id].team + 1;
5679 } else {
5680 t_team += p->id + 1;
5681 }
5682 }
5683 }
5684 }
5685 }
5686
5687 return t_team;
5688}
5689
5690bool AIObjFriend(object *obj, object *target) {
5691 bool f_friend = false;

Callers 2

AIObjFriendFunction · 0.85
AIObjEnemyFunction · 0.85

Calls 2

PlayerGetTeamFunction · 0.85
ObjGetFunction · 0.85

Tested by

no test coverage detected