#include "precompile.h" #include "modManage.h" #include #include #include using namespace std; map modManage; int paramSplit(char* srcStr, char dstParam[10][MAX_PATH]) { char *split = " ", *p = NULL; int i = 0; if (NULL == srcStr || NULL == dstParam) return -1; p = strtok(srcStr, split); for (i = 0; p != NULL; i++) { strcpy(&(dstParam[i][0]), p); p = strtok(NULL,split); } return i; } const mod_runInfo* queryModInfo(const char *modName) { if(NULL == modName) return NULL; map::iterator iter = modManage.find(string(modName)); if (iter != modManage.end()) return iter->second; else return NULL; } int AddmodInfo(mod_runInfo* threadInfo, const char *modName) { if (NULL == queryModInfo(modName)) modManage.insert(pair(string(modName), threadInfo)); return 0; } int removeModInfo(const char *modName) { if (NULL == modName) return -1; map::iterator iter = modManage.find(string(modName)); if (iter != modManage.end()) { free(iter->second); modManage.erase(iter); } return 0; }