| 78 | } |
| 79 | |
| 80 | int main(int argc, const char **argv) |
| 81 | { |
| 82 | CCmdlineFix CmdlineFix(&argc, &argv); |
| 83 | log_set_global_logger_default(); |
| 84 | |
| 85 | std::unique_ptr<IStorage> pStorage = std::unique_ptr<IStorage>(CreateStorage(IStorage::EInitializationType::BASIC, argc, argv)); |
| 86 | if(!pStorage) |
| 87 | { |
| 88 | log_error("map_optimize", "Error creating basic storage"); |
| 89 | return -1; |
| 90 | } |
| 91 | if(argc <= 1 || argc > 3) |
| 92 | { |
| 93 | dbg_msg("map_optimize", "Usage: map_optimize <source map filepath> [<dest map filepath>]"); |
| 94 | return -1; |
| 95 | } |
| 96 | |
| 97 | char aFilename[IO_MAX_PATH_LENGTH]; |
| 98 | if(argc == 3) |
| 99 | { |
| 100 | str_format(aFilename, sizeof(aFilename), "out/%s", argv[2]); |
| 101 | |
| 102 | fs_makedir_rec_for(aFilename); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | fs_makedir("out"); |
| 107 | char aBuff[IO_MAX_PATH_LENGTH]; |
| 108 | IStorage::StripPathAndExtension(argv[1], aBuff, sizeof(aBuff)); |
| 109 | str_format(aFilename, sizeof(aFilename), "out/%s.map", aBuff); |
| 110 | } |
| 111 | |
| 112 | CDataFileReader Reader; |
| 113 | if(!Reader.Open(pStorage.get(), argv[1], IStorage::TYPE_ABSOLUTE)) |
| 114 | { |
| 115 | dbg_msg("map_optimize", "Failed to open source file."); |
| 116 | return -1; |
| 117 | } |
| 118 | |
| 119 | CDataFileWriter Writer; |
| 120 | if(!Writer.Open(pStorage.get(), aFilename, IStorage::TYPE_ABSOLUTE)) |
| 121 | { |
| 122 | dbg_msg("map_optimize", "Failed to open target file."); |
| 123 | return -1; |
| 124 | } |
| 125 | |
| 126 | int aImageFlags[MAX_MAPIMAGES] = { |
| 127 | 0, |
| 128 | }; |
| 129 | |
| 130 | bool aaImageTiles[MAX_MAPIMAGES][256]{ |
| 131 | { |
| 132 | false, |
| 133 | }, |
| 134 | }; |
| 135 | |
| 136 | struct SMapOptimizeItem |
| 137 | { |
nothing calls this directly
no test coverage detected