Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mangosthree/server
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed Aug 28, 2024
2 parents 3228cad + 527e2cb commit e0dd459
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/game/BattleGround/BattleGround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ void BattleGround::EndBattleGround(Team winner)
uint8 battleground_type = (uint8)GetTypeID();

// query next id
result = CharacterDatabase.Query("SELECT MAX(id) FROM pvpstats_battlegrounds");
result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `pvpstats_battlegrounds`");
if (result)
{
Field* fields = result->Fetch();
Expand Down Expand Up @@ -1010,7 +1010,7 @@ void BattleGround::EndBattleGround(Team winner)
{
static SqlStatementID insPvPstatsPlayer;
BattleGroundScoreMap::iterator score = m_PlayerScores.find(itr->first);
SqlStatement stmt = CharacterDatabase.CreateStatement(insPvPstatsPlayer, "INSERT INTO pvpstats_players (battleground_id, character_guid, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done, attr_1, attr_2, attr_3, attr_4, attr_5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
SqlStatement stmt = CharacterDatabase.CreateStatement(insPvPstatsPlayer, "INSERT INTO `pvpstats_players` (`battleground_id`, `character_guid`, `score_killing_blows`, `score_deaths`, `score_honorable_kills`, `score_bonus_honor`, `score_damage_done`, `score_healing_done`, `attr_1`, `attr_2`, `attr_3`, `attr_4`, `attr_5`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

stmt.addUInt32(battleground_id);
stmt.addUInt32(plr->GetGUIDLow());
Expand Down
2 changes: 1 addition & 1 deletion src/game/BattleGround/BattleGroundDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ class BattleGroundDS : public BattleGround
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
void AddPlayer(Player* plr) override;
};
#endif
4 changes: 2 additions & 2 deletions src/mangosd/AFThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class AntiFreezeThread : public ACE_Task_Base
{
public:
explicit AntiFreezeThread(uint32 delay);
virtual int open(void*) override;
virtual int svc() override;
int open(void*) override;
int svc() override;

private:
uint32 m_loops;
Expand Down
2 changes: 1 addition & 1 deletion src/mangosd/CliThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CliThread : public ACE_Task_Base
enum { BUFFSIZE = 256 };
public:
CliThread(bool);
virtual int svc() override;
int svc() override;
void cli_shutdown();
private:
char buffer_[BUFFSIZE];
Expand Down
10 changes: 5 additions & 5 deletions src/mangosd/RAThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class RASocket: protected ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH>
sLog.outRALog("Connection was closed.");
}

virtual int open(void* unused) override
int open(void* unused) override
{
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
Expand All @@ -125,7 +125,7 @@ class RASocket: protected ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH>
return 0;
}

virtual int close(u_long unused) override
int close(u_long unused) override
{
if (closing_)
{
Expand All @@ -140,7 +140,7 @@ class RASocket: protected ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH>
return 0;
}

virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE) override
int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE) override
{
if (closing_)
{
Expand Down Expand Up @@ -276,7 +276,7 @@ class RASocket: protected ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH>
return 0;
}

virtual int handle_output(ACE_HANDLE h = ACE_INVALID_HANDLE) override
int handle_output(ACE_HANDLE h = ACE_INVALID_HANDLE) override
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, outBufferLock, -1);

Expand Down Expand Up @@ -312,7 +312,7 @@ class RASocket: protected ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH>
return 0;
}

virtual int handle_close(ACE_HANDLE h = ACE_INVALID_HANDLE,
int handle_close(ACE_HANDLE h = ACE_INVALID_HANDLE,
ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK) override
{
if (closing_)
Expand Down
4 changes: 2 additions & 2 deletions src/mangosd/RAThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class RAThread : public ACE_Task_Base
explicit RAThread(uint16 port, const char* host);
virtual ~RAThread();

virtual int open(void* unused) override;
virtual int svc() override;
int open(void* unused) override;
int svc() override;
};

#endif
Expand Down
4 changes: 2 additions & 2 deletions src/mangosd/WorldThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class WorldThread : public ACE_Task_Base
{
public:
explicit WorldThread(uint16 port, const char* host);
virtual int open(void*) override;
virtual int svc() override;
int open(void*) override;
int svc() override;
private:
ACE_INET_Addr listen_addr;
};
Expand Down
11 changes: 7 additions & 4 deletions src/shared/Database/DatabaseMysql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/

#ifndef DO_POSTGRESQL

#include "Utilities/Util.h"
#include "Policies/Singleton.h"
#include "Platform/Define.h"
Expand All @@ -46,7 +48,7 @@ DatabaseMysql::DatabaseMysql()
// before first connection
if (db_count++ == 0)
{
//Mysql Library Init
// Mysql Library Init
if(mysql_library_init(-1, NULL, NULL))
{
sLog.outError("Could not initialize MySQL client library\n");
Expand All @@ -67,9 +69,9 @@ DatabaseMysql::~DatabaseMysql()

// Free Mysql library pointers for last ~DB
if (--db_count == 0)
{
mysql_library_end();
}
{
mysql_library_end();
}
}

SqlConnection* DatabaseMysql::CreateConnection()
Expand Down Expand Up @@ -543,3 +545,4 @@ enum_field_types MySqlPreparedStatement::ToMySQLType(const SqlStmtFieldData& dat

return dataType;
}
#endif
12 changes: 8 additions & 4 deletions src/shared/Database/DatabaseMysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/

#ifndef DO_POSTGRESQL

#ifndef MANGOS_H_DATABASEMYSQL
#define MANGOS_H_DATABASEMYSQL

Expand Down Expand Up @@ -62,21 +64,21 @@ class MySqlPreparedStatement : public SqlPreparedStatement
*
* @return bool
*/
virtual bool prepare() override;
bool prepare() override;

/**
* @brief bind input parameters
*
* @param holder
*/
virtual void bind(const SqlStmtParameters& holder) override;
void bind(const SqlStmtParameters& holder) override;

/**
* @brief execute DML statement
*
* @return bool
*/
virtual bool execute() override;
bool execute() override;

protected:
/**
Expand Down Expand Up @@ -257,10 +259,12 @@ class DatabaseMysql : public Database
*
* @return SqlConnection
*/
virtual SqlConnection* CreateConnection() override;
SqlConnection* CreateConnection() override;

private:
static size_t db_count; /**< TODO */
};

#endif

#endif
3 changes: 3 additions & 0 deletions src/shared/Database/QueryResultMysql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/

#ifndef DO_POSTGRESQL

#include "DatabaseEnv.h"
#include "Utilities/Errors.h"

Expand Down Expand Up @@ -108,3 +110,4 @@ enum Field::DataTypes QueryResultMysql::ConvertNativeType(enum_field_types mysql
return Field::DB_TYPE_UNKNOWN;
}
}
#endif
4 changes: 4 additions & 0 deletions src/shared/Database/QueryResultMysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/

#ifndef DO_POSTGRESQL

#if !defined(QUERYRESULTMYSQL_H)
#define QUERYRESULTMYSQL_H

Expand Down Expand Up @@ -80,3 +82,5 @@ class QueryResultMysql : public QueryResult
MYSQL_RES* mResult; /**< TODO */
};
#endif

#endif
3 changes: 3 additions & 0 deletions src/shared/Database/SQLStorageImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::convert(uint32 /*field_p
}
else
#endif

dst = D(src);
}

Expand Down Expand Up @@ -108,6 +109,7 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::convert_from_str(uint32
}
else
#endif

dst = 0;
}

Expand All @@ -130,6 +132,7 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::default_fill(uint32 /*fi
}
else
#endif

dst = D(src);
}

Expand Down
5 changes: 5 additions & 0 deletions src/shared/Database/SqlDelayThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ SqlDelayThread::~SqlDelayThread()

void SqlDelayThread::run()
{
#ifndef DO_POSTGRESQL
mysql_thread_init();
#endif

const uint32 loopSleepms = 10;

Expand All @@ -60,7 +62,10 @@ void SqlDelayThread::run()
}
}

#ifndef DO_POSTGRESQL
mysql_thread_end();
#endif

}

void SqlDelayThread::Stop()
Expand Down
6 changes: 3 additions & 3 deletions src/shared/Database/SqlPreparedStatement.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,21 +801,21 @@ class SqlPlainPreparedStatement : public SqlPreparedStatement
*
* @return bool
*/
virtual bool prepare() override { return true; }
bool prepare() override { return true; }

/**
* @brief we should replace all '?' symbols with substrings with proper format
*
* @param holder
*/
virtual void bind(const SqlStmtParameters& holder) override;
void bind(const SqlStmtParameters& holder) override;

/**
* @brief
*
* @return bool
*/
virtual bool execute() override;
bool execute() override;

protected:
/**
Expand Down
1 change: 1 addition & 0 deletions src/tools/Extractor_projects/vmap-extractor/wdtfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ bool WDTFile::init(char* map_id, unsigned int mapID)

if (!strcmp(fourcc, "MAIN"))
{
// Do Nothing
}
if (!strcmp(fourcc, "MWMO"))
{
Expand Down

0 comments on commit e0dd459

Please sign in to comment.