forked from metin2/server
Database now runs on linux
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include "Cache.h"
|
||||
#include "../../common/auction_table.h"
|
||||
#include <common/auction_table.h>
|
||||
|
||||
class CItemCache;
|
||||
class CAuctionItemInfoCache;
|
||||
|
@ -61,7 +61,7 @@ bool CBlockCountry::Load()
|
||||
BLOCK_IP *block_ip = new BLOCK_IP;
|
||||
block_ip->ip_from = strtoul(row[0], NULL, 10);
|
||||
block_ip->ip_to = strtoul(row[1], NULL, 10);
|
||||
strlcpy(block_ip->country, row[2], sizeof(block_ip->country));
|
||||
strncpy(block_ip->country, row[2], sizeof(block_ip->country));
|
||||
|
||||
m_block_ip.push_back(block_ip);
|
||||
sys_log(0, "BLOCKED_IP : %u - %u", block_ip->ip_from, block_ip->ip_to);
|
||||
@ -174,7 +174,7 @@ void CBlockCountry::SendBlockExceptionOne(CPeer *peer, const char *login, BYTE c
|
||||
TPacketBlockException packet;
|
||||
|
||||
packet.cmd = cmd;
|
||||
strlcpy(packet.login, login, sizeof(packet.login));
|
||||
strncpy(packet.login, login, sizeof(packet.login));
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_BLOCK_EXCEPTION, 0, sizeof(TPacketBlockException));
|
||||
peer->Encode(&packet, sizeof(packet));
|
||||
|
@ -2,8 +2,8 @@
|
||||
#ifndef __INC_DB_CACHE_H__
|
||||
#define __INC_DB_CACHE_H__
|
||||
|
||||
#include "../../common/cache.h"
|
||||
#include "../../common/auction_table.h"
|
||||
#include <common/cache.h>
|
||||
#include <common/auction_table.h>
|
||||
|
||||
class CItemCache : public cache<TPlayerItem>
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "../../common/billing.h"
|
||||
#include "../../common/building.h"
|
||||
#include "../../common/VnumHelper.h"
|
||||
#include <common/billing.h>
|
||||
#include <common/building.h>
|
||||
#include <common/VnumHelper.h>
|
||||
#include "../../libgame/include/grid.h"
|
||||
|
||||
#include "ClientManager.h"
|
||||
@ -122,7 +122,7 @@ bool CClientManager::Initialize()
|
||||
char szBindIP[128];
|
||||
|
||||
if (!CConfig::instance().GetValue("BIND_IP", szBindIP, 128))
|
||||
strlcpy(szBindIP, "0", sizeof(szBindIP));
|
||||
strncpy(szBindIP, "0", sizeof(szBindIP));
|
||||
|
||||
m_fdAccept = socket_tcp_bind(szBindIP, tmpValue);
|
||||
|
||||
@ -483,11 +483,11 @@ void CClientManager::QUERY_QUEST_SAVE(CPeer * pkPeer, TQuestTable * pTable, DWOR
|
||||
void CClientManager::QUERY_SAFEBOX_LOAD(CPeer * pkPeer, DWORD dwHandle, TSafeboxLoadPacket * packet, bool bMall)
|
||||
{
|
||||
ClientHandleInfo * pi = new ClientHandleInfo(dwHandle);
|
||||
strlcpy(pi->safebox_password, packet->szPassword, sizeof(pi->safebox_password));
|
||||
strncpy(pi->safebox_password, packet->szPassword, sizeof(pi->safebox_password));
|
||||
pi->account_id = packet->dwID;
|
||||
pi->account_index = 0;
|
||||
pi->ip[0] = bMall ? 1 : 0;
|
||||
strlcpy(pi->login, packet->szLogin, sizeof(pi->login));
|
||||
strncpy(pi->login, packet->szLogin, sizeof(pi->login));
|
||||
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
@ -513,7 +513,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg)
|
||||
if (pi->account_index == 0)
|
||||
{
|
||||
char szSafeboxPassword[SAFEBOX_PASSWORD_MAX_LEN + 1];
|
||||
strlcpy(szSafeboxPassword, pi->safebox_password, sizeof(szSafeboxPassword));
|
||||
strncpy(szSafeboxPassword, pi->safebox_password, sizeof(szSafeboxPassword));
|
||||
|
||||
TSafeboxTable * pSafebox = new TSafeboxTable;
|
||||
memset(pSafebox, 0, sizeof(TSafeboxTable));
|
||||
@ -853,8 +853,8 @@ void CClientManager::RESULT_SAFEBOX_CHANGE_SIZE(CPeer * pkPeer, SQLMsg * msg)
|
||||
void CClientManager::QUERY_SAFEBOX_CHANGE_PASSWORD(CPeer * pkPeer, DWORD dwHandle, TSafeboxChangePasswordPacket * p)
|
||||
{
|
||||
ClientHandleInfo * pi = new ClientHandleInfo(dwHandle);
|
||||
strlcpy(pi->safebox_password, p->szNewPassword, sizeof(pi->safebox_password));
|
||||
strlcpy(pi->login, p->szOldPassword, sizeof(pi->login));
|
||||
strncpy(pi->safebox_password, p->szNewPassword, sizeof(pi->safebox_password));
|
||||
strncpy(pi->login, p->szOldPassword, sizeof(pi->login));
|
||||
pi->account_id = p->dwID;
|
||||
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
@ -1081,7 +1081,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
//
|
||||
TMapLocation kMapLocations;
|
||||
|
||||
strlcpy(kMapLocations.szHost, peer->GetPublicIP(), sizeof(kMapLocations.szHost));
|
||||
strncpy(kMapLocations.szHost, peer->GetPublicIP(), sizeof(kMapLocations.szHost));
|
||||
kMapLocations.wPort = peer->GetListenPort();
|
||||
thecore_memcpy(kMapLocations.alMaps, peer->GetMaps(), sizeof(kMapLocations.alMaps));
|
||||
|
||||
@ -1104,7 +1104,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
if (tmp->GetChannel() == GUILD_WARP_WAR_CHANNEL || tmp->GetChannel() == peer->GetChannel())
|
||||
{
|
||||
TMapLocation kMapLocation2;
|
||||
strlcpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
kMapLocation2.wPort = tmp->GetListenPort();
|
||||
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
|
||||
vec_kMapLocations.push_back(kMapLocation2);
|
||||
@ -1131,7 +1131,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
if (tmp->GetChannel() == 1 || tmp->GetChannel() == peer->GetChannel())
|
||||
{
|
||||
TMapLocation kMapLocation2;
|
||||
strlcpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
kMapLocation2.wPort = tmp->GetListenPort();
|
||||
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
|
||||
vec_kMapLocations.push_back(kMapLocation2);
|
||||
@ -1159,7 +1159,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
{
|
||||
TMapLocation kMapLocation2;
|
||||
|
||||
strlcpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
|
||||
kMapLocation2.wPort = tmp->GetListenPort();
|
||||
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
|
||||
|
||||
@ -1191,7 +1191,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
TPacketDGP2P p2pSetupPacket;
|
||||
p2pSetupPacket.wPort = peer->GetP2PPort();
|
||||
p2pSetupPacket.bChannel = peer->GetChannel();
|
||||
strlcpy(p2pSetupPacket.szHost, peer->GetPublicIP(), sizeof(p2pSetupPacket.szHost));
|
||||
strncpy(p2pSetupPacket.szHost, peer->GetPublicIP(), sizeof(p2pSetupPacket.szHost));
|
||||
|
||||
for (itertype(m_peerList) i = m_peerList.begin(); i != m_peerList.end();++i)
|
||||
{
|
||||
@ -1226,8 +1226,8 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
|
||||
r.id = pck->dwID;
|
||||
trim_and_lower(pck->szLogin, r.login, sizeof(r.login));
|
||||
strlcpy(r.social_id, pck->szSocialID, sizeof(r.social_id));
|
||||
strlcpy(r.passwd, "TEMP", sizeof(r.passwd));
|
||||
strncpy(r.social_id, pck->szSocialID, sizeof(r.social_id));
|
||||
strncpy(r.passwd, "TEMP", sizeof(r.passwd));
|
||||
|
||||
InsertLoginData(pkLD);
|
||||
|
||||
@ -1240,8 +1240,8 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
{
|
||||
TPacketBillingRepair pck_repair;
|
||||
pck_repair.dwLoginKey = pkLD->GetKey();
|
||||
strlcpy(pck_repair.szLogin, pck->szLogin, sizeof(pck_repair.szLogin));
|
||||
strlcpy(pck_repair.szHost, pck->szHost, sizeof(pck_repair.szHost));
|
||||
strncpy(pck_repair.szLogin, pck->szLogin, sizeof(pck_repair.szLogin));
|
||||
strncpy(pck_repair.szHost, pck->szHost, sizeof(pck_repair.szHost));
|
||||
vec_repair.push_back(pck_repair);
|
||||
}
|
||||
}
|
||||
@ -1791,8 +1791,8 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA
|
||||
|
||||
r.id = p->dwID;
|
||||
trim_and_lower(p->szLogin, r.login, sizeof(r.login));
|
||||
strlcpy(r.social_id, p->szSocialID, sizeof(r.social_id));
|
||||
strlcpy(r.passwd, "TEMP", sizeof(r.passwd));
|
||||
strncpy(r.social_id, p->szSocialID, sizeof(r.social_id));
|
||||
strncpy(r.passwd, "TEMP", sizeof(r.passwd));
|
||||
|
||||
sys_log(0, "AUTH_LOGIN id(%u) login(%s) social_id(%s) login_key(%u), client_key(%u %u %u %u)",
|
||||
p->dwID, p->szLogin, p->szSocialID, p->dwLoginKey,
|
||||
@ -1832,7 +1832,7 @@ void CClientManager::BillingExpire(TPacketBillingExpire * p)
|
||||
|
||||
if (pkPeer)
|
||||
{
|
||||
strlcpy(p->szLogin, pkLD->GetAccountRef().login, sizeof(p->szLogin));
|
||||
strncpy(p->szLogin, pkLD->GetAccountRef().login, sizeof(p->szLogin));
|
||||
pkPeer->EncodeHeader(HEADER_DG_BILLING_EXPIRE, 0, sizeof(TPacketBillingExpire));
|
||||
pkPeer->Encode(p, sizeof(TPacketBillingExpire));
|
||||
}
|
||||
@ -1945,8 +1945,8 @@ void CClientManager::SendAllLoginToBilling()
|
||||
CLoginData * pkLD = (it++)->second;
|
||||
|
||||
p.dwLoginKey = pkLD->GetKey();
|
||||
strlcpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin));
|
||||
strlcpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost));
|
||||
strncpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin));
|
||||
strncpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost));
|
||||
sys_log(0, "SendAllLoginToBilling %s %s", pkLD->GetAccountRef().login, pkLD->GetIP());
|
||||
vec.push_back(p);
|
||||
}
|
||||
@ -3332,8 +3332,8 @@ bool CClientManager::InitializeLocalization()
|
||||
int col = 0;
|
||||
tLocale locale;
|
||||
|
||||
strlcpy(locale.szValue, row[col++], sizeof(locale.szValue));
|
||||
strlcpy(locale.szKey, row[col++], sizeof(locale.szKey));
|
||||
strncpy(locale.szValue, row[col++], sizeof(locale.szValue));
|
||||
strncpy(locale.szKey, row[col++], sizeof(locale.szKey));
|
||||
|
||||
//DB_NAME_COLUMN Setting
|
||||
if (strcmp(locale.szKey, "LOCALE") == 0)
|
||||
@ -3731,9 +3731,9 @@ bool CClientManager::__GetAdminInfo(const char *szIP, std::vector<tAdminInfo> &
|
||||
|
||||
str_to_number(Info.m_ID, row[idx++]);
|
||||
trim_and_lower(row[idx++], Info.m_szAccount, sizeof(Info.m_szAccount));
|
||||
strlcpy(Info.m_szName, row[idx++], sizeof(Info.m_szName));
|
||||
strlcpy(Info.m_szContactIP, row[idx++], sizeof(Info.m_szContactIP));
|
||||
strlcpy(Info.m_szServerIP, row[idx++], sizeof(Info.m_szServerIP));
|
||||
strncpy(Info.m_szName, row[idx++], sizeof(Info.m_szName));
|
||||
strncpy(Info.m_szContactIP, row[idx++], sizeof(Info.m_szContactIP));
|
||||
strncpy(Info.m_szServerIP, row[idx++], sizeof(Info.m_szServerIP));
|
||||
std::string stAuth = row[idx++];
|
||||
|
||||
if (!stAuth.compare("IMPLEMENTOR"))
|
||||
@ -4054,7 +4054,7 @@ void CClientManager::RMCandidacy(CPeer * peer, DWORD dwHandle, const char * data
|
||||
{
|
||||
char szName[32];
|
||||
|
||||
strlcpy(szName, data, sizeof(szName));
|
||||
strncpy(szName, data, sizeof(szName));
|
||||
sys_log(0, "[MONARCH_GM] Remove candidacy name(%s)", szName);
|
||||
|
||||
int iRet = CMonarch::instance().DelCandidacy(szName) ? 1 : 0;
|
||||
@ -4095,7 +4095,7 @@ void CClientManager::SetMonarch(CPeer * peer, DWORD dwHandle, const char * data)
|
||||
{
|
||||
char szName[32];
|
||||
|
||||
strlcpy(szName, data, sizeof(szName));
|
||||
strncpy(szName, data, sizeof(szName));
|
||||
|
||||
if (g_test_server)
|
||||
sys_log(0, "[MONARCH_GM] Set Monarch name(%s)", szName);
|
||||
@ -4138,7 +4138,7 @@ void CClientManager::RMMonarch(CPeer * peer, DWORD dwHandle, const char * data)
|
||||
{
|
||||
char szName[32];
|
||||
|
||||
strlcpy(szName, data, sizeof(szName));
|
||||
strncpy(szName, data, sizeof(szName));
|
||||
|
||||
if (g_test_server)
|
||||
sys_log(0, "[MONARCH_GM] Remove Monarch name(%s)", szName);
|
||||
@ -4197,8 +4197,8 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan
|
||||
ack.dwPID = info->dwPID;
|
||||
|
||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
||||
strlcpy(ack.szName, row[0], sizeof(ack.szName));
|
||||
strlcpy(ack.szDate, row[1], sizeof(ack.szDate));
|
||||
strncpy(ack.szName, row[0], sizeof(ack.szName));
|
||||
strncpy(ack.szDate, row[1], sizeof(ack.szDate));
|
||||
|
||||
snprintf(szQuery, sizeof(szQuery), "UPDATE monarch SET pid=%u, windate=NOW() WHERE empire=%d", ack.dwPID, ack.bEmpire);
|
||||
SQLMsg* pMsg2 = CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER);
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "../../common/stl.h"
|
||||
#include "../../common/building.h"
|
||||
#include "../../common/auction_table.h"
|
||||
#include <common/stl.h>
|
||||
#include <common/building.h>
|
||||
#include <common/auction_table.h>
|
||||
|
||||
#include "Peer.h"
|
||||
#include "DBManager.h"
|
||||
|
@ -312,8 +312,8 @@ bool CClientManager::InitializeMobTable()
|
||||
TMobTable *tempTable = it_map_mobTable->second;
|
||||
|
||||
mob_table->dwVnum = tempTable->dwVnum;
|
||||
strlcpy(mob_table->szName, tempTable->szName, sizeof(tempTable->szName));
|
||||
strlcpy(mob_table->szLocaleName, tempTable->szLocaleName, sizeof(tempTable->szName));
|
||||
strncpy(mob_table->szName, tempTable->szName, sizeof(tempTable->szName));
|
||||
strncpy(mob_table->szLocaleName, tempTable->szLocaleName, sizeof(tempTable->szName));
|
||||
mob_table->bRank = tempTable->bRank;
|
||||
mob_table->bType = tempTable->bType;
|
||||
mob_table->bBattleType = tempTable->bBattleType;
|
||||
@ -323,7 +323,7 @@ bool CClientManager::InitializeMobTable()
|
||||
mob_table->dwRaceFlag = tempTable->dwRaceFlag;
|
||||
mob_table->dwImmuneFlag = tempTable->dwImmuneFlag;
|
||||
mob_table->bEmpire = tempTable->bEmpire;
|
||||
strlcpy(mob_table->szFolder, tempTable->szFolder, sizeof(tempTable->szName));
|
||||
strncpy(mob_table->szFolder, tempTable->szFolder, sizeof(tempTable->szName));
|
||||
mob_table->bOnClickType = tempTable->bOnClickType;
|
||||
mob_table->bStr = tempTable->bStr;
|
||||
mob_table->bDex = tempTable->bDex;
|
||||
@ -545,12 +545,12 @@ bool CClientManager::InitializeQuestItemTable()
|
||||
str_to_number(tbl.dwVnum, row[col++]);
|
||||
|
||||
if (row[col])
|
||||
strlcpy(tbl.szName, row[col], sizeof(tbl.szName));
|
||||
strncpy(tbl.szName, row[col], sizeof(tbl.szName));
|
||||
|
||||
col++;
|
||||
|
||||
if (row[col])
|
||||
strlcpy(tbl.szLocaleName, row[col], sizeof(tbl.szLocaleName));
|
||||
strncpy(tbl.szLocaleName, row[col], sizeof(tbl.szLocaleName));
|
||||
|
||||
col++;
|
||||
|
||||
@ -724,8 +724,8 @@ bool CClientManager::InitializeItemTable()
|
||||
TItemTable *tempTable = it_map_itemTable->second;
|
||||
|
||||
item_table->dwVnum = tempTable->dwVnum;
|
||||
strlcpy(item_table->szName, tempTable->szName, sizeof(item_table->szName));
|
||||
strlcpy(item_table->szLocaleName, tempTable->szLocaleName, sizeof(item_table->szLocaleName));
|
||||
strncpy(item_table->szName, tempTable->szName, sizeof(item_table->szName));
|
||||
strncpy(item_table->szLocaleName, tempTable->szLocaleName, sizeof(item_table->szLocaleName));
|
||||
item_table->bType = tempTable->bType;
|
||||
item_table->bSubType = tempTable->bSubType;
|
||||
item_table->bSize = tempTable->bSize;
|
||||
@ -888,33 +888,33 @@ bool CClientManager::InitializeSkillTable()
|
||||
col = 0;
|
||||
|
||||
str_to_number(t.dwVnum, data[col++]);
|
||||
strlcpy(t.szName, data[col++], sizeof(t.szName));
|
||||
strncpy(t.szName, data[col++], sizeof(t.szName));
|
||||
str_to_number(t.bType, data[col++]);
|
||||
str_to_number(t.bMaxLevel, data[col++]);
|
||||
str_to_number(t.dwSplashRange, data[col++]);
|
||||
|
||||
strlcpy(t.szPointOn, data[col++], sizeof(t.szPointOn));
|
||||
strlcpy(t.szPointPoly, data[col++], sizeof(t.szPointPoly));
|
||||
strlcpy(t.szSPCostPoly, data[col++], sizeof(t.szSPCostPoly));
|
||||
strlcpy(t.szDurationPoly, data[col++], sizeof(t.szDurationPoly));
|
||||
strlcpy(t.szDurationSPCostPoly, data[col++], sizeof(t.szDurationSPCostPoly));
|
||||
strlcpy(t.szCooldownPoly, data[col++], sizeof(t.szCooldownPoly));
|
||||
strlcpy(t.szMasterBonusPoly, data[col++], sizeof(t.szMasterBonusPoly));
|
||||
strncpy(t.szPointOn, data[col++], sizeof(t.szPointOn));
|
||||
strncpy(t.szPointPoly, data[col++], sizeof(t.szPointPoly));
|
||||
strncpy(t.szSPCostPoly, data[col++], sizeof(t.szSPCostPoly));
|
||||
strncpy(t.szDurationPoly, data[col++], sizeof(t.szDurationPoly));
|
||||
strncpy(t.szDurationSPCostPoly, data[col++], sizeof(t.szDurationSPCostPoly));
|
||||
strncpy(t.szCooldownPoly, data[col++], sizeof(t.szCooldownPoly));
|
||||
strncpy(t.szMasterBonusPoly, data[col++], sizeof(t.szMasterBonusPoly));
|
||||
|
||||
str_to_number(t.dwFlag, data[col++]);
|
||||
str_to_number(t.dwAffectFlag, data[col++]);
|
||||
|
||||
strlcpy(t.szPointOn2, data[col++], sizeof(t.szPointOn2));
|
||||
strlcpy(t.szPointPoly2, data[col++], sizeof(t.szPointPoly2));
|
||||
strlcpy(t.szDurationPoly2, data[col++], sizeof(t.szDurationPoly2));
|
||||
strncpy(t.szPointOn2, data[col++], sizeof(t.szPointOn2));
|
||||
strncpy(t.szPointPoly2, data[col++], sizeof(t.szPointPoly2));
|
||||
strncpy(t.szDurationPoly2, data[col++], sizeof(t.szDurationPoly2));
|
||||
str_to_number(t.dwAffectFlag2, data[col++]);
|
||||
|
||||
// ADD_GRANDMASTER_SKILL
|
||||
strlcpy(t.szPointOn3, data[col++], sizeof(t.szPointOn3));
|
||||
strlcpy(t.szPointPoly3, data[col++], sizeof(t.szPointPoly3));
|
||||
strlcpy(t.szDurationPoly3, data[col++], sizeof(t.szDurationPoly3));
|
||||
strncpy(t.szPointOn3, data[col++], sizeof(t.szPointOn3));
|
||||
strncpy(t.szPointPoly3, data[col++], sizeof(t.szPointPoly3));
|
||||
strncpy(t.szDurationPoly3, data[col++], sizeof(t.szDurationPoly3));
|
||||
|
||||
strlcpy(t.szGrandMasterAddSPCostPoly, data[col++], sizeof(t.szGrandMasterAddSPCostPoly));
|
||||
strncpy(t.szGrandMasterAddSPCostPoly, data[col++], sizeof(t.szGrandMasterAddSPCostPoly));
|
||||
// END_OF_ADD_GRANDMASTER_SKILL
|
||||
|
||||
str_to_number(t.bLevelStep, data[col++]);
|
||||
@ -924,7 +924,7 @@ bool CClientManager::InitializeSkillTable()
|
||||
|
||||
str_to_number(t.lMaxHit, data[col++]);
|
||||
|
||||
strlcpy(t.szSplashAroundDamageAdjustPoly, data[col++], sizeof(t.szSplashAroundDamageAdjustPoly));
|
||||
strncpy(t.szSplashAroundDamageAdjustPoly, data[col++], sizeof(t.szSplashAroundDamageAdjustPoly));
|
||||
|
||||
str_to_number(t.bSkillAttrType, data[col++]);
|
||||
str_to_number(t.dwTargetRange, data[col++]);
|
||||
@ -956,7 +956,7 @@ bool CClientManager::InitializeBanwordTable()
|
||||
|
||||
if (data[0])
|
||||
{
|
||||
strlcpy(t.szWord, data[0], sizeof(t.szWord));
|
||||
strncpy(t.szWord, data[0], sizeof(t.szWord));
|
||||
m_vec_banwordTable.push_back(t);
|
||||
}
|
||||
}
|
||||
@ -999,7 +999,7 @@ bool CClientManager::InitializeItemAttrTable()
|
||||
|
||||
int col = 0;
|
||||
|
||||
strlcpy(t.szApply, data[col++], sizeof(t.szApply));
|
||||
strncpy(t.szApply, data[col++], sizeof(t.szApply));
|
||||
str_to_number(t.dwApplyIndex, data[col++]);
|
||||
str_to_number(t.dwProb, data[col++]);
|
||||
str_to_number(t.lValues[0], data[col++]);
|
||||
@ -1073,7 +1073,7 @@ bool CClientManager::InitializeItemRareTable()
|
||||
|
||||
int col = 0;
|
||||
|
||||
strlcpy(t.szApply, data[col++], sizeof(t.szApply));
|
||||
strncpy(t.szApply, data[col++], sizeof(t.szApply));
|
||||
str_to_number(t.dwApplyIndex, data[col++]);
|
||||
str_to_number(t.dwProb, data[col++]);
|
||||
str_to_number(t.lValues[0], data[col++]);
|
||||
@ -1178,7 +1178,7 @@ void parse_pair_number_string(const char * c_pszString, std::vector<std::pair<in
|
||||
{
|
||||
if (isnhdigit(*t))
|
||||
{
|
||||
strlcpy(szNum, t, MIN(sizeof(szNum), (p-t)+1));
|
||||
strncpy(szNum, t, MIN(sizeof(szNum), (p-t)+1));
|
||||
|
||||
comma = strchr(szNum, ',');
|
||||
|
||||
@ -1200,7 +1200,7 @@ void parse_pair_number_string(const char * c_pszString, std::vector<std::pair<in
|
||||
|
||||
if (isnhdigit(*t))
|
||||
{
|
||||
strlcpy(szNum, t, sizeof(szNum));
|
||||
strncpy(szNum, t, sizeof(szNum));
|
||||
|
||||
comma = strchr(const_cast<char*>(t), ',');
|
||||
|
||||
|
@ -19,7 +19,7 @@ void CClientManager::LoadEventFlag()
|
||||
while ((row = mysql_fetch_row(pRes->pSQLResult)))
|
||||
{
|
||||
TPacketSetEventFlag p;
|
||||
strlcpy(p.szFlagName, row[0], sizeof(p.szFlagName));
|
||||
strncpy(p.szFlagName, row[0], sizeof(p.szFlagName));
|
||||
str_to_number(p.lValue, row[1]);
|
||||
sys_log(0, "EventFlag Load %s %d", p.szFlagName, p.lValue);
|
||||
m_map_lEventFlag.insert(std::make_pair(std::string(p.szFlagName), p.lValue));
|
||||
@ -68,7 +68,7 @@ void CClientManager::SendEventFlagsOnSetup(CPeer* peer)
|
||||
for (it = m_map_lEventFlag.begin(); it != m_map_lEventFlag.end(); ++it)
|
||||
{
|
||||
TPacketSetEventFlag p;
|
||||
strlcpy(p.szFlagName, it->first.c_str(), sizeof(p.szFlagName));
|
||||
strncpy(p.szFlagName, it->first.c_str(), sizeof(p.szFlagName));
|
||||
p.lValue = it->second;
|
||||
peer->EncodeHeader(HEADER_DG_SET_EVENT_FLAG, 0, sizeof(TPacketSetEventFlag));
|
||||
peer->Encode(&p, sizeof(TPacketSetEventFlag));
|
||||
|
@ -60,7 +60,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
|
||||
str_to_number(dg.dwOffer, row[3]);
|
||||
str_to_number(dg.bLevel, row[4]);
|
||||
str_to_number(dg.bJob, row[5]);
|
||||
strlcpy(dg.szName, row[6], sizeof(dg.szName));
|
||||
strncpy(dg.szName, row[6], sizeof(dg.szName));
|
||||
|
||||
ForwardPacket(HEADER_DG_GUILD_ADD_MEMBER, &dg, sizeof(TPacketDGGuildMember));
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ void CClientManager::AckHorseName(DWORD dwPID, CPeer* peer)
|
||||
else
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
|
||||
strlcpy(packet.szHorseName, row[0], sizeof(packet.szHorseName));
|
||||
strncpy(packet.szHorseName, row[0], sizeof(packet.szHorseName));
|
||||
}
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_ACK_HORSE_NAME, 0, sizeof(TPacketUpdateHorseName));
|
||||
|
@ -116,7 +116,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||
{
|
||||
sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey);
|
||||
TPacketDGLoginAlready ptog;
|
||||
strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
|
||||
strncpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
|
||||
pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
|
||||
pkPeer->Encode(&ptog, sizeof(TPacketDGLoginAlready));
|
||||
return;
|
||||
@ -147,13 +147,13 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||
|
||||
pkTab->id = r.id;
|
||||
trim_and_lower(r.login, pkTab->login, sizeof(pkTab->login));
|
||||
strlcpy(pkTab->passwd, r.passwd, sizeof(pkTab->passwd));
|
||||
strlcpy(pkTab->social_id, r.social_id, sizeof(pkTab->social_id));
|
||||
strlcpy(pkTab->status, "OK", sizeof(pkTab->status));
|
||||
strncpy(pkTab->passwd, r.passwd, sizeof(pkTab->passwd));
|
||||
strncpy(pkTab->social_id, r.social_id, sizeof(pkTab->social_id));
|
||||
strncpy(pkTab->status, "OK", sizeof(pkTab->status));
|
||||
|
||||
ClientHandleInfo * info = new ClientHandleInfo(dwHandle);
|
||||
info->pAccountTable = pkTab;
|
||||
strlcpy(info->ip, p->szIP, sizeof(info->ip));
|
||||
strncpy(info->ip, p->szIP, sizeof(info->ip));
|
||||
|
||||
sys_log(0, "LOGIN_BY_KEY success %s %lu %s", r.login, p->dwLoginKey, info->ip);
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
@ -250,17 +250,17 @@ TAccountTable * CreateAccountTableFromRes(MYSQL_RES * res)
|
||||
memset(pkTab, 0, sizeof(TAccountTable));
|
||||
|
||||
// ù<><C3B9>° <20>÷<EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD> (JOIN QUERY<52><59> <20><><EFBFBD><EFBFBD> <20><> <20><>)
|
||||
strlcpy(input_pwd, row[col++], sizeof(input_pwd));
|
||||
strncpy(input_pwd, row[col++], sizeof(input_pwd));
|
||||
str_to_number(pkTab->id, row[col++]);
|
||||
strlcpy(pkTab->login, row[col++], sizeof(pkTab->login));
|
||||
strlcpy(pkTab->passwd, row[col++], sizeof(pkTab->passwd));
|
||||
strlcpy(pkTab->social_id, row[col++], sizeof(pkTab->social_id));
|
||||
strncpy(pkTab->login, row[col++], sizeof(pkTab->login));
|
||||
strncpy(pkTab->passwd, row[col++], sizeof(pkTab->passwd));
|
||||
strncpy(pkTab->social_id, row[col++], sizeof(pkTab->social_id));
|
||||
str_to_number(pkTab->bEmpire, row[col++]);
|
||||
|
||||
for (int j = 0; j < PLAYER_PER_ACCOUNT; ++j)
|
||||
str_to_number(pkTab->players[j].dwID, row[col++]);
|
||||
|
||||
strlcpy(pkTab->status, row[col++], sizeof(pkTab->status));
|
||||
strncpy(pkTab->status, row[col++], sizeof(pkTab->status));
|
||||
|
||||
if (strcmp(pkTab->passwd, input_pwd))
|
||||
{
|
||||
@ -298,7 +298,7 @@ void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
|
||||
|
||||
if (pt)
|
||||
{
|
||||
strlcpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));
|
||||
strncpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));
|
||||
|
||||
pkTab->players[j].byJob = pt->job;
|
||||
pkTab->players[j].byLevel = pt->level;
|
||||
@ -319,7 +319,7 @@ void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
|
||||
if (!row[col++])
|
||||
*pkTab->players[j].szName = '\0';
|
||||
else
|
||||
strlcpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));
|
||||
strncpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));
|
||||
|
||||
pkTab->players[j].byJob = 0;
|
||||
pkTab->players[j].byLevel = 0;
|
||||
@ -428,7 +428,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
|
||||
sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login);
|
||||
|
||||
TPacketDGLoginAlready p;
|
||||
strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));
|
||||
strncpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, info->dwHandle, sizeof(TPacketDGLoginAlready));
|
||||
peer->Encode(&p, sizeof(p));
|
||||
@ -538,7 +538,7 @@ void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDCh
|
||||
TPacketDGChangeName pdg;
|
||||
peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));
|
||||
pdg.pid = p->pid;
|
||||
strlcpy(pdg.name, p->name, sizeof(pdg.name));
|
||||
strncpy(pdg.name, p->name, sizeof(pdg.name));
|
||||
peer->Encode(&pdg, sizeof(TPacketDGChangeName));
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||
void CClientManager::ItemAward(CPeer * peer,char* login)
|
||||
{
|
||||
char login_t[LOGIN_MAX_LEN + 1] = "";
|
||||
strlcpy(login_t,login,LOGIN_MAX_LEN + 1);
|
||||
strncpy(login_t,login,LOGIN_MAX_LEN + 1);
|
||||
std::set<TItemAward *> * pSet = ItemAwardManager::instance().GetByLogin(login_t);
|
||||
if(pSet == NULL)
|
||||
return;
|
||||
@ -458,7 +458,7 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
|
||||
// "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"
|
||||
// "skill_level,quickslot,skill_group,alignment,mobile,horse_level,horse_riding,horse_hp,horse_stamina FROM player%s WHERE id=%d",
|
||||
str_to_number(pkTab->id, row[col++]);
|
||||
strlcpy(pkTab->name, row[col++], sizeof(pkTab->name));
|
||||
strncpy(pkTab->name, row[col++], sizeof(pkTab->name));
|
||||
str_to_number(pkTab->job, row[col++]);
|
||||
str_to_number(pkTab->voice, row[col++]);
|
||||
str_to_number(pkTab->dir, row[col++]);
|
||||
@ -509,7 +509,7 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
|
||||
|
||||
if (row[col])
|
||||
{
|
||||
strlcpy(pkTab->szMobile, row[col], sizeof(pkTab->szMobile));
|
||||
strncpy(pkTab->szMobile, row[col], sizeof(pkTab->szMobile));
|
||||
}
|
||||
|
||||
col++;
|
||||
@ -759,8 +759,8 @@ void CClientManager::RESULT_QUEST_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwH
|
||||
row = mysql_fetch_row(pRes);
|
||||
|
||||
str_to_number(r.dwPID, row[0]);
|
||||
strlcpy(r.szName, row[1], sizeof(r.szName));
|
||||
strlcpy(r.szState, row[2], sizeof(r.szState));
|
||||
strncpy(r.szName, row[1], sizeof(r.szName));
|
||||
strncpy(r.szState, row[2], sizeof(r.szState));
|
||||
str_to_number(r.lValue, row[3]);
|
||||
}
|
||||
|
||||
@ -939,7 +939,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
|
||||
pack.bAccountCharacterIndex = packet->account_index;
|
||||
|
||||
pack.player.dwID = player_id;
|
||||
strlcpy(pack.player.szName, packet->player_table.name, sizeof(pack.player.szName));
|
||||
strncpy(pack.player.szName, packet->player_table.name, sizeof(pack.player.szName));
|
||||
pack.player.byJob = packet->player_table.job;
|
||||
pack.player.byLevel = 1;
|
||||
pack.player.dwPlayMinutes = 0;
|
||||
@ -1045,7 +1045,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg)
|
||||
str_to_number(deletedLevelLimit, row[1]);
|
||||
|
||||
char szName[64];
|
||||
strlcpy(szName, row[2], sizeof(szName));
|
||||
strncpy(szName, row[2], sizeof(szName));
|
||||
|
||||
if (deletedLevelLimit >= m_iPlayerDeleteLevelLimit && !IsChinaEventServer())
|
||||
{
|
||||
@ -1220,7 +1220,7 @@ void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore *
|
||||
sys_log(0, "HEADER_GD_HIGHSCORE_REGISTER: PID %u", data->dwPID);
|
||||
|
||||
ClientHandleInfo * pi = new ClientHandleInfo(0);
|
||||
strlcpy(pi->login, data->szBoard, sizeof(pi->login));
|
||||
strncpy(pi->login, data->szBoard, sizeof(pi->login));
|
||||
pi->account_id = (DWORD)data->lValue;
|
||||
pi->player_id = data->dwPID;
|
||||
pi->account_index = (data->cDir > 0);
|
||||
@ -1235,7 +1235,7 @@ void CClientManager::RESULT_HIGHSCORE_REGISTER(CPeer * pkPeer, SQLMsg * msg)
|
||||
//DWORD dwHandle = pi->dwHandle;
|
||||
|
||||
char szBoard[21];
|
||||
strlcpy(szBoard, pi->login, sizeof(szBoard));
|
||||
strncpy(szBoard, pi->login, sizeof(szBoard));
|
||||
int value = (int)pi->account_id;
|
||||
|
||||
SQLResult * res = msg->Get();
|
||||
|
@ -117,7 +117,7 @@ bool CConfig::LoadFile(const char* filename)
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
strlcpy(comment, szTmp, sizeof(comment));
|
||||
strncpy(comment, szTmp, sizeof(comment));
|
||||
++mode;
|
||||
break;
|
||||
|
||||
@ -229,7 +229,7 @@ bool CConfig::GetValue(const char * key, char *dest, size_t destSize)
|
||||
if (!Search(key))
|
||||
return false;
|
||||
|
||||
strlcpy(dest, Get(key), destSize);
|
||||
strncpy(dest, Get(key), destSize);
|
||||
|
||||
if (!*dest)
|
||||
return false;
|
||||
|
@ -7,7 +7,7 @@
|
||||
// <20>ڵ<EFBFBD> by <20><><EFBFBD><EFBFBD> <20>ķα<CEB1><D7B7><EFBFBD> <20>Ƴ<EFBFBD><C6B3><EFBFBD>~ = _=)b
|
||||
#include <mysql/mysql.h>
|
||||
|
||||
#include "../../libsql/AsyncSQL.h"
|
||||
#include <libsql/include/CAsyncSQL.h>
|
||||
|
||||
#define SQL_SAFE_LENGTH(size) (size * 2 + 1)
|
||||
#define QUERY_SAFE_LENGTH(size) (1024 + SQL_SAFE_LENGTH(size))
|
||||
|
@ -137,7 +137,7 @@ void CGuildManager::ParseResult(SQLResult * pRes)
|
||||
|
||||
TGuild & r_info = TouchGuild(GID);
|
||||
|
||||
strlcpy(r_info.szName, row[1], sizeof(r_info.szName));
|
||||
strncpy(r_info.szName, row[1], sizeof(r_info.szName));
|
||||
str_to_number(r_info.ladder_point, row[2]);
|
||||
str_to_number(r_info.win, row[3]);
|
||||
str_to_number(r_info.draw, row[4]);
|
||||
@ -1228,7 +1228,7 @@ void CGuildWarReserve::Initialize()
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
dwGuild = dwGold = 0;
|
||||
strlcpy(szLogin, row[0], sizeof(szLogin));
|
||||
strncpy(szLogin, row[0], sizeof(szLogin));
|
||||
str_to_number(dwGuild, row[1]);
|
||||
str_to_number(dwGold, row[2]);
|
||||
|
||||
@ -1254,7 +1254,7 @@ void CGuildWarReserve::OnSetup(CPeer * peer)
|
||||
|
||||
while (it != mapBet.end())
|
||||
{
|
||||
strlcpy(pckBet.szLogin, it->first.c_str(), sizeof(pckBet.szLogin));
|
||||
strncpy(pckBet.szLogin, it->first.c_str(), sizeof(pckBet.szLogin));
|
||||
pckBet.dwGuild = it->second.first;
|
||||
pckBet.dwGold = it->second.second;
|
||||
|
||||
@ -1316,7 +1316,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild)
|
||||
|
||||
TPacketGDGuildWarBet pckBet;
|
||||
pckBet.dwWarID = m_data.dwID;
|
||||
strlcpy(pckBet.szLogin, pszLogin, sizeof(pckBet.szLogin));
|
||||
strncpy(pckBet.szLogin, pszLogin, sizeof(pckBet.szLogin));
|
||||
pckBet.dwGuild = dwGuild;
|
||||
pckBet.dwGold = dwGold;
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include "Peer.h"
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
#include "../../libsql/libsql.h"
|
||||
#include "../../libpoly/Poly.h"
|
||||
#include <libsql/include/libsql.h>
|
||||
#include <libpoly/include/Poly.h>
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg)
|
||||
|
||||
if (row[col])
|
||||
{
|
||||
strlcpy(kData->szWhy, row[col], sizeof(kData->szWhy));
|
||||
strncpy(kData->szWhy, row[col], sizeof(kData->szWhy));
|
||||
//<2F><><EFBFBD><EFBFBD> <20>߿<EFBFBD> why<68>ݷ뿡 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char* whyStr = kData->szWhy; //why <20>ݷ<EFBFBD> <20>б<EFBFBD>
|
||||
char cmdStr[100] = ""; //why<68>ݷ뿡<DDB7><EBBFA1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ӽ<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
||||
|
@ -66,7 +66,7 @@ DWORD CLoginData::GetLogonTime()
|
||||
|
||||
void CLoginData::SetIP(const char * c_pszIP)
|
||||
{
|
||||
strlcpy(m_szIP, c_pszIP, sizeof(m_szIP));
|
||||
strncpy(m_szIP, c_pszIP, sizeof(m_szIP));
|
||||
}
|
||||
|
||||
const char * CLoginData::GetIP()
|
||||
|
@ -121,8 +121,8 @@ namespace marriage
|
||||
p.dwPID1 = dwPID1;
|
||||
p.dwPID2 = dwPID2;
|
||||
p.tMarryTime = now;
|
||||
strlcpy(p.szName1, szName1, sizeof(p.szName1));
|
||||
strlcpy(p.szName2, szName2, sizeof(p.szName2));
|
||||
strncpy(p.szName1, szName1, sizeof(p.szName1));
|
||||
strncpy(p.szName2, szName2, sizeof(p.szName2));
|
||||
CClientManager::instance().ForwardPacket(HEADER_DG_MARRIAGE_ADD, &p, sizeof(p));
|
||||
}
|
||||
|
||||
@ -263,8 +263,8 @@ namespace marriage
|
||||
p.dwPID1 = pMarriage->pid1;
|
||||
p.dwPID2 = pMarriage->pid2;
|
||||
p.tMarryTime = pMarriage->time;
|
||||
strlcpy(p.szName1, pMarriage->name1.c_str(), sizeof(p.szName1));
|
||||
strlcpy(p.szName2, pMarriage->name2.c_str(), sizeof(p.szName2));
|
||||
strncpy(p.szName1, pMarriage->name1.c_str(), sizeof(p.szName1));
|
||||
strncpy(p.szName2, pMarriage->name2.c_str(), sizeof(p.szName2));
|
||||
peer->EncodeHeader(HEADER_DG_MARRIAGE_ADD, 0, sizeof(p));
|
||||
peer->Encode(&p, sizeof(p));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "Monarch.h"
|
||||
#include "../../common/utils.h"
|
||||
#include <common/utils.h>
|
||||
#include "Main.h"
|
||||
#include "ClientManager.h"
|
||||
|
||||
@ -81,7 +81,7 @@ bool CMonarch::AddCandidacy(DWORD pid, const char * name)
|
||||
MonarchCandidacy info;
|
||||
|
||||
info.pid = pid;
|
||||
strlcpy(info.name, name, sizeof(info.name));
|
||||
strncpy(info.name, name, sizeof(info.name));
|
||||
m_vec_MonarchCandidacy.push_back(info);
|
||||
|
||||
char szQuery[256];
|
||||
@ -192,10 +192,10 @@ bool CMonarch::LoadMonarch()
|
||||
int Empire = 0; str_to_number(Empire, row[idx++]);
|
||||
|
||||
str_to_number(p->pid[Empire], row[idx++]);
|
||||
strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
||||
strncpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
||||
|
||||
str_to_number(p->money[Empire], row[idx++]);
|
||||
strlcpy(p->date[Empire], row[idx++], sizeof(p->date[Empire]));
|
||||
strncpy(p->date[Empire], row[idx++], sizeof(p->date[Empire]));
|
||||
|
||||
if (g_test_server)
|
||||
sys_log(0, "[LOAD_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]);
|
||||
@ -227,7 +227,7 @@ bool CMonarch::SetMonarch(const char * name)
|
||||
str_to_number(Empire, row[idx++]);
|
||||
|
||||
str_to_number(p->pid[Empire], row[idx++]);
|
||||
strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
||||
strncpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
||||
p->money[Empire] = atoll(row[idx++]);
|
||||
|
||||
if (g_test_server)
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include "../../libthecore/include/stdafx.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "../../common/singleton.h"
|
||||
#include "../../common/tables.h"
|
||||
#include <common/singleton.h>
|
||||
#include <common/tables.h>
|
||||
|
||||
class CMonarch : public singleton<CMonarch>
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ bool CPeerBase::Accept(socket_t fd_accept)
|
||||
socket_sndbuf(m_fd, 233016);
|
||||
socket_rcvbuf(m_fd, 233016);
|
||||
|
||||
strlcpy(m_host, inet_ntoa(peer.sin_addr), sizeof(m_host));
|
||||
strncpy(m_host, inet_ntoa(peer.sin_addr), sizeof(m_host));
|
||||
m_outBuffer = buffer_new(DEFAULT_PACKET_BUFFER_SIZE);
|
||||
m_inBuffer = buffer_new(MAX_INPUT_LEN);
|
||||
|
||||
@ -71,7 +71,7 @@ bool CPeerBase::Accept(socket_t fd_accept)
|
||||
|
||||
bool CPeerBase::Connect(const char* host, WORD port)
|
||||
{
|
||||
strlcpy(m_host, host, sizeof(m_host));
|
||||
strncpy(m_host, host, sizeof(m_host));
|
||||
|
||||
if ((m_fd = socket_connect(host, port)) == INVALID_SOCKET)
|
||||
return false;
|
||||
|
@ -586,16 +586,16 @@ bool Set_Proto_Mob_Table(TMobTable *mobTable, cCsvTable &csvTable,std::map<int,c
|
||||
{
|
||||
int col = 0;
|
||||
str_to_number(mobTable->dwVnum, csvTable.AsStringByIndex(col++));
|
||||
strlcpy(mobTable->szName, csvTable.AsStringByIndex(col++), sizeof(mobTable->szName));
|
||||
strncpy(mobTable->szName, csvTable.AsStringByIndex(col++), sizeof(mobTable->szName));
|
||||
|
||||
//3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD> <20>־<EFBFBD><D6BE>ֱ<EFBFBD>.
|
||||
map<int,const char*>::iterator it;
|
||||
it = nameMap.find(mobTable->dwVnum);
|
||||
if (it != nameMap.end()) {
|
||||
const char * localeName = it->second;
|
||||
strlcpy(mobTable->szLocaleName, localeName, sizeof (mobTable->szLocaleName));
|
||||
strncpy(mobTable->szLocaleName, localeName, sizeof (mobTable->szLocaleName));
|
||||
} else {
|
||||
strlcpy(mobTable->szLocaleName, mobTable->szName, sizeof (mobTable->szLocaleName));
|
||||
strncpy(mobTable->szLocaleName, mobTable->szName, sizeof (mobTable->szLocaleName));
|
||||
}
|
||||
|
||||
//RANK
|
||||
@ -626,7 +626,7 @@ bool Set_Proto_Mob_Table(TMobTable *mobTable, cCsvTable &csvTable,std::map<int,c
|
||||
|
||||
str_to_number(mobTable->bEmpire, csvTable.AsStringByIndex(col++)); //col = 11
|
||||
|
||||
strlcpy(mobTable->szFolder, csvTable.AsStringByIndex(col++), sizeof(mobTable->szFolder));
|
||||
strncpy(mobTable->szFolder, csvTable.AsStringByIndex(col++), sizeof(mobTable->szFolder));
|
||||
|
||||
str_to_number(mobTable->bOnClickType, csvTable.AsStringByIndex(col++));
|
||||
|
||||
@ -776,15 +776,15 @@ bool Set_Proto_Item_Table(TItemTable *itemTable, cCsvTable &csvTable,std::map<in
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(itemTable->szName, csvTable.AsStringByIndex(1), sizeof(itemTable->szName));
|
||||
strncpy(itemTable->szName, csvTable.AsStringByIndex(1), sizeof(itemTable->szName));
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD> <20>־<EFBFBD><D6BE>ֱ<EFBFBD>.
|
||||
map<int,const char*>::iterator it;
|
||||
it = nameMap.find(itemTable->dwVnum);
|
||||
if (it != nameMap.end()) {
|
||||
const char * localeName = it->second;
|
||||
strlcpy(itemTable->szLocaleName, localeName, sizeof (itemTable->szLocaleName));
|
||||
strncpy(itemTable->szLocaleName, localeName, sizeof (itemTable->szLocaleName));
|
||||
} else {
|
||||
strlcpy(itemTable->szLocaleName, itemTable->szName, sizeof (itemTable->szLocaleName));
|
||||
strncpy(itemTable->szLocaleName, itemTable->szName, sizeof (itemTable->szLocaleName));
|
||||
}
|
||||
itemTable->bType = dataArray[2];
|
||||
itemTable->bSubType = dataArray[3];
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../../libthecore/include/memcpy.h"
|
||||
#include "../../common/stl.h"
|
||||
#include <common/stl.h>
|
||||
#include "grid.h"
|
||||
|
||||
CGrid::CGrid(int w, int h) : m_iWidth(w), m_iHeight(h)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __INC_METiN_II_DBSERV_STDAFX_H__
|
||||
#define __INC_METiN_II_DBSERV_STDAFX_H__
|
||||
|
||||
#include "../../libthecore/include/stdafx.h"
|
||||
#include <libthecore/include/stdafx.h>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <semaphore.h>
|
||||
@ -10,11 +10,11 @@
|
||||
#define isspace iswspace
|
||||
#endif
|
||||
|
||||
#include "../../common/length.h"
|
||||
#include "../../common/tables.h"
|
||||
#include "../../common/singleton.h"
|
||||
#include "../../common/utils.h"
|
||||
#include "../../common/stl.h"
|
||||
#include "../../common/service.h"
|
||||
#include <common/length.h>
|
||||
#include <common/tables.h>
|
||||
#include <common/singleton.h>
|
||||
#include <common/utils.h>
|
||||
#include <common/stl.h>
|
||||
#include <common/service.h>
|
||||
|
||||
#endif
|
||||
|
@ -8,8 +8,7 @@ void WriteVersion()
|
||||
|
||||
if (NULL != fp)
|
||||
{
|
||||
fprintf(fp, "game perforce revision: %s\n", __P4_VERSION__);
|
||||
fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__);
|
||||
fprintf(fp, "db\n");
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user