EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MapConnections.cpp
Go to the documentation of this file.
1 /*
2  * File: MapConnections.cpp
3  * Author: Allan
4  * Purpose: This file was created to hold functions specific to the mapConnections DB table.
5  * The table is used to supply map connection data to the client for drawing maps, and is not supplied by CCP.
6  * The functions in this file will gather approprate data from the DB, and populate mapConnections with the data needed.
7  *
8  * Created on June 29, 2014, 12:40
9  * Updated on December 27, 2014, 12:01
10  * Updated/Corrected cType info on July 11, 2015, 13:20
11  * Updated/Corrected cType info *again* on 13 November 2018
12  */
13 
14 #include "eve-server.h"
15 #include "MapConnections.h"
16 
17 #include "../../eve-common/EVE_Map.h"
18 
19 
21  double starttime = GetTimeMSeconds();
22  sLog.Warning("PopulateConnections()", "Populating mapConnections.");
23  uint16 loops = 14335; //14334
24  uint16 count = 1;
25  uint8 ctype = 3;
26  uint32 fromreg = 0, fromcon = 0, tocon = 0, toreg = 0;
27 
28  DBerror err;
29  DBQueryResult res;
30  DBResultRow row;
31 
32  while ( count < loops ) {
33  sDatabase.RunQuery(res, "SELECT fromreg, fromcon, tocon, toreg FROM mapConnections WHERE AI = %u", count );
34 
35  res.GetRow(row);
36  fromreg = row.GetUInt(0);
37  fromcon = row.GetUInt(1);
38  tocon = row.GetUInt(2);
39  toreg = row.GetUInt(3);
40 
41  if (fromreg != toreg) {
42  ctype = Map::Jumptype::Region;
43  } else if (fromcon != tocon) {
45  } else {
46  ctype = Map::Jumptype::System;
47  }
48 
49  sDatabase.RunQuery(err, "UPDATE mapConnections SET ctype = %u WHERE AI = %u", ctype, count);
50 
51  //res.Reset();
52  ++count;
53  }
54 
55  sLog.Green("PopulateConnections()", "mapConnections Populated in %.3f ms. Please disable this function.", (GetTimeMSeconds() -starttime));
56 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
double GetTimeMSeconds()
Definition: utils_time.cpp:104
unsigned __int32 uint32
Definition: eve-compat.h:50
static void PopulateConnections()
unsigned __int16 uint16
Definition: eve-compat.h:48
Definition: dbcore.h:39