View Single Post
  #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