[FIXED] Pentagram Deeds

Here we stuff all the bugs we've managed to squash/squish/squelch.
Post Reply
User avatar
Jediman
UOX3 Apprentice
Posts: 177
Joined: Fri Jul 16, 2004 1:38 am
Location: New England
Has thanked: 0
Been thanked: 0
Contact:

Pentagram Deeds

Post 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.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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!".
-= Ho Eyo He Hum =-
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Post 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.
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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).
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Post 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.
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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? :P

Spacex and spacey for pentagrams are both 0, btw.
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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.
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Fixed, fixed, and fixed.
Post Reply