| 174 | } |
| 175 | |
| 176 | void TCGoalsBuildLineData(void) { |
| 177 | int number_of_goals = Level_goals.GetNumGoals(); |
| 178 | int index, goal_status, count = 0, i; |
| 179 | |
| 180 | // see how many of these are something we want |
| 181 | for (index = 0; index < number_of_goals; index++) { |
| 182 | Level_goals.GoalStatus(index, LO_GET_SPECIFIED, &goal_status); |
| 183 | |
| 184 | if (goal_status & LGF_ENABLED) |
| 185 | count++; |
| 186 | } |
| 187 | |
| 188 | //'count' goals are what we have to display |
| 189 | // allocate memory needed and start filling in |
| 190 | if (count) { |
| 191 | TG_Lines = (tGoalLineInfo *)mem_malloc(sizeof(tGoalLineInfo) * count); |
| 192 | TG_NumLines = count; |
| 193 | TG_SortedList = (int *)mem_malloc(sizeof(int) * count); |
| 194 | if (!TG_SortedList || !TG_Lines) { |
| 195 | // out of memory |
| 196 | Telcom_system.current_status = TS_OFF; |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | // fill in data |
| 201 | i = 0; |
| 202 | for (index = 0; index < number_of_goals; index++) { |
| 203 | Level_goals.GoalStatus(index, LO_GET_SPECIFIED, &goal_status); |
| 204 | |
| 205 | if (goal_status & LGF_ENABLED) { |
| 206 | TG_Lines[i].goal_index = index; |
| 207 | TG_Lines[i].is_active = false; |
| 208 | |
| 209 | // Is this a primary or secondary goal? |
| 210 | if (goal_status & LGF_SECONDARY_GOAL) { |
| 211 | TG_Lines[i].primary = false; |
| 212 | } else { |
| 213 | TG_Lines[i].primary = true; |
| 214 | } |
| 215 | |
| 216 | if (goal_status & LGF_TELCOM_LISTS) { |
| 217 | TG_Lines[i].is_objective = true; |
| 218 | } else { |
| 219 | TG_Lines[i].is_objective = false; |
| 220 | } |
| 221 | |
| 222 | // initialize x/y values to -1, that way they will be filled in when drawn first |
| 223 | // frame. |
| 224 | TG_Lines[i].lx = TG_Lines[i].rx = TG_Lines[i].ty = TG_Lines[i].by = -1; |
| 225 | |
| 226 | i++; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | // Determine which goals are active |
| 231 | int num_active, act_g_index; |
| 232 | num_active = Level_goals.GetNumActivePrimaryGoals(); |
| 233 | for (i = 0; i < num_active; i++) { |
no test coverage detected