Exemplo n.º 1
0
static JsonElement *ReadPolicyValidatedFile(const char *filename)
{
    bool missing = true;
    struct stat sb;
    if (stat(filename, &sb) != -1)
    {
        missing = false;
    }

    JsonElement *validated_doc = ReadJsonFile(filename);
    if (NULL == validated_doc)
    {
        Log(missing ? LOG_LEVEL_DEBUG : LOG_LEVEL_VERBOSE, "Could not parse policy_validated JSON file '%s', using dummy data", filename);
        validated_doc = JsonObjectCreate(2);
        if (missing)
        {
            JsonObjectAppendInteger(validated_doc, "timestamp", 0);
        }
        else
        {
            JsonObjectAppendInteger(validated_doc, "timestamp", sb.st_mtime);
        }
    }

    return validated_doc;
}
Exemplo n.º 2
0
void Map::Load(char * mapFileName)
{
	int temp[2]={0,0};
	memcpy(_StartPos,temp,sizeof(temp));
	memcpy(_EndPos,temp,sizeof(temp));
	showDialog=-1;
	screenHeight= IwGxGetScreenHeight();
	screenWidth=IwGxGetScreenWidth();
	_layer_base=new Layer;
	_layer_middle=new Layer;
	_layer_maze=new Layer;
	_tileset_map=new TileSet;
	_tileset_maze=new TileSet;
	_path=new Path;
	ReadJsonFile(mapFileName);
	_characterPreIndex=0;
	_NPC=new NPC;
	_NPC->m_Dialogs.append("Hello there!!!!");
	_NPC->m_Dialogs.append("How are you?");
	_NPC->m_Dialogs.append("This is World of MI. Welcome!");
	_NPC->Init();
	
	for(int i=0;i!=9;i++)
	{
		TileObstacle tileObs=TileObstacle();
		tileObs.InitialObstacle(CIwFVec2(0,0),CIwSVec2(_tileWidth,_tileHeight));
		_TileObstacles.append(tileObs);
	}
	//_EventBlock.append(4322);
}
Exemplo n.º 3
0
void Map::Load()
{
	_layer_base=new Layer;
	_layer_middle=new Layer;
	_layer_maze=new Layer;
	_tileset_map=new TileSet;
	_tileset_maze=new TileSet;
	ReadJsonFile("Level Alpha 7.5.json");//hard code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	
	int startPoint_X=22,startPoint_Y=12;
	m_Position=CIwSVec2(startPoint_X*_tileWidth,startPoint_Y*_tileHeight);
	
	for(int i=0;i!=_total;i++)
	{
		m_TileDir.append(0);
	}
}