MCPcopy Create free account
hub / github.com/ddnet/ddnet / ExtractMap

Function ExtractMap

src/tools/map_extract.cpp:108–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static bool ExtractMap(IStorage *pStorage, const char *pMapName, const char *pPathSave)
109{
110 CDataFileReader Reader;
111 if(!Reader.Open(pStorage, pMapName, IStorage::TYPE_ABSOLUTE))
112 {
113 log_error("map_extract", "error opening map '%s'", pMapName);
114 return false;
115 }
116
117 const CMapItemVersion *pVersion = static_cast<CMapItemVersion *>(Reader.FindItem(MAPITEMTYPE_VERSION, 0));
118 if(pVersion == nullptr || pVersion->m_Version != 1)
119 {
120 log_error("map_extract", "unsupported map version '%s'", pMapName);
121 return false;
122 }
123
124 log_info("map_extract", "Make sure you have the permission to use these images and sounds in your own maps");
125
126 PrintMapInfo(Reader);
127 ExtractMapImages(Reader, pPathSave);
128 ExtractMapSounds(Reader, pPathSave);
129
130 Reader.Close();
131 return true;
132}
133
134int main(int argc, const char *argv[])
135{

Callers 1

mainFunction · 0.85

Calls 6

PrintMapInfoFunction · 0.85
ExtractMapImagesFunction · 0.85
ExtractMapSoundsFunction · 0.85
OpenMethod · 0.45
FindItemMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected