MCPcopy Create free account
hub / github.com/TurningWheel/Barony / getAllOtherFollowersForSendAllCommand

Function getAllOtherFollowersForSendAllCommand

src/interface/interface.cpp:2059–2159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2057}
2058
2059std::vector<Entity*> getAllOtherFollowersForSendAllCommand(const int gui_player, Entity* followerToCommand, Monster followerType, int optionSelected)
2060{
2061 std::vector<Entity*> vec;
2062 if ( !followerToCommand )
2063 {
2064 return vec;
2065 }
2066 if ( !commandCanBeSentToAll(optionSelected) )
2067 {
2068 return vec;
2069 }
2070
2071 if ( optionSelected == ALLY_CMD_ATTACK_CONFIRM )
2072 {
2073 // only send commands if we're trying to attack
2074 Entity* target = uidToEntity(followerToCommand->monsterAllyInteractTarget);
2075 if ( target )
2076 {
2077 if ( target->behavior != &actMonster && target->behavior != &actPlayer )
2078 {
2079 return vec;
2080 }
2081 }
2082 else
2083 {
2084 return vec;
2085 }
2086 }
2087
2088 for ( node_t* node = stats[gui_player]->FOLLOWERS.first; node != nullptr; node = node->next )
2089 {
2090 Entity* follower2 = nullptr;
2091 if ( (Uint32*)node->element )
2092 {
2093 if ( follower2 = uidToEntity(*((Uint32*)node->element)) )
2094 {
2095 if ( follower2 == followerToCommand || !follower2->getStats() )
2096 {
2097 continue;
2098 }
2099 auto follower2Type = follower2->getStats()->type;
2100
2101 if ( optionSelected == ALLY_CMD_MOVETO_CONFIRM || optionSelected == ALLY_CMD_FOLLOW
2102 || optionSelected == ALLY_CMD_DEFEND )
2103 {
2104 if ( (followerType == SENTRYBOT || followerType == SPELLBOT)
2105 && (follower2Type != SENTRYBOT && follower2Type != SPELLBOT) )
2106 {
2107 continue; // bots have unique moveto cmd
2108 }
2109 if ( followerType != SENTRYBOT && followerType != SPELLBOT
2110 && (follower2Type == SENTRYBOT || follower2Type == SPELLBOT) )
2111 {
2112 continue; // bots have unique moveto cmd
2113 }
2114 }
2115
2116 if ( optionSelected == ALLY_CMD_FOLLOW )

Callers 1

drawFollowerMenuMethod · 0.85

Calls 8

commandCanBeSentToAllFunction · 0.85
statGetCHRFunction · 0.85
statGetPERFunction · 0.85
isTinkeringFollowerMethod · 0.80
uidToEntityFunction · 0.50
getStatsMethod · 0.45

Tested by

no test coverage detected