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

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2008, 04:53 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by Rocker8956 View Post
I am not sure if where all this is used in the code
It looks like the only place it is referenced is in zone/command.cpp, and it is commented out, and has been at least since the code was moved to the current CVS system sometime over 3 years ago.

Thankfully, the zone names are loaded from the database in common/database.cpp:
Code:
 1111 bool Database::LoadZoneNames() {
 1112 	char errbuf[MYSQL_ERRMSG_SIZE];
 1113     char *query = 0;
 1114     MYSQL_RES *result;
 1115     MYSQL_ROW row;
 1116 	query = new char[256];
 1117 	strcpy(query, "SELECT MAX(zoneidnumber) FROM zone");
 1118 
 1119 	if (RunQuery(query, strlen(query), errbuf, &result)) {
 1120 		safe_delete_array(query);
 1121 		row = mysql_fetch_row(result);
 1122 		if (row && row[0])
 1123 		{
 1124 			max_zonename = atoi(row[0]);
 1125 			zonename_array = new char*[max_zonename+1];
 1126 			for(unsigned int i=0; i<max_zonename; i++) {
 1127 				zonename_array[i] = 0;
 1128 			}
 1129 			mysql_free_result(result);
 1130 
 1131 			MakeAnyLenString(&query, "SELECT zoneidnumber, short_name FROM zone");
 1132 			if (RunQuery(query, strlen(query), errbuf, &result)) {
 1133 				safe_delete_array(query);
 1134 				while((row = mysql_fetch_row(result))) {
 1135 					zonename_array[atoi(row[0])] = new char[strlen(row[1]) + 1];
 1136 					strcpy(zonename_array[atoi(row[0])], row[1]);
 1137 					Sleep(0);
 1138 				}
 1139 				mysql_free_result(result);
 1140 			}
 1141 			else {
 1142 				cerr << "Error in LoadZoneNames query '" << query << "' " << errbuf << endl;
 1143 				safe_delete_array(query);
 1144 				return false;
 1145 			}
 1146 		}
 1147 		else {
 1148 			mysql_free_result(result);
 1149 		}
 1150 	}
 1151 	else {
 1152 		cerr << "Error in LoadZoneNames query '" << query << "' " << errbuf << endl;
 1153 		safe_delete_array(query);
 1154 		return false;
 1155 	}
 1156 	return true;
 1157 }
Which can then be called using Database::GetZoneID, Database::GetZoneName, or Database::GetZoneLongName.

Although it doesn't look like this was really a major deal (and can probably be removed from the main source), it's things like these that can really help the code, so definitely a good catch in general
__________________
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


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 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