添加waypoing dat

This commit is contained in:
aozhiwei 2019-06-01 17:40:13 +08:00
parent 366eeab683
commit c8007e81dd
2 changed files with 95 additions and 85 deletions

View File

@ -30,7 +30,7 @@ namespace f8
return itr != prop_hash.end(); return itr != prop_hash.end();
} }
bool TiledMap::LoadTmxFile(const std::string& filename) bool TiledMap::LoadTmxFile(const std::string& filename, bool new_tmx_format)
{ {
a8::XObject xobj; a8::XObject xobj;
if (!xobj.ReadFromXmlFile(filename)) { if (!xobj.ReadFromXmlFile(filename)) {
@ -401,10 +401,10 @@ namespace f8
return true; return true;
} }
return false; return false;
} }
std::vector<GridCell*> TiledMap::SortGridList(std::vector<GridCell*>* grid_list, StagePoint* sp) std::vector<GridCell*> TiledMap::SortGridList(std::vector<GridCell*>* grid_list, StagePoint* sp)
{ {
std::vector<GridCell*> grid_sort_list; std::vector<GridCell*> grid_sort_list;
std::map<GridCell*, bool> grid_tag_hash; std::map<GridCell*, bool> grid_tag_hash;
int grid_list_count = grid_list->size(); int grid_list_count = grid_list->size();
@ -449,10 +449,10 @@ std::vector<GridCell*> TiledMap::SortGridList(std::vector<GridCell*>* grid_list,
} }
} }
return grid_sort_list; return grid_sort_list;
} }
void TiledMap::SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash) void TiledMap::SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash)
{ {
for (auto& pair : stage_path_hash) { for (auto& pair : stage_path_hash) {
for (auto& grid_cell : pair.second) { for (auto& grid_cell : pair.second) {
auto itr = area_speed_hash.find(grid_cell->speed); auto itr = area_speed_hash.find(grid_cell->speed);
@ -461,5 +461,11 @@ void TiledMap::SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash)
} }
} }
} }
} }
void TiledMap::LoadWayPointsData()
{
}
} }

View File

@ -60,7 +60,7 @@ namespace f8
int tile_rows = 0; //行 int tile_rows = 0; //行
int tile_columns = 0; //列 int tile_columns = 0; //列
bool LoadTmxFile(const std::string& filename); bool LoadTmxFile(const std::string& filename, bool new_tmx_format = false);
std::list<TiledObject>* GetObjectGroup(const std::string& object_class_name); std::list<TiledObject>* GetObjectGroup(const std::string& object_class_name);
void Dump(); void Dump();
void Init(); void Init();
@ -76,6 +76,9 @@ namespace f8
//速度设置 //速度设置
void SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash);//key:area_id value:speed void SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash);//key:area_id value:speed
private:
void LoadWayPointsData();
private: private:
std::map<std::string, std::list<TiledLayer>> layer_hash; std::map<std::string, std::list<TiledLayer>> layer_hash;
std::map<std::string, std::list<TiledObject>> object_group_hash; std::map<std::string, std::list<TiledObject>> object_group_hash;
@ -86,5 +89,6 @@ namespace f8
std::vector<GridCell> grid_cell_list; //所有的格子数组 size = x * y std::vector<GridCell> grid_cell_list; //所有的格子数组 size = x * y
std::map<std::string, std::vector<GridCell>> grid_cell_hash; //key 11|2 坐标 std::map<std::string, std::vector<GridCell>> grid_cell_hash; //key 11|2 坐标
std::map<std::string, std::vector<std::tuple<int, int>>> waypoint_hash_; //路点数据
}; };
} }