Çözüldü warning ve syserr problemi

  • Konuyu açan Konuyu açan nesterali
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 41
  • Gösterim Gösterim 4K
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

nesterali

Üye
Üye
Mesaj
149
Beğeni
62
Puan
726
Ticaret Puanı
0
Hayırlı Bayramlar Bayramınız Mubarek Olsun
client build de aldıgım warning problemi nedir acaba ama build ediyor yine metin2giriş exe si geliyor yine
Kod:
Genişlet Daralt Kopyala
1>------ Build started: Project: UserInterface, Configuration: Distribute Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>  PythonTextTail.cpp
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>  Generating code
1>c:\eskiwslik src li başlangıç\eric bloodaxe - altyapı s.f\client source\source\userinterface\instancebase.cpp(572): warning C4715: 'CInstanceBase::GetPrestigeGrade' : not all control paths return a value
1>  Finished generating code
1>  UserInterface.vcxproj -> C:\eskiwslik src li başlangıç\Eric Bloodaxe - Altyapı S.F\Client Source\binary\Metin2Distribute.exe
========== Build: 1 succeeded, 0 failed, 15 up-to-date, 0 skipped ==========


metin2 ye girdiğimde karakter seçme bölümünde karakterin ismi gözükmüyor ve karakteri seçtiğimde yükleme ekranı hiç dolmuyor ve syserr boş hiç bişey gelmiyor . client builde warning problemi ile alakalımı acaba
 
yeni bir karakter oluşturup girmeyi dener misin birde tekrardan tüm sysserleri kontrol et kayıtları buraya yaz yeni bir karakter oluşturduktan sonra giremezsen usr/game/share/locale/turkey/map index dosyasının içindekilerini ekle buraya
 
yeni bir karakter oluşturup girmeyi dener misin birde tekrardan tüm sysserleri kontrol et kayıtları buraya yaz yeni bir karakter oluşturduktan sonra giremezsen usr/game/share/locale/turkey/map index dosyasının içindekilerini ekle buraya
aynı şekilde kalıyor yine
ch1 syserr
Kod:
Genişlet Daralt Kopyala
SYSERR: Jul 31 21:56:28 :: pid_init:
Start of pid: 984

SYSERR: Jul 31 21:57:17 :: heart_idle: losing 47 seconds. (lag occured)
SYSERR: Jul 31 21:57:19 :: GetServerLocation: location error name altyapi mapindex 0 0 x 957081 empire 3
SYSERR: Jul 31 21:57:27 :: GetServerLocation: location error name altyapi mapindex 0 0 x 957081 empire 3
SYSERR: Jul 31 22:14:53 :: GetServerLocation: location error name altyapi mapindex 0 0 x 957081 empire 3
SYSERR: Jul 31 22:15:16 :: GetServerLocation: location error name altyapi mapindex 0 0 x 957081 empire 3
SYSERR: Jul 31 22:15:16 :: GetServerLocation: location error name TEST00 mapindex 0 0 x 957453 empire 3

dp syserr
Kod:
Genişlet Daralt Kopyala
SYSERR: Jul 31 21:56:24 :: pid_init:
Start of pid: 978

SYSERR: Jul 31 21:56:29 :: __GetAdminInfo: __GetAdminInfo() ==> DirectQuery failed(SELECT mID,mAccount,mName,mContactIP,mServerIP,mAuthority FROM gmlist WHERE mServerIP='ALL' or mServerIP='192.168.1.24')
SYSERR: Jul 31 21:56:30 :: __GetAdminInfo: __GetAdminInfo() ==> DirectQuery failed(SELECT mID,mAccount,mName,mContactIP,mServerIP,mAuthority FROM gmlist WHERE mServerIP='ALL' or mServerIP='192.168.1.24')

/usr/game/share/locale/turkey/map indexteki içerik
Kod:
Genişlet Daralt Kopyala
1 metin2_map_a1
3 metin2_map_a3
4 metin2_map_guild_01
5 metin2_map_monkey_dungeon_11
6 metin2_guild_village_01
21 metin2_map_b1
23 metin2_map_b3
24 metin2_map_guild_02
25 metin2_map_monkey_dungeon_12
26 metin2_guild_village_02
41 metin2_map_c1
43 metin2_map_c3
44 metin2_map_guild_03
45 metin2_map_monkey_dungeon_13
46 metin2_guild_village_03
61 map_n_snowm_01
62 metin2_map_n_flame_01
63 metin2_map_n_desert_01
64 map_n_threeway
65 metin2_map_milgyo
66 metin2_map_deviltower1
67 metin2_map_trent
68 metin2_map_trent02
69 metin2_map_WL_01
70 metin2_map_nusluck01
71 metin2_map_spiderdungeon_02
72 metin2_map_skipia_dungeon_01
73 metin2_map_skipia_dungeon_02
81 metin2_map_wedding_01
100 metin2_map_fielddungeon
101 metin2_map_resources_zon
103 metin2_map_t1
104 metin2_map_spiderdungeon
105 metin2_map_t2
107 metin2_map_monkey_dungeon
108 metin2_map_monkey_dungeon2
109 metin2_map_monkey_dungeon3
110 metin2_map_t3
111 metin2_map_t4
112 metin2_map_duel
113 metin2_map_oxevent
114 metin2_map_sungzi
118 metin2_map_sungzi_flame_hill_01
119 metin2_map_sungzi_flame_hill_02
120 metin2_map_sungzi_flame_hill_03
121 metin2_map_sungzi_snow
122 metin2_map_sungzi_snow_pass01
123 metin2_map_sungzi_snow_pass02
124 metin2_map_sungzi_snow_pass03
125 metin2_map_sungzi_desert_01
126 metin2_map_sungzi_desert_hill_01
127 metin2_map_sungzi_desert_hill_02
128 metin2_map_sungzi_desert_hill_03
181 metin2_map_empirewar01
182 metin2_map_empirewar02
183 metin2_map_empirewar03
200 gm_guild_build
208 metin2_map_skipia_dungeon_boss
216 metin2_map_devilcatacomb
217 metin2_map_spiderdungeon_03
301 Metin2_map_CapeDragonHead
302 metin2_map_dawnmistwood
303 metin2_map_BayBlackSand
304 metin2_map_Mt_Thunder
351 metin2_map_n_flame_dungeon_01
352 metin2_map_n_snow_dungeon_01
 
Aklıma birşey gelmiyor game99 syserr bakabilir misiniz birde

usr/game/share/locale/turkey setting lua tarzı bi dosya olacak onuda eklermisiniz konuya
 
Aklıma birşey gelmiyor game99 syserr bakabilir misiniz birde

usr/game/share/locale/turkey setting lua tarzı bi dosya olacak onuda eklermisiniz konuya
bu dizinlerde hiç bir ekleme düzenleme oynama vs sorucede game dp bölümünde buil clientmanagerlogin.cpp kontrol edicem bi dp ile ilgili sorun veriyor sanki orda yanlışlıkmı yaptım build edip kontrol edip tekrar yazıyım ben hemen
 
Tamam eğer game ve db dosyası build edilmiş şekli varsa direk öyle başlatmayı dene paylaşılan bir files ise bu sorunların olmaması gerekirdi indiren kişiler bu yüzden giriş yapamayabilirler
 
Tamam eğer game ve db dosyası build edilmiş şekli varsa direk öyle başlatmayı dene paylaşılan bir files ise bu sorunların olmaması gerekirdi indiren kişiler bu yüzden giriş yapamayabilirler
büyük ihtimal src dp src dizinindeki bahsettiğim dosyadan dolayı oldu tekrar ellenmemiş üzerinden sistem eklentilerimi ekledim tekrar build yapıyorum src yi normalde giriyordu ama builden sonra böyle oldu maalesef
 
sizden bi konuda daha yardım istesem
puttyde derlemede bu hatayı veriyor
içerikledi ekledim aşşağıda nerde yanlış yapıyorum acaba ellenmemiş ClientManagerLogin.cpp içeriğinide en altta paylaştım isterseniz
bu linkte hepsinin bulunduğu rar
Linkleri görebilmek için giriş yap veya kayıt ol.


Kod:
Genişlet Daralt Kopyala
ClientManagerLogin.cpp: In member function 'void CClientManager::RESULT_LOGIN(CPeer*, SQLMsg*)':
ClientManagerLogin.cpp:409:14: error: 'szQuery' was not declared in this scope
     snprintf(szQuery, sizeof(szQuery),
              ^
gmake: *** [.obj/ClientManagerLogin.o] Error 1

ClientManagerLogin.cpp içeriği
C++:
Genişlet Daralt Kopyala
#include "stdafx.h"
#include "../../common/CommonDefines.h"

#include "ClientManager.h"

#include "Main.h"
#include "Config.h"
#include "QID.h"
#include "Cache.h"

extern std::string g_stLocale;
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
extern int g_test_server;
extern int g_log;

bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (m_map_kLogonAccount.end() != it)
        return false;

    CLoginData * pkLD = GetLoginDataByLogin(c_pszLogin);

    if (!pkLD)
        return false;

    pkLD->SetConnectedPeerHandle(dwHandle);
    pkLD->SetIP(c_pszIP);

    m_map_kLogonAccount.insert(TLogonAccountMap::value_type(szLogin, pkLD));
    return true;
}

bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (it == m_map_kLogonAccount.end())
        return false;

    CLoginData * pkLD = it->second;

    if (pkLD->GetConnectedPeerHandle() != dwHandle)
    {
        sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle());
        return false;
    }

    if (pkLD->IsPlay())
    {
        pkLD->SetPlay(false);
        SendLoginToBilling(pkLD, false);
    }

    if (pkLD->IsDeleted())
    {
        delete pkLD;
    }

    m_map_kLogonAccount.erase(it);
    return true;
}

bool CClientManager::FindLogonAccount(const char * c_pszLogin)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    if (m_map_kLogonAccount.end() == m_map_kLogonAccount.find(szLogin))
        return false;

    return true;
}

void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p)
{
#ifdef ENABLE_LIMIT_TIME
    static int s_updateCount = 0;
    static int s_curTime = time(0);
    if (s_updateCount > 100)
    {
        s_curTime = time(0);
        s_updateCount = 0;
    }
    ++s_updateCount;

    if (s_curTime >= GLOBAL_LIMIT_TIME)
    {
        sys_err("Server life time expired.");
        exit(0);
        return;
    }
#endif

    CLoginData * pkLoginData = GetLoginData(p->dwLoginKey);
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(p->szLogin, szLogin, sizeof(szLogin));

    if (!pkLoginData)
    {
        sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable & r = pkLoginData->GetAccountRef();

    if (FindLogonAccount(r.login))
    {
        sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey);
        TPacketDGLoginAlready ptog;
        strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
        pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
        pkPeer->Encode(&ptog, sizeof(TPacketDGLoginAlready));
        return;
    }

    if (strcasecmp(r.login, szLogin))
    {
        sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(DWORD) * 4))
    {
        const DWORD * pdwClientKey = pkLoginData->GetClientKey();

        sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu",
                r.login,
                p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
                pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]);

        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    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));

    ClientHandleInfo * info = new ClientHandleInfo(dwHandle);
    info->pAccountTable = pkTab;
    strlcpy(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];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}

void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (msg->uiSQLErrno != 0)
    {
        peer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle);
        delete info;
        return;
    }

    char szQuery[QUERY_MAX_LEN];

    if (msg->Get()->uiNumRows == 0)
    {
        DWORD account_id = info->pAccountTable->id;
        char szQuery[QUERY_MAX_LEN];
        snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
        std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));

        sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

        if (pMsg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

            // PLAYER_INDEX_CREATE_BUG_FIX
            //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id);
            snprintf(szQuery, sizeof(szQuery), "INSERT INTO player_index%s (id) VALUES(%u)", GetTablePostfix(), info->pAccountTable->id);
            CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_INDEX_CREATE, peer->GetHandle(), info);
            // END_PLAYER_INDEX_CREATE_BUF_FIX
        }
        return;
    }

    MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);

    int col = 0;

    for (; col < PLAYER_PER_ACCOUNT; ++col)
        str_to_number(info->pAccountTable->players[col].dwID, row[col]);

    str_to_number(info->pAccountTable->bEmpire, row[col++]);
    info->account_index = 1;

    extern std::string g_stLocale;
    if (g_stLocale == "gb2312")
    {
#ifdef ENABLE_TITLE_SYSTEM
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u",
                GetTablePostfix(), info->pAccountTable->id);
#else
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u",
                GetTablePostfix(), info->pAccountTable->id);
#endif
    }
    else
    {
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, name, job, level, playtime, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                GetTablePostfix(), info->pAccountTable->id);
    }

    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN, peer->GetHandle(), info);
}

// PLAYER_INDEX_CREATE_BUG_FIX
void CClientManager::RESULT_PLAYER_INDEX_CREATE(CPeer * pkPeer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    char szQuery[QUERY_MAX_LEN];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
            info->pAccountTable->id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}
// END_PLAYER_INDEX_CREATE_BUG_FIX

TAccountTable * CreateAccountTableFromRes(MYSQL_RES * res)
{
    char input_pwd[PASSWD_MAX_LEN + 1];
    MYSQL_ROW row = NULL;
    DWORD col;

    row = mysql_fetch_row(res);
    col = 0;

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    // 첫번째 컬럼 것만 참고 한다 (JOIN QUERY를 위한 것 임)
    strlcpy(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));
    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));

    if (strcmp(pkTab->passwd, input_pwd))
    {
        delete pkTab;
        return NULL;
    }

    return pkTab;
}

void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
{
    if (!pRes)
        return;

    for (DWORD i = 0; i < mysql_num_rows(pRes); ++i)
    {
        MYSQL_ROW row = mysql_fetch_row(pRes);
        int col = 0;

        DWORD player_id = 0;
        !row[col++] ? 0 : str_to_number(player_id, row[col - 1]);

        if (!player_id)
            continue;

        int j;

        for (j = 0; j < PLAYER_PER_ACCOUNT; ++j)
        {
            if (pkTab->players[j].dwID == player_id)
            {
                CPlayerTableCache * pc = CClientManager::instance().GetPlayerCache(player_id);
                TPlayerTable * pt = pc ? pc->Get(false) : NULL;

                if (pt)
                {
                    strlcpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = pt->job;
                    pkTab->players[j].byLevel            = pt->level;
                    pkTab->players[j].dwPlayMinutes        = pt->playtime;
                    pkTab->players[j].byST            = pt->st;
                    pkTab->players[j].byHT            = pt->ht;
                    pkTab->players[j].byDX            = pt->dx;
                    pkTab->players[j].byIQ            = pt->iq;
                    pkTab->players[j].wMainPart            = pt->parts[PART_MAIN];
                    pkTab->players[j].wHairPart            = pt->parts[PART_HAIR];
                    pkTab->players[j].x                = pt->x;
                    pkTab->players[j].y                = pt->y;
                    pkTab->players[j].skill_group        = pt->skill_group;
                    pkTab->players[j].bChangeName        = 0;
                }
                else
                {
                    if (!row[col++])
                        *pkTab->players[j].szName = '\0';
                    else
                        strlcpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = 0;
                    pkTab->players[j].byLevel        = 0;
                    pkTab->players[j].dwPlayMinutes    = 0;
                    pkTab->players[j].byST            = 0;
                    pkTab->players[j].byHT            = 0;
                    pkTab->players[j].byDX            = 0;
                    pkTab->players[j].byIQ            = 0;
                    pkTab->players[j].wMainPart        = 0;
                    pkTab->players[j].wHairPart        = 0;
                    pkTab->players[j].x                = 0;
                    pkTab->players[j].y                = 0;
                    pkTab->players[j].skill_group    = 0;
                    pkTab->players[j].bChangeName    = 0;

                    str_to_number(pkTab->players[j].byJob, row[col++]);
                    str_to_number(pkTab->players[j].byLevel, row[col++]);
                    str_to_number(pkTab->players[j].dwPlayMinutes, row[col++]);
                    str_to_number(pkTab->players[j].byST, row[col++]);
                    str_to_number(pkTab->players[j].byHT, row[col++]);
                    str_to_number(pkTab->players[j].byDX, row[col++]);
                    str_to_number(pkTab->players[j].byIQ, row[col++]);
                    str_to_number(pkTab->players[j].wMainPart, row[col++]);
                    str_to_number(pkTab->players[j].wHairPart, row[col++]);
                    str_to_number(pkTab->players[j].x, row[col++]);
                    str_to_number(pkTab->players[j].y, row[col++]);
                    str_to_number(pkTab->players[j].skill_group, row[col++]);
                    str_to_number(pkTab->players[j].bChangeName, row[col++]);
                }

                sys_log(0, "%s %lu %lu hair %u",
                        pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart);
                break;
            }
        }
        /*
           if (j == PLAYER_PER_ACCOUNT)
           sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)",
           pkTab->login, player_id,
           pkTab->players[0].dwID,
           pkTab->players[1].dwID,
           pkTab->players[2].dwID);
           */
    }
}

void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (info->account_index == 0)
    {
        // 계정이 없네?
        if (msg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN: no account");
            peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0);
            delete info;
            return;
        }

        info->pAccountTable = CreateAccountTableFromRes(msg->Get()->pSQLResult);

        if (!info->pAccountTable)
        {
            sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD");
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
        }
        else
        {
            ++info->account_index;

            char queryStr[512];
            extern std::string g_stLocale;
            if (g_stLocale == "gb2312")
            {
#ifdef ENABLE_TITLE_SYSTEM       
                snprintf(szQuery, sizeof(szQuery),
                        "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u",
                        GetTablePostfix(), info->pAccountTable->id);
#else   
                snprintf(szQuery, sizeof(szQuery),
                        "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u",
                        GetTablePostfix(), info->pAccountTable->id);
#endif
            }
            else
            {
                snprintf(queryStr, sizeof(queryStr),
                        "SELECT id, name, job, level, playtime, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                        GetTablePostfix(), info->pAccountTable->id);
            }

            CDBManager::instance().ReturnQuery(queryStr, QID_LOGIN, peer->GetHandle(), info);
        }
        return;
    }
    else
    {
        if (!info->pAccountTable) // 이럴리는 없겠지만;;
        {
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
            return;
        }

        // 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
        if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip))
        {
            sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login);

            TPacketDGLoginAlready p;
            strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));

            peer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, info->dwHandle, sizeof(TPacketDGLoginAlready));
            peer->Encode(&p, sizeof(p));
        }
        else
        {
            sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows);

            if (msg->Get()->uiNumRows > 0)
                CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable);

            //PREVENT_COPY_ITEM
            CLoginData * p = GetLoginDataByLogin(info->pAccountTable->login);
            memcpy(&p->GetAccountRef(), info->pAccountTable, sizeof(TAccountTable));

            //END_PREVENT_COPY_ITEM
            peer->EncodeHeader(HEADER_DG_LOGIN_SUCCESS, info->dwHandle, sizeof(TAccountTable));
            peer->Encode(info->pAccountTable, sizeof(TAccountTable));

        }

        delete info->pAccountTable;
        info->pAccountTable = NULL;
        delete info;
    }
}

void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data)
{
    TLogoutPacket* packet = (TLogoutPacket*)data;

    if (!*packet->login)
        return;

    CLoginData * pLoginData = GetLoginDataByLogin(packet->login);

    if (pLoginData == NULL)
        return;

    int pid[PLAYER_PER_ACCOUNT];

    for (int n = 0; n < PLAYER_PER_ACCOUNT; ++n)
    {
        if (pLoginData->GetAccountRef().players[n].dwID == 0)
        {
            if (g_test_server)
                sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID);
            continue;
        }

        pid[n] = pLoginData->GetAccountRef().players[n].dwID;

        if (g_log)
            sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]);

        InsertLogoutPlayer(pid[n]);
    }

    if (DeleteLogonAccount(packet->login, peer->GetHandle()))
    {
        if (g_log)
            sys_log(0, "LOGOUT %s ", packet->login);
    }
}

void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p)
{
    char queryStr[QUERY_MAX_LEN];

    if (g_stLocale == "sjis")
        snprintf(queryStr, sizeof(queryStr),
                "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci AND id <> %u",
                GetTablePostfix(), p->name, p->pid);
    else
        snprintf(queryStr, sizeof(queryStr),
            "SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    if (pMsg->Get()->uiNumRows)
    {
        if (!pMsg->Get()->pSQLResult)
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
            return;
        }

        MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

        if (*row[0] != '0')
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
            return;
        }
    }
    else
    {
        peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
        return;
    }

    snprintf(queryStr, sizeof(queryStr),
            "UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    TPacketDGChangeName pdg;
    peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));
    pdg.pid = p->pid;
    strlcpy(pdg.name, p->name, sizeof(pdg.name));
    peer->Encode(&pdg, sizeof(TPacketDGChangeName));
}


ClientManagerLogin.cpp ye eklenecek olan içerik

C++:
Genişlet Daralt Kopyala
// 1) Search:
    snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
   
// 2) Delete their function and paste:
#ifdef ENABLE_TITLE_SYSTEM       
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else   
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif
   
// 1) Search:    
    snprintf(queryStr, sizeof(queryStr), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
// 2) Delete their function and paste:
#ifdef ENABLE_TITLE_SYSTEM       
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else   
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif

ClientManagerLogin.cpp hiç ellenmemiş olan dosya buda bunun üstünde de bakmak isterseniz

C++:
Genişlet Daralt Kopyala
#include "stdafx.h"
#include "../../common/CommonDefines.h"

#include "ClientManager.h"

#include "Main.h"
#include "Config.h"
#include "QID.h"
#include "Cache.h"

extern std::string g_stLocale;
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
extern int g_test_server;
extern int g_log;

bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (m_map_kLogonAccount.end() != it)
        return false;

    CLoginData * pkLD = GetLoginDataByLogin(c_pszLogin);

    if (!pkLD)
        return false;

    pkLD->SetConnectedPeerHandle(dwHandle);
    pkLD->SetIP(c_pszIP);

    m_map_kLogonAccount.insert(TLogonAccountMap::value_type(szLogin, pkLD));
    return true;
}

bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (it == m_map_kLogonAccount.end())
        return false;

    CLoginData * pkLD = it->second;

    if (pkLD->GetConnectedPeerHandle() != dwHandle)
    {
        sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle());
        return false;
    }

    if (pkLD->IsPlay())
    {
        pkLD->SetPlay(false);
        SendLoginToBilling(pkLD, false);
    }

    if (pkLD->IsDeleted())
    {
        delete pkLD;
    }

    m_map_kLogonAccount.erase(it);
    return true;
}

bool CClientManager::FindLogonAccount(const char * c_pszLogin)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    if (m_map_kLogonAccount.end() == m_map_kLogonAccount.find(szLogin))
        return false;

    return true;
}

void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p)
{
#ifdef ENABLE_LIMIT_TIME
    static int s_updateCount = 0;
    static int s_curTime = time(0);
    if (s_updateCount > 100)
    {
        s_curTime = time(0);
        s_updateCount = 0;
    }
    ++s_updateCount;

    if (s_curTime >= GLOBAL_LIMIT_TIME)
    {
        sys_err("Server life time expired.");
        exit(0);
        return;
    }
#endif

    CLoginData * pkLoginData = GetLoginData(p->dwLoginKey);
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(p->szLogin, szLogin, sizeof(szLogin));

    if (!pkLoginData)
    {
        sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable & r = pkLoginData->GetAccountRef();

    if (FindLogonAccount(r.login))
    {
        sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey);
        TPacketDGLoginAlready ptog;
        strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
        pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
        pkPeer->Encode(&ptog, sizeof(TPacketDGLoginAlready));
        return;
    }

    if (strcasecmp(r.login, szLogin))
    {
        sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(DWORD) * 4))
    {
        const DWORD * pdwClientKey = pkLoginData->GetClientKey();

        sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu",
                r.login,
                p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
                pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]);

        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    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));

    ClientHandleInfo * info = new ClientHandleInfo(dwHandle);
    info->pAccountTable = pkTab;
    strlcpy(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];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}

void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (msg->uiSQLErrno != 0)
    {
        peer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle);
        delete info;
        return;
    }

    char szQuery[QUERY_MAX_LEN];

    if (msg->Get()->uiNumRows == 0)
    {
        DWORD account_id = info->pAccountTable->id;
        char szQuery[QUERY_MAX_LEN];
        snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
        std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));

        sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

        if (pMsg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

            // PLAYER_INDEX_CREATE_BUG_FIX
            //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id);
            snprintf(szQuery, sizeof(szQuery), "INSERT INTO player_index%s (id) VALUES(%u)", GetTablePostfix(), info->pAccountTable->id);
            CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_INDEX_CREATE, peer->GetHandle(), info);
            // END_PLAYER_INDEX_CREATE_BUF_FIX
        }
        return;
    }

    MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);

    int col = 0;

    for (; col < PLAYER_PER_ACCOUNT; ++col)
        str_to_number(info->pAccountTable->players[col].dwID, row[col]);

    str_to_number(info->pAccountTable->bEmpire, row[col++]);
    info->account_index = 1;

    extern std::string g_stLocale;
    if (g_stLocale == "gb2312")
    {
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                GetTablePostfix(), info->pAccountTable->id);
    }
    else
    {
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, name, job, level, playtime, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                GetTablePostfix(), info->pAccountTable->id);
    }

    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN, peer->GetHandle(), info);
}

// PLAYER_INDEX_CREATE_BUG_FIX
void CClientManager::RESULT_PLAYER_INDEX_CREATE(CPeer * pkPeer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    char szQuery[QUERY_MAX_LEN];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
            info->pAccountTable->id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}
// END_PLAYER_INDEX_CREATE_BUG_FIX

TAccountTable * CreateAccountTableFromRes(MYSQL_RES * res)
{
    char input_pwd[PASSWD_MAX_LEN + 1];
    MYSQL_ROW row = NULL;
    DWORD col;

    row = mysql_fetch_row(res);
    col = 0;

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    // 첫번째 컬럼 것만 참고 한다 (JOIN QUERY를 위한 것 임)
    strlcpy(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));
    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));

    if (strcmp(pkTab->passwd, input_pwd))
    {
        delete pkTab;
        return NULL;
    }

    return pkTab;
}

void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
{
    if (!pRes)
        return;

    for (DWORD i = 0; i < mysql_num_rows(pRes); ++i)
    {
        MYSQL_ROW row = mysql_fetch_row(pRes);
        int col = 0;

        DWORD player_id = 0;
        !row[col++] ? 0 : str_to_number(player_id, row[col - 1]);

        if (!player_id)
            continue;

        int j;

        for (j = 0; j < PLAYER_PER_ACCOUNT; ++j)
        {
            if (pkTab->players[j].dwID == player_id)
            {
                CPlayerTableCache * pc = CClientManager::instance().GetPlayerCache(player_id);
                TPlayerTable * pt = pc ? pc->Get(false) : NULL;

                if (pt)
                {
                    strlcpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = pt->job;
                    pkTab->players[j].byLevel            = pt->level;
                    pkTab->players[j].dwPlayMinutes        = pt->playtime;
                    pkTab->players[j].byST            = pt->st;
                    pkTab->players[j].byHT            = pt->ht;
                    pkTab->players[j].byDX            = pt->dx;
                    pkTab->players[j].byIQ            = pt->iq;
                    pkTab->players[j].wMainPart            = pt->parts[PART_MAIN];
                    pkTab->players[j].wHairPart            = pt->parts[PART_HAIR];
                    pkTab->players[j].x                = pt->x;
                    pkTab->players[j].y                = pt->y;
                    pkTab->players[j].skill_group        = pt->skill_group;
                    pkTab->players[j].bChangeName        = 0;
                }
                else
                {
                    if (!row[col++])
                        *pkTab->players[j].szName = '\0';
                    else
                        strlcpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = 0;
                    pkTab->players[j].byLevel        = 0;
                    pkTab->players[j].dwPlayMinutes    = 0;
                    pkTab->players[j].byST            = 0;
                    pkTab->players[j].byHT            = 0;
                    pkTab->players[j].byDX            = 0;
                    pkTab->players[j].byIQ            = 0;
                    pkTab->players[j].wMainPart        = 0;
                    pkTab->players[j].wHairPart        = 0;
                    pkTab->players[j].x                = 0;
                    pkTab->players[j].y                = 0;
                    pkTab->players[j].skill_group    = 0;
                    pkTab->players[j].bChangeName    = 0;

                    str_to_number(pkTab->players[j].byJob, row[col++]);
                    str_to_number(pkTab->players[j].byLevel, row[col++]);
                    str_to_number(pkTab->players[j].dwPlayMinutes, row[col++]);
                    str_to_number(pkTab->players[j].byST, row[col++]);
                    str_to_number(pkTab->players[j].byHT, row[col++]);
                    str_to_number(pkTab->players[j].byDX, row[col++]);
                    str_to_number(pkTab->players[j].byIQ, row[col++]);
                    str_to_number(pkTab->players[j].wMainPart, row[col++]);
                    str_to_number(pkTab->players[j].wHairPart, row[col++]);
                    str_to_number(pkTab->players[j].x, row[col++]);
                    str_to_number(pkTab->players[j].y, row[col++]);
                    str_to_number(pkTab->players[j].skill_group, row[col++]);
                    str_to_number(pkTab->players[j].bChangeName, row[col++]);
                }

                sys_log(0, "%s %lu %lu hair %u",
                        pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart);
                break;
            }
        }
        /*
           if (j == PLAYER_PER_ACCOUNT)
           sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)",
           pkTab->login, player_id,
           pkTab->players[0].dwID,
           pkTab->players[1].dwID,
           pkTab->players[2].dwID);
           */
    }
}

void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (info->account_index == 0)
    {
        // 계정이 없네?
        if (msg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN: no account");
            peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0);
            delete info;
            return;
        }

        info->pAccountTable = CreateAccountTableFromRes(msg->Get()->pSQLResult);

        if (!info->pAccountTable)
        {
            sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD");
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
        }
        else
        {
            ++info->account_index;

            char queryStr[512];
            extern std::string g_stLocale;
            if (g_stLocale == "gb2312")
            {
                snprintf(queryStr, sizeof(queryStr),
                        "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                        GetTablePostfix(), info->pAccountTable->id);
            }
            else
            {
                snprintf(queryStr, sizeof(queryStr),
                        "SELECT id, name, job, level, playtime, st, ht, dx, iq, part_main, part_hair, x, y, skill_group, change_name FROM player%s WHERE account_id=%u",
                        GetTablePostfix(), info->pAccountTable->id);
            }

            CDBManager::instance().ReturnQuery(queryStr, QID_LOGIN, peer->GetHandle(), info);
        }
        return;
    }
    else
    {
        if (!info->pAccountTable) // 이럴리는 없겠지만;;
        {
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
            return;
        }

        // 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
        if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip))
        {
            sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login);

            TPacketDGLoginAlready p;
            strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));

            peer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, info->dwHandle, sizeof(TPacketDGLoginAlready));
            peer->Encode(&p, sizeof(p));
        }
        else
        {
            sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows);

            if (msg->Get()->uiNumRows > 0)
                CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable);

            //PREVENT_COPY_ITEM
            CLoginData * p = GetLoginDataByLogin(info->pAccountTable->login);
            memcpy(&p->GetAccountRef(), info->pAccountTable, sizeof(TAccountTable));

            //END_PREVENT_COPY_ITEM
            peer->EncodeHeader(HEADER_DG_LOGIN_SUCCESS, info->dwHandle, sizeof(TAccountTable));
            peer->Encode(info->pAccountTable, sizeof(TAccountTable));

        }

        delete info->pAccountTable;
        info->pAccountTable = NULL;
        delete info;
    }
}

void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data)
{
    TLogoutPacket* packet = (TLogoutPacket*)data;

    if (!*packet->login)
        return;

    CLoginData * pLoginData = GetLoginDataByLogin(packet->login);

    if (pLoginData == NULL)
        return;

    int pid[PLAYER_PER_ACCOUNT];

    for (int n = 0; n < PLAYER_PER_ACCOUNT; ++n)
    {
        if (pLoginData->GetAccountRef().players[n].dwID == 0)
        {
            if (g_test_server)
                sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID);
            continue;
        }

        pid[n] = pLoginData->GetAccountRef().players[n].dwID;

        if (g_log)
            sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]);

        InsertLogoutPlayer(pid[n]);
    }

    if (DeleteLogonAccount(packet->login, peer->GetHandle()))
    {
        if (g_log)
            sys_log(0, "LOGOUT %s ", packet->login);
    }
}

void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p)
{
    char queryStr[QUERY_MAX_LEN];

    if (g_stLocale == "sjis")
        snprintf(queryStr, sizeof(queryStr),
                "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci AND id <> %u",
                GetTablePostfix(), p->name, p->pid);
    else
        snprintf(queryStr, sizeof(queryStr),
            "SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    if (pMsg->Get()->uiNumRows)
    {
        if (!pMsg->Get()->pSQLResult)
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
            return;
        }

        MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

        if (*row[0] != '0')
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
            return;
        }
    }
    else
    {
        peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
        return;
    }

    snprintf(queryStr, sizeof(queryStr),
            "UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    TPacketDGChangeName pdg;
    peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));
    pdg.pid = p->pid;
    strlcpy(pdg.name, p->name, sizeof(pdg.name));
    peer->Encode(&pdg, sizeof(TPacketDGChangeName));
}
 
Bilgisayar başında değilim sanırım böyle olması gerekli denermisin gmake komutunu kullan clean yapmadan

C++:
Genişlet Daralt Kopyala
#include "stdafx.h"
#include "../../common/CommonDefines.h"

#include "ClientManager.h"

#include "Main.h"
#include "Config.h"
#include "QID.h"
#include "Cache.h"

extern std::string g_stLocale;
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
extern int g_test_server;
extern int g_log;

bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (m_map_kLogonAccount.end() != it)
        return false;

    CLoginData * pkLD = GetLoginDataByLogin(c_pszLogin);

    if (!pkLD)
        return false;

    pkLD->SetConnectedPeerHandle(dwHandle);
    pkLD->SetIP(c_pszIP);

    m_map_kLogonAccount.insert(TLogonAccountMap::value_type(szLogin, pkLD));
    return true;
}

bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (it == m_map_kLogonAccount.end())
        return false;

    CLoginData * pkLD = it->second;

    if (pkLD->GetConnectedPeerHandle() != dwHandle)
    {
        sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle());
        return false;
    }

    if (pkLD->IsPlay())
    {
        pkLD->SetPlay(false);
        SendLoginToBilling(pkLD, false);
    }

    if (pkLD->IsDeleted())
    {
        delete pkLD;
    }

    m_map_kLogonAccount.erase(it);
    return true;
}

bool CClientManager::FindLogonAccount(const char * c_pszLogin)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    if (m_map_kLogonAccount.end() == m_map_kLogonAccount.find(szLogin))
        return false;

    return true;
}

void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p)
{
#ifdef ENABLE_LIMIT_TIME
    static int s_updateCount = 0;
    static int s_curTime = time(0);
    if (s_updateCount > 100)
    {
        s_curTime = time(0);
        s_updateCount = 0;
    }
    ++s_updateCount;

    if (s_curTime >= GLOBAL_LIMIT_TIME)
    {
        sys_err("Server life time expired.");
        exit(0);
        return;
    }
#endif

    CLoginData * pkLoginData = GetLoginData(p->dwLoginKey);
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(p->szLogin, szLogin, sizeof(szLogin));

    if (!pkLoginData)
    {
        sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable & r = pkLoginData->GetAccountRef();

    if (FindLogonAccount(r.login))
    {
        sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey);
        TPacketDGLoginAlready ptog;
        strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
        pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
        pkPeer->Encode(&ptog, sizeof(TPacketDGLoginAlready));
        return;
    }

    if (strcasecmp(r.login, szLogin))
    {
        sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(DWORD) * 4))
    {
        const DWORD * pdwClientKey = pkLoginData->GetClientKey();

        sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu",
                r.login,
                p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
                pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]);

        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    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));

    ClientHandleInfo * info = new ClientHandleInfo(dwHandle);
    info->pAccountTable = pkTab;
    strlcpy(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];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}

void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (msg->uiSQLErrno != 0)
    {
        peer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle);
        delete info;
        return;
    }

    char szQuery[QUERY_MAX_LEN];

    if (msg->Get()->uiNumRows == 0)
    {
        DWORD account_id = info->pAccountTable->id;
        char szQuery[QUERY_MAX_LEN];
        snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
        std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));

        sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

        if (pMsg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

            // PLAYER_INDEX_CREATE_BUG_FIX
            //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id);
            snprintf(szQuery, sizeof(szQuery), "INSERT INTO player_index%s (id) VALUES(%u)", GetTablePostfix(), info->pAccountTable->id);
            CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_INDEX_CREATE, peer->GetHandle(), info);
            // END_PLAYER_INDEX_CREATE_BUF_FIX
        }
        return;
    }

    MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);

    int col = 0;

    for (; col < PLAYER_PER_ACCOUNT; ++col)
        str_to_number(info->pAccountTable->players[col].dwID, row[col]);

    str_to_number(info->pAccountTable->bEmpire, row[col++]);
    info->account_index = 1;

    extern std::string g_stLocale;
    if (g_stLocale == "gb2312")

#ifdef ENABLE_TITLE_SYSTEM      
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else  
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif

    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN, peer->GetHandle(), info);
}

// PLAYER_INDEX_CREATE_BUG_FIX
void CClientManager::RESULT_PLAYER_INDEX_CREATE(CPeer * pkPeer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    char szQuery[QUERY_MAX_LEN];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
            info->pAccountTable->id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}
// END_PLAYER_INDEX_CREATE_BUG_FIX

TAccountTable * CreateAccountTableFromRes(MYSQL_RES * res)
{
    char input_pwd[PASSWD_MAX_LEN + 1];
    MYSQL_ROW row = NULL;
    DWORD col;

    row = mysql_fetch_row(res);
    col = 0;

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    // 첫번째 컬럼 것만 참고 한다 (JOIN QUERY를 위한 것 임)
    strlcpy(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));
    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));

    if (strcmp(pkTab->passwd, input_pwd))
    {
        delete pkTab;
        return NULL;
    }

    return pkTab;
}

void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
{
    if (!pRes)
        return;

    for (DWORD i = 0; i < mysql_num_rows(pRes); ++i)
    {
        MYSQL_ROW row = mysql_fetch_row(pRes);
        int col = 0;

        DWORD player_id = 0;
        !row[col++] ? 0 : str_to_number(player_id, row[col - 1]);

        if (!player_id)
            continue;

        int j;

        for (j = 0; j < PLAYER_PER_ACCOUNT; ++j)
        {
            if (pkTab->players[j].dwID == player_id)
            {
                CPlayerTableCache * pc = CClientManager::instance().GetPlayerCache(player_id);
                TPlayerTable * pt = pc ? pc->Get(false) : NULL;

                if (pt)
                {
                    strlcpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = pt->job;
                    pkTab->players[j].byLevel            = pt->level;
                    pkTab->players[j].dwPlayMinutes        = pt->playtime;
                    pkTab->players[j].byST            = pt->st;
                    pkTab->players[j].byHT            = pt->ht;
                    pkTab->players[j].byDX            = pt->dx;
                    pkTab->players[j].byIQ            = pt->iq;
                    pkTab->players[j].wMainPart            = pt->parts[PART_MAIN];
                    pkTab->players[j].wHairPart            = pt->parts[PART_HAIR];
                    pkTab->players[j].x                = pt->x;
                    pkTab->players[j].y                = pt->y;
                    pkTab->players[j].skill_group        = pt->skill_group;
                    pkTab->players[j].bChangeName        = 0;
                }
                else
                {
                    if (!row[col++])
                        *pkTab->players[j].szName = '\0';
                    else
                        strlcpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = 0;
                    pkTab->players[j].byLevel        = 0;
                    pkTab->players[j].dwPlayMinutes    = 0;
                    pkTab->players[j].byST            = 0;
                    pkTab->players[j].byHT            = 0;
                    pkTab->players[j].byDX            = 0;
                    pkTab->players[j].byIQ            = 0;
                    pkTab->players[j].wMainPart        = 0;
                    pkTab->players[j].wHairPart        = 0;
                    pkTab->players[j].x                = 0;
                    pkTab->players[j].y                = 0;
                    pkTab->players[j].skill_group    = 0;
                    pkTab->players[j].bChangeName    = 0;

                    str_to_number(pkTab->players[j].byJob, row[col++]);
                    str_to_number(pkTab->players[j].byLevel, row[col++]);
                    str_to_number(pkTab->players[j].dwPlayMinutes, row[col++]);
                    str_to_number(pkTab->players[j].byST, row[col++]);
                    str_to_number(pkTab->players[j].byHT, row[col++]);
                    str_to_number(pkTab->players[j].byDX, row[col++]);
                    str_to_number(pkTab->players[j].byIQ, row[col++]);
                    str_to_number(pkTab->players[j].wMainPart, row[col++]);
                    str_to_number(pkTab->players[j].wHairPart, row[col++]);
                    str_to_number(pkTab->players[j].x, row[col++]);
                    str_to_number(pkTab->players[j].y, row[col++]);
                    str_to_number(pkTab->players[j].skill_group, row[col++]);
                    str_to_number(pkTab->players[j].bChangeName, row[col++]);
                }

                sys_log(0, "%s %lu %lu hair %u",
                        pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart);
                break;
            }
        }
        /*
           if (j == PLAYER_PER_ACCOUNT)
           sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)",
           pkTab->login, player_id,
           pkTab->players[0].dwID,
           pkTab->players[1].dwID,
           pkTab->players[2].dwID);
           */
    }
}

void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (info->account_index == 0)
    {
        // 계정이 없네?
        if (msg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN: no account");
            peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0);
            delete info;
            return;
        }

        info->pAccountTable = CreateAccountTableFromRes(msg->Get()->pSQLResult);

        if (!info->pAccountTable)
        {
            sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD");
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
        }
        else
        {
            ++info->account_index;

            char queryStr[512];
            extern std::string g_stLocale;
            if (g_stLocale == "gb2312")

#ifdef ENABLE_TITLE_SYSTEM      
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else  
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif

            CDBManager::instance().ReturnQuery(queryStr, QID_LOGIN, peer->GetHandle(), info);
        }
        return;
    }
    else
    {
        if (!info->pAccountTable) // 이럴리는 없겠지만;;
        {
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
            return;
        }

        // 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
        if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip))
        {
            sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login);

            TPacketDGLoginAlready p;
            strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));

            peer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, info->dwHandle, sizeof(TPacketDGLoginAlready));
            peer->Encode(&p, sizeof(p));
        }
        else
        {
            sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows);

            if (msg->Get()->uiNumRows > 0)
                CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable);

            //PREVENT_COPY_ITEM
            CLoginData * p = GetLoginDataByLogin(info->pAccountTable->login);
            memcpy(&p->GetAccountRef(), info->pAccountTable, sizeof(TAccountTable));

            //END_PREVENT_COPY_ITEM
            peer->EncodeHeader(HEADER_DG_LOGIN_SUCCESS, info->dwHandle, sizeof(TAccountTable));
            peer->Encode(info->pAccountTable, sizeof(TAccountTable));

        }

        delete info->pAccountTable;
        info->pAccountTable = NULL;
        delete info;
    }
}

void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data)
{
    TLogoutPacket* packet = (TLogoutPacket*)data;

    if (!*packet->login)
        return;

    CLoginData * pLoginData = GetLoginDataByLogin(packet->login);

    if (pLoginData == NULL)
        return;

    int pid[PLAYER_PER_ACCOUNT];

    for (int n = 0; n < PLAYER_PER_ACCOUNT; ++n)
    {
        if (pLoginData->GetAccountRef().players[n].dwID == 0)
        {
            if (g_test_server)
                sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID);
            continue;
        }

        pid[n] = pLoginData->GetAccountRef().players[n].dwID;

        if (g_log)
            sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]);

        InsertLogoutPlayer(pid[n]);
    }

    if (DeleteLogonAccount(packet->login, peer->GetHandle()))
    {
        if (g_log)
            sys_log(0, "LOGOUT %s ", packet->login);
    }
}

void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p)
{
    char queryStr[QUERY_MAX_LEN];

    if (g_stLocale == "sjis")
        snprintf(queryStr, sizeof(queryStr),
                "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci AND id <> %u",
                GetTablePostfix(), p->name, p->pid);
    else
        snprintf(queryStr, sizeof(queryStr),
            "SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    if (pMsg->Get()->uiNumRows)
    {
        if (!pMsg->Get()->pSQLResult)
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
            return;
        }

        MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

        if (*row[0] != '0')
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
            return;
        }
    }
    else
    {
        peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
        return;
    }

    snprintf(queryStr, sizeof(queryStr),
            "UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    TPacketDGChangeName pdg;
    peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));
    pdg.pid = p->pid;
    strlcpy(pdg.name, p->name, sizeof(pdg.name));
    peer->Encode(&pdg, sizeof(TPacketDGChangeName));
}
 
Bilgisayar başında değilim sanırım böyle olması gerekli denermisin gmake komutunu kullan clean yapmadan

C++:
Genişlet Daralt Kopyala
#include "stdafx.h"
#include "../../common/CommonDefines.h"

#include "ClientManager.h"

#include "Main.h"
#include "Config.h"
#include "QID.h"
#include "Cache.h"

extern std::string g_stLocale;
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
extern int g_test_server;
extern int g_log;

bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (m_map_kLogonAccount.end() != it)
        return false;

    CLoginData * pkLD = GetLoginDataByLogin(c_pszLogin);

    if (!pkLD)
        return false;

    pkLD->SetConnectedPeerHandle(dwHandle);
    pkLD->SetIP(c_pszIP);

    m_map_kLogonAccount.insert(TLogonAccountMap::value_type(szLogin, pkLD));
    return true;
}

bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    itertype(m_map_kLogonAccount) it = m_map_kLogonAccount.find(szLogin);

    if (it == m_map_kLogonAccount.end())
        return false;

    CLoginData * pkLD = it->second;

    if (pkLD->GetConnectedPeerHandle() != dwHandle)
    {
        sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle());
        return false;
    }

    if (pkLD->IsPlay())
    {
        pkLD->SetPlay(false);
        SendLoginToBilling(pkLD, false);
    }

    if (pkLD->IsDeleted())
    {
        delete pkLD;
    }

    m_map_kLogonAccount.erase(it);
    return true;
}

bool CClientManager::FindLogonAccount(const char * c_pszLogin)
{
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(c_pszLogin, szLogin, sizeof(szLogin));

    if (m_map_kLogonAccount.end() == m_map_kLogonAccount.find(szLogin))
        return false;

    return true;
}

void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p)
{
#ifdef ENABLE_LIMIT_TIME
    static int s_updateCount = 0;
    static int s_curTime = time(0);
    if (s_updateCount > 100)
    {
        s_curTime = time(0);
        s_updateCount = 0;
    }
    ++s_updateCount;

    if (s_curTime >= GLOBAL_LIMIT_TIME)
    {
        sys_err("Server life time expired.");
        exit(0);
        return;
    }
#endif

    CLoginData * pkLoginData = GetLoginData(p->dwLoginKey);
    char szLogin[LOGIN_MAX_LEN + 1];
    trim_and_lower(p->szLogin, szLogin, sizeof(szLogin));

    if (!pkLoginData)
    {
        sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable & r = pkLoginData->GetAccountRef();

    if (FindLogonAccount(r.login))
    {
        sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey);
        TPacketDGLoginAlready ptog;
        strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
        pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
        pkPeer->Encode(&ptog, sizeof(TPacketDGLoginAlready));
        return;
    }

    if (strcasecmp(r.login, szLogin))
    {
        sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin);
        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(DWORD) * 4))
    {
        const DWORD * pdwClientKey = pkLoginData->GetClientKey();

        sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu",
                r.login,
                p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
                pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]);

        pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
        return;
    }

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    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));

    ClientHandleInfo * info = new ClientHandleInfo(dwHandle);
    info->pAccountTable = pkTab;
    strlcpy(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];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}

void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (msg->uiSQLErrno != 0)
    {
        peer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle);
        delete info;
        return;
    }

    char szQuery[QUERY_MAX_LEN];

    if (msg->Get()->uiNumRows == 0)
    {
        DWORD account_id = info->pAccountTable->id;
        char szQuery[QUERY_MAX_LEN];
        snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
        std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));

        sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

        if (pMsg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);

            // PLAYER_INDEX_CREATE_BUG_FIX
            //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id);
            snprintf(szQuery, sizeof(szQuery), "INSERT INTO player_index%s (id) VALUES(%u)", GetTablePostfix(), info->pAccountTable->id);
            CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_INDEX_CREATE, peer->GetHandle(), info);
            // END_PLAYER_INDEX_CREATE_BUF_FIX
        }
        return;
    }

    MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);

    int col = 0;

    for (; col < PLAYER_PER_ACCOUNT; ++col)
        str_to_number(info->pAccountTable->players[col].dwID, row[col]);

    str_to_number(info->pAccountTable->bEmpire, row[col++]);
    info->account_index = 1;

    extern std::string g_stLocale;
    if (g_stLocale == "gb2312")

#ifdef ENABLE_TITLE_SYSTEM     
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else 
        snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif

    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN, peer->GetHandle(), info);
}

// PLAYER_INDEX_CREATE_BUG_FIX
void CClientManager::RESULT_PLAYER_INDEX_CREATE(CPeer * pkPeer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    char szQuery[QUERY_MAX_LEN];
    snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
            info->pAccountTable->id);
    CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
}
// END_PLAYER_INDEX_CREATE_BUG_FIX

TAccountTable * CreateAccountTableFromRes(MYSQL_RES * res)
{
    char input_pwd[PASSWD_MAX_LEN + 1];
    MYSQL_ROW row = NULL;
    DWORD col;

    row = mysql_fetch_row(res);
    col = 0;

    TAccountTable * pkTab = new TAccountTable;
    memset(pkTab, 0, sizeof(TAccountTable));

    // 첫번째 컬럼 것만 참고 한다 (JOIN QUERY를 위한 것 임)
    strlcpy(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));
    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));

    if (strcmp(pkTab->passwd, input_pwd))
    {
        delete pkTab;
        return NULL;
    }

    return pkTab;
}

void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab)
{
    if (!pRes)
        return;

    for (DWORD i = 0; i < mysql_num_rows(pRes); ++i)
    {
        MYSQL_ROW row = mysql_fetch_row(pRes);
        int col = 0;

        DWORD player_id = 0;
        !row[col++] ? 0 : str_to_number(player_id, row[col - 1]);

        if (!player_id)
            continue;

        int j;

        for (j = 0; j < PLAYER_PER_ACCOUNT; ++j)
        {
            if (pkTab->players[j].dwID == player_id)
            {
                CPlayerTableCache * pc = CClientManager::instance().GetPlayerCache(player_id);
                TPlayerTable * pt = pc ? pc->Get(false) : NULL;

                if (pt)
                {
                    strlcpy(pkTab->players[j].szName, pt->name, sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = pt->job;
                    pkTab->players[j].byLevel            = pt->level;
                    pkTab->players[j].dwPlayMinutes        = pt->playtime;
                    pkTab->players[j].byST            = pt->st;
                    pkTab->players[j].byHT            = pt->ht;
                    pkTab->players[j].byDX            = pt->dx;
                    pkTab->players[j].byIQ            = pt->iq;
                    pkTab->players[j].wMainPart            = pt->parts[PART_MAIN];
                    pkTab->players[j].wHairPart            = pt->parts[PART_HAIR];
                    pkTab->players[j].x                = pt->x;
                    pkTab->players[j].y                = pt->y;
                    pkTab->players[j].skill_group        = pt->skill_group;
                    pkTab->players[j].bChangeName        = 0;
                }
                else
                {
                    if (!row[col++])
                        *pkTab->players[j].szName = '\0';
                    else
                        strlcpy(pkTab->players[j].szName, row[col - 1], sizeof(pkTab->players[j].szName));

                    pkTab->players[j].byJob            = 0;
                    pkTab->players[j].byLevel        = 0;
                    pkTab->players[j].dwPlayMinutes    = 0;
                    pkTab->players[j].byST            = 0;
                    pkTab->players[j].byHT            = 0;
                    pkTab->players[j].byDX            = 0;
                    pkTab->players[j].byIQ            = 0;
                    pkTab->players[j].wMainPart        = 0;
                    pkTab->players[j].wHairPart        = 0;
                    pkTab->players[j].x                = 0;
                    pkTab->players[j].y                = 0;
                    pkTab->players[j].skill_group    = 0;
                    pkTab->players[j].bChangeName    = 0;

                    str_to_number(pkTab->players[j].byJob, row[col++]);
                    str_to_number(pkTab->players[j].byLevel, row[col++]);
                    str_to_number(pkTab->players[j].dwPlayMinutes, row[col++]);
                    str_to_number(pkTab->players[j].byST, row[col++]);
                    str_to_number(pkTab->players[j].byHT, row[col++]);
                    str_to_number(pkTab->players[j].byDX, row[col++]);
                    str_to_number(pkTab->players[j].byIQ, row[col++]);
                    str_to_number(pkTab->players[j].wMainPart, row[col++]);
                    str_to_number(pkTab->players[j].wHairPart, row[col++]);
                    str_to_number(pkTab->players[j].x, row[col++]);
                    str_to_number(pkTab->players[j].y, row[col++]);
                    str_to_number(pkTab->players[j].skill_group, row[col++]);
                    str_to_number(pkTab->players[j].bChangeName, row[col++]);
                }

                sys_log(0, "%s %lu %lu hair %u",
                        pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart);
                break;
            }
        }
        /*
           if (j == PLAYER_PER_ACCOUNT)
           sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)",
           pkTab->login, player_id,
           pkTab->players[0].dwID,
           pkTab->players[1].dwID,
           pkTab->players[2].dwID);
           */
    }
}

void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
{
    CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
    ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;

    if (info->account_index == 0)
    {
        // 계정이 없네?
        if (msg->Get()->uiNumRows == 0)
        {
            sys_log(0, "RESULT_LOGIN: no account");
            peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0);
            delete info;
            return;
        }

        info->pAccountTable = CreateAccountTableFromRes(msg->Get()->pSQLResult);

        if (!info->pAccountTable)
        {
            sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD");
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
        }
        else
        {
            ++info->account_index;

            char queryStr[512];
            extern std::string g_stLocale;
            if (g_stLocale == "gb2312")

#ifdef ENABLE_TITLE_SYSTEM     
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#else 
                snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
#endif

            CDBManager::instance().ReturnQuery(queryStr, QID_LOGIN, peer->GetHandle(), info);
        }
        return;
    }
    else
    {
        if (!info->pAccountTable) // 이럴리는 없겠지만;;
        {
            peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
            delete info;
            return;
        }

        // 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
        if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip))
        {
            sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login);

            TPacketDGLoginAlready p;
            strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));

            peer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, info->dwHandle, sizeof(TPacketDGLoginAlready));
            peer->Encode(&p, sizeof(p));
        }
        else
        {
            sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows);

            if (msg->Get()->uiNumRows > 0)
                CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable);

            //PREVENT_COPY_ITEM
            CLoginData * p = GetLoginDataByLogin(info->pAccountTable->login);
            memcpy(&p->GetAccountRef(), info->pAccountTable, sizeof(TAccountTable));

            //END_PREVENT_COPY_ITEM
            peer->EncodeHeader(HEADER_DG_LOGIN_SUCCESS, info->dwHandle, sizeof(TAccountTable));
            peer->Encode(info->pAccountTable, sizeof(TAccountTable));

        }

        delete info->pAccountTable;
        info->pAccountTable = NULL;
        delete info;
    }
}

void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data)
{
    TLogoutPacket* packet = (TLogoutPacket*)data;

    if (!*packet->login)
        return;

    CLoginData * pLoginData = GetLoginDataByLogin(packet->login);

    if (pLoginData == NULL)
        return;

    int pid[PLAYER_PER_ACCOUNT];

    for (int n = 0; n < PLAYER_PER_ACCOUNT; ++n)
    {
        if (pLoginData->GetAccountRef().players[n].dwID == 0)
        {
            if (g_test_server)
                sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID);
            continue;
        }

        pid[n] = pLoginData->GetAccountRef().players[n].dwID;

        if (g_log)
            sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]);

        InsertLogoutPlayer(pid[n]);
    }

    if (DeleteLogonAccount(packet->login, peer->GetHandle()))
    {
        if (g_log)
            sys_log(0, "LOGOUT %s ", packet->login);
    }
}

void CClientManager::QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p)
{
    char queryStr[QUERY_MAX_LEN];

    if (g_stLocale == "sjis")
        snprintf(queryStr, sizeof(queryStr),
                "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci AND id <> %u",
                GetTablePostfix(), p->name, p->pid);
    else
        snprintf(queryStr, sizeof(queryStr),
            "SELECT COUNT(*) as count FROM player%s WHERE name='%s' AND id <> %u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    if (pMsg->Get()->uiNumRows)
    {
        if (!pMsg->Get()->pSQLResult)
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
            return;
        }

        MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

        if (*row[0] != '0')
        {
            peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
            return;
        }
    }
    else
    {
        peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
        return;
    }

    snprintf(queryStr, sizeof(queryStr),
            "UPDATE player%s SET name='%s',change_name=0 WHERE id=%u", GetTablePostfix(), p->name, p->pid);

    std::unique_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr, SQL_PLAYER));

    TPacketDGChangeName pdg;
    peer->EncodeHeader(HEADER_DG_CHANGE_NAME, dwHandle, sizeof(TPacketDGChangeName));
    pdg.pid = p->pid;
    strlcpy(pdg.name, p->name, sizeof(pdg.name));
    peer->Encode(&pdg, sizeof(TPacketDGChangeName));
}

bu hatayı veriyor şimdide

Kod:
Genişlet Daralt Kopyala
ClientManagerLogin.cpp: In member function 'void CClientManager::RESULT_LOGIN(CPeer*, SQLMsg*)':
ClientManagerLogin.cpp:398:26: error: 'szQuery' was not declared in this scope
                 snprintf(szQuery, sizeof(szQuery), "SELECT id, name, job, level, alignment, prestige, st, ht, dx, iq, part_main, part_hair, part_acce, x, y, skill_group, extended_count, change_name FROM player%s WHERE account_id=%u", GetTablePostfix(), info->pAccountTable->id);
                          ^
gmake: *** [.obj/ClientManagerLogin.o] Error 1
 
398 de olan hatanın sebebi szQuery tanımlı değil

393 satırda
Kod:
Genişlet Daralt Kopyala
char queryStr[512];

str yi silersen tanır fakat onun altakiler hata verme ihtimali olur yada strli bir şekilde eklersin her türlü uyar fakat sağlamlığı açısından birşey diyemem
 
398 de olan hatanın sebebi szQuery tanımlı değil

393 satırda
Kod:
Genişlet Daralt Kopyala
char queryStr[512];

str yi silersen tanır fakat onun altakiler hata verme ihtimali olur yada strli bir şekilde eklersin her türlü uyar fakat sağlamlığı açısından birşey diyemem
snprintf(queryStr, sizeof(queryStr),
ilk kendi eklediğim cpp uzantılı dosyanın 409. satırda hata veren kısmın "snprintf(szQuery, sizeof(szQuery)," başlıkları bu şekilde iken altta eklediğim yaptım sorun yok derledi şuanda ama eklenmesi gerekeni sistemi yapan öyle yazmış nekadar sağlıklı olur veya doğru olur acaba ?
Kod:
Genişlet Daralt Kopyala
snprintf(queryStr, sizeof(queryStr),
 
Bilen birine sormalısın sonuçta sisteme daima sorgu gönderecektir. Bunu Forum yöneticimize sorman lazım . Oyun içi testlerini yaptıktan sonra kendinde değerlendirebilirsin .
 
Bilen birine sormalısın sonuçta sisteme daima sorgu gönderecektir. Bunu Forum yöneticimize sorman lazım . Oyun içi testlerini yaptıktan sonra kendinde değerlendirebilirsin .
derleme bitti ve nacivata eklettiğiniz kodlar ile girişi denemdim yükleme ekranında kalıyor eklettiğiniz kodları sildim reboot attım karakter seçme ekranında isimler gözüküyor fakat yükleme ekranında kalıyor yine
Kod:
Genişlet Daralt Kopyala
ch1 sysser
SYSERR: Aug  1 03:53:28 :: pid_init:
Start of pid: 984

SYSERR: Aug  1 03:54:12 :: heart_idle: losing 41 seconds. (lag occured)
dp syserr
Kod:
Genişlet Daralt Kopyala
SYSERR: Aug  1 03:53:24 :: pid_init:
Start of pid: 978

SYSERR: Aug  1 03:53:29 :: __GetAdminInfo: __GetAdminInfo() ==> DirectQuery failed(SELECT mID,mAccount,mName,mContactIP,mServerIP,mAuthority FROM gmlist WHERE mServerIP='ALL' or mServerIP='192.168.1.24')
SYSERR: Aug  1 03:53:31 :: __GetAdminInfo: __GetAdminInfo() ==> DirectQuery failed(SELECT mID,mAccount,mName,mContactIP,mServerIP,mAuthority FROM gmlist WHERE mServerIP='ALL' or mServerIP='192.168.1.24')
SYSERR: Aug  1 03:54:20 :: ChildLoop: AsyncSQL: query failed: Unknown column 'won' in 'field list' (query: SELECT id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime,gold,won,level,level_step,st,ht,dx,iq,exp,stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,part_acce,skill_level,quickslot,newquickslot,skill_group,extended_count,alignment,prestige,mobile,horse_level,horse_riding,horse_hp,horse_hp_droptime,horse_stamina,UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(last_play),horse_skill_point FROM player WHERE id=10013 errno: 1054)
SYSERR: Aug  1 03:54:20 :: RESULT_COMPOSITE_PLAYER: null MYSQL_RES QID 0
 
Sıkıntı yok yardım etmek için buradayız. Ünvan sisteminde eklenen tablolar Navicatta player tablosuna da aktarılmalıydı ,Bundan sonra öğrenmiş oldun tablo kısımlarını fazla tablo eklersen db kısmında navicat a yansıtmak zorundayız. Kolay gelsin :)
 
Sıkıntı yok yardım etmek için buradayız. Ünvan sisteminde eklenen tablolar Navicatta player tablosuna da aktarılmalıydı ,Bundan sonra öğrenmiş oldun tablo kısımlarını fazla tablo eklersen db kısmında navicat a yansıtmak zorundayız. Kolay gelsin :)
tabloluk hiç bir durum yokmuş root içerisinde anlatımda eklenecek olan kod bir yere gösteriyor ama bi forumda birisi eksik diyor bu sistem aynı dosyanın içinde farklı yere daha aynı kodu eklemek gerekiyormuş. kaç gündür servere bi gi girip bakamadım sabahlara kadar uğraştırıyor ufak işler bilgisizlikten tabiki :cool:
 
Hayırlı bayramlar. Metin2 tutkusu bambaşka bir şey sanırsam. Bayram zamanı bile uğraşıyoruz. :)
Sdk’yı bulamadığını söylüyor. Proje ayarlarından mevcut sdk sürümümü seçmeniz gerekiyor
teşekkür ederim. kaç gündür visual studio 2013 - 2019 kurmaya çalışıyorum internetinizi kontrol edin diyor sürekli bende dün 7 gb lik 2013 dosyalarını indirdim açtık sonunda girsekte nasıl oldu diye baksak diye can atmıyor değilidm :D bu arada " Proje ayarlarından mevcut sdk sürümümü seçmeniz gerekiyor" bu kısmı nasıl yapacağım tam anlayamadım program üzerinden ama detay verebilirmisiniz
bu dediğiniz işlemi nasıl yapacağım acaba ?
 
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst