Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "unit_generic.h"
#include "csv.h"
#include "savegame.h"
#include "xml_serializer.h"
#include "gfx/sphere.h"
#include "unit_collide.h"
#include "collide2/Stdafx.h"
#include "collide2/CSopcodecollider.h"
#include "unit_factory.h"
#include "audiolib.h"
#include "unit_xml.h"
#include "gfx/quaternion.h"
#include "role_bitmask.h"
#include "unit_csv.h"
#include <algorithm>
#include "lin_time.h"
#include "unit_const_cache.h"
Go to the source code of this file.
Classes | |
struct | SubUnitStruct |
Macros | |
#define | VS_PI 3.1415926535897931 |
#define | LOADROW_OPTIMIZER ((0x348299ab)) |
#define | FORCE_OPTIMIZER (1) |
#define | OPTIMIZER_INDEX(Variable) OPTIDX_##Variable |
#define | INIT_OPTIMIZER(keys, Variable) do{OPTIMIZER_INDEX(Variable)=(keys.push_back(#Variable),(keys.size()-1));}while(0) |
#define | DEF_OPTIMIZER(Variable) static unsigned int OPTIMIZER_INDEX( Variable ) = CSVTable::optimizer_undefined; |
#define | OPTIM_GET(row, table, variable) |
Functions | |
CSVRow | LookupUnitRow (const string &unitname, const string &faction) |
int | GetModeFromName (const char *input_buffer) |
void | pushMesh (std::vector< Mesh * > &mesh, float &randomstartframe, float &randomstartseconds, const char *filename, const float scale, int faction, class Flightgroup *fg, int startframe, double texturestarttime) |
void | addShieldMesh (Unit::XML *xml, const char *filename, const float scale, int faction, class Flightgroup *fg) |
void | addRapidMesh (Unit::XML *xml, const char *filename, const float scale, int faction, class Flightgroup *fg) |
static void | UpgradeUnit (Unit *un, const std::string &upgrades) |
void | AddMeshes (std::vector< Mesh * > &xmeshes, float &randomstartframe, float &randomstartseconds, float unitscale, const std::string &meshes, int faction, Flightgroup *fg, vector< unsigned int > *counts) |
static std::pair < string::size_type, string::size_type > | nextElementRange (const string &inp, string::size_type &start, string::size_type end) |
static string | nextElementString (const string &inp, string::size_type &start, string::size_type end) |
static int | nextElementInt (const string &inp, string::size_type &start, string::size_type end, int def=0) |
static double | nextElementFloat (const string &inp, string::size_type &start, string::size_type end, double def=0) |
static double | nextElementBool (const string &inp, string::size_type &start, string::size_type end, bool def=false) |
static string | nextElement (string &inp) |
static bool | stob (const string &inp, bool defaul) |
static double | stof (const string &inp, double def=0) |
static int | stoi (const string &inp, int def=0) |
bool | CheckAccessory (Unit *) |
int | parseMountSizes (const char *str) |
static void | AddMounts (Unit *thus, Unit::XML &xml, const std::string &mounts) |
static vector< SubUnitStruct > | GetSubUnits (const std::string &subunits) |
static void | AddSubUnits (Unit *thus, Unit::XML &xml, const std::string &subunits, int faction, const std::string &modification) |
void | AddDocks (Unit *thus, Unit::XML &xml, const string &docks) |
void | AddLights (Unit *thus, Unit::XML &xml, const string &lights) |
static void | ImportCargo (Unit *thus, const string &imports) |
static void | AddCarg (Unit *thus, const string &cargos) |
void | HudDamage (float *dam, const string &damages) |
string | WriteHudDamage (Unit *un) |
string | WriteHudDamageFunc (Unit *un) |
void | AddSounds (Unit *thus, string sounds) |
void | LoadCockpit (Unit *thus, const string &cockpit) |
static int | AssignIf (const string &inp, float &val, float &val1, float &val2) |
static int | AssignIfDeg (const string &inp, float &val) |
float | getFuelConversion () |
const std::string | EMPTY_STRING ("") |
CSVRow | GetUnitRow (string filename, bool subu, int faction, bool readlast, bool &rread) |
static void | mapToStringVec (vsUMap< string, string >a, vector< string > &key, vector< string > &value) |
static string | tos (float val) |
static string | tos (double val) |
static string | tos (unsigned int val) |
static string | tos (bool val) |
static string | tos (int val) |
void | UpdateMasterPartList (Unit *ret) |
#define DEF_OPTIMIZER | ( | Variable) | static unsigned int OPTIMIZER_INDEX( Variable ) = CSVTable::optimizer_undefined; |
Definition at line 672 of file unit_csv.cpp.
Referenced by Unit::LoadRow().
#define FORCE_OPTIMIZER (1) |
Definition at line 666 of file unit_csv.cpp.
#define INIT_OPTIMIZER | ( | keys, | |
Variable | |||
) | do{OPTIMIZER_INDEX(Variable)=(keys.push_back(#Variable),(keys.size()-1));}while(0) |
Definition at line 670 of file unit_csv.cpp.
Referenced by Unit::LoadRow().
#define LOADROW_OPTIMIZER ((0x348299ab)) |
Definition at line 663 of file unit_csv.cpp.
Referenced by Unit::LoadRow().
#define OPTIM_GET | ( | row, | |
table, | |||
variable | |||
) |
Definition at line 676 of file unit_csv.cpp.
Referenced by Unit::LoadRow().
#define OPTIMIZER_INDEX | ( | Variable) | OPTIDX_##Variable |
Definition at line 668 of file unit_csv.cpp.
#define VS_PI 3.1415926535897931 |
Definition at line 20 of file unit_csv.cpp.
Referenced by AssignIfDeg(), GetSubUnits(), Unit::LoadRow(), and Unit::WriteUnitString().
|
static |
Definition at line 499 of file unit_csv.cpp.
References Unit::AddCargo(), UnitImages< BOGUS >::cargo, Cargo::category, Cargo::content, Cargo::description, Cargo::functionality, Cargo::installed, Cargo::mass, Cargo::maxfunctionality, Cargo::mission, nextElementBool(), nextElementFloat(), nextElementInt(), nextElementString(), Unit::pImage, Cargo::price, Cargo::quantity, and Cargo::volume.
Referenced by Unit::LoadRow().
Definition at line 400 of file unit_csv.cpp.
References UnitImages< BOGUS >::dockingports, VegaConfig::getVariable(), i, nextElementFloat(), nextElementInt(), XMLSupport::parse_int(), Unit::pImage, QVector, SERVER, size, Unit::XML::unitscale, and vs_config.
Referenced by Unit::LoadRow().
Definition at line 436 of file unit_csv.cpp.
References GFXColor::a, Unit::addHalo(), GFXColor::b, GFXColor::g, VegaConfig::getVariable(), nextElementFloat(), nextElementString(), XMLSupport::parse_float(), QVector, GFXColor::r, Unit::XML::unitscale, and vs_config.
Referenced by Unit::LoadRow().
void AddMeshes | ( | std::vector< Mesh * > & | xmeshes, |
float & | randomstartframe, | ||
float & | randomstartseconds, | ||
float | unitscale, | ||
const std::string & | meshes, | ||
int | faction, | ||
Flightgroup * | fg, | ||
vector< unsigned int > * | counts | ||
) |
Definition at line 84 of file unit_csv.cpp.
References StarSystemGent::faction, and pushMesh().
Referenced by Unit::LoadRow(), and GameUnit< UnitType >::Split().
Definition at line 209 of file unit_csv.cpp.
References a, AUDCreateSound(), b, Quaternion::from_vectors(), Unit::GetNumMounts(), VegaConfig::getVariable(), int, Unit::mounts, nextElementBool(), nextElementFloat(), nextElementInt(), nextElementString(), weapon_info::NOWEAP, XMLSupport::parse_bool(), parseMountSizes(), weapon_info::PROJECTILE, QVector, R, Mount::SetMountOrientation(), Mount::SetMountPosition(), weapon_info::size, Mount::size, Mount::type, Unit::XML::unitscale, volume, and vs_config.
Referenced by Unit::LoadRow().
void addRapidMesh | ( | Unit::XML * | xml, |
const char * | filename, | ||
const float | scale, | ||
int | faction, | ||
class Flightgroup * | fg | ||
) |
void addShieldMesh | ( | Unit::XML * | xml, |
const char * | filename, | ||
const float | scale, | ||
int | faction, | ||
class Flightgroup * | fg | ||
) |
Definition at line 453 of file unit_xml.cpp.
Referenced by Unit::LoadRow().
void AddSounds | ( | Unit * | thus, |
string | sounds | ||
) |
Definition at line 571 of file unit_csv.cpp.
References UnitSounds::armor, AUDCreateSound(), AUDCreateSoundWAV(), UnitSounds::cloak, UnitSounds::engine, UnitSounds::explode, VegaConfig::getVariable(), UnitSounds::hull, UnitSounds::jump, nextElement(), UnitSounds::shield, Unit::sound, and vs_config.
Referenced by Unit::LoadRow().
|
static |
Definition at line 348 of file unit_csv.cpp.
References a, CheckAccessory(), UnitFactory::createUnit(), StarSystemGent::faction, float_to_int(), GetSubUnits(), Unit::graphicOptions, i, Unit::isSubUnit(), Network, UnitCollection::prepend(), QVector, R, SERVER, Unit::graphic_options::SubUnit, Unit::SubUnits, Unit::XML::units, and Unit::XML::unitscale.
Referenced by Unit::LoadRow().
Definition at line 646 of file unit_csv.cpp.
Referenced by Unit::LoadRow().
Definition at line 1348 of file unit_generic.cpp.
const std::string EMPTY_STRING | ( | "" | ) |
float getFuelConversion | ( | ) |
Definition at line 655 of file unit_csv.cpp.
References VegaConfig::getVariable(), XMLSupport::parse_float(), and vs_config.
int GetModeFromName | ( | const char * | input_buffer) |
Definition at line 87 of file unit_xml.cpp.
|
static |
Definition at line 310 of file unit_csv.cpp.
References UniverseUtil::cos(), nextElementFloat(), nextElementString(), QVector, R, and VS_PI.
Referenced by AddSubUnits(), and Unit::WriteUnitString().
Definition at line 1429 of file unit_csv.cpp.
References FactionUtil::GetFactionName(), i, and unitTables.
void HudDamage | ( | float * | dam, |
const string & | damages | ||
) |
Definition at line 535 of file unit_csv.cpp.
References i, and nextElementFloat().
Referenced by Unit::LoadRow().
|
static |
Definition at line 468 of file unit_csv.cpp.
References UnitImages< BOGUS >::cargo, Unit::ImportPartList(), Network, nextElementFloat(), nextElementString(), and Unit::pImage.
Referenced by Unit::LoadRow().
void LoadCockpit | ( | Unit * | thus, |
const string & | cockpit | ||
) |
Definition at line 626 of file unit_csv.cpp.
References UnitImages< BOGUS >::CockpitCenter, UnitImages< BOGUS >::cockpitImage, nextElementFloat(), nextElementString(), and Unit::pImage.
Referenced by Unit::LoadRow().
CSVRow LookupUnitRow | ( | const string & | unitname, |
const string & | faction | ||
) |
Definition at line 22 of file unit_csv.cpp.
References StarSystemGent::faction, i, and unitTables.
Referenced by UniverseUtil::LookupUnitStat(), and GameUnit< UnitType >::Split().
|
static |
|
static |
Definition at line 175 of file unit_csv.cpp.
References nextElementRange(), and start.
Referenced by AddSounds().
|
static |
Definition at line 165 of file unit_csv.cpp.
References nextElementRange(), and XMLSupport::parse_bool().
Referenced by AddCarg(), and AddMounts().
|
static |
Definition at line 159 of file unit_csv.cpp.
References nextElementRange().
Referenced by AddCarg(), AddDocks(), AddLights(), AddMounts(), GetSubUnits(), HudDamage(), ImportCargo(), and LoadCockpit().
|
static |
Definition at line 153 of file unit_csv.cpp.
References nextElementRange().
Referenced by AddCarg(), AddDocks(), and AddMounts().
|
static |
Definition at line 128 of file unit_csv.cpp.
References start.
Referenced by nextElement(), nextElementBool(), nextElementFloat(), nextElementInt(), and nextElementString().
|
static |
Definition at line 143 of file unit_csv.cpp.
References nextElementRange().
Referenced by AddCarg(), AddLights(), AddMounts(), GetSubUnits(), ImportCargo(), and LoadCockpit().
int parseMountSizes | ( | const char * | str) |
void pushMesh | ( | std::vector< Mesh * > & | mesh, |
float & | randomstartframe, | ||
float & | randomstartseconds, | ||
const char * | filename, | ||
const float | scale, | ||
int | faction, | ||
class Flightgroup * | fg, | ||
int | startframe, | ||
double | texturestarttime | ||
) |
Definition at line 469 of file unit_xml.cpp.
References float, i, Mesh::LoadMeshes(), and Vector.
Referenced by AddMeshes().
Definition at line 184 of file unit_csv.cpp.
References XMLSupport::parse_bool().
Referenced by Unit::LoadRow().
|
static |
Definition at line 191 of file unit_csv.cpp.
References XMLSupport::parse_float().
Referenced by AssignIf(), AssignIfDeg(), Unit::LoadRow(), Unit::makeMasterPartList(), and Unit::WriteUnitString().
Definition at line 198 of file unit_csv.cpp.
References XMLSupport::parse_int().
Referenced by Unit::LoadRow(), and Unit::makeMasterPartList().
|
static |
Definition at line 1487 of file unit_csv.cpp.
References XMLSupport::tostring().
Referenced by Unit::WriteUnitString().
|
static |
Definition at line 1492 of file unit_csv.cpp.
References XMLSupport::tostring().
|
static |
Definition at line 1497 of file unit_csv.cpp.
References XMLSupport::tostring().
|
static |
Definition at line 1502 of file unit_csv.cpp.
References XMLSupport::tostring().
|
static |
Definition at line 1507 of file unit_csv.cpp.
References XMLSupport::tostring().
void UpdateMasterPartList | ( | Unit * | ret) |
Definition at line 1758 of file unit_csv.cpp.
References _Universe, Universe::AccessCockpit(), UnitImages< BOGUS >::cargo, Cargo::category, Cargo::content, Cargo::description, Unit::GetCargo(), Unit::GetImageInformation(), SaveGame::getMissionStringData(), i, j, Cargo::mass, Unit::numCargo(), Universe::numPlayers(), XMLSupport::parse_float(), Cargo::price, Cargo::quantity, Unit::RemoveCargo(), Cockpit::savegame, and Cargo::volume.
Referenced by Unit::ForceDock(), and Unit::makeMasterPartList().
|
static |
Definition at line 48 of file unit_csv.cpp.
References UnitFactory::createUnit(), ClassCache< Typ, Key >::getCachedConst(), GetModeFromName(), FactionUtil::GetUpgradeFaction(), XMLSupport::parse_int(), ClassCache< Typ, Key >::setCachedConst(), and UnitUtil::upgrade().
Referenced by Unit::LoadRow().
string WriteHudDamage | ( | Unit * | un) |
Definition at line 544 of file unit_csv.cpp.
References UnitImages< BOGUS >::cockpit_damage, i, Unit::pImage, and XMLSupport::tostring().
Referenced by Unit::WriteUnitString().
string WriteHudDamageFunc | ( | Unit * | un) |
Definition at line 557 of file unit_csv.cpp.
References UnitImages< BOGUS >::cockpit_damage, i, MAXVDUS, Unit::pImage, and XMLSupport::tostring().
Referenced by Unit::WriteUnitString().