CGE: Remove useless functions related to data file creation (unused)

This commit is contained in:
Strangerke 2011-08-13 10:09:45 +02:00
parent 177da650dd
commit 1d3f1830c8
6 changed files with 2 additions and 77 deletions

View File

@ -135,32 +135,6 @@ int keycomp(const void *k1, const void *k2) {
return scumm_strnicmp((const char *) k1, (const char*) k2, kBtKeySize);
}
void BtFile::make(BtKeypack *keypack, uint16 count) {
debugC(1, kCGEDebugFile, "BtFile::make(keypack, %d)", count);
#if kBtLevel != 2
#error This tiny BTREE implementation works with exactly 2 levels!
#endif
_fqsort(keypack, count, sizeof(*keypack), keycomp);
uint16 n = 0;
BtPage *Root = getPage(0, n++);
BtPage *Leaf = getPage(1, n);
Root->_hea._down = n;
putPage(0, true);
while (count--) {
if (Leaf->_hea._count >= ArrayCount(Leaf->_lea)) {
putPage(1, true); // save filled page
Leaf = getPage(1, ++n); // take empty page
memcpy(Root->_inn[Root->_hea._count]._key, keypack->_key, kBtKeySize);
Root->_inn[Root->_hea._count++]._down = n;
_buff[0]._updt = true;
}
Leaf->_lea[Leaf->_hea._count++] = *(keypack++);
_buff[1]._updt = true;
}
}
void BtPage::read(Common::ReadStream &s) {
_hea._count = s.readUint16LE();
_hea._down = s.readUint16LE();

View File

@ -87,7 +87,6 @@ public:
virtual ~BtFile();
BtKeypack *find(const char *key);
BtKeypack *next();
void make(BtKeypack *keypack, uint16 count);
};
} // End of namespace CGE

View File

@ -92,10 +92,6 @@ Dac _stdPal[] = {// R G B
{ 255, 255, 255}, // 255
};
void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *)) {
warning("STUB: _fqsort");
}
const char *progName(const char *ext) {
static char buf[kMaxFile];
strcpy(buf, "CGE");
@ -292,18 +288,6 @@ int takeEnum(const char **tab, const char *text) {
return -1;
}
long timer() {
/*
asm mov ax,0x40
asm mov es,ax
asm mov cx,es:[0x6C]
asm mov dx,es:[0x6E]
return ((long) _DX << 16) | _CX;
*/
warning("STUB: timer");
return 0;
}
int newRandom(int range) {
return ((CGEEngine *)g_engine)->_randomSource.getRandomNumber(range - 1);
}

View File

@ -113,22 +113,14 @@ char *wtom(uint16 val, char *str, int radix, int len);
char *dwtom(uint32 val, char *str, int radix, int len);
int takeEnum(const char **tab, const char *text);
uint16 chkSum(void *m, uint16 n);
long timer();
char *mergeExt(char *buf, const char *name, const char *ext);
char *forceExt(char *buf, const char *name, const char *ext);
// MISSING FUNCTIONS
void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *));
const char *progName(const char *ext = NULL);
unsigned fastRand();
unsigned fastRand(unsigned s);
uint16 rCrypt(void *buf, uint16 siz, uint16 seed);
uint16 atow(const char *a);
uint16 xtow(const char *x);
char *wtom(uint16 val, char *str, int radix, int len);
char *dwtom(uint32 val, char * str, int radix, int len);
int takeEnum(const char **tab, const char *text);
long timer();
int newRandom(int range);
} // End of namespace CGE

View File

@ -40,13 +40,7 @@ VFile *VFile::_recent = NULL;
/*-----------------------------------------------------------------------*/
Dat::Dat():
#ifdef VOL_UPD
_file(DAT_NAME, UPD, CRP)
#else
_file(DAT_NAME, kModeRead, CRP)
#endif
{
Dat::Dat(): _file(DAT_NAME, kModeRead, CRP) {
debugC(1, kCGEDebugFile, "Dat::Dat()");
}
@ -56,12 +50,7 @@ void VFile::init() {
debugC(1, kCGEDebugFile, "VFile::init()");
_dat = new Dat();
#ifdef VOL_UPD
_cat = new BtFile(CAT_NAME, UPD, CRP);
#else
_cat = new BtFile(CAT_NAME, kModeRead, CRP);
#endif
_recent = NULL;
}
@ -82,10 +71,6 @@ VFile::VFile(const char *name, IOMode mode)
_error = 1;
_endMark = (_bufMark = _begMark = kp->_mark) + kp->_size;
}
#ifdef VOL_UPD
else
Make(name);
#endif
}

View File

@ -36,16 +36,9 @@ namespace CGE {
#define CAT_NAME "VOL.CAT"
#define DAT_NAME "VOL.DAT"
#define CRP XCrypt
#define CRP XCrypt
#define XMASK 0xA5
#ifdef VOL_UPD
#define VOLBASE IOHAND
#else
#define VOLBASE CFile
#endif
class Dat {
friend class VFile;
@ -58,7 +51,6 @@ public:
bool read(long org, uint16 len, uint8 *buf);
};
class VFile : public IoBuf {
private:
static Dat *_dat;
@ -70,7 +62,6 @@ private:
void readBuf();
void writeBuf() { }
void make(const char *fspec);
public:
VFile(const char *name, IOMode mode = kModeRead);
~VFile();