Klín gém szörsz

Indította Hellstar, 2017-09-01, 14:02:39

2017-09-01, 14:02:39 Utolsó szerkesztés: 2017-09-01, 17:43:57 Szerző: Hellstar
Sziasztok!
Elkezdtem a forrást takarítgatni viszont akadt egykét dolog amiben nem vagyok biztos.
Az első: PetSystem.ccp[spoiler]CPetActor* CPetSystem::Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, bool bSpawnFar, DWORD options)
{
CPetActor* petActor = this->GetByVnum(mobVnum);
if (0 == petActor)
{
petActor = M2_NEW CPetActor(m_pkOwner, mobVnum, options);
m_petActorMap.insert(std::make_pair(mobVnum, petActor));
}

DWORD petVID = petActor->Summon(petName, pSummonItem, bSpawnFar);

if (NULL == m_pkPetSystemUpdateEvent)
{
petsystem_event_info* info = AllocEventInfo<petsystem_event_info>();

info->pPetSystem = this;

m_pkPetSystemUpdateEvent = event_create(petsystem_update_event, info, PASSES_PER_SEC(1) / 4);
}

return petActor;
}
[/spoiler]

A PetVID használaton kívüli változót hogyan tudnám eltüntetni hogy a működésben ne befolyásolja a cuccost?

ClientPackageCryptInfo.h
Hiba:[spoiler]
ClientPackageCryptInfo.h: In constructor 'CClientPackageCryptInfo::CClientPackageCryptInfo()':
ClientPackageCryptInfo.h:50: warning: 'CClientPackageCryptInfo::m_pSerializedCryptKeyStream' will be initialized after
ClientPackageCryptInfo.h:48: warning:   'int CClientPackageCryptInfo::m_nCryptKeyPackageCnt'
[/spoiler]
Részlet:[spoiler]class CClientPackageCryptInfo
{
public:
CClientPackageCryptInfo();
~CClientPackageCryptInfo();

bool LoadPackageCryptInfo( const char* pCryptInfoDir );
void GetPackageCryptKeys( BYTE** ppData, int& iDataSize );

bool GetRelatedMapSDBStreams(const char* pMapName, BYTE** ppData, int& iDataSize );

private:
bool LoadPackageCryptFile( const char* pCryptFile );

private:
int   m_nCryptKeyPackageCnt;
std::vector<BYTE> m_vecPackageCryptKeys;
BYTE*   m_pSerializedCryptKeyStream;

typedef struct SPerFileSDBInfo
{
SPerFileSDBInfo() : m_pSerializedStream(NULL) {}
~SPerFileSDBInfo()
{
if(m_pSerializedStream)
{
delete[]m_pSerializedStream;
}
}

DWORD GetSize() const
{
DWORD dwSize = 4;

for(int i = 0; i < (int)vecSDBInfos.size(); ++i)
{
dwSize += vecSDBInfos[i].GetSerializedSize();
}

return dwSize;
}

BYTE* GetSerializedStream()
{
if(m_pSerializedStream)
return m_pSerializedStream;

m_pSerializedStream = new BYTE[GetSize()];

int iWrittenOffset = 0;
int iSDBInfoSize   = vecSDBInfos.size();
memcpy( m_pSerializedStream, &iSDBInfoSize, sizeof(int) );
iWrittenOffset += sizeof(int);
for(int i = 0; i < iSDBInfoSize; ++i)
{
vecSDBInfos[i].Serialize( m_pSerializedStream + iWrittenOffset );
iWrittenOffset += vecSDBInfos[i].GetSerializedSize();
}

return m_pSerializedStream;
}

std::vector<TSupplementaryDataBlockInfo> vecSDBInfos;

private:
BYTE* m_pSerializedStream;

} TPerFileSDBInfo;

typedef boost::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap;
TPackageSDBMap   m_mapPackageSDB;


};
[/spoiler][/s]
Igazából ez a két hiba maradt hátra.
Előrre köszönöm a segítségeteket.

2.-nál rossz a sorrend, erre még emlékszem.

2017-09-01, 17:43:10 #2 Utolsó szerkesztés: 2017-09-02, 01:02:30 Szerző: Hellstar
Köszönöm! Javítva.
Akit érdekelne a fix itt megtalálja
[spoiler]class CClientPackageCryptInfo
{
public:
CClientPackageCryptInfo();
~CClientPackageCryptInfo();

bool LoadPackageCryptInfo( const char* pCryptInfoDir );
void GetPackageCryptKeys( BYTE** ppData, int& iDataSize );

bool GetRelatedMapSDBStreams(const char* pMapName, BYTE** ppData, int& iDataSize );

private:
bool LoadPackageCryptFile( const char* pCryptFile );

private:
BYTE*   m_pSerializedCryptKeyStream;
std::vector<BYTE> m_vecPackageCryptKeys;
int   m_nCryptKeyPackageCnt;

typedef struct SPerFileSDBInfo
{
SPerFileSDBInfo() : m_pSerializedStream(NULL) {}
~SPerFileSDBInfo()
{
if(m_pSerializedStream)
{
delete[]m_pSerializedStream;
}
}

DWORD GetSize() const
{
DWORD dwSize = 4;

for(int i = 0; i < (int)vecSDBInfos.size(); ++i)
{
dwSize += vecSDBInfos[i].GetSerializedSize();
}

return dwSize;
}

BYTE* GetSerializedStream()
{
if(m_pSerializedStream)
return m_pSerializedStream;

m_pSerializedStream = new BYTE[GetSize()];

int iWrittenOffset = 0;
int iSDBInfoSize   = vecSDBInfos.size();
memcpy( m_pSerializedStream, &iSDBInfoSize, sizeof(int) );
iWrittenOffset += sizeof(int);
for(int i = 0; i < iSDBInfoSize; ++i)
{
vecSDBInfos[i].Serialize( m_pSerializedStream + iWrittenOffset );
iWrittenOffset += vecSDBInfos[i].GetSerializedSize();
}

return m_pSerializedStream;
}

std::vector<TSupplementaryDataBlockInfo> vecSDBInfos;

private:
BYTE* m_pSerializedStream;

} TPerFileSDBInfo;

typedef boost::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap;
TPackageSDBMap   m_mapPackageSDB;


};
[/spoiler]

Üzenet összefésülés: 2017-09-02, 01:01:55

PetSystem.ccp

CPetActor* CPetSystem::Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, bool bSpawnFar, DWORD options)
{
   CPetActor* petActor = this->GetByVnum(mobVnum);
   if (0 == petActor)
   {
      petActor = M2_NEW CPetActor(m_pkOwner, mobVnum, options);
      m_petActorMap.insert(std::make_pair(mobVnum, petActor));
   }

   //DWORD petVID = petActor->Summon(petName, pSummonItem, bSpawnFar);

   if (NULL == m_pkPetSystemUpdateEvent)
   {
      petsystem_event_info* info = AllocEventInfo<petsystem_event_info>();

      info->pPetSystem = this;

      m_pkPetSystemUpdateEvent = event_create(petsystem_update_event, info, PASSES_PER_SEC(1) / 4);
   }

   return petActor;
}


Üzenet összefésülés: 2017-09-02, 01:02:30

Megoldva minden zárom.