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

Function NewPltUpdate

Descent3/pilot.cpp:1490–1528  ·  view source on GitHub ↗

////////////////////////////////////////////////////// copies a pilot to another bool PilotCopy(pilot *Src,pilot *Dest) { char sname[PILOT_STRING_SIZE]; char sship[PAGENAME_LEN]; uint8_t sdiff; Src->get_name(sname); Src->get_ship(sship); Src->get_difficulty(&sdiff); Dest->set_name(sname); Dest->set_ship(sship); Dest->set_dif

Source from the content-addressed store, hash-verified

1488/////////////////////////////////////////////////////
1489// Updates the pilot listbox
1490void NewPltUpdate(newuiListBox *list, char **flist, int filecount, int selected, char *filename) {
1491 int index;
1492 pilot tPilot;
1493
1494 list->RemoveAll();
1495
1496 if (pilot_items) {
1497 delete[] pilot_items;
1498 pilot_items = NULL;
1499 }
1500
1501 if (filecount) {
1502 // create UIItems
1503 char pname[PILOT_STRING_SIZE];
1504
1505 for (index = 0; index < filecount; index++) {
1506 tPilot.set_filename(flist[index]);
1507 PltReadFile(&tPilot);
1508
1509 tPilot.get_name(pname);
1510
1511 list->AddItem(pname);
1512 }
1513
1514 list->SetCurrentIndex(selected);
1515
1516 if (filename && (cfexist(filename) != CFES_NOT_FOUND)) {
1517 // get the selected pilot from the filename
1518 mprintf(0, "Looking for Pilot: %s\n", filename);
1519 for (int d = 0; d < filecount; d++) {
1520 if (!stricmp(flist[d], filename)) {
1521 // ok we found the filename that they want as the pilot
1522 list->SetCurrentIndex(d);
1523 break;
1524 }
1525 }
1526 }
1527 }
1528}
1529
1530// updates the current pilot's information (level played, mission played, etc)
1531// call after every successful mission completion

Callers 2

PilotSelectFunction · 0.85
PilotChooseFunction · 0.85

Calls 7

PltReadFileFunction · 0.85
cfexistFunction · 0.85
set_filenameMethod · 0.80
RemoveAllMethod · 0.45
get_nameMethod · 0.45
AddItemMethod · 0.45
SetCurrentIndexMethod · 0.45

Tested by

no test coverage detected