MCPcopy Create free account
hub / github.com/assaultcube/AC / peekmapheader

Function peekmapheader

source/src/tools.cpp:84–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84header *peekmapheader(uchar *data, int len) // extract the header from an in-memory mapfile (doesn't process all values: only used to get the map revision and timestamp)
85{
86 static header h;
87 uLongf rawsize = (int)sizeof(header);
88 if(uncompress((Bytef*)&h, &rawsize, data, len) == Z_BUF_ERROR && (!strncmp(h.head, "CUBE", 4) || !strncmp(h.head, "ACMP",4)))
89 {
90 lilswap(&h.version, 4); // version, headersize, sfactor, numents
91 if(h.version < 4) memset(&h.waterlevel, 0, sizeof(int) * 16);
92 else lilswap(&h.maprevision, 4); // maprevision, ambient, flags, timestamp
93 return &h;
94 }
95 return NULL;
96}
97
98// map geometry statistics
99

Callers 2

processFunction · 0.85
readmapFunction · 0.85

Calls 1

lilswapFunction · 0.85

Tested by

no test coverage detected