Call with NULL to poll Call with -1 to cancel wait Call with valid pointer to a vmt_descent3_struct to get a response
| 339 | // Call with -1 to cancel wait |
| 340 | // Call with valid pointer to a vmt_descent3_struct to get a response |
| 341 | int GetD3PilotData(vmt_descent3_struct *d3_pilot, char *pilot_name, char *tracker_id) { |
| 342 | // First check the network |
| 343 | PollPTrackNet(); |
| 344 | |
| 345 | if (d3_pilot == nullptr) { |
| 346 | if (D3ReadState == STATE_IDLE) { |
| 347 | return -3; |
| 348 | } |
| 349 | if (D3ReadState == STATE_READING_PILOT) { |
| 350 | return 0; |
| 351 | } |
| 352 | if (D3ReadState == STATE_RECEIVED_PILOT) { |
| 353 | // We got this pilot, and now we are about to inform the app, so back to idle |
| 354 | D3ReadState = STATE_IDLE; |
| 355 | ReadD3Pilot = nullptr; |
| 356 | |
| 357 | return 1; |
| 358 | } |
| 359 | if (D3ReadState == STATE_TIMED_OUT) { |
| 360 | // We gave up on this pilot, and now we are about to inform the app, so back to idle |
| 361 | D3ReadState = STATE_IDLE; |
| 362 | ReadD3Pilot = nullptr; |
| 363 | return -1; |
| 364 | } |
| 365 | if (D3ReadState == STATE_PILOT_NOT_FOUND) { |
| 366 | // The tracker said this dude is not found. |
| 367 | D3ReadState = STATE_IDLE; |
| 368 | ReadD3Pilot = nullptr; |
| 369 | return 3; |
| 370 | } |
| 371 | |
| 372 | } else if (D3ReadState == STATE_IDLE) { |
| 373 | // New request, send out the req, and go for it. |
| 374 | |
| 375 | D3ReadState = STATE_READING_PILOT; |
| 376 | ReadD3Pilot = d3_pilot; |
| 377 | D3LastSent = DLLtimer_GetTime(); |
| 378 | D3FirstSent = DLLtimer_GetTime(); // DLLtimer_GetTime(); |
| 379 | |
| 380 | d3_pilot_req.len = INTEL_SHORT(PACKED_HEADER_ONLY_SIZE + sizeof(pilot_request)); |
| 381 | d3_pilot_req.type = UNT_PILOT_DATA_READ; |
| 382 | d3_pilot_req.code = INTEL_INT(CMD_GAME_DESCENT3); |
| 383 | strcpy(d3_pr->pilot_name, pilot_name); |
| 384 | strcpy(d3_pr->tracker_id, tracker_id); |
| 385 | strcpy(ProccesingPilot, pilot_name); |
| 386 | return 0; |
| 387 | } |
| 388 | return -2; |
| 389 | } |
| 390 | |
| 391 | int GetD3PilotDataCancel() { |
| 392 | // First check the network |
no test coverage detected