| 537 | } |
| 538 | |
| 539 | void UpdateGamelist(void *lb) { |
| 540 | |
| 541 | int i, j; |
| 542 | |
| 543 | // Look for items that we need to remove |
| 544 | for (i = 0; i < MAX_GAMELIST_ITEMS; i++) { |
| 545 | bool found = false; |
| 546 | if (PXOGamelist[i].used) { |
| 547 | for (j = 0; j < *DLLNum_network_games_known; j++) { |
| 548 | if (DLLNetwork_games[j].handle == PXOGamelist[i].handle) { |
| 549 | found = true; |
| 550 | } |
| 551 | } |
| 552 | if (!found) { |
| 553 | // Remove this item! |
| 554 | /* |
| 555 | int gameid = GetGameByHandle(PXOGamelist[i].handle); |
| 556 | |
| 557 | if(gameid!=-1) |
| 558 | { |
| 559 | DLLmprintf(0,"Removing %s\n",DLLNetwork_games[gameid].name); |
| 560 | } |
| 561 | */ |
| 562 | |
| 563 | // Now we need to fix up the lb_no items because we removed this one! |
| 564 | int k = 0; |
| 565 | for (k = 0; k < MAX_GAMELIST_ITEMS; k++) { |
| 566 | if (!PXOGamelist[k].used) |
| 567 | continue; |
| 568 | |
| 569 | // This is yucky, but it accounts for the shifting up of the game items in the list |
| 570 | if (PXOGamelist[i].lb_no < PXOGamelist[k].lb_no) |
| 571 | PXOGamelist[k].lb_no--; |
| 572 | } |
| 573 | NextGameItemNo--; |
| 574 | PXOGamelist[i].used = false; |
| 575 | PXOGamelist[i].handle = -1; |
| 576 | DLLListRemoveItem(lb, PXOGamelist[i].ti); |
| 577 | DLLRemoveUITextItem(PXOGamelist[i].ti); |
| 578 | } |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | // Look for items to add |
| 583 | for (i = 0; i < *DLLNum_network_games_known; i++) { |
| 584 | bool found = false; |
| 585 | for (j = 0; j < MAX_GAMELIST_ITEMS; j++) { |
| 586 | if (DLLNetwork_games[i].handle == PXOGamelist[j].handle) { |
| 587 | found = true; |
| 588 | } |
| 589 | } |
| 590 | if (!found) { |
| 591 | // Add this item! |
| 592 | // Update PXOGamelist[i].ti |
| 593 | for (j = 0; j < MAX_GAMELIST_ITEMS; j++) { |
| 594 | if (!PXOGamelist[j].used) { |
| 595 | // Aha! an empty slot |
| 596 | break; |
no test coverage detected