1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

fix relative includes in PubUtilLib, move them up to where they belong, remvoe some unused files

This commit is contained in:
diafero
2011-08-28 00:55:47 +02:00
parent 78e507ffd6
commit adc3653296
42 changed files with 87 additions and 6503 deletions

View File

@ -1,195 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#define plIndexFile_cpp // for version numbers in plVersion.h
#include "plIndexFile.h"
#include "hsStream.h"
#include "plVersion.h"
//--------------------
// plIndexFileHeader
//--------------------
plIndexFileHeader::plIndexFileHeader()
{
fTimeStamp[ 0 ] = fTimeStamp[ 1 ] = 0;
fStrTblStartPos = 0;
fStrTblKnt = 0;
fMajorVersion = plVersion::GetMajorVersion();
fMinorVersion = plVersion::GetMinorVersion();
fExportLocal = 0;
}
void plIndexFileHeader::Write(hsStream *s)
{
s->WriteSwap32(2,fTimeStamp);
s->WriteSwap32(fStrTblStartPos);
s->WriteSwap16(fStrTblKnt);
s->WriteSwap16(fMajorVersion);
s->WriteSwap16(fMinorVersion);
s->WriteSwap16(fExportLocal);
}
void plIndexFileHeader::Read(hsStream *s)
{
s->ReadSwap32(2,fTimeStamp);
fStrTblStartPos = s->ReadSwap32();
fStrTblKnt = s->ReadSwap16();
fMajorVersion = s->ReadSwap16();
fMinorVersion = s->ReadSwap16();
fExportLocal = s->ReadSwap16();
}
//--------------------
// plIndexFileRoom
//--------------------
void plIndexFileRoom::Write(hsStream *s)
{
fRmUoid.Write(s);
s->WriteSwap32(fTypesInRoom);
s->WriteSwap16(fFiller1_16);
s->WriteSwap32(fFiller2_32);
s->WriteSwap32(fFiller3_32);
}
void plIndexFileRoom::Read(hsStream *s)
{
fRmUoid.Read(s);
fTypesInRoom = s->ReadSwap32();
s->ReadSwap16();
s->ReadSwap32();
s->ReadSwap32();
}
//--------------------
// plIndexFileType
//--------------------
void plIndexFileType::Write(hsStream *s)
{
fTypeUoid.Write(s);
s->WriteSwap32(fNumKeys);
s->WriteSwap32(fFiller1_32);
s->WriteSwap32(fFiller2_32);
}
void plIndexFileType::Read(hsStream *s)
{
fTypeUoid.Read(s);
fNumKeys = s->ReadSwap32();
s->ReadSwap32();
s->ReadSwap32();
}
//--------------------
// plIndexFileKey
//--------------------
void plIndexFileKey::Write(hsStream *s)
{
fKeyUoid.Write(s);
s->WriteSwap32(fStartPos);
s->WriteSwap32(fDataLen);
s->WriteSwap16(fNameIx);
s->WriteSwap16(fFiller1_16);
}
void plIndexFileKey::Read(hsStream *s)
{
fKeyUoid.Read(s);
fStartPos = s->ReadSwap32();
fDataLen = s->ReadSwap32();
fNameIx = s->ReadSwap16();
s->ReadSwap16();
}
//--------------------
// plIxStrTbl
//--------------------
plIxStrTbl::~plIxStrTbl()
{
if (fpStrings) delete []fpStrings; // if strings came from elsewhere, not our responsibility
}
UInt16 plIxStrTbl::AddString(const char *p)
{ Int16 ix = FindString(p);
if (ix != -1)
return ix; // duplicate
fStringTbl.push_back(p); return fStringTbl.size() - 1;
}
Int16 plIxStrTbl::FindString(const char *p)
{
for (int i=0; i < fStringTbl.size(); i++)
{
if (!_stricmp(p,fStringTbl[i]))
return i;
}
return -1;
}
void plIxStrTbl::Write(hsStream *s)
{
for (int i=0; i < fStringTbl.size(); i++)
{ Int32 len= fStringTbl[i] ? strlen(fStringTbl[i]) : 0;
hsAssert(len < 256,"Name string too long");
UInt8 l = (UInt8) len;
s->WriteByte(l); // FUTURE, don't really need length!
if (len)
{
s->Write(len, fStringTbl[i]);
}
s->WriteByte(0); // Null terminate
}
}
void plIxStrTbl::Read(hsStream *s)
{ UInt32 pos = s->GetPosition();
s->FastFwd();
fTabSize = s->GetPosition() - pos; // Get size of table
s->SetPosition(pos);
fpStrings = new char[fTabSize];
hsAssert(fpStrings,"new failed");
s->Read(fTabSize,fpStrings); // Read all the string in
char *p = fpStrings;
while (p < fpStrings + fTabSize)
{
UInt8 len = *p;
p++;
hsAssert(p < fpStrings + fTabSize,"String Index error");
fStringTbl.push_back(p);
p += len + 1; // past len and NULL
};
}

View File

@ -1,152 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef PLINDEXFILE_H
#define PLINDEXFILE_H
#include "../pnKeyedObject/plUoid.h"
#include <vector>
//---------------------------------------------------------------
// These Classes are used to Read and Write the Index file for the Database
// Records are kept the same size Currently 20 Bytes
// At the End of the file, the Strings are stored
// plIxStrTbl is used to Read and Write the String section of the Index
//---------------------------------------------------------------
//---------------------------------------------------------------
// Main header Entry, One per Index file
//---------------------------------------------------------------
class plIndexFileHeader
{
public:
plIndexFileHeader(); // I buried Paul
~plIndexFileHeader(){}
UInt32 fTimeStamp[2];
UInt32 fStrTblStartPos; // where the String table starts in the Index file
UInt16 fStrTblKnt; // how many strings in the string table
UInt16 fMajorVersion;
UInt16 fMinorVersion;
UInt16 fExportLocal; // was this file exported locally or downloaded from server?
void Write(hsStream *s);
void Read(hsStream *s);
};
//---------------------------------------------------------------
// Room Entry One Entry per Room
//---------------------------------------------------------------
class plIndexFileRoom
{
public:
plIndexFileRoom() { memset(this,1,sizeof(this)); } // no virtuals...relax
~plIndexFileRoom(){}
plUoid fRmUoid;
UInt16 fTypesInRoom;
UInt16 fFiller1_16;
UInt32 fFiller2_32;
UInt32 fFiller3_32;
void Write(hsStream *s);
void Read(hsStream *s);
};
//---------------------------------------------------------------
// Type Entry One Entry per Type in each Room
//---------------------------------------------------------------
class plIndexFileType
{
public:
plIndexFileType() { memset(this,1,sizeof(this)); } // no virtuals...relax
~plIndexFileType(){}
plUoid fTypeUoid;
UInt16 fNumKeys;
UInt32 fFiller1_32;
UInt32 fFiller2_32;
void Write(hsStream *s);
void Read(hsStream *s);
};
//---------------------------------------------------------------
// Key Entry One Entry per Type in each Room
//---------------------------------------------------------------
class plIndexFileKey
{
public:
plIndexFileKey() { memset(this,1,sizeof(this)); } // no virtuals...relax
~plIndexFileKey(){}
plUoid fKeyUoid;
UInt32 fStartPos;
UInt32 fDataLen;
UInt16 fNameIx; // Index into string table of name
UInt16 fFiller1_16;
void Write(hsStream *s) ;
void Read(hsStream *s);
};
//---------------------------------------------------------------
// String Table, Lives at the end of the Index File
//---------------------------------------------------------------
class plIxStrTbl
{
std::vector<const char *>fStringTbl;
char *fpStrings;
UInt32 fTabSize; // buffer size for strings
public:
plIxStrTbl() :fpStrings(nil), fTabSize(0){}
~plIxStrTbl();
Int16 FindString(const char *p); // returns -1 if not found, otherwise the index from zero
UInt16 AddString(const char *p);
UInt16 NumStrings() { return fStringTbl.size(); }
const char * GetString(UInt16 x) { return fStringTbl[x]; }
void Write(hsStream *s);
void Read(hsStream *s);
};
class plLinkRecord
{
public:
plLinkRecord(UInt16 a, UInt16 d, UInt16 r) : fAgeIx(a), fDistIx(d), fRoomIx(r){}
~plLinkRecord(){}
UInt16 fAgeIx; // Index into string table
UInt16 fDistIx;
UInt16 fRoomIx;
UInt32 fTimeStamp[2];
};
#endif

View File

@ -24,7 +24,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "plLoc.h"
#include "../pnKeyedObject/hsKeyedObject.h"
#include "pnKeyedObject/hsKeyedObject.h"
plLocFileParser::plLocFileParser(): fThrowBack(nil), fThrowBackLevel(0)