From 45b67b6e2c4246fd708fe95149ac44e462c2fc32 Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Mon, 21 Aug 2006 03:46:20 +0000 Subject: [PATCH] more tweaks to binlogs --- amxmodx/binlog.cpp | 54 ++++++++-------------------------------------- amxmodx/binlog.h | 19 +++++----------- 2 files changed, 14 insertions(+), 59 deletions(-) diff --git a/amxmodx/binlog.cpp b/amxmodx/binlog.cpp index e358236a..72861f08 100644 --- a/amxmodx/binlog.cpp +++ b/amxmodx/binlog.cpp @@ -202,21 +202,12 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...) } case BinLog_NativeError: { - int file; int err = va_arg(ap, int); const char *msg = va_arg(ap, const char *); short len = (short)strlen(msg); fwrite(&err, sizeof(int), 1, fp); fwrite(&len, sizeof(short), 1, fp); fwrite(msg, sizeof(char), len+1, fp); - if (debug) - { - file = LookupFile(dbg, amx->cip); - fwrite(&file, sizeof(int), 1, fp); - } else { - file = 0; - fwrite(&file, sizeof(int), 1, fp); - } break; } case BinLog_CallPubFunc: @@ -236,13 +227,21 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...) } case BinLog_SetLine: { + int file; int line = va_arg(ap, int); fwrite(&line, sizeof(int), 1, fp); + if (debug) + { + file = LookupFile(dbg, amx->cip); + fwrite(&file, sizeof(int), 1, fp); + } else { + file = 0; + fwrite(&file, sizeof(int), 1, fp); + } break; } case BinLog_FormatString: { - int file; int param = va_arg(ap, int); int maxlen = va_arg(ap, int); const char *str = va_arg(ap, const char *); @@ -251,56 +250,29 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...) fwrite(&maxlen, sizeof(int), 1, fp); fwrite(&len, sizeof(short), 1, fp); fwrite(str, sizeof(char), len+1, fp); - if (debug) - { - file = LookupFile(dbg, amx->cip); - fwrite(&file, sizeof(int), 1, fp); - } else { - file = 0; - fwrite(&file, sizeof(int), 1, fp); - } break; } case BinLog_NativeParams: { - int file; cell *params = va_arg(ap, cell *); cell num = params[0] / sizeof(cell); fwrite(&num, sizeof(cell), 1, fp); for (cell i=1; i<=num; i++) fwrite(&(params[i]), sizeof(cell), 1, fp); - if (debug) - { - file = LookupFile(dbg, amx->cip); - fwrite(&file, sizeof(int), 1, fp); - } else { - file = 0; - fwrite(&file, sizeof(int), 1, fp); - } break; } case BinLog_GetString: { - int file; cell addr = va_arg(ap, cell); const char *str = va_arg(ap, const char *); short len = (short)strlen(str); fwrite(&addr, sizeof(cell), 1, fp); fwrite(&len, sizeof(short), 1, fp); fwrite(str, sizeof(char), len+1, fp); - if (debug) - { - file = LookupFile(dbg, amx->cip); - fwrite(&file, sizeof(int), 1, fp); - } else { - file = 0; - fwrite(&file, sizeof(int), 1, fp); - } break; } case BinLog_SetString: { - int file; cell addr = va_arg(ap, cell); int maxlen = va_arg(ap, int); const char *str = va_arg(ap, const char *); @@ -309,14 +281,6 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...) fwrite(&maxlen, sizeof(int), 1, fp); fwrite(&len, sizeof(short), 1, fp); fwrite(str, sizeof(char), len+1, fp); - if (debug) - { - file = LookupFile(dbg, amx->cip); - fwrite(&file, sizeof(int), 1, fp); - } else { - file = 0; - fwrite(&file, sizeof(int), 1, fp); - } break; } }; diff --git a/amxmodx/binlog.h b/amxmodx/binlog.h index dfed650d..22d34b6f 100644 --- a/amxmodx/binlog.h +++ b/amxmodx/binlog.h @@ -38,28 +38,19 @@ * float gametime * int32 plugin id * - * Following operation codes will have an extra int for filename - * If filename is 0 skip as plugin was not in debug mode, if -1 there was an error. - * NativeCall - * NativeRet - * NativeError - * CallPubFunc - * FormatString - * NativeParams - * GetString - * SetString * ] + * If filename id is 0 skip as plugin was not in debug mode, if -1 there was an error. */ enum BinLogOp { BinLog_Start=1, BinLog_End, - BinLog_NativeCall, // + BinLog_NativeCall, // BinLog_NativeError, // - BinLog_NativeRet, // - BinLog_CallPubFunc, // - BinLog_SetLine, // + BinLog_NativeRet, // + BinLog_CallPubFunc, // + BinLog_SetLine, // BinLog_Registered, // BinLog_FormatString, // BinLog_NativeParams, //