Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
universe_util.h File Reference
#include "cmd/collection.h"
#include "gfx/vec.h"
#include "networking/const.h"
#include "cmd/unit_util.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  UniverseUtil::PythonUnitIter
 

Namespaces

 UniverseUtil
 

Constant Groups

 UniverseUtil
 

Functions

std::string UniverseUtil::LookupUnitStat (const std::string &unitname, const std::string &faction, const std::string &statname)
 
UnitUniverseUtil::GetUnitFromSerial (ObjSerial serial)
 
UnitUniverseUtil::GetMasterPartList ()
 this gets a unit with 1 of each cargo type in it More...
 
void UniverseUtil::pushSystem (std::string name)
 this function sets the "current" system to be "name" where name may be something like "Sol/Sol" or "Crucible/Cephid_17" this function may take some time if the system has not been loaded before More...
 
bool UniverseUtil::systemInMemory (std::string name)
 
void UniverseUtil::popSystem ()
 this function restores the active system.... there must be an equal number of pushSystems ans popSystems or else Vega Strike may behave unpredictably More...
 
std::string UniverseUtil::getSystemFile ()
 This function gets the current system's official name. More...
 
std::string UniverseUtil::getSystemName ()
 this function gets the current system's nickname (not useful) More...
 
PythonUnitIter UniverseUtil::getUnitList ()
 this function gets an iterator into the units in the current system... do NOT keep an iterator across a frame–it may get deleted! More...
 
UnitUniverseUtil::getUnit (int index)
 This function gets a unit given a number (how many iterations to go down in the iterator) More...
 
UnitUniverseUtil::getUnitByName (std::string name)
 This function gets a unit given a name. More...
 
UnitUniverseUtil::getUnitByPtr (void *ptr, Unit *finder=0, bool allowslowness=true)
 This function gets a unit given an unreferenceable pointer to it - much faster if finder is provided. More...
 
UnitUniverseUtil::getScratchUnit ()
 
void UniverseUtil::setScratchUnit (Unit *)
 
void UniverseUtil::precacheUnit (std::string name, std::string faction)
 
QVector UniverseUtil::getScratchVector ()
 
void UniverseUtil::setScratchVector (QVector)
 
int UniverseUtil::getNumUnits ()
 
void UniverseUtil::cacheAnimation (std::string anim)
 
UnitUniverseUtil::launchJumppoint (std::string name_string, std::string faction_string, std::string type_string, std::string unittype_string, std::string ai_string, int nr_of_ships, int nr_of_waves, QVector pos, std::string squadlogo, std::string destinations)
 this function launches a wormhole or a jump point. More...
 
std::string UniverseUtil::vsConfig (std::string category, std::string option, std::string def)
 
UnitUniverseUtil::launch (std::string name_string, std::string type_string, std::string faction_string, std::string unittype, std::string ai_string, int nr_of_ships, int nr_of_waves, QVector pos, std::string sqadlogo)
 this function launches a normal fighter the name is the flightgroup name, the type is the ship type, the faction is who it belongs to, the unittype is usually "unit" unless you want to make asteroids or nebulae or jump points or planets. the aistring is either a python filename or "default" the nr of ships is the number of ships to be launched with this group, the number of waves is num reinforcements... the position is a tuple (x,y,z) where they appear and the squadlogo is a squadron image...you can leave this the empty string '' for the default squadron logo. More...
 
Cargo UniverseUtil::getRandCargo (int quantity, std::string category)
 this gets a random cargo type (useful for cargo missions) from either any category if category is '' or else from a specific category 'Contraband' comes to mind! More...
 
std::string UniverseUtil::GetAdjacentSystem (std::string str, int which)
 this gets a string which has in it a space delimited list of neighmoring systems More...
 
std::string UniverseUtil::GetGalaxyProperty (std::string sys, std::string prop)
 this gets a specific property of this system as found in universe/milky_way.xml More...
 
std::vector< std::string > UniverseUtil::GetJumpPath (std::string from, std::string to)
 get the shortest path between systems as found in universe/milky_way.xml More...
 
std::string UniverseUtil::GetGalaxyPropertyDefault (std::string sys, std::string prop, std::string def)
 this gets a specific property of this system as found in universe/milky_way.xml and returns a default value if not found More...
 
std::string UniverseUtil::GetGalaxyFaction (std::string sys)
 
void UniverseUtil::SetGalaxyFaction (std::string sys, std::string fac)
 
int UniverseUtil::GetNumAdjacentSystems (std::string sysname)
 this gets the number of systems adjacent to the sysname More...
 
float UniverseUtil::GetGameTime ()
 this gets the current game time since last start in seconds More...
 
float UniverseUtil::getStarTime ()
 this gets the current absolute startime in seconds More...
 
string UniverseUtil::getStarDate ()
 this gets the current stardate string More...
 
void UniverseUtil::SetTimeCompression ()
 this sets the time compresison value to zero More...
 
int UniverseUtil::musicAddList (std::string str)
 this adds a playlist to the music and may be triggered with an int More...
 
void UniverseUtil::musicSetSoftVolume (float vol, float latency_override)
 sets the software volume, with smooth transitions (latency_override==-1 uses default transition time) More...
 
void UniverseUtil::musicSetHardVolume (float vol)
 sets the hardware volume, does not support transitions of any kind. More...
 
void UniverseUtil::musicLayerPlaySong (std::string str, int layer)
 this plays a specific song, at a specific layer More...
 
void UniverseUtil::musicLayerPlayList (int which, int layer)
 this plays msuci from a given list, at a specific layer (where the int is what was returned by musicAddList) More...
 
void UniverseUtil::musicLayerLoopList (int numloops, int layer)
 this plays msuci from a given list, at a specific layer (where the int is what was returned by musicAddList) More...
 
void UniverseUtil::musicLayerSkip (int layer)
 this skips the current music track, at a specific layer (and goes to the next in the currently playing list) More...
 
void UniverseUtil::musicLayerStop (int layer)
 this stops the music currently playing at a specific layer - with a nice fadeout More...
 
void UniverseUtil::musicLayerSetSoftVolume (float vol, float latency_override, int layer)
 sets the software volume, with smooth transitions (latency_override==-1 uses default transition time) More...
 
void UniverseUtil::musicLayerSetHardVolume (float vol, int layer)
 sets the hardware volume, does not support transitions of any kind. More...
 
void UniverseUtil::musicMute (bool stopSound)
 this mutes sound - or unmutes it More...
 
void UniverseUtil::musicPlaySong (std::string str)
 this plays a specific song, through the crossfader construct More...
 
void UniverseUtil::musicPlayList (int which)
 this plays msuci from a given list (where the int is what was returned by musicAddList) More...
 
void UniverseUtil::musicLoopList (int numloops)
 this plays msuci from a given list (where the int is what was returned by musicAddList) More...
 
void UniverseUtil::musicSkip ()
 this skips the current music track (and goes to the next in the currently playing list) More...
 
void UniverseUtil::musicStop ()
 this stops the music currently playing - with a nice fadeout More...
 
float UniverseUtil::GetDifficulty ()
 this gets the difficutly of the game... ranges between 0 and 1... many missions depend on it never going past .99 unless it's always at one. More...
 
void UniverseUtil::SetDifficulty (float diff)
 this sets the difficulty More...
 
void UniverseUtil::playSound (std::string soundName, QVector loc, Vector speed)
 this plays a sound at a location...if the sound has dual channels it will play in the center More...
 
void UniverseUtil::playSoundCockpit (std::string soundName)
 this plays a sound at full volume in the cockpit More...
 
void UniverseUtil::playAnimation (std::string aniName, QVector loc, float size)
 this plays an image (explosion or warp animation) at a location More...
 
void UniverseUtil::playAnimationGrow (std::string aniName, QVector loc, float size, float growpercent)
 
void UniverseUtil::TargetEachOther (std::string fgname, std::string faction, std::string enfgname, std::string enfaction)
 tells the respective flightgroups in this system to start shooting at each other More...
 
void UniverseUtil::StopTargettingEachOther (std::string fgname, std::string faction, std::string enfgname, std::string enfaction)
 tells the respective flightgroups in this system to stop killing each other urgently...they may still attack–just not warping and stuff More...
 
void UniverseUtil::terminateMission (bool term)
 this ends the mission with either success or failure More...
 
UnitUniverseUtil::getPlayer ()
 this gets the player belonging to this mission More...
 
UnitUniverseUtil::getPlayerX (int which)
 this gets a player number (if in splitscreen mode) More...
 
unsigned int UniverseUtil::getCurrentPlayer ()
 
int UniverseUtil::getNumPlayers ()
 this gets the number of active players More...
 
void UniverseUtil::setTargetLabel (std::string label)
 
std::string UniverseUtil::getTargetLabel ()
 
float UniverseUtil::getRelationModifierInt (int which_cp, int faction)
 
float UniverseUtil::getRelationModifier (int which_cp, string faction)
 
float UniverseUtil::getFGRelationModifier (int which_cp, string fg)
 
void UniverseUtil::adjustRelationModifierInt (int which_cp, int faction, float delta)
 
void UniverseUtil::adjustRelationModifier (int which_cp, string faction, float delta)
 
void UniverseUtil::adjustFGRelationModifier (int which_cp, string fg, float delta)
 
void UniverseUtil::AdjustRelation (std::string myfaction, std::string theirfaction, float factor, float rank)
 
float UniverseUtil::GetRelation (std::string myfaction, std::string theirfaction)
 
void UniverseUtil::clearObjectives ()
 
void UniverseUtil::eraseObjective (int which)
 
int UniverseUtil::addObjective (std::string objective)
 this adds an objective for the cockpit to view ("go here and do this) More...
 
void UniverseUtil::setObjective (int which, std::string newobjective)
 this sets the objective's completeness (the int was returned by add objective) More...
 
void UniverseUtil::setCompleteness (int which, float completeNess)
 this sets the completeness of a particular objective... chanigng the color onscreen More...
 
float UniverseUtil::getCompleteness (int which)
 this gets that completeness More...
 
void UniverseUtil::setOwnerII (int which, Unit *owner)
 this sets the owner of a completeness More...
 
UnitUniverseUtil::getOwner (int which)
 this gets an owner of a completeness (NULL means all players can see this objective) More...
 
int UniverseUtil::getMissionOwner ()
 
void UniverseUtil::setMissionOwner (int)
 
int UniverseUtil::numActiveMissions ()
 returns number missions running to tweak difficulty More...
 
void UniverseUtil::IOmessage (int delay, std::string from, std::string to, std::string message)
 this sends an IO message... I'm not sure if delay currently works, but from, to and message do :-) ... if you want to send to the bar do "bar" as the to string... if you want to make news for the news room specify "news" More...
 
UnitUniverseUtil::GetContrabandList (std::string faction)
 this gets a unit with a faction's contraband list... may be null (check with isNull) More...
 
void UniverseUtil::SetAutoStatus (int global_auto, int player_auto)
 this sets whether or not a player may autopilot. Normally they are both 0 and the autopiloting is allowed based on if enemies are near... if you pass in 1 then autopilot will be allowed no matter who is near... if you set -1 then autopilot is never allowed. global affects all players... player just affects the player who accepted the mission. More...
 
void UniverseUtil::LoadMission (std::string missionname)
 
void UniverseUtil::LoadMissionScript (std::string scriptcontents)
 
void UniverseUtil::LoadNamedMissionScript (std::string missiontitle, std::string scriptcontents)
 
QVector UniverseUtil::SafeEntrancePoint (QVector, float radial_size=-1)
 
QVector UniverseUtil::SafeStarSystemEntrancePoint (StarSystem *sts, QVector, float radial_size=-1)
 
float UniverseUtil::getPlanetRadiusPercent ()
 
void UniverseUtil::StopAllSounds (void)
 
unsigned int UniverseUtil::maxMissions ()
 
bool UniverseUtil::networked ()
 
bool UniverseUtil::isserver ()
 
void UniverseUtil::sendCustom (int cp, string cmd, string args, string id)
 
void UniverseUtil::receivedCustom (int cp, bool trusted, string cmd, string args, string id)
 
std::string UniverseUtil::getVariable (std::string section, std::string name, std::string def)
 
std::string UniverseUtil::getSubVariable (std::string section, std::string subsection, std::string name, std::string def)
 
double UniverseUtil::timeofday ()
 
double UniverseUtil::sqrt (double)
 
double UniverseUtil::log (double)
 
double UniverseUtil::exp (double)
 
double UniverseUtil::cos (double)
 
double UniverseUtil::sin (double)
 
double UniverseUtil::acos (double)
 
double UniverseUtil::asin (double)
 
double UniverseUtil::atan (double)
 
double UniverseUtil::tan (double)
 
void UniverseUtil::micro_sleep (int n)
 
void UniverseUtil::addParticle (QVector loc, Vector velocity, Vector color, float size)
 
void UniverseUtil::ComputeGalaxySerials (std::vector< std::string > &stak)
 
void UniverseUtil::ComputeSystemSerials (std::string &systempath)
 
std::string UniverseUtil::getSaveDir ()
 
std::string UniverseUtil::getSaveInfo (const std::string &filename, bool formatForTextbox)
 
std::string UniverseUtil::getCurrentSaveGame ()
 
std::string UniverseUtil::setCurrentSaveGame (const std::string &newsave)
 
std::string UniverseUtil::getNewGameSaveName ()
 
void UniverseUtil::loadGame (const std::string &savename)
 
void UniverseUtil::saveGame (const std::string &savename)
 
void UniverseUtil::showSplashScreen (const std::string &filename)
 
void UniverseUtil::showSplashMessage (const std::string &text)
 
void UniverseUtil::showSplashProgress (float progress)
 
void UniverseUtil::hideSplashScreen ()
 
bool UniverseUtil::isSplashScreenShowing ()
 
void UniverseUtil::startMenuInterface (bool firstTime, string error)