Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2008, 04:49 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Maybe I accidentally changed something else door related in the source while I was making these changes. I will go through them all again tonight and make absolutely sure that nothing else was changed that might have caused it to get messed up.

What I did was search the source directory for all files containing the word "door" and then 1 by 1, I went through each file and looked to see if any of them had door name set to 16. I am pretty sure I got them all, but there is still the possibility I missed something. I don't see why this change would cause doors to disappear. Maybe there is some setting that limits the field to 16 that I am not aware of (maybe like a uint setting or something). I am not a coder, so I would really appreciate if a coder could have a quick look at this.

This might not seem too major, but as far as using zones from later expansions go, we will always be limited with objects until this is fixed. I imagine that the object table will probably need similar name updates as well. I think this is the final thing needed to allow all Titanium zones to be used fully. Sure, you can use them now without doors, but IMO, doors are required in many to complete the zone.

Now that I look at it, maybe my changes in utils/schema.xml are what caused the problem. I don't know much about that file and have never changed it before. Maybe this change is what broke it:

Quote:
<COLUMN ID="4909" ColName="name" PrevColName="" Pos="4" idDatatype="20" DatatypeParams="(32)" Width="0" Prec="0" PrimaryKey="0" NotNull="1" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="">
Maybe that still has to be set to 16. I notice that it says Params (parameter I suppose) and not anything about length of the column. Can anyone confirm how that is supposed to be set?
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 06-09-2008, 10:40 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Here are the sections of code that I suspect one of them being the cause of doors disappearing when I change them. I changed all of the ones highlighted in red to 32 as shown in the earlier post. The red values here show the original values for coders to compare. All other changes above were all 16 to begin with.

dbmemshare.cpp: (note that this one was previously set to 10 and not 16 like all of the others. So, this leads me to believe that it either isn't used anymore, or maybe I need to leave it set to 10 for whatever reason...)

Code:
bool Database::DBLoadDoors(int32 iDoorCount, int32 iMaxDoorID) {
	cout << "Loading Doors from database..." << endl;
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;
	query = new char[256];
	strcpy(query, "SELECT MAX(id), Count(*) FROM doors");
	if (RunQuery(query, strlen(query), errbuf, &result))
	{
		safe_delete(query);
		row = mysql_fetch_row(result);
		if (row && row[0]) {
			if (atoi(row[0]) > iMaxDoorID) {
				cout << "Error: Insufficient shared memory to load doors." << endl;
				cout << "Max(id): " << atoi(row[0]) << ", iMaxDoorID: " << iMaxDoorID << endl;
				cout << "Fix this by increasing the MMF_MAX_Door_ID define statement" << endl;
				return false;
			}
			if (atoi(row[1]) != iDoorCount) {
				cout << "Error: Insufficient shared memory to load doors." << endl;
				cout << "Count(*): " << atoi(row[1]) << ", iDoorCount: " << iDoorCount << endl;
				return false;
			}
			max_door_type = atoi(row[0]);
			mysql_free_result(result);
			Door tmpDoor;
				MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,triggerdoor,triggertype from doors");//WHERE zone='%s'", zone_name
				if (RunQuery(query, strlen(query), errbuf, &result))
				{
					safe_delete(query);
					while((row = mysql_fetch_row(result))) {
						memset(&tmpDoor, 0, sizeof(Door));
						tmpDoor.db_id = atoi(row[0]);
						tmpDoor.door_id = atoi(row[1]);
						strncpy(tmpDoor.zone_name,row[2],16);
						strncpy(tmpDoor.door_name,row[3],10);
						tmpDoor.pos_x = (float)atof(row[4]);
						tmpDoor.pos_y = (float)atof(row[5]);
						tmpDoor.pos_z = (float)atof(row[6]);
						tmpDoor.heading = atoi(row[7]);
						tmpDoor.opentype = atoi(row[8]);
						tmpDoor.guild_id = atoi(row[9]);
						tmpDoor.lockpick = atoi(row[10]);
						tmpDoor.keyitem = atoi(row[11]);
						tmpDoor.trigger_door = atoi(row[12]);
						tmpDoor.trigger_type = atoi(row[13]);
						EMuShareMemDLL.Doors.cbAddDoor(tmpDoor.db_id, &tmpDoor);
						Sleep(0);
					}
					mysql_free_result(result);
				}
				else
				{
					cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
					delete[] query;
					return false;
				}
			}
		}
	return true;
}
#endif

doors.cpp:

Code:
Doors::Doors(const Door* door)
:    close_timer(5000)
{
	db_id = door->db_id;
	door_id = door->door_id;
	strncpy(zone_name,door->zone_name,16);
	strncpy(door_name,door->door_name,16);
	pos_x = door->pos_x;
	pos_y = door->pos_y;
	pos_z = door->pos_z;
	heading = door->heading;
	incline = door->incline;
	opentype = door->opentype;
	guild_id = door->guild_id;
	lockpick = door->lockpick;
	keyitem = door->keyitem;
	trigger_door = door->trigger_door;
	trigger_type = door->trigger_type;
	triggered=false;
	door_param = door->door_param;
	size = door->size;
	invert_state = door->invert_state;
	SetOpenState(false);

	close_timer.Disable();
    
	strncpy(dest_zone,door->dest_zone,16);
	dest_x = door->dest_x;
	dest_y = door->dest_y;
	dest_z = door->dest_z;
	dest_heading = door->dest_heading;

}
Code:
//	Door tmpDoor;
	MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading,"
		"opentype,guild,lockpick,keyitem,triggerdoor,triggertype,dest_zone,dest_x,"
		"dest_y,dest_z,dest_heading,door_param,invert_state,incline,size "
		"FROM doors WHERE zone='%s' ORDER BY doorid asc", zone_name);
	if (RunQuery(query, strlen(query), errbuf, &result)) {
		safe_delete_array(query);
		sint32 r;
		for(r = 0; (row = mysql_fetch_row(result)); r++) {
			if(r >= iDoorCount) {
				cerr << "Error, Door Count of " << iDoorCount << " exceeded." << endl;
				break;
			}
			memset(&into[r], 0, sizeof(Door));
			into[r].db_id = atoi(row[0]);
			into[r].door_id = atoi(row[1]);
			strncpy(into[r].zone_name,row[2],16);
			strncpy(into[r].door_name,row[3],16);
			into[r].pos_x = (float)atof(row[4]);
			into[r].pos_y = (float)atof(row[5]);
			into[r].pos_z = (float)atof(row[6]);
			into[r].heading = (float)atof(row[7]);
			into[r].opentype = atoi(row[8]);
			into[r].guild_id = atoi(row[9]);
			into[r].lockpick = atoi(row[10]);
			into[r].keyitem = atoi(row[11]);
			into[r].trigger_door = atoi(row[12]);
			into[r].trigger_type = atoi(row[13]);
            strncpy(into[r].dest_zone,row[14],16);
            into[r].dest_x = (float) atof(row[15]);
            into[r].dest_y = (float) atof(row[16]);
            into[r].dest_z = (float) atof(row[17]);
            into[r].dest_heading = (float) atof(row[18]);
			into[r].door_param=atoi(row[19]);
			into[r].invert_state=atoi(row[20]);
			into[r].incline=atoi(row[21]);
			into[r].size=atoi(row[22]);
		}
		mysql_free_result(result);
	}
	else
	{
		cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
		safe_delete_array(query);
		return false;
	}
	return true;
}
doors.h:

Code:
private:
int32	db_id;
sint8	door_id;
char	zone_name[16];
char	door_name[16];
float	pos_x;
float	pos_y;
float	pos_z;
float	heading;
int incline;
int8	opentype;
int32	guild_id;
int16	lockpick;
uint32	keyitem;
int8	trigger_door;
int8	trigger_type;
int32	door_param;
int16	size;
int invert_state;
int32	entity_id;
bool	isopen;
Timer	close_timer;
//Timer	trigger_timer;

char    dest_zone[16];
float   dest_x;
float   dest_y;
float   dest_z;
float   dest_heading;


};
entity.cpp:

Code:
bool EntityList::MakeDoorSpawnPacket(EQApplicationPacket* app)
{
	int32 count = door_list.Count();
	if( !count || count>500)
		return false;
	int32 length = count * sizeof(Door_Struct);
	uchar* packet_buffer = new uchar[length];
	memset(packet_buffer, 0, length);
	uchar* ptr = packet_buffer;
	Doors *door;
	LinkedListIterator<Doors*> iterator(door_list);
	Door_Struct nd;
	iterator.Reset();
	while(iterator.MoreElements()){
		door = iterator.GetData();
		if(door && strlen(door->GetDoorName()) > 3){
			memset(&nd, 0, sizeof(nd));
			memcpy(nd.name, door->GetDoorName(), 16);
			nd.xPos = door->GetX();
			nd.yPos = door->GetY();
			nd.zPos = door->GetZ();
			nd.heading = door->GetHeading();
			nd.incline = door->GetIncline();
			nd.size = door->GetSize();
			nd.doorId = door->GetDoorID();				
			nd.opentype = door->GetOpenType();
			nd.state_at_spawn = door->GetInvertState() ? !door->IsDoorOpen() : door->IsDoorOpen();
			nd.invert_state = door->GetInvertState();
			nd.door_param = door->GetDoorParam();	
			memcpy(ptr, &nd, sizeof(nd));
			ptr+=sizeof(nd);
			*(ptr-1)=0x01;
			*(ptr-3)=0x01;
		}
		iterator.Advance();
	}

#if EQDEBUG >= 5
//	LogFile->write(EQEMuLog::Debug, "MakeDoorPacket() packet length:%i qty:%i ", length, qty);
#endif
	app->SetOpcode(OP_SpawnDoor);
	app->size = length;
	app->pBuffer = packet_buffer;
	return true;	
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 06-10-2008, 08:12 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, I didn't get any code working for greater than 16 char door names yet, but I did get a new wiki page added. Noting it here since it is door related. I tested every opentype and created a nice reference list with descriptions for anyone wanting to create their own doors. Here is the completed list:

http://www.eqemulator.net/wiki/wikka.php?wakka=OpenType

I still want to get the 16 char limit raised in the source, but I think I may need more help with it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 06-10-2008, 08:40 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Quote:
Originally Posted by trevius View Post
I still want to get the 16 char limit raised in the source, but I think I may need more help with it.
The size of the door name appears to be set to 16 characters in the packet the server sends to the client, i.e. 16 characters is all the client will accept, in which case it can't be changed.
Reply With Quote
  #5  
Old 06-10-2008, 03:15 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by Derision View Post
The size of the door name appears to be set to 16 characters in the packet the server sends to the client, i.e. 16 characters is all the client will accept, in which case it can't be changed.
There are so many items that can be placed, but exist over the 16 character limit - would it be possible to upgrade the portion of source involving packets sent to the client?
Reply With Quote
  #6  
Old 06-10-2008, 03:34 PM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

I haven't had time to look into this a lot, but I noticed this:

Code:
struct Door_Struct
{
/*0000*/ char    name[16];            // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade
/*0016*/ char    unknown0016[16];
So, if you change name to be name[32] I think it would be a good guess that the unknown0016[16] is actually the other half of the name. So... to keep from breaking the packet struct, you should remove the line that says /*0016*/ char unknown0016[16]; when you change the one above it to /*0000*/ char name[32];
__________________
Maybe I should try making one of these servers...
Reply With Quote
  #7  
Old 06-10-2008, 04:08 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ahh, worth a shot! So, 2 parts of the packet would essentially become 1 but use the same space so that packet structure doesn't change?

I will see if I can get a compiler working on my windows pc so I can compile the source over and over testing each way without having to impact my players all night lol.

And to Derision; I think this should be adjustable because of the note in the comment below showing that it was previously set to 10 and it is now 16. So, if it can go from 10 to 16, it should be able to go higher.

Quote:
// Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade
What S2K said makes alot of sense to me. Basically it sounds like that unknown packet is just set there to fill the gap of the missing 16 chars from the size of the name that should actually be 32. I bet there is actually nothing at all in that space currently and that is why it was able to be adjusted in the past. I wish that note from Daeken was a little clearer lol. I wonder if he means "subtracted the 6 from the unknown below which was previously 22 and added that to the name so it went from 10 to 16".
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #8  
Old 06-10-2008, 06:07 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by Scorpious2k View Post
I haven't had time to look into this a lot, but I noticed this:

Code:
struct Door_Struct
{
/*0000*/ char    name[16];            // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade
/*0016*/ char    unknown0016[16];
So, if you change name to be name[32] I think it would be a good guess that the unknown0016[16] is actually the other half of the name. So... to keep from breaking the packet struct, you should remove the line that says /*0016*/ char unknown0016[16]; when you change the one above it to /*0000*/ char name[32];
We'll try this out in a while - tell ya what happened.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:14 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3