MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / IncreaseRestoreCount

Function IncreaseRestoreCount

Descent3/loadstate.cpp:235–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233// int Gamesave_read_version=0;
234
235void IncreaseRestoreCount(const char *file) {
236 // Open the file up in read more, read the current count, then incease it
237 // and write the increased value back out.
238
239 char countpath[_MAX_PATH * 2];
240 CFILE *cfp;
241
242 strcpy(countpath, file);
243 strcat(countpath, ".cnt");
244
245 cfp = cfopen(countpath, "rb");
246 if (cfp) {
247 Times_game_restored = cf_ReadInt(cfp);
248 cfclose(cfp);
249 } else {
250 Times_game_restored = 0;
251 }
252 Times_game_restored++;
253
254 cfp = cfopen(countpath, "wb");
255 if (cfp) {
256 cf_WriteInt(cfp, Times_game_restored);
257 cfclose(cfp);
258 }
259}
260
261extern bool IsRestoredGame;
262///////////////////////////////////////////////////////////////////////////////

Callers 1

LoadGameStateFunction · 0.85

Calls 4

cfopenFunction · 0.85
cf_ReadIntFunction · 0.85
cfcloseFunction · 0.85
cf_WriteIntFunction · 0.85

Tested by

no test coverage detected