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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2004, 12:40 AM
smogo
Discordant
 
Join Date: Jan 2004
Location: 47
Posts: 339
Default

this sounds good idea : more functionnality as no limit to WP count, and space saved as empty WP account for nothing. Using correct indexes could keep overhead to a minimum.

Also, it relieves the error prone 'what value for an empty waypoint ? is it NULL, " ", 0 ?'

unfortunatly, this can not be done without changing the code AFAIK, as you cant retrieve multiple lines data across a single line, what would leave the code untouched (but i may need SQL lessons)

example using a wp table :
create table wp (grid_id int(11),number int(4), x, float, y float, z float);
insert into wp values (1, 1, 7,8, 34.5, -5.0);
insert into wp values (1, 1, 8,9, 21.5, -5.1);

Code:
bool Database::GetWaypoints(int16 grid, int8 num, char* data) {
    char *query = 0;
  char errbuf[MYSQL_ERRMSG_SIZE];
    MYSQL_RES *result;
    MYSQL_ROW row;
  if (RunQuery(query, MakeAnyLenString(&query,"SELECT type,type2,concat(x," ",y," ",z) from grid where id = %i and grid.id=wp.grid_id and wp.number=%i", grid,num),errbuf,&result)) {
    safe_delete_array(query);
    if (mysql_num_rows(result) == 1) {
      row = mysql_fetch_row(result);
      strcpy(data, row[2]);
      mysql_free_result(result);
      return true;
    }
    mysql_free_result(result);
  }
  else {
    cerr << "Error in GetWaypoints query '" << query << "' " << errbuf << endl;
    safe_delete_array(query);
  }
  return false;
}
did i get you right ?
Reply With Quote
 


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 01:21 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