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

Function main

src/tools/map_optimize.cpp:80–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80int 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 {

Callers

nothing calls this directly

Calls 15

CreateStorageFunction · 0.85
dbg_msgFunction · 0.85
str_formatFunction · 0.85
fs_makedir_rec_forFunction · 0.85
fs_makedirFunction · 0.85
mem_copyFunction · 0.85
ClearPixelsTileFunction · 0.85
mem_zeroFunction · 0.85
ClearTransparentPixelsFunction · 0.85
DilateImageSubFunction · 0.85

Tested by

no test coverage detected