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

Method GetNumActiveSecondaryGoals

Descent3/levelgoal.cpp:1010–1058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008}
1009
1010int levelgoals::GetNumActiveSecondaryGoals() {
1011 int x;
1012 m_num_active_secondaries = 0;
1013
1014 int i;
1015 int bestp[4];
1016 int cp; // Current priority
1017 char cl; // Current list
1018 int temp_p[MAX_GOAL_LISTS][MAX_LEVEL_GOALS];
1019 char temp_g[MAX_GOAL_LISTS][MAX_LEVEL_GOALS];
1020
1021 int temp_count[MAX_GOAL_LISTS];
1022
1023 for (i = 0; i < MAX_GOAL_LISTS; i++) {
1024 bestp[i] = -1;
1025 temp_count[i] = 0;
1026 }
1027
1028 // Determine the active number for the current list
1029 for (i = 0; i < m_num_goals; i++) {
1030 int flags;
1031 m_goal[i].GetStatus(i, LO_GET_SPECIFIED, &flags);
1032
1033 if (!(flags & (LGF_COMPLETED | LGF_FAILED))) {
1034 if (flags & LGF_ENABLED) {
1035 if (flags & LGF_SECONDARY_GOAL) {
1036 m_goal[i].GoalList(LO_GET_SPECIFIED, &cl);
1037 m_goal[i].Priority(i, LO_GET_SPECIFIED, &cp);
1038
1039 if (bestp[cl] == -1 || cp <= bestp[cl]) {
1040 bestp[cl] = cp;
1041 temp_p[cl][temp_count[cl]] = cp;
1042 temp_g[cl][(temp_count[cl])++] = i;
1043 }
1044 }
1045 }
1046 }
1047 }
1048
1049 for (x = 0; x < MAX_GOAL_LISTS; x++) {
1050 for (i = 0; i < temp_count[x]; i++) {
1051 if (temp_p[x][i] == bestp[x]) {
1052 m_active_secondaries[m_num_active_secondaries++] = temp_g[x][i];
1053 }
1054 }
1055 }
1056
1057 return m_num_active_secondaries;
1058}
1059
1060int levelgoals::GetActiveSecondaryGoal(int s_index) {
1061 if (s_index < 0 || s_index >= m_num_active_secondaries)

Callers 2

osipf_LGoalValueFunction · 0.80
TCGoalsBuildLineDataFunction · 0.80

Calls 3

GoalListMethod · 0.80
PriorityMethod · 0.80
GetStatusMethod · 0.45

Tested by

no test coverage detected