Added support for CLion, removed a lot of unused code in preparation of the rewriting of the network stack

This commit is contained in:
2022-03-06 17:36:43 +02:00
parent b99293c9d7
commit d2f43a8620
82 changed files with 251 additions and 12546 deletions

View File

@ -198,7 +198,7 @@ void AuctionManager::LoadAuctionInfo()
str_to_number(auctionItemInfo.offer_price, row[cur++]);
str_to_number(auctionItemInfo.price, row[cur++]);
str_to_number(auctionItemInfo.offer_id, row[cur++]);
thecore_memcpy (auctionItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
memcpy (auctionItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
cur++;
str_to_number(auctionItemInfo.empire, row[cur++]);
str_to_number(auctionItemInfo.expired_time, row[cur++]);
@ -242,7 +242,7 @@ void AuctionManager::LoadSaleInfo()
str_to_number(saleItemInfo.offer_price, row[cur++]);
str_to_number(saleItemInfo.price, row[cur++]);
str_to_number(saleItemInfo.offer_id, row[cur++]);
thecore_memcpy (saleItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
memcpy (saleItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
cur++;
str_to_number(saleItemInfo.empire, row[cur++]);
str_to_number(saleItemInfo.expired_time, row[cur++]);
@ -285,7 +285,7 @@ void AuctionManager::LoadWishInfo()
str_to_number(wishItemInfo.offer_price, row[cur++]);
str_to_number(wishItemInfo.price, row[cur++]);
str_to_number(wishItemInfo.offer_id, row[cur++]);
thecore_memcpy (wishItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
memcpy (wishItemInfo.shown_name, (char*)row[cur], strlen((char*)row[cur]) +1);
cur++;
str_to_number(wishItemInfo.empire, row[cur++]);
str_to_number(wishItemInfo.expired_time, row[cur++]);
@ -551,7 +551,7 @@ AuctionResult AuctionManager::GetAuctionedItem (DWORD actor_id, DWORD item_id, T
return AUCTION_NOT_EXPIRED;
}
thecore_memcpy(&item, c->Get(), sizeof(TPlayerItem));
memcpy(&item, c->Get(), sizeof(TPlayerItem));
return AUCTION_SUCCESS;
}
@ -574,7 +574,7 @@ AuctionResult AuctionManager::BuySoldItem (DWORD actor_id, DWORD item_id, TPlaye
TSaleItemInfo* item_info = item_info_cache->Get(false);
thecore_memcpy(&item, c->Get(), sizeof(TPlayerItem));
memcpy(&item, c->Get(), sizeof(TPlayerItem));
return AUCTION_SUCCESS;
}
@ -596,7 +596,7 @@ AuctionResult AuctionManager::CancelAuction (DWORD actor_id, DWORD item_id, TPla
}
TAuctionItemInfo* item_info = item_info_cache->Get(false);
thecore_memcpy(&item, c->Get(), sizeof(TPlayerItem));
memcpy(&item, c->Get(), sizeof(TPlayerItem));
return AUCTION_SUCCESS;
}
@ -630,7 +630,7 @@ AuctionResult AuctionManager::CancelSale (DWORD actor_id, DWORD item_id, TPlayer
}
TSaleItemInfo* item_info = item_info_cache->Get(false);
thecore_memcpy(&item, c->Get(), sizeof(TPlayerItem));
memcpy(&item, c->Get(), sizeof(TPlayerItem));
return AUCTION_SUCCESS;
}

View File

@ -217,7 +217,7 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList
m_data.byCount = pUpdateList->byCount;
thecore_memcpy(m_data.aPriceInfo, pUpdateList->aPriceInfo, sizeof(TItemPriceInfo) * pUpdateList->byCount);
memcpy(m_data.aPriceInfo, pUpdateList->aPriceInfo, sizeof(TItemPriceInfo) * pUpdateList->byCount);
int nDeletedNum; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
@ -228,7 +228,7 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList
if (tmpvec.size() < sizeAddOldDataSize)
sizeAddOldDataSize = tmpvec.size();
thecore_memcpy(m_data.aPriceInfo + pUpdateList->byCount, &tmpvec[0], sizeof(TItemPriceInfo) * sizeAddOldDataSize);
memcpy(m_data.aPriceInfo + pUpdateList->byCount, &tmpvec[0], sizeof(TItemPriceInfo) * sizeAddOldDataSize);
m_data.byCount += sizeAddOldDataSize;
nDeletedNum = tmpvec.size() - sizeAddOldDataSize;

View File

@ -1083,7 +1083,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
strncpy(kMapLocations.szHost, peer->GetPublicIP(), sizeof(kMapLocations.szHost));
kMapLocations.wPort = peer->GetListenPort();
thecore_memcpy(kMapLocations.alMaps, peer->GetMaps(), sizeof(kMapLocations.alMaps));
memcpy(kMapLocations.alMaps, peer->GetMaps(), sizeof(kMapLocations.alMaps));
BYTE bMapCount;
@ -1106,7 +1106,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
TMapLocation kMapLocation2;
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
kMapLocation2.wPort = tmp->GetListenPort();
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
vec_kMapLocations.push_back(kMapLocation2);
tmp->EncodeHeader(HEADER_DG_MAP_LOCATIONS, 0, sizeof(BYTE) + sizeof(TMapLocation));
@ -1133,7 +1133,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
TMapLocation kMapLocation2;
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
kMapLocation2.wPort = tmp->GetListenPort();
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
vec_kMapLocations.push_back(kMapLocation2);
}
@ -1161,7 +1161,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
strncpy(kMapLocation2.szHost, tmp->GetPublicIP(), sizeof(kMapLocation2.szHost));
kMapLocation2.wPort = tmp->GetListenPort();
thecore_memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
memcpy(kMapLocation2.alMaps, tmp->GetMaps(), sizeof(kMapLocation2.alMaps));
vec_kMapLocations.push_back(kMapLocation2);
}
@ -2180,7 +2180,7 @@ void CClientManager::MyshopPricelistUpdate(const TPacketMyshopPricelistHeader* p
table.byCount = pPacket->byCount;
const TItemPriceInfo * pInfo = reinterpret_cast<const TItemPriceInfo*>(pPacket + sizeof(TPacketMyshopPricelistHeader));
thecore_memcpy(table.aPriceInfo, pInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
memcpy(table.aPriceInfo, pInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
pCache->UpdateList(&table);
}
@ -2192,7 +2192,7 @@ void CClientManager::MyshopPricelistUpdate(const TPacketMyshopPricelistHeader* p
pUpdateTable->byCount = pPacket->byCount;
const TItemPriceInfo * pInfo = reinterpret_cast<const TItemPriceInfo*>(pPacket + sizeof(TPacketMyshopPricelistHeader));
thecore_memcpy(pUpdateTable->aPriceInfo, pInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
memcpy(pUpdateTable->aPriceInfo, pInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
char szQuery[QUERY_MAX_LEN];
snprintf(szQuery, sizeof(szQuery), "SELECT item_vnum, price FROM myshop_pricelist%s WHERE owner_id=%u", GetTablePostfix(), pPacket->dwOwnerID);

View File

@ -507,7 +507,7 @@ bool CClientManager::InitializeShopTable()
while (it != map_shop.end())
{
thecore_memcpy((m_pShopTable + i), (it++)->second, sizeof(TShopTable));
memcpy((m_pShopTable + i), (it++)->second, sizeof(TShopTable));
sys_log(0, "SHOP: #%d items: %d", (m_pShopTable + i)->dwVnum, (m_pShopTable + i)->byItemCount);
++i;
}
@ -1176,7 +1176,7 @@ void parse_pair_number_string(const char * c_pszString, std::vector<std::pair<in
while (p)
{
if (isnhdigit(*t))
if (isdigit(*t))
{
strncpy(szNum, t, MIN(sizeof(szNum), (p-t)+1));
@ -1198,7 +1198,7 @@ void parse_pair_number_string(const char * c_pszString, std::vector<std::pair<in
p = strchr(t, '/');
}
if (isnhdigit(*t))
if (isdigit(*t))
{
strncpy(szNum, t, sizeof(szNum));

View File

@ -245,7 +245,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
pkLD->SetPlay(true);
SendLoginToBilling(pkLD, true);
thecore_memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes));
memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes));
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, dwHandle, sizeof(TPlayerTable));
peer->Encode(pTab, sizeof(TPlayerTable));
@ -290,7 +290,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
TPlayerItem * p = c->Get();
if (p->vnum) // vnum<75><6D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.
thecore_memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem));
memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem));
}
if (g_test_server)
@ -491,14 +491,14 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
str_to_number(pkTab->parts[PART_HAIR], row[col++]);
if (row[col])
thecore_memcpy(pkTab->skills, row[col], sizeof(pkTab->skills));
memcpy(pkTab->skills, row[col], sizeof(pkTab->skills));
else
memset(&pkTab->skills, 0, sizeof(pkTab->skills));
col++;
if (row[col])
thecore_memcpy(pkTab->quickslot, row[col], sizeof(pkTab->quickslot));
memcpy(pkTab->quickslot, row[col], sizeof(pkTab->quickslot));
else
memset(pkTab->quickslot, 0, sizeof(pkTab->quickslot));
@ -652,7 +652,7 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa
pkLD->SetPlay(true);
SendLoginToBilling(pkLD, true);
thecore_memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes));
memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes));
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, pkInfo->dwHandle, sizeof(TPlayerTable));
peer->Encode(&tab, sizeof(TPlayerTable));

View File

@ -1203,7 +1203,7 @@ bool CGuildManager::ChangeMaster(DWORD dwGID, DWORD dwFrom, DWORD dwTo)
//////////////////////////////////////////////////////////////////////////////////////////
CGuildWarReserve::CGuildWarReserve(const TGuildWarReserve & rTable)
{
thecore_memcpy(&m_data, &rTable, sizeof(TGuildWarReserve));
memcpy(&m_data, &rTable, sizeof(TGuildWarReserve));
m_iLastNoticeMin = -1;
Initialize();

View File

@ -26,7 +26,7 @@ TAccountTable & CLoginData::GetAccountRef()
void CLoginData::SetClientKey(const DWORD * c_pdwClientKey)
{
thecore_memcpy(&m_adwClientKey, c_pdwClientKey, sizeof(DWORD) * 4);
memcpy(&m_adwClientKey, c_pdwClientKey, sizeof(DWORD) * 4);
}
const DWORD * CLoginData::GetClientKey()
@ -105,7 +105,7 @@ bool CLoginData::IsDeleted()
void CLoginData::SetPremium(int * paiPremiumTimes)
{
thecore_memcpy(m_aiPremiumTimes, paiPremiumTimes, sizeof(m_aiPremiumTimes));
memcpy(m_aiPremiumTimes, paiPremiumTimes, sizeof(m_aiPremiumTimes));
}
int CLoginData::GetPremium(BYTE type)

View File

@ -129,7 +129,7 @@ void CPeer::SetP2PPort(WORD wPort)
void CPeer::SetMaps(long * pl)
{
thecore_memcpy(m_alMaps, pl, sizeof(m_alMaps));
memcpy(m_alMaps, pl, sizeof(m_alMaps));
}
void CPeer::SendSpareItemIDRange()

View File

@ -1,6 +1,5 @@
#include <string.h>
#include <stdio.h>
#include "../../libthecore/include/memcpy.h"
#include <common/stl.h>
#include "grid.h"
@ -14,7 +13,7 @@ CGrid::CGrid(CGrid * pkGrid, int w, int h) : m_iWidth(w), m_iHeight(h)
{
m_pGrid = new char[m_iWidth * m_iHeight];
int iSize = std::MIN(w * h, pkGrid->m_iWidth * pkGrid->m_iHeight);
thecore_memcpy(m_pGrid, pkGrid->m_pGrid, sizeof(char) * iSize);
memcpy(m_pGrid, pkGrid->m_pGrid, sizeof(char) * iSize);
}
CGrid::~CGrid()