Skip to content

Commit

Permalink
[luadefs-server] Clean up Database
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Sep 13, 2015
1 parent 46856ee commit 2500ca4
Show file tree
Hide file tree
Showing 13 changed files with 851 additions and 848 deletions.
3 changes: 1 addition & 2 deletions MTA10_Server/mods/deathmatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ LOGIC = \
./logic/lua/CLuaFunctionDefs.cpp \
./logic/lua/CLuaFunctionDefs.Clothing.cpp \
./logic/lua/CLuaFunctionDefs.Crypt.cpp \
./logic/lua/CLuaFunctionDefs.Database.cpp \
./logic/lua/CLuaFunctionDefs.Event.cpp \
./logic/lua/CLuaFunctionDefs.Misc.cpp \
./logic/lua/CLuaFunctionDefs.PREG.cpp \
Expand All @@ -212,7 +211,6 @@ LOGIC = \
./logic/lua/CLuaVector4.cpp \
./logic/lua/LuaCommon.cpp \
./logic/lua/LuaUtils.cpp \
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Connection.cpp \
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Player.cpp \
./logic/luadefs/CLuaAccountDefs.cpp \
./logic/luadefs/CLuaACLDefs.cpp \
Expand All @@ -222,6 +220,7 @@ LOGIC = \
./logic/luadefs/CLuaCameraDefs.cpp \
./logic/luadefs/CLuaClassDefs.cpp \
./logic/luadefs/CLuaColShapeDefs.cpp \
./logic/luadefs/CLuaDatabaseDefs.cpp \
./logic/luadefs/CLuaDefs.cpp \
./logic/luadefs/CLuaElementDefs.cpp \
./logic/luadefs/CLuaFileDefs.cpp \
Expand Down
1 change: 1 addition & 0 deletions MTA10_Server/mods/deathmatch/StdInc.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ struct SAclRequest;
#include "luadefs/CLuaCameraDefs.h"
#include "luadefs/CLuaClassDefs.h"
#include "luadefs/CLuaColShapeDefs.h"
#include "luadefs/CLuaDatabaseDefs.h"
#include "luadefs/CLuaDefs.h"
#include "luadefs/CLuaFileDefs.h"
#include "luadefs/CLuaHTTPDefs.h"
Expand Down
4 changes: 2 additions & 2 deletions MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@
<ClCompile Include="logic\luadefs\CLuaBanDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaBlipDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaColShapeDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaDatabaseDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaMarkerDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaMatrixDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaObjectDefs.cpp" />
Expand All @@ -469,7 +470,6 @@
<ClCompile Include="logic\luadefs\CLuaWaterDefs.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Clothing.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Crypt.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Database.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Event.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Misc.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.PREG.cpp" />
Expand All @@ -482,7 +482,6 @@
<ClCompile Include="logic\lua\CLuaVector3.cpp" />
<ClCompile Include="logic\lua\CLuaVector4.cpp" />
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Player.cpp" />
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Connection.cpp" />
<ClCompile Include="logic\packets\CPlayerNetworkStatusPacket.cpp" />
<ClCompile Include="Server.cpp" />
<ClCompile Include="StdInc.cpp">
Expand Down Expand Up @@ -883,6 +882,7 @@
<ClInclude Include="logic\luadefs\CLuaBanDefs.h" />
<ClInclude Include="logic\luadefs\CLuaBlipDefs.h" />
<ClInclude Include="logic\luadefs\CLuaColShapeDefs.h" />
<ClInclude Include="logic\luadefs\CLuaDatabaseDefs.h" />
<ClInclude Include="logic\luadefs\CLuaMarkerDefs.h" />
<ClInclude Include="logic\luadefs\CLuaMatrixDefs.h" />
<ClInclude Include="logic\luadefs\CLuaObjectDefs.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,15 +912,9 @@
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Player.cpp">
<Filter>Source Files\logic\oopdefs</Filter>
</ClCompile>
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Connection.cpp">
<Filter>Source Files\logic\oopdefs</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.Database.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.Event.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
Expand Down Expand Up @@ -990,6 +984,9 @@
<ClCompile Include="logic\luadefs\CLuaBanDefs.cpp">
<Filter>Source Files\logic\luadefs</Filter>
</ClCompile>
<ClCompile Include="logic\luadefs\CLuaDatabaseDefs.cpp">
<Filter>Source Files\logic\luadefs</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="logic\CLightsyncManager.h">
Expand Down Expand Up @@ -1892,6 +1889,9 @@
<ClInclude Include="logic\luadefs\CLuaBanDefs.h">
<Filter>Header Files\logic\luadefs</Filter>
</ClInclude>
<ClInclude Include="logic\luadefs\CLuaDatabaseDefs.h">
<Filter>Header Files\logic\luadefs</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Xml Include="acl.xml">
Expand Down
18 changes: 0 additions & 18 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ class CLuaFunctionDefs
public:
static void Initialize ( class CLuaManager* pLuaManager, class CGame* pClientGame );

static void DbFreeCallback ( CDbJobData* pJobData, void* pContext );
static void DbExecCallback ( CDbJobData* pJobData, void* pContext );

LUA_DECLARE ( DisabledFunction );
LUA_DECLARE ( CallRemote );
LUA_DECLARE ( FetchRemote );
Expand Down Expand Up @@ -177,22 +174,7 @@ class CLuaFunctionDefs
LUA_DECLARE ( SetRuleValue );
LUA_DECLARE ( RemoveRuleValue );

// Database funcs
static void DbQueryCallback ( CDbJobData* pJobData, void* pContext );
LUA_DECLARE ( DbConnect );
LUA_DECLARE ( DbExec );
LUA_DECLARE ( DbQuery );
LUA_DECLARE ( DbFree );
LUA_DECLARE ( DbPoll );

// Registry funcs
LUA_DECLARE ( ExecuteSQLCreateTable );
LUA_DECLARE ( ExecuteSQLDropTable );
LUA_DECLARE ( ExecuteSQLDelete );
LUA_DECLARE ( ExecuteSQLInsert );
LUA_DECLARE ( ExecuteSQLSelect );
LUA_DECLARE ( ExecuteSQLUpdate );
LUA_DECLARE ( ExecuteSQLQuery );
LUA_DECLARE ( GetPerformanceStats );

// Misc funcs
Expand Down
66 changes: 21 additions & 45 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,6 @@ void CLuaMain::InitSecurity ( void )
}


void CLuaMain::AddConnectionClass ( lua_State* luaVM )
{
lua_newclass ( luaVM );

lua_classfunction ( luaVM, "create", "dbConnect" );
lua_classfunction ( luaVM, "exec", "dbExec" );
lua_classfunction ( luaVM, "query", "dbQuery", CLuaOOPDefs::DbQuery );

lua_registerclass ( luaVM, "Connection", "Element" );
}


void CLuaMain::AddQueryHandleClass ( lua_State* luaVM )
{
lua_newclass ( luaVM );

lua_classfunction ( luaVM, "poll", "dbPoll" );
lua_classfunction ( luaVM, "free", "dbFree" );

lua_registerclass ( luaVM, "QueryHandle" );
}


void CLuaMain::InitClasses ( lua_State* luaVM )
{
lua_initclasses ( luaVM );
Expand All @@ -203,28 +180,27 @@ void CLuaMain::InitClasses ( lua_State* luaVM )
if ( !m_bEnableOOP )
return;

CLuaElementDefs ::AddClass ( luaVM ); // keep this at the top because inheritance
CLuaAccountDefs ::AddClass ( luaVM );
CLuaACLDefs ::AddClass ( luaVM );
CLuaBanDefs ::AddClass ( luaVM );
CLuaBlipDefs ::AddClass ( luaVM );
CLuaColShapeDefs ::AddClass ( luaVM );
AddConnectionClass ( luaVM );
CLuaFileDefs ::AddClass ( luaVM );
CLuaMarkerDefs ::AddClass ( luaVM );
CLuaObjectDefs ::AddClass ( luaVM );
CLuaPedDefs ::AddClass ( luaVM );
CLuaPickupDefs ::AddClass ( luaVM );
CLuaPlayerDefs ::AddClass ( luaVM );
AddQueryHandleClass ( luaVM );
CLuaRadarAreaDefs ::AddClass ( luaVM );
CLuaResourceDefs ::AddClass ( luaVM );
CLuaTeamDefs ::AddClass ( luaVM );
CLuaTextDefs ::AddClass ( luaVM );
CLuaTimerDefs ::AddClass ( luaVM );
CLuaVehicleDefs ::AddClass ( luaVM );
CLuaWaterDefs ::AddClass ( luaVM );
CLuaXMLDefs ::AddClass ( luaVM );
CLuaElementDefs ::AddClass ( luaVM ); // keep this at the top because inheritance
CLuaAccountDefs ::AddClass ( luaVM );
CLuaACLDefs ::AddClass ( luaVM );
CLuaBanDefs ::AddClass ( luaVM );
CLuaBlipDefs ::AddClass ( luaVM );
CLuaColShapeDefs ::AddClass ( luaVM );
CLuaDatabaseDefs ::AddClass ( luaVM );
CLuaFileDefs ::AddClass ( luaVM );
CLuaMarkerDefs ::AddClass ( luaVM );
CLuaObjectDefs ::AddClass ( luaVM );
CLuaPedDefs ::AddClass ( luaVM );
CLuaPickupDefs ::AddClass ( luaVM );
CLuaPlayerDefs ::AddClass ( luaVM );
CLuaRadarAreaDefs ::AddClass ( luaVM );
CLuaResourceDefs ::AddClass ( luaVM );
CLuaTeamDefs ::AddClass ( luaVM );
CLuaTextDefs ::AddClass ( luaVM );
CLuaTimerDefs ::AddClass ( luaVM );
CLuaVehicleDefs ::AddClass ( luaVM );
CLuaWaterDefs ::AddClass ( luaVM );
CLuaXMLDefs ::AddClass ( luaVM );
}


Expand Down
4 changes: 1 addition & 3 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ class CLuaMain //: public CClient
void InitClasses ( lua_State* luaVM );

public:
void AddConnectionClass ( lua_State* luaVM );
void AddQueryHandleClass ( lua_State* luaVM );

bool IsOOPEnabled ( void ) { return m_bEnableOOP; }

private:

static void InstructionCountHook ( lua_State* luaVM, lua_Debug* pDebug );
Expand Down
15 changes: 1 addition & 14 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ void CLuaManager::LoadCFunctions ( void )
CLuaBlipDefs::LoadFunctions ();
CLuaCameraDefs::LoadFunctions ();
CLuaColShapeDefs::LoadFunctions ();
CLuaDatabaseDefs::LoadFunctions ();
CLuaElementDefs::LoadFunctions ();
CLuaFileDefs::LoadFunctions ();
CLuaHandlingDefs::LoadFunctions ();
Expand Down Expand Up @@ -322,21 +323,7 @@ void CLuaManager::LoadCFunctions ( void )
CLuaCFunctions::AddFunction ( "setRuleValue", CLuaFunctionDefs::SetRuleValue );
CLuaCFunctions::AddFunction ( "removeRuleValue", CLuaFunctionDefs::RemoveRuleValue );

// Database funcs
CLuaCFunctions::AddFunction ( "dbConnect", CLuaFunctionDefs::DbConnect );
CLuaCFunctions::AddFunction ( "dbExec", CLuaFunctionDefs::DbExec );
CLuaCFunctions::AddFunction ( "dbQuery", CLuaFunctionDefs::DbQuery );
CLuaCFunctions::AddFunction ( "dbFree", CLuaFunctionDefs::DbFree );
CLuaCFunctions::AddFunction ( "dbPoll", CLuaFunctionDefs::DbPoll );

// Registry functions
CLuaCFunctions::AddFunction ( "executeSQLCreateTable", CLuaFunctionDefs::ExecuteSQLCreateTable );
CLuaCFunctions::AddFunction ( "executeSQLDropTable", CLuaFunctionDefs::ExecuteSQLDropTable );
CLuaCFunctions::AddFunction ( "executeSQLDelete", CLuaFunctionDefs::ExecuteSQLDelete );
CLuaCFunctions::AddFunction ( "executeSQLSelect", CLuaFunctionDefs::ExecuteSQLSelect );
CLuaCFunctions::AddFunction ( "executeSQLUpdate", CLuaFunctionDefs::ExecuteSQLUpdate );
CLuaCFunctions::AddFunction ( "executeSQLInsert", CLuaFunctionDefs::ExecuteSQLInsert );
CLuaCFunctions::AddFunction ( "executeSQLQuery", CLuaFunctionDefs::ExecuteSQLQuery );
CLuaCFunctions::AddFunction ( "getPerformanceStats", CLuaFunctionDefs::GetPerformanceStats );

// Admin functions
Expand Down
3 changes: 0 additions & 3 deletions MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ class CLuaOOPDefs : public CLuaDefs

// Player
LUA_DECLARE ( OutputChat );

// Connection
LUA_DECLARE ( DbQuery );
};

#endif

This file was deleted.

2 changes: 1 addition & 1 deletion MTA10_Server/mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* PROJECT: Multi Theft Auto v1.x
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp
* FILE: mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp
* PURPOSE: Lua function definitions class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
Expand Down

4 comments on commit 2500ca4

@ccw808
Copy link
Member

@ccw808 ccw808 commented on 2500ca4 Dec 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance of getting this reorganizing into 1.5.1, or is it too complicated?

@qaisjp
Copy link
Contributor Author

@qaisjp qaisjp commented on 2500ca4 Dec 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have a go at it using an interactive merge when you first asked me and it was quite complicated. I'll try to merge each commit individually and see where I get.

I am doubtful about it getting merged though.

@ccw808
Copy link
Member

@ccw808 ccw808 commented on 2500ca4 Dec 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about reverting 1.5.1 to 13th Sep, merging, then reapplying 1.5.1 commits since 13th Sep?

@qaisjp
Copy link
Contributor Author

@qaisjp qaisjp commented on 2500ca4 Dec 9, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.