Beispiel #1
0
 void VMapManager::preventMapsFromBeingUsed(const char* pMapIdString)
 {
     if(pMapIdString != NULL)
     {
         unsigned int pos =0;
         unsigned int id;
         std::string confString(pMapIdString);
         chompAndTrim(confString);
         while(getNextMapId(confString, pos, id))
         {
             iIgnoreMapIds.set(id, true);
         }
     }
 }
void VMapFactory::preventSpellsFromBeingTestedForLoS(
		const char* pSpellIdString) {
	if (!iIgnoreSpellIds)
		iIgnoreSpellIds = new Table<unsigned int, bool>();
	if (pSpellIdString != NULL) {
		unsigned int pos = 0;
		unsigned int id;
		std::string confString(pSpellIdString);
		chompAndTrim(confString);
		while (getNextId(confString, pos, id)) {
			iIgnoreSpellIds->set(id, true);
		}
	}
}
Beispiel #3
0
bool Player::requiredQuests(const char* pQuestIdString)
{
    if (pQuestIdString != nullptr)
    {
        unsigned int pos = 0;
        unsigned int id;
        std::string confString(pQuestIdString);
        chompAndTrim(confString);
        while (getNextQuestId(confString, pos, id))
        {
            QuestStatus status = GetQuestStatus(id);
            if (status == QUEST_STATUS_COMPLETE)
                return true;
        }
    }
    return false;
}
bool getNextId(const std::string& pString, unsigned int& pStartPos,
		unsigned int& pId) {
	bool result = false;
	unsigned int i;
	for (i = pStartPos; i < pString.size(); ++i) {
		if (pString[i] == ',') {
			break;
		}
	}
	if (i > pStartPos) {
		std::string idString = pString.substr(pStartPos, i - pStartPos);
		pStartPos = i + 1;
		chompAndTrim(idString);
		pId = atoi(idString.c_str());
		result = true;
	}
	return (result);
}
Beispiel #5
0
bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa)
{
    bool result = false;
    char buffer[501];
    FILE *cf = fopen(pConffile, "rb");
    if(cf) {
        while(fgets(buffer, 500, cf)) {
            std::string name = std::string(buffer);
            size_t pos = name.find_first_not_of(' ');
            name = name.substr(pos);
            chompAndTrim(name); // just to be sure
            if(name[0] != '#' && name.size() >0) { // comment?
                unsigned int mapId = atoi(name.c_str());
                pTa->addWorldAreaMapId(mapId);
            }
        }
        fclose(cf);
        result = true;
    }
    return(result);
}