| 676 | static MasterReader master_reader; |
| 677 | |
| 678 | bool CGameConfig::Reparse(char *error, size_t maxlength) |
| 679 | { |
| 680 | /* Reset cached data */ |
| 681 | // m_pStrings->Reset(); |
| 682 | m_Offsets.clear(); |
| 683 | m_Sigs.clear(); |
| 684 | |
| 685 | |
| 686 | char path[PLATFORM_MAX_PATH]; |
| 687 | |
| 688 | /* See if we can use the extended gamedata format. */ |
| 689 | //TODO pass in path to gamedata somehow |
| 690 | // g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/master.games.txt", m_File); |
| 691 | |
| 692 | /* Otherwise, it's time to parse the master. */ |
| 693 | SMCError err; |
| 694 | SMCStates state = {0, 0}; |
| 695 | list<char*> fileList; |
| 696 | master_reader.fileList = &fileList; |
| 697 | |
| 698 | err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength); |
| 699 | if (err != SMCError_Okay) |
| 700 | { |
| 701 | const char *msg = textparsers->GetSMCErrorString(err); |
| 702 | |
| 703 | printf("[SM] Error parsing master gameconf file \"%s\":", path); |
| 704 | printf("[SM] Error %d on line %d, col %d: %s", |
| 705 | err, |
| 706 | state.line, |
| 707 | state.col, |
| 708 | msg ? msg : "Unknown error"); |
| 709 | exit(PARSE_ERROR); |
| 710 | } |
| 711 | |
| 712 | /* Go through each file we found and parse it. */ |
| 713 | list<char*>::iterator iter; |
| 714 | for (iter = fileList.begin(); iter != fileList.end(); iter++) |
| 715 | { |
| 716 | UTIL_Format(path, sizeof(path), "%s/%s", m_File, *iter); |
| 717 | if (!EnterFile(path, error, maxlength)) |
| 718 | { |
| 719 | return false; |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | return true; |
| 724 | } |
| 725 | |
| 726 | bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength) |
| 727 | { |
nothing calls this directly
no test coverage detected