* fixed crash that appeared after last commit for some reason (no idea why ADT file loading was suddenly broken) - thx JPhix for report.

-> some ADT files still use the old MCLQ-block!!! (for example Draenei starting zone)
* fixed crash when loggin in and using maps was disabled
* forgot to add a scp file
This commit is contained in:
false_genesis 2009-04-29 20:51:13 +00:00
parent 2b1d743125
commit 046d161faa
4 changed files with 57 additions and 32 deletions

View File

@ -0,0 +1,19 @@
#dbname=generic_text
// Server auth, login, charlist, char create,... response code texts
[0]
47=Character created.
48=The server had an error when creating the character!
49=Character creation failed!
50=The name you have chosen is already in use.
51=Character creation is currently disabled on this realm!
52=You cannot create a character on this side; it would violate PVP rules!
53=You have reached the limit of characters on this realm!
54=You have reached the limit of characters on this account!
55=CHAR_CREATE_SERVER_QUEUE
56=CHAR_CREATE_ONLY_EXISTING
57=You do not have the required explainsion installed to create this character!
58=You do not have the required expansion installed to create characters of this class!
59=Your characters do not have reached the a level that is required to create this character!
60=You have reached the limit of characters of this class!

View File

@ -99,7 +99,7 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m)
if( !_tiles->GetTile(gx,gy) ) if( !_tiles->GetTile(gx,gy) )
{ {
ADTFile *adt = new ADTFile();
char buf[300]; char buf[300];
MakeMapFilename(buf,m,gx,gy); MakeMapFilename(buf,m,gx,gy);
MemoryDataHolder::memblock mb = MemoryDataHolder::GetFileBasic(buf); MemoryDataHolder::memblock mb = MemoryDataHolder::GetFileBasic(buf);
@ -108,10 +108,12 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m)
ByteBuffer bb(mb.size); ByteBuffer bb(mb.size);
bb.append(mb.ptr,mb.size); bb.append(mb.ptr,mb.size);
MemoryDataHolder::Delete(buf); MemoryDataHolder::Delete(buf);
ADTFile *adt = new ADTFile();
adt->LoadMem(bb); adt->LoadMem(bb);
logdebug("MAPMGR: Loaded ADT '%s'",buf); logdebug("MAPMGR: Loaded ADT '%s'",buf);
MapTile *tile = new MapTile(); MapTile *tile = new MapTile();
tile->ImportFromADT(adt); tile->ImportFromADT(adt);
delete adt;
_tiles->SetTile(tile,gx,gy); _tiles->SetTile(tile,gx,gy);
logdebug("MAPMGR: Imported MapTile (%u, %u) for map %u",gx,gy,m); logdebug("MAPMGR: Imported MapTile (%u, %u) for map %u",gx,gy,m);
} }
@ -119,7 +121,6 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m)
{ {
logerror("MAPMGR: Loading ADT '%s' failed!",buf); logerror("MAPMGR: Loading ADT '%s' failed!",buf);
} }
delete adt;
} }
else else
{ {

View File

@ -748,7 +748,9 @@ void WorldSession::PreloadDataBeforeEnterWorld(PlayerEnum& pl)
{ {
log("Loading data before entering world..."); log("Loading data before entering world...");
_LoadCache(); // we are about to login, so we need cache data _LoadCache(); // we are about to login, so we need cache data
GetWorld()->GetMapMgr()->Update(pl._x, pl._y, pl._mapId); // make it load the map files if(MapMgr *mmgr = GetWorld()->GetMapMgr())
{
mmgr->Update(pl._x, pl._y, pl._mapId); // make it load the map files
// preload additional map data only when the GUI is enabled // preload additional map data only when the GUI is enabled
// TODO: at some later point we will need the geometry for correct collision calculation, etc... // TODO: at some later point we will need the geometry for correct collision calculation, etc...
@ -780,6 +782,7 @@ void WorldSession::PreloadDataBeforeEnterWorld(PlayerEnum& pl)
} }
} }
} }
}
void WorldSession::_HandleSetProficiencyOpcode(WorldPacket& recvPacket) void WorldSession::_HandleSetProficiencyOpcode(WorldPacket& recvPacket)

View File

@ -89,7 +89,7 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
{ {
buf.read(fourcc,4); flipcc(fourcc); buf.read(fourcc,4); flipcc(fourcc);
buf.read((uint8*)&size,4); buf.read((uint8*)&size,4);
//DEBUG(printf("ADT: reading '%s' size %u\n",fourcc,size)); DEBUG(printf("ADT: reading '%s' size %u\n",fourcc,size));
if(!strcmp((char*)fourcc,"MVER")) if(!strcmp((char*)fourcc,"MVER"))
{ {
@ -226,11 +226,13 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
buf.read(mfcc,4); flipcc(mfcc); buf.read(mfcc,4); flipcc(mfcc);
buf.read((uint8*)&msize,4); buf.read((uint8*)&msize,4);
DEBUG(printf("ADT:MCNK[%u]: reading '%s' size %u\n",mcnkid,mfcc,msize));
// HACKS to make it work properly // HACKS to make it work properly
if(!msize && !strcmp((char*)mfcc,"MCAL")) if(!msize && !strcmp((char*)mfcc,"MCAL"))
continue; continue;
//if((!msize) && !strcmp((char*)mfcc,"MCLQ")) if((!msize) && !strcmp((char*)mfcc,"MCLQ")) // size for MCLQ block is always 0
// msize = _chunks[mcnkid].hdr.sizeLiquid; msize = _chunks[mcnkid].hdr.sizeLiquid - 8; // but even the size in the header is somewhat wrong.. pfff
//DEBUG(printf("ADT: MCNK: reading '%s' size %u\n",mfcc,msize)); //DEBUG(printf("ADT: MCNK: reading '%s' size %u\n",mfcc,msize));
@ -290,7 +292,7 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
} }
} }
} }
/*else if(!strcmp((char*)mfcc,"MCLQ")) // MCLQ changed to MH2O chunk for whole ADT file else if(!strcmp((char*)mfcc,"MCLQ")) // MCLQ changed to MH2O chunk for whole ADT file
{ {
uint8 _cc3[5]; uint8 _cc3[5];
uint8 *fcc1 = &_cc3[0]; uint8 *fcc1 = &_cc3[0];
@ -310,13 +312,13 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
float tmp; float tmp;
buf.rpos(buf.rpos()-4); buf.rpos(buf.rpos()-4);
uint32 bufpos=buf.rpos(); uint32 bufpos=buf.rpos();
uint32 rbytes,diffbytes;
buf >> _chunks[mcnkid].waterlevel; buf >> _chunks[mcnkid].waterlevel;
buf >> tmp; buf >> tmp;
//DEBUG(printf("ADT: MCNK: MCLQ base floats: %f %f\n",_chunks[mcnkid].waterlevel,tmp)); //DEBUG(printf("ADT: MCNK: MCLQ base floats: %f %f\n",_chunks[mcnkid].waterlevel,tmp));
//buf.rpos(buf.rpos()+4); // base height?? //buf.rpos(buf.rpos()+4); // base height??
if(msize > 8) // just to be sure if(msize > 8) // just to be sure
{ {
uint32 rbytes,diffbytes;
for(uint32 i = 0; i < 81; i++) for(uint32 i = 0; i < 81; i++)
{ {
_chunks[mcnkid].lqvertex[i] = buf.read<LiquidVertex>(); _chunks[mcnkid].lqvertex[i] = buf.read<LiquidVertex>();
@ -326,18 +328,18 @@ bool ADTFile::LoadMem(ByteBuffer& buf)
buf >> _chunks[mcnkid].lqflags[i]; buf >> _chunks[mcnkid].lqflags[i];
} }
rbytes = buf.rpos() - bufpos; rbytes = buf.rpos() - bufpos;
//DEBUG(printf("ADT: MCNK: MCLQ block loaded. %u / %u bytes.\n",rbytes,msize)); DEBUG(printf("ADT: MCNK: MCLQ block loaded. %u / %u bytes.\n",rbytes,msize));
// HACK: skip some unk junk bytes
diffbytes = msize - rbytes; // difference should always be 84 (0x54) bytes
buf.rpos(buf.rpos()+diffbytes);
DEBUG(printf("ADT: MCNK: MCLQ - %u junk bytes skipped\n",diffbytes));
} }
else else
{ {
//DEBUG(printf("ADT: MCNK: MCLQ block has only %u bytes\n",msize)); //DEBUG(printf("ADT: MCNK: MCLQ block has only %u bytes\n",msize));
} }
// HACK: skip some unk junk bytes
diffbytes = (msize-8) - rbytes; // dont forget to skip the 8 initial bytes
buf.rpos(buf.rpos()+diffbytes);
//DEBUG(printf("ADT: MCNK: MCLQ - %u junk bytes skipped\n",diffbytes));
} }
}*/ }
else if(!strcmp((char*)mfcc,"MCSE")) else if(!strcmp((char*)mfcc,"MCSE"))
{ {
uint32 emm = _chunks[mcnkid].hdr.nSndEmitters; uint32 emm = _chunks[mcnkid].hdr.nSndEmitters;