Page 1 of 1

Heading "0" (zero) as a value ignored

Posted: Sun Apr 12, 2009 10:52 am
by John Adams
In some cases (doors specifically for this bug), setting an open_heading or close_heading to 0 (zero) degrees seems to make World think there is no value. Default for these fields appears to be -1, which according to SOE seems to be a valid heading on the compass (ie., open_heading of -20 is the same as an open_heading of 340).

For doors who's spawn heading is 90 and swing counter-clockwise, setting the open_heading to 0 results in the door not opening. Set the value to 1, or -1, the door opens properly. 1 degree is not a huge deal visually, but it adds excessive data entry we would otherwise not need to do if "0" were considered Zero Degrees.

Re: Heading "0" (zero) as a value ignored

Posted: Mon Aug 10, 2009 9:11 am
by John Adams
Devs,

I am trying to fix this issue where if a door's Heading = 0, the door won't open until you set the open_heading to something not "0" (zero).

Would this be the solution? Change:

Code: Select all

void Widget::OpenDoor(){
	if(GetOpenHeading() = 0)
		SetHeading(GetOpenHeading());
	if(GetOpenY() > 0){
To:

Code: Select all

void Widget::OpenDoor(){
	if(GetOpenHeading() >= 0)                           <-- added =
		SetHeading(GetOpenHeading());
	if(GetOpenY() > 0){
There is also another check in Widget::CloseDoor()

Code: Select all

void Widget::CloseDoor(){
	if(GetClosedHeading() >= 0)                           <-- added =
		SetHeading(GetClosedHeading());
	else if(GetOpenHeading() >= 0)                       <-- added =
		SetHeading(GetSpawnOrigHeading());
	if(GetCloseY() >= 0){
The reason I think Zero is valid is that by default, all these values are -1. I think they only get set to 0 if the DB has 0 as a value, which should be valid.

Going to test this on my server, but I am not sure of the long-term effects of OpenHeading = 0, so input would be appreciated.

Re: Heading "0" (zero) as a value ignored

Posted: Wed Aug 12, 2009 2:48 pm
by LethalEncounter
I don't see why it would have issues, but I haven't messed with that code in a while so who knows :P