forked from teamnwah/openmw-tes3coop
		
	[Server] Add LogMessage() and LogAppend() script functions
This commit is contained in:
		
							parent
							
								
									1d2a6d9056
								
							
						
					
					
						commit
						174937f412
					
				
					 2 changed files with 18 additions and 2 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| #include "Miscellaneous.hpp" | ||||
| #include <apps/openmw-mp/Script/ScriptFunctions.hpp> | ||||
| #include <apps/openmw-mp/Networking.hpp> | ||||
| #include <components/openmw-mp/Log.hpp> | ||||
| 
 | ||||
| #include <iostream> | ||||
| using namespace std; | ||||
|  | @ -9,3 +10,13 @@ unsigned int MiscellaneousFunctions::GetLastPlayerId() noexcept | |||
| { | ||||
|     return Players::getLastPlayerId(); | ||||
| } | ||||
| 
 | ||||
| void MiscellaneousFunctions::LogMessage(unsigned short level, const char *message) noexcept | ||||
| { | ||||
|     LOG_MESSAGE_SIMPLE(level, "[Script]: %s", message); | ||||
| } | ||||
| 
 | ||||
| void MiscellaneousFunctions::LogAppend(unsigned short level, const char *message) noexcept | ||||
| { | ||||
|     LOG_APPEND(level, "[Script]: %s", message); | ||||
| } | ||||
|  |  | |||
|  | @ -4,13 +4,18 @@ | |||
| #include "../Types.hpp" | ||||
| 
 | ||||
| #define MISCELLANEOUSAPI \ | ||||
|     {"GetLastPlayerId",  MiscellaneousFunctions::GetLastPlayerId} | ||||
| 
 | ||||
|     {"GetLastPlayerId",  MiscellaneousFunctions::GetLastPlayerId},\ | ||||
|     \ | ||||
|     {"LogMessage",       MiscellaneousFunctions::LogMessage},\ | ||||
|     {"LogAppend",        MiscellaneousFunctions::LogAppend} | ||||
| 
 | ||||
| class MiscellaneousFunctions | ||||
| { | ||||
| public: | ||||
|     static unsigned int GetLastPlayerId() noexcept; | ||||
| 
 | ||||
|     static void LogMessage(unsigned short level, const char *message) noexcept; | ||||
|     static void LogAppend(unsigned short level, const char *message) noexcept; | ||||
| }; | ||||
| 
 | ||||
| #endif //OPENMW_MISCELLANEOUSAPI_HPP
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue