EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EvE Namespace Reference

Namespaces

 Time
 
 Trig
 

Classes

struct  TimeParts
 

Functions

double min (double x, double y)
 
int32 min (int32 x, int32 y)
 
double min1 (double x, double y)
 
double min (double x, double y, double z)
 
int64 max (int64 x, int64 y=0)
 
double max (double x, double y=0)
 
double max (double x, double y, double z)
 
void traceStack (void)
 
bool icontains (std::string data, std::string toSearch, size_t pos=0)
 
const char * FormatTime (int64 time=-1)
 
const char * FormatTime (double time=-1)
 
double trunicate2 (double dig=0)
 

Function Documentation

const char * EvE::FormatTime ( int64  time = -1)

Definition at line 204 of file misc.cpp.

References minutes.

Referenced by Character::AddToSkillQueue(), and Character::SkillQueueLoop().

204  {
205  if (time < 0)
206  return "Invalid Time";
207  if (time < 1)
208  return "None";
209  double seconds = time;
210  double minutes = seconds / 60.0;
211  float hours = minutes / 60.0;
212  float days = hours / 24.0;
213  float weeks = days / 7.0;
214  float months = days / 30.0;
215 
216  int s(fmod(seconds, 60.0));
217  int m(fmod(minutes, 60.0));
218  int h(fmod(hours, 24.0));
219  int d(fmod(days, 7.0));
220  int w(fmod(weeks, 4.0));
221  int M(fmod(months, 12.0));
222 
223  std::ostringstream uptime;
224  if (M)
225  uptime << M << "M" << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
226  else if (w)
227  uptime << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
228  else if (d)
229  uptime << d << "d" << h << "h" << m << "m" << s << "s";
230  else if (h)
231  uptime << h << "h" << m << "m" << s << "s";
232  else if (m)
233  uptime << m << "m" << s << "s";
234  else
235  uptime << s << "s";
236 
237  return uptime.str().c_str();
238 }
Respawn timer checks every u minutes

Here is the caller graph for this function:

const char * EvE::FormatTime ( double  time = -1)

Definition at line 240 of file misc.cpp.

References minutes.

240  {
241  if (time < 0)
242  return "Invalid Time";
243  if (time < 1)
244  return "None";
245  double seconds = time;
246  double minutes = seconds / 60.0;
247  float hours = minutes / 60.0;
248  float days = hours / 24.0;
249  float weeks = days / 7.0;
250  float months = days / 30.0;
251 
252  int s(fmod(seconds, 60.0));
253  int m(fmod(minutes, 60.0));
254  int h(fmod(hours, 24.0));
255  int d(fmod(days, 7.0));
256  int w(fmod(weeks, 4.0));
257  int M(fmod(months, 12.0));
258 
259  std::ostringstream uptime;
260  if (M)
261  uptime << M << "M" << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
262  else if (w)
263  uptime << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
264  else if (d)
265  uptime << d << "d" << h << "h" << m << "m" << s << "s";
266  else if (h)
267  uptime << h << "h" << m << "m" << s << "s";
268  else if (m)
269  uptime << m << "m" << s << "s";
270  else
271  uptime << s << "s";
272 
273  return uptime.str().c_str();
274 }
Respawn timer checks every u minutes
bool EvE::icontains ( std::string  data,
std::string  toSearch,
size_t  pos = 0 
)

Definition at line 194 of file misc.cpp.

Referenced by Command_tr(), generic_createitem(), ServiceDB::ValidateAccountName(), CharacterDB::ValidateCharName(), and CharacterDB::ValidateCharNameRep().

195 {
196  // Convert complete given String to lower case
197  std::transform(data.begin(), data.end(), data.begin(), ::tolower);
198  // Convert complete given Sub String to lower case
199  std::transform(toSearch.begin(), toSearch.end(), toSearch.begin(), ::tolower);
200  // Find sub string in given string
201  return (data.find(toSearch, pos) != std::string::npos);
202 }

Here is the caller graph for this function:

int64 EvE::max ( int64  x,
int64  y = 0 
)
inline

Definition at line 103 of file misc.h.

References y().

Referenced by EvEMath::Market::BrokerFee(), RamMethods::Calculate(), Agent::CanUseAgent(), ModuleManager::GetAvailableSlotInBank(), TurretFormulas::GetDroneToHit(), TurretFormulas::GetNPCToHit(), PIDataMgr::GetProgramOutput(), PIDataMgr::GetProgramResultInfo(), TurretFormulas::GetSentryToHit(), Scan::GetSignalData(), ReprocessingServiceBound::GetStanding(), TurretFormulas::GetToHit(), max(), ProbeSE::RecoverProbe(), EvEMath::Market::RelistFee(), and ProbeSE::UpdateProbe().

103 { return ((x > y) ? x : y); }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate

Here is the call graph for this function:

Here is the caller graph for this function:

double EvE::max ( double  x,
double  y = 0 
)
inline

Definition at line 105 of file misc.h.

References y().

105 { return ((x > y) ? x : y); }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate

Here is the call graph for this function:

double EvE::max ( double  x,
double  y,
double  z 
)

Definition at line 162 of file misc.cpp.

References max(), and y().

163 {
164  double max = ((x > y) ? x : y);
165  return ((max < z) ? z : max);
166 }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
int64 max(int64 x, int64 y=0)
Definition: misc.h:103

Here is the call graph for this function:

double EvE::min ( double  x,
double  y 
)
inline

Definition at line 95 of file misc.h.

Referenced by Agent::CanUseAgent(), RamMethods::EncodeMissingMaterials(), EvEMath::Skill::LevelForPoints(), PlanetSE::LoadExtras(), Colony::LoadPlants(), min(), min1(), EvEMath::Market::SalesTax(), and Colony::SetSchematic().

95 { return ((x < y) ? x : y); }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate

Here is the caller graph for this function:

int32 EvE::min ( int32  x,
int32  y 
)
inline

Definition at line 97 of file misc.h.

97 { return ((x < y) ? x : y); }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
double EvE::min ( double  x,
double  y,
double  z 
)

Definition at line 156 of file misc.cpp.

References min(), and y().

157 {
158  double min = ((x < y) ? x : y);
159  return ((min > z) ? z : min);
160 }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
double min(double x, double y)
Definition: misc.h:95

Here is the call graph for this function:

double EvE::min1 ( double  x,
double  y 
)

Definition at line 150 of file misc.cpp.

References min(), and y().

Referenced by Missile::HitTarget().

151 {
152  double min = ((x < y) ? x : y);
153  return ((min > 1) ? 1 : min);
154 }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
double min(double x, double y)
Definition: misc.h:95

Here is the call graph for this function:

Here is the caller graph for this function:

void EvE::traceStack ( void  )

Definition at line 169 of file misc.cpp.

References SIZE.

Referenced by ClientSession::_GetCurrent(), ProbeItem::_LoadItem(), ModuleItem::_LoadItem(), StationOffice::_LoadItem(), AsteroidItem::_LoadItem(), StructureItem::_LoadItem(), CelestialObject::_LoadItem(), Skill::_LoadItem(), CargoContainer::_LoadItem(), StationItem::_LoadItem(), SolarSystem::_LoadItem(), Blueprint::_LoadItem(), ShipItem::_LoadItem(), WreckContainer::_LoadItem(), Character::_LoadItem(), StationType::_LoadType(), ShipItem::AddItemByFlag(), ModuleManager::addModuleRef(), InventoryItem::AlterQuantity(), FxProc::ApplyEffects(), DynamicEntityFactory::BuildEntity(), CatchSignal(), DBResultRow::ColumnLength(), DBQueryResult::ColumnName(), DBQueryResult::ColumnType(), PyService::CreateBoundObject(), InventoryItem::CreateItemID(), ActiveModule::DeactivateCycle(), RefObject::DecRef(), ModuleManager::deleteModuleRef(), DBResultRow::GetBool(), DBResultRow::GetDouble(), DBResultRow::GetFloat(), DBResultRow::GetInt(), DBResultRow::GetInt64(), Inventory::GetInvForOwner(), PIDataMgr::GetProductLevel(), EvilNumber::GetPyObject(), DBResultRow::GetUInt(), RefObject::IncRef(), StructureSE::Init(), InventoryItem::InventoryItem(), ShipSE::Killed(), InventoryBound::MoveItems(), EntityList::Multicast(), AttributeMap::MultiplyAttribute(), SystemBubble::Remove(), DBcore::RunQuery(), DestinyManager::SendDestinyUpdate(), Client::SendSessionChange(), AttributeMap::SetAttribute(), Client::SetBallParkTimer(), Client::SetCloakTimer(), Client::SetInvulTimer(), DestinyManager::SetPosition(), Client::SetStateTimer(), Client::SetUncloakTimer(), WreckContainer::ValidateAddItem(), and MarshalStream::VisitPackedRow().

170 {
171  uint8 j(0), nptrs(0);
172  #define SIZE 100
173  void *buffer[100];
174  char **strings;
175 
176  nptrs = backtrace(buffer, SIZE);
177  printf("backtrace() returned %i addresses\n", nptrs);
178 
179  /* The call backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO)
180  * would produce similar output to the following: */
181 
182  strings = backtrace_symbols(buffer, nptrs);
183  if (!strings) {
184  printf("backtrace symbols error");
185  return;
186  }
187 
188  for (j = 0; j < nptrs; ++j)
189  printf("%s\n", strings[j]);
190 
191  free(strings);
192 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define SIZE
double EvE::trunicate2 ( double  dig = 0)

Definition at line 276 of file misc.cpp.

277 {
278  int64 first = dig * 100;
279  double ret = (float)first / 100;
280  return ret;
281  //return (double)((int)dig*100)/100;
282 }
signed __int64 int64
Definition: eve-compat.h:51