Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Feature Requests

Development::Feature Requests Post suggestions/feature requests here.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2008, 05:33 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I thought it would be fine the way I did this, but I guess maybe not.

Quote:
Originally Posted by AndMetal View Post
zone/command.cpp
Code:
void command_wp(Client *c, const Seperator *sep)
{
	if (sep->arg[4] == NULL)
		int wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2]));
	else
		int wp = atoi(sep->arg[4]);
	if (strcasecmp("add",sep->arg[1]) == 0)
		database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
	else if (strcasecmp("delete",sep->arg[1]) == 0)
		database.DeleteWaypoint(c, atoi(sep->arg[2]),atoi(sep->arg[4]),zone->GetZoneID());
	else
		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
}
Try this instead:
Code:
void command_wp(Client *c, const Seperator *sep)
{
	int wp;
	if (sep->arg[4] == NULL)
		wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2]));
	else
		wp = atoi(sep->arg[4]);
	if (strcasecmp("add",sep->arg[1]) == 0)
		database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
	else if (strcasecmp("delete",sep->arg[1]) == 0)
		database.DeleteWaypoint(c, atoi(sep->arg[2]),atoi(sep->arg[4]),zone->GetZoneID());
	else
		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
}
Let me know if that works. I knew when I wrote it that 2nd one would work, I just figured the other way would be a little cleaner & still work

Oh well, that's why KLS & Derision are the "devs", and I just tinker
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #2  
Old 09-01-2008, 06:16 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Derision isn't an official Dev yet, but he probably should be

I will give that a try later and see if it compiles like that. It looks like that could resolve it. But, I was getting a similar error when trying to compile some code with a rule I made up. I will post more after I get to test it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 09-24-2008, 10:19 AM
ChaosSlayer
Demi-God
 
Join Date: May 2007
Posts: 1,032
Default

So Trev - did you ever managed to get this one working?
Reply With Quote
  #4  
Old 09-25-2008, 05:56 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I guess I never tried the latest code change AndMetal made on this. Now it compiles just fine. Going to test it later after the next server reboot to verify it works. If so, I will sticky this in the Server Code Submissions section
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 09-25-2008, 10:49 AM
ChaosSlayer
Demi-God
 
Join Date: May 2007
Posts: 1,032
Default

that be perfect - trying to populated something as large as West Karana by hand... is simply insane without this feature
Reply With Quote
  #6  
Old 09-28-2008, 07:51 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

The original code didn't work as intended, but I had a chance to compile & debug, and this is what I came up with.

In zone/zonedb.h around line 215 (under the Grids/Paths heading), add
Code:
	int		GetHighestWaypoint(uint32 zoneid, int32 gridid);
In zone/waypoints.cpp around line 1300 (the end of the file), add
Code:
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, int32 gridid) {
	char *query = 0;
	char errbuff[MYSQL_ERRMSG_SIZE];
	MYSQL_RES *result;
	MYSQL_ROW row;
	int res = 0;
	if (RunQuery(query, MakeAnyLenString(&query,
		"SELECT COALESCE(MAX(number), 0) FROM grid_entries WHERE zoneid = %i AND gridid = %i",
		zoneid, gridid),errbuff,&result)) {
		safe_delete_array(query);
		if (mysql_num_rows(result) == 1) {
			row = mysql_fetch_row(result);
			res = atoi( row[0] );
		}
		mysql_free_result(result);
	} else {
		LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query, errbuff);
		safe_delete_array(query);
	}

	return(res);
}
And in zone/command.cpp around line 2345, change
Code:
void command_wp(Client *c, const Seperator *sep)
{
	if (strcasecmp("add",sep->arg[1]) == 0)
		database.AddWP(c, atoi(sep->arg[2]),atoi(sep->arg[4]), c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
	else if (strcasecmp("delete",sep->arg[1]) == 0)
		database.DeleteWaypoint(c, atoi(sep->arg[2]),atoi(sep->arg[4]),zone->GetZoneID());
	else
		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
}
to this
Code:
void command_wp(Client *c, const Seperator *sep)
{
	int wp = atoi(sep->arg[4]);

	if (strcasecmp("add",sep->arg[1]) == 0) {
		if (wp == 0) //AndMetal: default to highest if it's left blank, or we enter 0
			wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2])) + 1;
		database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
	}
	else if (strcasecmp("delete",sep->arg[1]) == 0)
		database.DeleteWaypoint(c, atoi(sep->arg[2]),wp,zone->GetZoneID());
	else
		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
}
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
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 11:13 PM.


 

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