summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-02-20 18:01:38 +0000
committerDarkvater <darkvater@openttd.org>2006-02-20 18:01:38 +0000
commitf15b8b6cda87380366f44634ad6ae8872eb4d4d9 (patch)
treefaad44a2a265b7b111f88a22ede24b7abda7f82b
parentf112cd722c6b127cc89ee59b5fa7e9b4eb18c51f (diff)
downloadopenttd-f15b8b6cda87380366f44634ad6ae8872eb4d4d9.tar.xz
(svn r3623) - Standardize DEBUG() messages in saveload.c
-rw-r--r--saveload.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/saveload.c b/saveload.c
index 210022039..202320cf4 100644
--- a/saveload.c
+++ b/saveload.c
@@ -291,7 +291,7 @@ int SlIterateArray(void)
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 @@ static void SlSaveChunk(const ChunkHandler *ch)
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 @@ static void SlLoadChunks(void)
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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
_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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
_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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
* 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 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
}
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();
}