From 804259b2c9f03f8e435639ea11a95222d268d3b2 Mon Sep 17 00:00:00 2001 From: Koncord Date: Fri, 16 Dec 2016 18:50:34 +0800 Subject: [PATCH] Change some printf to LOG_MESSAGE_SIMPLE printf is not streamed to files --- apps/openmw-mp/Script/LangNative/LangNative.cpp | 2 +- apps/openmw/mwgui/hud.cpp | 3 ++- apps/openmw/mwmp/GUIController.cpp | 4 ++-- apps/openmw/mwscript/interpretercontext.cpp | 9 +++++---- apps/openmw/mwscript/transformationextensions.cpp | 3 ++- apps/openmw/mwworld/actiontake.cpp | 3 ++- apps/openmw/mwworld/worldimp.cpp | 9 +++++---- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/apps/openmw-mp/Script/LangNative/LangNative.cpp b/apps/openmw-mp/Script/LangNative/LangNative.cpp index 01706b396..d08003b5e 100644 --- a/apps/openmw-mp/Script/LangNative/LangNative.cpp +++ b/apps/openmw-mp/Script/LangNative/LangNative.cpp @@ -50,7 +50,7 @@ void LangNative::LoadProgram(const char *filename) for (const auto &function : ScriptFunctions::functions) if (!SetScript(lib, string(pf + function.name).c_str(), function.func.addr)) - printf("Script function pointer not found: %s\n", function.name); + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Script function pointer not found: %s", function.name); } catch (...) { diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 839b81590..904ae6fbe 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -13,6 +13,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -83,7 +84,7 @@ namespace MWGui mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(event); - printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->count); diff --git a/apps/openmw/mwmp/GUIController.cpp b/apps/openmw/mwmp/GUIController.cpp index eb1746331..7a4facc01 100644 --- a/apps/openmw/mwmp/GUIController.cpp +++ b/apps/openmw/mwmp/GUIController.cpp @@ -156,7 +156,7 @@ void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessa void mwmp::GUIController::onInputBoxDone(MWGui::WindowBase *parWindow) { //MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager(); - printf("GUIController::OnInputBoxDone: %s.\n",mInputBox->getTextInput().c_str()); + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "GUIController::OnInputBoxDone: %s.",mInputBox->getTextInput().c_str()); Main::get().getLocalPlayer()->guiMessageBox.data = mInputBox->getTextInput(); Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer()); @@ -198,7 +198,7 @@ void mwmp::GUIController::update(float dt) int pressedButton = MWBase::Environment::get().getWindowManager()->readPressedButton(); if (pressedButton != -1 && calledMessageBox) { - printf("Pressed: %d\n", pressedButton); + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Pressed: %d", pressedButton); calledMessageBox = false; Main::get().getLocalPlayer()->guiMessageBox.data = MyGUI::utility::toString(pressedButton); Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer()); diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index c999940da..7b6df1e1b 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -11,6 +11,7 @@ #include #include +#include #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" @@ -193,7 +194,7 @@ namespace MWScript event->shortVal = value; mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send(event); - printf("Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str(), @@ -230,7 +231,7 @@ namespace MWScript event->floatVal = value; mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(event); - printf("Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str(), @@ -288,7 +289,7 @@ namespace MWScript event->shortVal = value; mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send(event); - printf("Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i", event->varName.c_str(), event->shortVal); } @@ -618,7 +619,7 @@ namespace MWScript event->shortVal = value; mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send(event); - printf("Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i", event->cellRef.mRefID.c_str(), event->index, event->shortVal); diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 2e0c2de11..9452c3a30 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -558,7 +559,7 @@ namespace MWScript event->count = 1; mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(event); - printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->count); diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index 9bcfe48b3..320e45653 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -1,6 +1,7 @@ #include "actiontake.hpp" #include +#include #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" @@ -31,7 +32,7 @@ namespace MWWorld event->cellRef.mRefNum = getTarget().getCellRef().getRefNum(); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event); - printf("Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s\n", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s.", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str()); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index c20dacea9..adec50b61 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -20,6 +20,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" @@ -1158,8 +1159,8 @@ namespace MWWorld // tes3mp debug start if (currCell != newCell) { - - printf("Tick: %s was %s move from %s to %s\n", + + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Tick: %s was %s move from %s to %s", ptr.getBase()->mRef.getRefId().c_str(), ptr.getBase()->canChangeCell ? "allowed" : "denied", currCell->getCell()->getDescription().c_str(), @@ -2271,7 +2272,7 @@ namespace MWWorld event->state = state; mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_ACTIVATE)->Send(event); - printf("Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str(), @@ -2291,7 +2292,7 @@ namespace MWWorld event->state = state; mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_ACTIVATE)->Send(event); - printf("Door activation 2\n- cellRef: %s, %i\n- cell: %s\n- state: %s", + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 2\n- cellRef: %s, %i\n- cell: %s\n- state: %s", event->cellRef.mRefID.c_str(), event->cellRef.mRefNum.mIndex, event->cell.getDescription().c_str(),