Page 1 of 1
Pentagram Deeds
Posted: Fri Aug 11, 2006 3:54 pm
by Jediman
Client version: latest
UOX version: latest released
Client type: 2d (and I believe 3d is affected as well):
Issue: Pentagram deeds crash uox3, console reports 0 errors, and just crashes.
Posted: Fri Aug 11, 2006 4:48 pm
by Xuri
The callstack from MSVC 6:
Code: Select all
UOX::CBaseObject::WorldNumber() line 1834 + 3 bytes
UOX::CreateHouseItems(UOX::CChar * 0x02848bb8, std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > {...}, UOX::CMultiObj * 0x00000000, unsigned short 0x0fea, short 0x08af, short 0x0480, char 0x00) line 94 + 8 bytes
UOX::BuildHouse(UOX::CSocket * 0x1883e958, unsigned char 0x12) line 288 + 64 bytes
UOX::BuildHouseTarget(UOX::CSocket * 0x1883e958) line 208 + 18 bytes
UOX::CPITargetCursor::Handle() line 1607 + 12 bytes
UOX::cNetworkStuff::GetMsg(unsigned long 0x00000000) line 561 + 17 bytes
UOX::cNetworkStuff::CheckMessage() line 442
UOX::cNetworkStuff::CheckMessages() line 1201
main(int 0x00000001, char * * 0x003d2508) line 2816
mainCRTStartup() line 338 + 17 bytes
KERNEL32! 7c816fd7()
Note that the crash only happens if you're attempting to place the pentagram outside a house (at least, with me it only crashed then) - when attempting to place the pentagram inside a house (which should work), it gave me the message "You cannot build your house there!".
Posted: Fri Aug 11, 2006 6:19 pm
by Grimson
The problem seems to be in BuildHouse() in house.cpp, there UOX3 creates a fakeHouse item instead of a house multi for the pentagram. But sends the non existent house multi to the CreateHouseItems() function. I'm not shure what was intended with the fakeHouse Item, so I'm a bit stuck.
Posted: Fri Aug 11, 2006 6:19 pm
by giwo
Funny when things work that way, isn't it....
As for the crash, it's obviously assuming the object is being placed in a multi and then doing a multi->WorldNumber() call, which would puke.
For not being able to place inside the house, either 1) the SPACEX and SPACEY for the pentagram is not 0, or 2) It is 0 and there's an error in our calculating the area (0*0=0 last I checked).
Posted: Fri Aug 11, 2006 6:23 pm
by Grimson
giwo wrote:For not being able to place inside the house, either 1) the SPACEX and SPACEY for the pentagram is not 0, or 2) It is 0 and there's an error in our calculating the area (0*0=0 last I checked).
I guess that's more related to the fact that we don't allow a multi inside a multi, and as the pentagram is handled like a multi in BuildHouse() it fails.
Posted: Fri Aug 11, 2006 6:38 pm
by giwo
I've found, and believe I've fixed the problem, however I'm at work and thus without a compiler at the moment.
If you want to test out the fix for yourself, do this:
On Line 80 of house.cpp change this:
Code: Select all
void CreateHouseItems( CChar *mChar, STRINGLIST houseItems, CMultiObj *house, UI16 houseID, SI16 x, SI16 y, SI08 z )
To this:
Code: Select all
void CreateHouseItems( CChar *mChar, STRINGLIST houseItems, CItem *house, UI16 houseID, SI16 x, SI16 y, SI08 z )
on line 287, change this:
Code: Select all
if( !houseItems.empty() )
CreateHouseItems( mChar, houseItems, house, houseID, x, y, z );
to this:
Code: Select all
if( !houseItems.empty() )
{
if( !ValidateObject( fakeHouse ) )
fakeHouse = house;
CreateHouseItems( mChar, houseItems, fakeHouse, houseID, x, y, z );
}
Compile and try to place a pentagram outside a house, it should work now.
Posted: Fri Aug 11, 2006 7:27 pm
by Xuri
Well. Placing outside of houses shouldn't really be possible for normal players in any case, seeing as it's a house add-on, and we don't want players adding pentagrams everywhere =) Or do we?
Spacex and spacey for pentagrams are both 0, btw.
Posted: Fri Aug 11, 2006 8:34 pm
by giwo
I do agree, however if it does work, it shouldn't crash.
Obviously there is a bug with the space calculation, so I'll look into that as well.
Posted: Fri Aug 11, 2006 9:10 pm
by giwo
Fixed, fixed, and fixed.