•         

            

            

  • HyperFilter | DoS Protection | DDoS Protection | DoS Mitigation | DDoS Mitigation | AntiDoS | AntiDDoS | Proxy Shielding

START_POSITION Tablosuna Bağlamak..

Katılım
11 Ocak 2012
Mesajlar
12,856
Öncelikle GameServer(Ebenezer) > User.cpp Açıyoruz ve CUser::Home() Fonksiyonumuzu Silip Yerine Bunu Koyuyoruz...



View hidden content is available for registered users!

#############################

Yeni Eklenecek Dosya StartPositionSet.cpp

#############################

Kod:
// StartPositionSet.cpp : implementation file

//



#include "stdafx.h"

#include "ebenezer.h"

#include "StartPositionSet.h"



#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif



/////////////////////////////////////////////////////////////////////////////

// CStartPositionSet



IMPLEMENT_DYNAMIC(CStartPositionSet, CRecordset)



CStartPositionSet::CStartPositionSet(CDatabase* pdb)

    : CRecordset(pdb)

{

    //{{AFX_FIELD_INIT(CStartPositionSet)

    m_ZoneID = 0;

    m_sKarusX = 0;

    m_sKarusZ = 0;

    m_sElmoradX = 0;

    m_sElmoradZ = 0;

    m_bRangeX = 0;

    m_bRangeZ = 0;

//

    m_sKarusGateX = 0;

    m_sKarusGateZ = 0;

    m_sElmoGateX = 0;

    m_sElmoGateZ = 0;

//



//    m_nFields = 7;

    m_nFields = 11;

    //}}AFX_FIELD_INIT

    m_nDefaultType = snapshot;

}





CString CStartPositionSet::GetDefaultConnect()

{

    return _T("ODBC;DSN=KO_GAME;UID=KOUSER;PWD=KX852456");

}



CString CStartPositionSet::GetDefaultSQL()

{

    return _T("[dbo].[START_POSITION]");

}



void CStartPositionSet::DoFieldExchange(CFieldExchange* pFX)

{

    //{{AFX_FIELD_MAP(CStartPositionSet)

    pFX->SetFieldType(CFieldExchange::outputColumn);

    RFX_Long(pFX, _T("[ZoneID]"), m_ZoneID);

    RFX_Long(pFX, _T("[sKarusX]"), m_sKarusX);

    RFX_Long(pFX, _T("[sKarusZ]"), m_sKarusZ);

    RFX_Long(pFX, _T("[sElmoradX]"), m_sElmoradX);

    RFX_Long(pFX, _T("[sElmoradZ]"), m_sElmoradZ);

    RFX_Byte(pFX, _T("[bRangeX]"), m_bRangeX);

    RFX_Byte(pFX, _T("[bRangeZ]"), m_bRangeZ);

    RFX_Long(pFX, _T("[sKarusGateX]"), m_sKarusGateX);

    RFX_Long(pFX, _T("[sKarusGateZ]"), m_sKarusGateZ);

    RFX_Long(pFX, _T("[sElmoGateX]"), m_sElmoGateX);

    RFX_Long(pFX, _T("[sElmoGateZ]"), m_sElmoGateZ);

//

    //}}AFX_FIELD_MAP

}



/////////////////////////////////////////////////////////////////////////////

// CStartPositionSet diagnostics



#ifdef _DEBUG

void CStartPositionSet::AssertValid() const

{

    CRecordset::AssertValid();

}



void CStartPositionSet::Dump(CDumpContext& dc) const

{

    CRecordset::Dump(dc);

}

#endif //_DEBUG



############################

Yeni Eklenecek Dosya StartPositionSet.h

############################

Kod:
#if !defined(AFX_STARTPOSITIONSET_H__496F83FF_F4B8_4DBF_803B_BA8E741D9FDB__INCLUDED_)

#define AFX_STARTPOSITIONSET_H__496F83FF_F4B8_4DBF_803B_BA8E741D9FDB__INCLUDED_



#if _MSC_VER > 1000

#pragma once

#endif // _MSC_VER > 1000

// StartPositionSet.h : header file

//



/////////////////////////////////////////////////////////////////////////////

// CStartPositionSet recordset



class CStartPositionSet : public CRecordset

{

public:

    CStartPositionSet(CDatabase* pDatabase = NULL);

    DECLARE_DYNAMIC(CStartPositionSet)



// Field/Param Data

    //{{AFX_FIELD(CStartPositionSet, CRecordset)

    long    m_ZoneID;

    long    m_sKarusX;

    long    m_sKarusZ;

    long    m_sElmoradX;

    long    m_sElmoradZ;

    BYTE    m_bRangeX;

    BYTE    m_bRangeZ;

//

    long    m_sKarusGateX;

    long    m_sKarusGateZ;

    long    m_sElmoGateX;

    long    m_sElmoGateZ;

//

    //}}AFX_FIELD





// Overrides

    // ClassWizard generated virtual function overrides

    //{{AFX_VIRTUAL(CStartPositionSet)

    public:

    virtual CString GetDefaultConnect();    // Default connection string

    virtual CString GetDefaultSQL();    // Default SQL for Recordset

    virtual void DoFieldExchange(CFieldExchange* pFX);  // RFX support

    //}}AFX_VIRTUAL



// Implementation

#ifdef _DEBUG

    virtual void AssertValid() const;

    virtual void Dump(CDumpContext& dc) const;

#endif

};



//{{AFX_INSERT_LOCATION}}

// Microsoft Visual C++ will insert additional declarations immediately before the previous line.



#endif // !defined(AFX_STARTPOSITIONSET_H__496F83FF_F4B8_4DBF_803B_BA8E741D9FDB__INCLUDED_)



##################################

Bu İki Dosyayı Projemize Ekliyoruz...





EbenezerDlg.cpp Değiliklikleri ;



Aranacak : #include "HomeSet.h"

Üstüne Eklenecek : #include "StartPositionSet.h"



Aranacak : if( LoadHomeTable() == FALSE ){

Üstüne Eklenecek ;

##################################

Kod:
if( LoadStartPositionTable() == FALSE ){

        AfxMessageBox("LoadStartPositionTable Load Fail");

        AfxPostQuitMessage(0);

        return FALSE;

    }

#############################

Aranacak : if ( !m_HomeArray.IsEmpty() )

Üstüne Eklenecek ;

#############################

--------------------------------------------------

Kod:
if ( !m_StartPositionArray.IsEmpty() )

        m_StartPositionArray.DeleteAllData();



Aranacak : CEbenezerDlg::LoadHomeTable()

Üstüne Eklencek ;

---------------------------------------------------

Kod:
BOOL CEbenezerDlg::LoadStartPositionTable()

{

    CStartPositionSet    StartPositionSet;



    if( !StartPositionSet.Open() ) {

        AfxMessageBox(_T("Start Position Data Open Fail!"));

        return FALSE;

    }

    if(StartPositionSet.IsBOF() || StartPositionSet.IsEOF()) {

        AfxMessageBox(_T("Start Position Data Empty!"));

        return FALSE;

    }



    StartPositionSet.MoveFirst();



    while( !StartPositionSet.IsEOF() )

    {

        _START_POSITIONINFO* pStartPositionSet = new _START_POSITIONINFO;

                

        pStartPositionSet->ZoneID= StartPositionSet.m_ZoneID;



        pStartPositionSet->sKarusX = StartPositionSet.m_sKarusX;

        pStartPositionSet->sKarusZ = StartPositionSet.m_sKarusZ;



        pStartPositionSet->sElmoradX = StartPositionSet.m_sElmoradX;

        pStartPositionSet->sElmoradZ = StartPositionSet.m_sElmoradZ;



        pStartPositionSet->bRangeX = StartPositionSet.m_bRangeX;

        pStartPositionSet->bRangeZ = StartPositionSet.m_bRangeZ;

//

        pStartPositionSet->sKarusGateX = StartPositionSet.m_sKarusGateX;

        pStartPositionSet->sKarusGateZ = StartPositionSet.m_sKarusGateZ;

        pStartPositionSet->sElmoGateX = StartPositionSet.m_sElmoGateX;

        pStartPositionSet->sElmoGateZ = StartPositionSet.m_sElmoGateZ;

//



        if( !m_StartPositionArray.PutData(pStartPositionSet->ZoneID, pStartPositionSet) ) {

            TRACE("Start Position PutData Fail - %d\n", pStartPositionSet->ZoneID );

            delete pStartPositionSet;

            pStartPositionSet = NULL;

        }



        StartPositionSet.MoveNext();

    }



    return TRUE;

}



##################################################

Şimdi GameDefine.h Açıyoruz, struct _HOME_INFO Arıyoruz ve Üzerine Aşağadaki Structumuzu Ekliyoruz...

##################################################

Kod:
struct _START_POSITIONINFO

{

    float ZoneID;

    float sKarusX;

    float sKarusZ;

    float sElmoradX;

    float sElmoradZ;

    BYTE bRangeX;

    BYTE bRangeZ;

    float sKarusGateX;

    float sKarusGateZ;

    float sElmoGateX;

    float sElmoGateZ;

};



#################################################

Bu Kadar Artık Town Koordinatları START_POSITION Tablosuna Bağlanmış Olacaktır.. Kolay Gelsin..

#################################################
 
Cevap: START_POSITION Tablosuna Bağlamak..



hocam acme ebenezer açılıyo mu açılıyosa hangi editörle açılıyor onu da paylaşır mısın
 
Geri
Üst