Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2009, 10:57 AM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default Small patch to see the long name of the zone in the web interface

Small patch to see the long name of the zone in the web interface, i am working currently on a server status page so i need this piece of code

Code:
diff -r 1119a9fad2a9 world/EQW.cpp
--- a/world/EQW.cpp	Sun Apr 19 10:41:37 2009 +0200
+++ b/world/EQW.cpp	Sun Apr 19 16:39:35 2009 +0200
@@ -140,7 +140,7 @@
 	res["zone_id"] = itoa(zs->GetZoneID());
 	res["launch_name"] = zs->GetLaunchName();
 	res["short_name"] = zs->GetZoneName();
-	res["long_name"] = zs->GetZoneName();	//TODO: get this some day
+	res["long_name"] = zs->GetZoneLongName();
 	res["port"] = itoa(zs->GetCPort());
 	res["player_count"] = itoa(zs->NumPlayers());
diff -r 1119a9fad2a9 world/zoneserver.cpp
--- a/world/zoneserver.cpp	Sun Apr 19 10:41:37 2009 +0200
+++ b/world/zoneserver.cpp	Sun Apr 19 16:39:35 2009 +0200
@@ -64,7 +64,8 @@
 	BootingUp = false;
 	
 	const char* zn = MakeLowerString(database.GetZoneName(iZoneID));
-
+	char*	longname;
+	
 	if (iZoneID)
 		zlog(WORLD__ZONE,"Setting to '%s' (%d)%s",(zn) ? zn : "",iZoneID,iStaticZone ? " (Static)" : "");
 
@@ -80,9 +81,21 @@
 	staticzone = iStaticZone;
 
 	if (zn)
+	{
 		strcpy(zone_name, zn);
+		if( database.GetZoneLongName( (char*)zone_name, &longname, NULL, NULL, NULL, NULL, NULL, NULL ) )
+		{
+			strcpy(long_name, longname);
+			safe_delete( longname );
+		}
+		else
+			strcpy(long_name, "");
+	}
 	else
+	{
 		strcpy(zone_name, "");
+		strcpy(long_name, "");
+	}	
 
 	client_list.ZoneBootup(this);
 	ls_zboot.Start();
diff -r 1119a9fad2a9 world/zoneserver.h
--- a/world/zoneserver.h	Sun Apr 19 10:41:37 2009 +0200
+++ b/world/zoneserver.h	Sun Apr 19 16:39:35 2009 +0200
@@ -50,6 +50,7 @@
 	void		SendGroupIDs();
 
 	inline const char*	GetZoneName() const	{ return zone_name; }
+	inline const char*	GetZoneLongName() const	{ return long_name; }
 	const char*			GetCompileTime() const{ return compiled; }
 	void				SetCompile(char* in_compile){ strcpy(compiled,in_compile); }
 	inline int32		GetZoneID() const	{ return zoneID; }
@@ -82,6 +83,7 @@
 	int32	pNumPlayers;
 	char	compiled[25];
 	char	zone_name[16];
+	char	long_name[256];
 	int32	zoneID;
 	int32	oldZoneID;
 	Timer	ls_zboot;
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote
  #2  
Old 04-19-2009, 02:45 PM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default

Here is a pic how it looks now
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote
  #3  
Old 04-21-2009, 02:07 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Thanks, this will be in my next commit.
Reply With Quote
  #4  
Old 05-03-2009, 04:18 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

This has been committed in Revision 454.
Reply With Quote
  #5  
Old 05-05-2009, 07:00 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

On a related note; Is there any way to have this screen display which dynamic zone process that each zone is using? As far as I can tell, the only way to currently figure out which zones are using which process is to read through the log files. It would be nice if there was a considerably easier way to do this. It would be very useful.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 05-06-2009, 03:36 AM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default

Quote:
Originally Posted by trevius View Post
On a related note; Is there any way to have this screen display which dynamic zone process that each zone is using? As far as I can tell, the only way to currently figure out which zones are using which process is to read through the log files. It would be nice if there was a considerably easier way to do this. It would be very useful.
I cant look into the log file currently, i am at work. But do you mean the process id? To be able to attach to the process and debug?

I am not a win or linux system programmer, but i think nothing is impossible. Only takes time, i will look into these when i have some time.
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote
  #7  
Old 05-06-2009, 06:00 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Basically, I mean the name of the process.

Code:
./zone dynamic_47 zone
Or whatever the process is named. Just showing the "dynamic_47" would be awesome. For servers that run many dynamic zones, it could make troubleshooting issues easier. Every time I have a problem with a dynamic crashing for any reason, it can be a pain to figure out which one it is. Had issues with it yesterday while trying to figure out the cause of some crashes, which is why I brought it up.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #8  
Old 05-06-2009, 07:38 AM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default

Like that?


Code:
Index: world/EQW.cpp
===================================================================
--- world/EQW.cpp       (Revision 473)
+++ world/EQW.cpp       (Arbeitskopie)
@@ -139,6 +139,7 @@
        res["type"] = zs->IsStaticZone()?"static":"dynamic";
        res["zone_id"] = itoa(zs->GetZoneID());
        res["launch_name"] = zs->GetLaunchName();
+       res["launched_name"] = zs->GetLaunchedName();
        res["short_name"] = zs->GetZoneName();
        res["long_name"] = zs->GetZoneLongName();
        res["port"] = itoa(zs->GetCPort());
and in utils/default/template/zones.html change
around line 51
Code:
			if($zone->{zone_id} == 0) {
				print "\t<td><b>Dynamic:</b> <a href='zone.html?zone=$zone->{short_name}'>Idle</a></td>";
			} else {
				print "\t<td><b>Dynamic:</b> <a href='zone.html?zone=$zone->{short_name}'>$zone->{long_name}</a> ($zone->{short_name})</td>";
			}
to

Code:
			if($zone->{zone_id} == 0) {
				print "\t<td><b>Dynamic:</b> <a href='zone.html?zone=$zone->{short_name}'>Idle</a><br>$zone->{launched_name}</td>";
			} else {
				print "\t<td><b>Dynamic:</b> <a href='zone.html?zone=$zone->{short_name}'>$zone->{long_name}</a> ($zone->{short_name})<br>$zone->{launched_name}</td>";
			}
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote
  #9  
Old 05-06-2009, 08:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, just like that! Maybe we could move the process name for dynamics to the left of the zone name instead of having it say "Dynamic". Not a big deal, but that would probably cut down the page length some instead of doing it on the next line. I run 50 dynamics, so less is more. Gonna get this tested and see how it looks. If people are ok with it, I will get it added to the SVN. Thanks, Erde!

Tested this and it seems to work well:
Code:
			if($zone->{zone_id} == 0) {
				print "\t<td><b>$zone->{launched_name}:</b> <a href='zone.html?zone=$zone->{short_name}'>Idle</a></td>";
			} else {
				print "\t<td><b>$zone->{launched_name}:</b> <a href='zone.html?zone=$zone->{short_name}'>$zone->{long_name}</a> ($zone->{short_name})</td>";
			}
Anyone have a preference?

Code:
dynamic_02: Idle
dynamic_03: Idle
dynamic_01: Nexus (nexus)
That is what it looks like with the change above. Looks really good to me
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 05-06-2009 at 04:09 PM..
Reply With Quote
  #10  
Old 05-07-2009, 03:52 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Got this commited to the SVN. Thanks again for it! I am certain this will come in handy
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply


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 04:22 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3