(svn r3623) - Standardize DEBUG() messages in saveload.c
authorDarkvater
Mon, 20 Feb 2006 18:01:38 +0000
changeset 3043 b916dbc4e514
parent 3042 227101cb98ca
child 3044 fbaef2401476
(svn r3623) - Standardize DEBUG() messages in saveload.c
saveload.c
--- a/saveload.c	Mon Feb 20 17:54:25 2006 +0000
+++ b/saveload.c	Mon Feb 20 18:01:38 2006 +0000
@@ -291,7 +291,7 @@
 		case CH_SPARSE_ARRAY: index = SlReadSparseIndex(); break;
 		case CH_ARRAY:        index = _sl.array_index++; break;
 		default:
-			DEBUG(misc, 0) ("SlIterateArray: error");
+			DEBUG(misc, 0) ("[Sl] SlIterateArray: error");
 			return -1; // error
 		}
 
@@ -720,6 +720,7 @@
 	ChunkSaveLoadProc *proc = ch->save_proc;
 
 	SlWriteUint32(ch->id);
+	DEBUG(misc, 1) ("[Sl] Saving chunk %c%c%c%c", ch->id >> 24, ch->id >> 16, ch->id >> 8, ch->id);
 
 	if (ch->flags & CH_AUTO_LENGTH) {
 		// Need to calculate the length. Solve that by calling SlAutoLength in the save_proc.
@@ -797,7 +798,7 @@
 	const ChunkHandler *ch;
 
 	for (id = SlReadUint32(); id != 0; id = SlReadUint32()) {
-		DEBUG(misc, 1) ("Loading chunk %c%c%c%c", id >> 24, id>>16, id>>8, id);
+		DEBUG(misc, 1) ("[Sl] Loading chunk %c%c%c%c", id >> 24, id >> 16, id >> 8, id);
 
 		ch = SlFindChunkHandler(id);
 		if (ch == NULL) SlError("found unknown tag in savegame (sync error)");
@@ -1381,7 +1382,7 @@
 
 	_sl.fh = fopen(filename, (mode == SL_SAVE) ? "wb" : "rb");
 	if (_sl.fh == NULL) {
-		DEBUG(misc, 0) ("Cannot open savegame for saving/loading.");
+		DEBUG(misc, 0) ("[Sl] Cannot open savegame for saving/loading.");
 		return SL_ERROR;
 	}
 
@@ -1423,7 +1424,7 @@
 		_sl.write_bytes = fmt->writer;
 		_sl.excpt_uninit = fmt->uninit_write;
 		if (!fmt->init_write()) {
-			DEBUG(misc, 0) ("Initializing writer %s failed.", fmt->name);
+			DEBUG(misc, 0) ("[Sl] Initializing writer %s failed.", fmt->name);
 			return AbortSaveLoad();
 		}
 
@@ -1435,7 +1436,7 @@
 
 		if (_network_server ||
 					(save_thread = OTTDCreateThread(&SaveFileToDisk, (void*)"")) == NULL) {
-			DEBUG(misc, 1) ("cannot create savegame thread, reverting to single-threaded mode...");
+			DEBUG(misc, 1) ("[Sl] Cannot create savegame thread, reverting to single-threaded mode...");
 			SaveFileToDisk(NULL);
 		}
 
@@ -1443,7 +1444,7 @@
 		assert(mode == SL_LOAD);
 
 		if (fread(hdr, sizeof(hdr), 1, _sl.fh) != 1) {
-			DEBUG(misc, 0) ("Cannot read savegame header, aborting.");
+			DEBUG(misc, 0) ("[Sl] Cannot read savegame header, aborting.");
 			return AbortSaveLoad();
 		}
 
@@ -1451,7 +1452,7 @@
 		for (fmt = _saveload_formats; ; fmt++) {
 			/* No loader found, treat as version 0 and use LZO format */
 			if (fmt == endof(_saveload_formats)) {
-				DEBUG(misc, 0) ("Unknown savegame type, trying to load it as the buggy format.");
+				DEBUG(misc, 0) ("[Sl] Unknown savegame type, trying to load it as the buggy format.");
 				rewind(_sl.fh);
 				_sl_version = version = 0;
 				_sl_minor_version = 0;
@@ -1468,11 +1469,11 @@
 				 *  So never EVER use this minor version again. -- TrueLight -- 22-11-2005 */
 				_sl_minor_version = (TO_BE32(hdr[1]) >> 8) & 0xFF;
 
-				DEBUG(misc, 1)("[Savegame] Loading savegame version %d\n", _sl_version);
+				DEBUG(misc, 1)("[Sl] Loading savegame version %d", _sl_version);
 
 				/* Is the version higher than the current? */
 				if (_sl_version > SAVEGAME_VERSION) {
-					DEBUG(misc, 0) ("Savegame version invalid.");
+					DEBUG(misc, 0) ("[Sl] Savegame version invalid.");
 					return AbortSaveLoad();
 				}
 				break;
@@ -1489,7 +1490,7 @@
 		}
 
 		if (!fmt->init_read()) {
-			DEBUG(misc, 0) ("Initializing loader %s failed.", fmt->name);
+			DEBUG(misc, 0) ("[Sl] Initializing loader %s failed.", fmt->name);
 			return AbortSaveLoad();
 		}