| 106 | } |
| 107 | |
| 108 | static 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 | |
| 134 | int main(int argc, const char *argv[]) |
| 135 | { |
no test coverage detected