Exemple #1
0
//loads the dungeon depending on the level in the initial state
bool CDungeon::Load(const json::Array& regions, int level) //file read how the level should look like
{
    _level = level;
    
    json::Array::const_iterator iter(regions.Begin());
    json::Array::const_iterator iterEnd(regions.End());
    for (; iter != iterEnd; ++iter)
    {
        const json::Object& region = *iter;
        const json::Number& posX   = region["X"];
        const json::Number& posY   = region["Y"];

        int regionX = posX;
        int regionY = posY;

        if (!_regions[regionX][regionY].Load(region))
            return false;
    }

    return true;
}
Exemple #2
0
/// @brief Load MRU Lists.
/// @param key List name.
/// @param array json::Array of values.
void MRUManager::Load(const std::string &key, const json::Array& array) {
	transform(array.Begin(), array.End(), back_inserter(mru[key]), cast_str);
	Prune(mru[key]);
}