Files
ROSS/Src/World Server/quest/CIntStb.hpp
T
ThomasandClaude Sonnet 5 1998bf4273 Strip dead Windows-only code paths, add LTO/march build flags, seed default GM account
Removes now-unreachable #ifdef _WIN32 branches across Common/ and the three
server binaries (all builds are Linux-only), deletes the entirely unused
SEH exception-handling shim and an orphaned vendored MySQL client header.
Enables LTO and -march=x86-64-v2 in Release builds for a small free perf win.

Also seeds a default GM account (gmadmin/changeme) via
database sql files/gm_account.sql so a fresh deploy has something to log
into the web admin panel with, switches the MariaDB data directory from a
Docker named volume to a host bind mount for visibility/backup, and expands
the README with a fuller Docker deployment walkthrough.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 15:42:36 +02:00

56 lines
1.1 KiB
C++

// Props to ExJam for this code :D
class CIntStb
{
public:
CIntStb() : rows(0) {}
CIntStb(char* filename) : rows(0){ LoadSTB(filename); }
~CIntStb(){ CleanUp(); }
int LoadSTB( char* filename ){
FILE* fh;
char tmpfield[512];
unsigned dataoffset = 0;
unsigned short fieldlen = 0;
if ( (fh = rose_fopen( filename, "rb" )) == 0 ) {
Log( MSG_ERROR, "Could not load STB '%s'", filename );
return 1;
}else{
fseek( fh, 4, SEEK_SET );
fread( &dataoffset, 4, 1, fh );
fread( &rowcount, 4, 1, fh );
fread( &fieldcount, 4, 1, fh );
rowcount--;
fieldcount--;
fseek( fh, dataoffset, SEEK_SET );
int* tmp = new int[rowcount*fieldcount];
rows = new int*[rowcount];
for(dword i = 0; i < rowcount; i++ ) rows[i] = &tmp[i*fieldcount];
for(dword j = 0; j < rowcount*fieldcount; j++) {
fread( &fieldlen, 2, 1, fh );
fread( tmpfield, 1, fieldlen, fh );
tmpfield[fieldlen]=0;
tmp[j] = atoi( tmpfield );
}
fclose( fh );
}
return 0;
}
dword rowcount;
dword fieldcount;
int** rows;
private:
void CleanUp(){
if(rows != NULL){
delete [] rows[0];
delete [] rows;
}
}
};