Skip to content

Commit

Permalink
[luadefs-server] Clean up OutputChat OOPdef
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Sep 13, 2015
1 parent ebe4a24 commit 68117db
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 104 deletions.
1 change: 0 additions & 1 deletion MTA10_Server/mods/deathmatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ LOGIC = \
./logic/lua/CLuaVector4.cpp \
./logic/lua/LuaCommon.cpp \
./logic/lua/LuaUtils.cpp \
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Player.cpp \
./logic/luadefs/CLuaAccountDefs.cpp \
./logic/luadefs/CLuaACLDefs.cpp \
./logic/luadefs/CLuaBanDefs.cpp \
Expand Down
1 change: 0 additions & 1 deletion MTA10_Server/mods/deathmatch/StdInc.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ struct SAclRequest;
#include "luadefs/CLuaWaterDefs.h"
#include "luadefs/CLuaWorldDefs.h"
#include "luadefs/CLuaXMLDefs.h"
#include "lua/oopdefs/CLuaOOPDefs.h"

// Lua includes
#include "lua/LuaCommon.h"
Expand Down
2 changes: 0 additions & 2 deletions MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@
<ClCompile Include="logic\lua\CLuaVector2.cpp" />
<ClCompile Include="logic\lua\CLuaVector3.cpp" />
<ClCompile Include="logic\lua\CLuaVector4.cpp" />
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Player.cpp" />
<ClCompile Include="logic\packets\CPlayerNetworkStatusPacket.cpp" />
<ClCompile Include="Server.cpp" />
<ClCompile Include="StdInc.cpp">
Expand Down Expand Up @@ -899,7 +898,6 @@
<ClInclude Include="logic\lua\CLuaVector2.h" />
<ClInclude Include="logic\lua\CLuaVector3.h" />
<ClInclude Include="logic\lua\CLuaVector4.h" />
<ClInclude Include="logic\lua\oopdefs\CLuaOOPDefs.h" />
<ClInclude Include="logic\packets\CPlayerNetworkStatusPacket.h" />
<ClInclude Include="utils\CZipMaker.h" />
<ClInclude Include="..\EXECryptor\EXECryptor.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@
<Filter Include="Resource Files\output">
<UniqueIdentifier>{4a26eed3-0f7c-400a-b106-efff6f2b1bb6}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\logic\oopdefs">
<UniqueIdentifier>{3769e3ec-6cde-45c2-9bf0-b30dd16010ec}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\logic\oopdefs">
<UniqueIdentifier>{802fad09-80e2-4684-80cf-b3145bd3809c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CServer.cpp">
Expand Down Expand Up @@ -909,9 +903,6 @@
<ClCompile Include="logic\CPerfStat.PlayerPacketUsage.cpp">
<Filter>Source Files\logic</Filter>
</ClCompile>
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Player.cpp">
<Filter>Source Files\logic\oopdefs</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
Expand Down Expand Up @@ -1820,9 +1811,6 @@
<ClInclude Include="..\..\..\Shared\animation\TInterpolation.h">
<Filter>Header Files\shared\animation</Filter>
</ClInclude>
<ClInclude Include="logic\lua\oopdefs\CLuaOOPDefs.h">
<Filter>Header Files\logic\oopdefs</Filter>
</ClInclude>
<ClInclude Include="logic\luadefs\CLuaMatrixDefs.h">
<Filter>Header Files\logic\luadefs</Filter>
</ClInclude>
Expand Down
39 changes: 39 additions & 0 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,45 @@ int CLuaFunctionDefs::OutputChatBox ( lua_State* luaVM )
return 1;
}


int CLuaFunctionDefs::OOP_OutputChatBox ( lua_State * luaVM )
{
// bool Player:outputChat ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] )
CElement* pElement; SString strText; uchar ucRed = 231; uchar ucGreen = 217; uchar ucBlue = 176; bool bColorCoded;

CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
argStream.ReadString ( strText );

if ( argStream.NextIsNumber ( 0 ) && argStream.NextIsNumber ( 1 ) && argStream.NextIsNumber ( 2 ) )
{
argStream.ReadNumber ( ucRed );
argStream.ReadNumber ( ucGreen );
argStream.ReadNumber ( ucBlue );
}
else
argStream.Skip ( 3 );

argStream.ReadBool ( bColorCoded, false );

if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CStaticFunctionDefinitions::OutputChatBox ( strText, pElement, ucRed, ucGreen, ucBlue, bColorCoded, pLuaMain );
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

lua_pushboolean ( luaVM, false );
return 1;
}


int CLuaFunctionDefs::OutputConsole ( lua_State* luaVM )
{
SString strMessage;
Expand Down
12 changes: 4 additions & 8 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ class CAccountManager;
class CColManager;
class CAccessControlListManager;

#ifndef __CLUAFUNCTIONDEFINITIONS_H
#define __CLUAFUNCTIONDEFINITIONS_H

#pragma once
#include "LuaCommon.h"
#include "CLuaMain.h"
#include "CLuaTimerManager.h"

#define LUA_ERROR() lua_pushboolean ( luaVM, false ); return 0;
#define LUA_DECLARE(x) static int x ( lua_State * luaVM );
#define LUA_DECLARE(x) static int x ( lua_State * luaVM );

extern CTimeUsMarker < 20 > markerLatentEvent; // For timing triggerLatentClientEvent

Expand Down Expand Up @@ -117,7 +115,7 @@ class CLuaFunctionDefs
// Standard server functions
LUA_DECLARE ( GetMaxPlayers );
LUA_DECLARE ( SetMaxPlayers );
LUA_DECLARE ( OutputChatBox );
LUA_DECLARE ( OutputChatBox ); LUA_DECLARE ( OOP_OutputChatBox );
LUA_DECLARE ( OutputConsole );
LUA_DECLARE ( OutputDebugString );
LUA_DECLARE ( OutputServerLog );
Expand Down Expand Up @@ -219,6 +217,4 @@ class CLuaFunctionDefs
static CResourceManager* m_pResourceManager;
static CAccessControlListManager* m_pACLManager;
static CLuaModuleManager* m_pLuaModuleManager;
};

#endif
};
32 changes: 0 additions & 32 deletions MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPDefs.h

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void CLuaPlayerDefs::AddClass ( lua_State* luaVM )
lua_classfunction ( luaVM, "logOut", "logOut" );
lua_classfunction ( luaVM, "toggleControl", "toggleControl" );
lua_classfunction ( luaVM, "triggerEvent", "triggerClientEvent" );
lua_classfunction ( luaVM, "outputChat", "outputChatBox", CLuaOOPDefs::OutputChat );
lua_classfunction ( luaVM, "outputChat", "outputChatBox", CLuaFunctionDefs::OutputChatBox );

lua_classfunction ( luaVM, "forceMap", "forcePlayerMap" );
lua_classfunction ( luaVM, "fadeCamera", "fadeCamera" );
Expand Down

0 comments on commit 68117db

Please sign in to comment.