| 618 | |
| 619 | |
| 620 | void ResourceGetter::finalization(char* data, unsigned int length, bool good) { |
| 621 | printf("FIXME -- ResourceGetter::finalization, %i\n", good ? 1 : 0); |
| 622 | |
| 623 | if (!resources.size() || !doingStuff) { |
| 624 | return; // we are suposed to be done |
| 625 | } |
| 626 | |
| 627 | // this is who we are suposed to be geting |
| 628 | trResourceItem item = resources[0]; |
| 629 | resources.erase(resources.begin()); |
| 630 | if (good) { |
| 631 | // save the thing |
| 632 | FILE* fp = fopen(item.filePath.c_str(), "wb"); |
| 633 | if (fp) { |
| 634 | fwrite(data, length, 1, fp); |
| 635 | fclose(fp); |
| 636 | } |
| 637 | |
| 638 | } |
| 639 | |
| 640 | if (item.doneFunc != NULL) { |
| 641 | item.doneFunc(item, good); |
| 642 | } |
| 643 | |
| 644 | // do the next one if we must |
| 645 | getResource(); |
| 646 | } |
| 647 | |
| 648 | |
| 649 | bool ResourceGetter::itemExists(trResourceItem& item) { |