MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / processChunk

Method processChunk

src/clientbase/WorldDownLoader.cpp:107–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107uint32_t WorldDownLoader::processChunk(void* buf, uint16_t len, int bytesLeft) {
108 if (cacheOut) {
109 cacheOut->write((char*)buf, len);
110 }
111
112 worldPtr += len;
113
114 const int totalSize = worldPtr + bytesLeft;
115 const int doneSize = worldPtr;
116 const int complete = (100 * doneSize) / totalSize;
117 const int remaining = bytesLeft / 1024;
118
119 showError(
120 TextUtils::format("Downloading World (%2d%% complete/%d kb remaining)...",
121 complete, remaining).c_str());
122
123 if (bytesLeft == 0) {
124 if (cacheOut) {
125 delete cacheOut;
126 cacheOut = NULL;
127 }
128 loadCached();
129 if (isCacheTemp) {
130 markOld(worldCachePath);
131 }
132 }
133
134 return (bytesLeft > 0) ? worldPtr : 0;
135}
136
137
138void WorldDownLoader::cleanCache() {

Callers 1

handleGetWorldFunction · 0.80

Calls 4

c_strMethod · 0.80
showErrorFunction · 0.50
formatFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected