IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
IMS_ModuleFunctionData_Tank Class Reference

Stores the static data of a tank. More...

Inheritance diagram for IMS_ModuleFunctionData_Tank:
IMS_ModuleFunctionData_Pressurised IMS_ModuleFunctionData_Base

Public Member Functions

virtual bool HasGui ()
 This function serves to check whether a module function has a GUI before creating it. More...
 
CONSUMABLEDATAgetPropellant ()
 
- Public Member Functions inherited from IMS_ModuleFunctionData_Pressurised
double getVolume ()
 
- Public Member Functions inherited from IMS_ModuleFunctionData_Base
virtual bool LoadFromFile (string configfile, IMSFILE cfg)
 Loads the data from config file. More...
 
FUNCTIONTYPE GetType ()
 
string GetName ()
 

Protected Member Functions

bool processConfigLine (vector< string > &tokens)
 Receives all lines of the config file that concern this ModuleFunction one by one. More...
 
bool validateData (string configfile)
 Validates the data for completeness after loading. More...
 

Protected Attributes

CONSUMABLEDATApropellant = NULL
 pointer to the information of the contents of this tank
 
bool convertible = true
 whether the tank can be converted to living space
 
- Protected Attributes inherited from IMS_ModuleFunctionData_Pressurised
double volume
 usable volume in m^3
 
- Protected Attributes inherited from IMS_ModuleFunctionData_Base
FUNCTIONTYPE type
 Stores the type of the ModuleFunction.
 
string name = ""
 Stores the Name of the ModuleFunction.
 

Detailed Description

Stores the static data of a tank.

Config parameters

contains = <string id> //the id of an item defined in Config/IMS2/consumables.cfg
volume = <float m^3> //the usable tank volume in m^3
[convertible] = <true/false> //optional. Whether the tank can be converted to habitation space. Default is true, has no effect when containing solid fuel (always false).

Config example

BEGIN_MODULEFUNCTION TANK
contains = LH2
volume = 5
convertible = false
END_MODULEFUNC

Member Function Documentation

CONSUMABLEDATA* IMS_ModuleFunctionData_Tank::getPropellant ( )
inline
Returns
A pointer to the consumable type this tank contains
virtual bool IMS_ModuleFunctionData_Tank::HasGui ( )
inlinevirtual

This function serves to check whether a module function has a GUI before creating it.

Note
If your ModuleFunction has its own GUI, overload this function and return true, as simple as that.
Returns
Always false

Reimplemented from IMS_ModuleFunctionData_Base.

bool IMS_ModuleFunctionData_Tank::processConfigLine ( vector< string > &  tokens)
protectedvirtual

Receives all lines of the config file that concern this ModuleFunction one by one.

Overload this function to receive the relevant data of your module.

Parameters
tokensa vector of strings that contains the individual parts of the line, delimited by whitespace or '='
Note
Throw runtime_error with an error message if you encounter an invalid line! The message will be loged in Orbiter.log together with the name of the config file.
Returns
true if the passed line was processed, false if not.

Reimplemented from IMS_ModuleFunctionData_Pressurised.

bool IMS_ModuleFunctionData_Tank::validateData ( string  configfile)
protectedvirtual

Validates the data for completeness after loading.

Implement this function to validate your data at the end of the loading process. Check if everything's there that needs to be, and write log messages if it isn't.

Parameters
configfileThe name of the configfile, so you can add it to your messages so config writers find their mistakes faster.
Returns
False if the modulefunction is unable to function, otherwise return true.
Note
If your Implementation returns false, The loading process will be aborted by forcing orbiter to crash, so be sure to keep your loging straight!

Reimplemented from IMS_ModuleFunctionData_Pressurised.


The documentation for this class was generated from the following files: