X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsnapshot.c;h=cd83dc5be1636470983d559a334dad309e96b2f9;hb=38212569c2f58866417f26e9c813ed8b23c5b2c4;hp=a3c2162da54a73215557bdd025b9af5792f65db1;hpb=e73cc9fa0feac62a97f7bb0bf0346cdf2134c249;p=rocksndiamonds.git diff --git a/src/libgame/snapshot.c b/src/libgame/snapshot.c index a3c2162d..cd83dc5b 100644 --- a/src/libgame/snapshot.c +++ b/src/libgame/snapshot.c @@ -4,7 +4,7 @@ // (c) 1995-2014 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // snapshot.c // ============================================================================ @@ -88,7 +88,7 @@ static void FreeSnapshot(void *snapshot_buffers_ptr) FreeSnapshotBuffers(snapshot_buffers_ptr); } -void FreeSnapshotSingle() +void FreeSnapshotSingle(void) { FreeSnapshotBuffers(snapshot_single); @@ -100,8 +100,8 @@ static void FreeSnapshotList_UpToNode(ListNode *node) while (snapshot_list != node) { #if DEBUG_SNAPSHOTS - printf("::: FreeSnapshotList_*() [%s, %d, %d]\n", - snapshot_list->key, num_snapshot_buffers, num_snapshot_bytes); + Debug("snapshot:FreeSnapshotList_UpToNode", "[%s, %d, %d]", + snapshot_list->key, num_snapshot_buffers, num_snapshot_bytes); #endif deleteNodeFromList(&snapshot_list, snapshot_list->key, FreeSnapshot); @@ -111,10 +111,10 @@ static void FreeSnapshotList_UpToNode(ListNode *node) } } -void FreeSnapshotList() +void FreeSnapshotList(void) { #if DEBUG_SNAPSHOTS - printf("::: FreeSnapshotList()\n"); + Debug("snapshot:FreeSnapshotList", ""); #endif FreeSnapshotList_UpToNode(NULL); @@ -127,11 +127,10 @@ void FreeSnapshotList() snapshot_current = NULL; } -void ReduceSnapshotList() +static void ReduceSnapshotList(void) { #if DEBUG_SNAPSHOTS - printf("::: (Reducing number of snapshots from %d ", - num_snapshots); + int num_snapshots_last = num_snapshots; #endif // maximum number of snapshots exceeded -- thin out list of snapshots @@ -158,13 +157,16 @@ void ReduceSnapshotList() } #if DEBUG_SNAPSHOTS - printf("to %d.)\n", num_snapshots); + Debug("snapshot:ReduceSnapshotList", + "(Reducing number of snapshots from %d to %d.)", + num_snapshots_last, num_snapshots); #if 0 node = snapshot_list; while (node) { - printf("::: key: %s\n", node->key); + Debug("snapshot:ReduceSnapshotList", "key: %s", node->key); + node = node->next; } #endif @@ -185,9 +187,10 @@ void SaveSnapshotToList(ListNode *snapshot_buffers) FreeSnapshotList_UpToNode(snapshot_current); #if DEBUG_SNAPSHOTS - printf("::: SaveSnapshotToList() [%d] [%d snapshots, %d buffers, %d bytes]\n", - next_snapshot_key, num_snapshots, - num_snapshot_buffers, num_snapshot_bytes); + Debug("snapshot:SaveSnapshotToList", + "[%d] [%d snapshots, %d buffers, %d bytes]", + next_snapshot_key, num_snapshots, + num_snapshot_buffers, num_snapshot_bytes); #endif addNodeToList(&snapshot_list, i_to_a(next_snapshot_key), @@ -202,7 +205,7 @@ void SaveSnapshotToList(ListNode *snapshot_buffers) ReduceSnapshotList(); } -boolean LoadSnapshotSingle() +boolean LoadSnapshotSingle(void) { if (snapshot_single) { @@ -224,7 +227,7 @@ boolean LoadSnapshotFromList_Older(int steps) LoadSnapshotBuffers(snapshot_current->content); #if DEBUG_SNAPSHOTS - printf("::: LoadSnapshotFromList_Older() [%s]\n", snapshot_current->key); + Debug("snapshot:LoadSnapshotFromList_Older", "[%s]", snapshot_current->key); #endif return TRUE; @@ -243,7 +246,7 @@ boolean LoadSnapshotFromList_Newer(int steps) LoadSnapshotBuffers(snapshot_current->content); #if DEBUG_SNAPSHOTS - printf("::: LoadSnapshotFromList_Newer() [%s]\n", snapshot_current->key); + Debug("snapshot:LoadSnapshotFromList_Newer", "[%s]", snapshot_current->key); #endif return TRUE; @@ -252,7 +255,7 @@ boolean LoadSnapshotFromList_Newer(int steps) return FALSE; } -boolean CheckSnapshotList() +boolean CheckSnapshotList(void) { return (snapshot_list ? TRUE : FALSE); }