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
VegaConfig Class Reference

#include <configxml.h>

Inheritance diagram for VegaConfig:
GameVegaConfig

Public Member Functions

 VegaConfig (const char *configfile)
 
virtual ~VegaConfig ()
 
void getColor (configNode *node, string name, float color[4], bool have_color=false)
 
void getColor (string section, string name, float color[4], bool have_color=false)
 
void gethColor (string section, string name, float color[4], int hexcolor)
 
void getColor (string name, float color[4], bool have_color=false)
 
string getVariable (string section, string name, string defaultvalue)
 
string getVariable (string section, string subsection, string name, string defaultvalue)
 
configNodefindSection (string section, configNode *startnode)
 
configNodefindEntry (string name, configNode *startnode)
 
void setVariable (configNode *entry, string value)
 
bool setVariable (string section, string name, string value)
 
bool setVariable (string section, string subsection, string name, string value)
 
easyDomNodeVariables ()
 
virtual void bindKeys ()
 

Public Attributes

int axis_axis [MAX_AXIS]
 
int axis_joy [MAX_AXIS]
 
bool axis_inverse [MAX_AXIS]
 
float hatswitch [MAX_HATSWITCHES][MAX_VALUES]
 
float hatswitch_margin [MAX_HATSWITCHES]
 
int hatswitch_axis [MAX_HATSWITCHES]
 
int hatswitch_joystick [MAX_HATSWITCHES]
 

Protected Member Functions

string getVariable (configNode *section, string name, string defaultval)
 
bool checkConfig (configNode *node)
 
void doVariables (configNode *node)
 
void checkSection (configNode *node, enum section_t section_type)
 
void checkVar (configNode *node)
 
void doSection (string prefix, configNode *node, enum section_t section_type)
 
void doVar (string prefix, configNode *node)
 
void doColors (configNode *node)
 
bool checkColor (string prefix, configNode *node)
 
virtual void doBindings (configNode *node)
 
virtual void checkBind (configNode *node)
 
virtual void doAxis (configNode *node)
 
virtual void checkHatswitch (int nr, configNode *node)
 

Protected Attributes

configNodevariables
 
configNodebindings
 
configNodecolors
 
map< string, string > map_variables
 
map< string, vColormap_colors
 
int hs_value_index
 

Detailed Description

Definition at line 58 of file configxml.h.

Constructor & Destructor Documentation

VegaConfig::VegaConfig ( const char *  configfile)
explicit

Definition at line 38 of file configxml.cpp.

References checkConfig(), colors, easyDomFactory< domNodeType >::LoadXML(), and variables.

39 {
41  configNode *top = (configNode*) domf->LoadXML( configfile );
42  if (top == NULL) {
43  cout<<"Panic exit - no configuration"<<endl;
44  exit( 0 );
45  }
46  variables = NULL;
47  colors = NULL;
48  checkConfig( top );
49 }
VegaConfig::~VegaConfig ( )
virtual

Definition at line 51 of file configxml.cpp.

References bindings, colors, and variables.

52 {
53  if (variables != NULL)
54  delete variables;
55  if (colors != NULL)
56  delete colors;
57  if (bindings != NULL)
58  delete bindings;
59 }

Member Function Documentation

virtual void VegaConfig::bindKeys ( )
inlinevirtual

Definition at line 91 of file configxml.h.

Referenced by bootstrap_main_loop().

91 {}
virtual void VegaConfig::checkBind ( configNode node)
inlineprotectedvirtual

Definition at line 110 of file configxml.h.

110 {}
bool VegaConfig::checkColor ( string  prefix,
configNode node 
)
protected

Definition at line 162 of file configxml.cpp.

References vColor::a, a, easyDomNode::attr_value(), vColor::b, b, configNode::color, vColor::g, g, getColor(), map_colors, vColor::name, easyDomNode::Name(), and vColor::r.

Referenced by doSection().

163 {
164  if (node->Name() != "color") {
165  cout<<"no color definition"<<endl;
166  return false;
167  }
168  if ( node->attr_value( "name" ).empty() ) {
169  cout<<"no color name given"<<endl;
170  return false;
171  }
172  string name = node->attr_value( "name" );
173  string hashname = prefix+name;
174 
175  vColor *color;
176  if ( node->attr_value( "ref" ).empty() ) {
177  string r = node->attr_value( "r" );
178  string g = node->attr_value( "g" );
179  string b = node->attr_value( "b" );
180  string a = node->attr_value( "a" );
181  if ( r.empty() || g.empty() || b.empty() || a.empty() ) {
182  cout<<"neither name nor r,g,b given for color "<<node->Name()<<endl;
183  return false;
184  }
185  float rf = atof( r.c_str() );
186  float gf = atof( g.c_str() );
187  float bf = atof( b.c_str() );
188  float af = atof( a.c_str() );
189 
190  vColor &vc = map_colors[hashname];
191  vc.name.erase();
192  vc.r = rf;
193  vc.g = gf;
194  vc.b = bf;
195  vc.a = af;
196 
197  color = new vColor;
198 
199  color->r = rf;
200  color->g = gf;
201  color->b = bf;
202  color->a = af;
203  } else {
204  float refcol[4];
205 
206  string ref_section = node->attr_value( "section" );
207  string ref_name = node->attr_value( "ref" );
208  if ( ref_section.empty() ) {
209  cout<<"you have to give a referenced section when referencing colors"<<endl;
210  ref_section = "default";
211  }
212  getColor( ref_section, ref_name, refcol );
213 
214  vColor &vc = map_colors[hashname];
215  vc.name = ref_section+"/"+ref_name;
216  vc.r = refcol[0];
217  vc.g = refcol[1];
218  vc.b = refcol[2];
219  vc.a = refcol[3];
220 
221  color = new vColor;
222 
223  color->r = refcol[0];
224  color->g = refcol[1];
225  color->b = refcol[2];
226  color->a = refcol[3];
227  }
228  color->name = node->attr_value( "name" );
229 
230  node->color = color;
231 
232  return true;
233 }
bool VegaConfig::checkConfig ( configNode node)
protected

Definition at line 63 of file configxml.cpp.

References bindings, doColors(), doVariables(), easyDomNode::Name(), and easyDomNode::subnodes.

Referenced by VegaConfig().

64 {
65  if (node->Name() != "vegaconfig") {
66  cout<<"this is no Vegastrike config file"<<endl;
67  return false;
68  }
69  vector< easyDomNode* >::const_iterator siter;
70  for (siter = node->subnodes.begin(); siter != node->subnodes.end(); siter++) {
71  configNode *cnode = (configNode*) (*siter);
72  if (cnode->Name() == "variables")
73  doVariables( cnode );
74  else if (cnode->Name() == "colors")
75  doColors( cnode );
76  else if (cnode->Name() == "bindings")
77  bindings = cnode; //delay the bindings until keyboard/joystick is initialized
78  else
79  cout<<"Unknown tag: "<<cnode->Name()<<endl;
80  }
81  return true;
82 }
virtual void VegaConfig::checkHatswitch ( int  nr,
configNode node 
)
inlineprotectedvirtual

Definition at line 112 of file configxml.h.

112 {}
void VegaConfig::checkSection ( configNode node,
enum section_t  section_type 
)
protected

Definition at line 126 of file configxml.cpp.

References easyDomNode::attr_value(), doSection(), easyDomNode::Name(), and easyDomNode::printNode().

Referenced by doColors(), and doVariables().

127 {
128  if (node->Name() != "section") {
129  cout<<"not a section"<<endl;
130  node->printNode( cout, 0, 1 );
131 
132  return;
133  }
134  doSection( node->attr_value( "name" )+"/", node, section_type );
135 }
void VegaConfig::checkVar ( configNode node)
protected

Definition at line 151 of file configxml.cpp.

References doVar(), and easyDomNode::Name().

152 {
153  if (node->Name() != "var") {
154  cout<<"not a variable"<<endl;
155  return;
156  }
157  doVar( "", node );
158 }
virtual void VegaConfig::doAxis ( configNode node)
inlineprotectedvirtual

Definition at line 111 of file configxml.h.

111 {}
virtual void VegaConfig::doBindings ( configNode node)
inlineprotectedvirtual

Definition at line 109 of file configxml.h.

109 {}
void VegaConfig::doColors ( configNode node)
protected

Definition at line 237 of file configxml.cpp.

References checkSection(), colors, SECTION_COLOR, and easyDomNode::subnodes.

Referenced by checkConfig().

238 {
239  if (colors != NULL) {
240  cout<<"only one variable section allowed"<<endl;
241  return;
242  }
243  colors = node;
244 
245  vector< easyDomNode* >::const_iterator siter;
246  for (siter = node->subnodes.begin(); siter != node->subnodes.end(); siter++) {
247  configNode *cnode = (configNode*) (*siter);
248  checkSection( cnode, SECTION_COLOR );
249  }
250 }
void VegaConfig::doSection ( string  prefix,
configNode node,
enum section_t  section_type 
)
protected

Definition at line 103 of file configxml.cpp.

References easyDomNode::attr_value(), checkColor(), doVar(), easyDomNode::Name(), SECTION_COLOR, SECTION_VAR, and easyDomNode::subnodes.

Referenced by checkSection().

104 {
105  string section = node->attr_value( "name" );
106  if ( section.empty() )
107  cout<<"no name given for section"<<endl;
108  vector< easyDomNode* >::const_iterator siter;
109  for (siter = node->subnodes.begin(); siter != node->subnodes.end(); siter++) {
110  configNode *cnode = (configNode*) (*siter);
111  if (section_type == SECTION_COLOR) {
112  checkColor( prefix, cnode );
113  } else if (section_type == SECTION_VAR) {
114  if (cnode->Name() == "var")
115  doVar( prefix, cnode );
116  else if (cnode->Name() == "section")
117  doSection( prefix+cnode->attr_value( "name" )+"/", cnode, section_type );
118  else
119  cout<<"neither a variable nor a section"<<endl;
120  }
121  }
122 }
void VegaConfig::doVar ( string  prefix,
configNode node 
)
protected

Definition at line 139 of file configxml.cpp.

References easyDomNode::attr_value(), and map_variables.

Referenced by checkVar(), and doSection().

140 {
141  string name = node->attr_value( "name" );
142  string value = node->attr_value( "value" );
143  string hashname = prefix+name;
144  map_variables[hashname] = value;
145  if ( name.empty() )
146  cout<<"no name given for variable "<<name<<" "<<value<<" "<<endl;
147 }
void VegaConfig::doVariables ( configNode node)
protected

Definition at line 86 of file configxml.cpp.

References checkSection(), SECTION_VAR, easyDomNode::subnodes, and variables.

Referenced by checkConfig().

87 {
88  if (variables != NULL) {
89  cout<<"only one variable section allowed"<<endl;
90  return;
91  }
92  variables = node;
93 
94  vector< easyDomNode* >::const_iterator siter;
95  for (siter = node->subnodes.begin(); siter != node->subnodes.end(); siter++) {
96  configNode *cnode = (configNode*) (*siter);
97  checkSection( cnode, SECTION_VAR );
98  }
99 }
configNode * VegaConfig::findEntry ( string  name,
configNode startnode 
)

Definition at line 359 of file configxml.cpp.

References findSection().

Referenced by setVariable().

360 {
361  return findSection( name, startnode );
362 }
configNode * VegaConfig::findSection ( string  section,
configNode startnode 
)

Definition at line 366 of file configxml.cpp.

References easyDomNode::subnodes.

Referenced by findEntry(), and setVariable().

367 {
368  vector< easyDomNode* >::const_iterator siter;
369  for (siter = startnode->subnodes.begin(); siter != startnode->subnodes.end(); siter++) {
370  configNode *cnode = (configNode*) (*siter);
371  string scan_name = (cnode)->attr_value( "name" );
372  if (scan_name == section)
373  return cnode;
374  }
375  cout<<"WARNING: no section/variable/color named "<<section<<endl;
376 
377  return NULL;
378 }
void VegaConfig::getColor ( configNode node,
string  name,
float  color[4],
bool  have_color = false 
)

Definition at line 332 of file configxml.cpp.

References configNode::color, vColor::g, and easyDomNode::subnodes.

Referenced by checkColor(), DockBoxColor(), DrawDamageFlash(), drawlistitem(), DrawNode(), NavigationSystem::DrawSystem(), GameCockpit::GameCockpit(), getColor(), getConfigColor(), getDamageColor(), gethColor(), getSphereColor(), getUnitTypeColor(), GFXInit(), anonymous_namespace{sensor.cpp}::RetrColor(), RetrColor(), and NavigationSystem::Setup().

333 {
334  vector< easyDomNode* >::const_iterator siter;
335  for (siter = node->subnodes.begin(); siter != node->subnodes.end(); siter++) {
336  configNode *cnode = (configNode*) (*siter);
337  if ( (cnode)->attr_value( "name" ) == name ) {
338  color[0] = (cnode)->color->r;
339  color[1] = (cnode)->color->g;
340  color[2] = (cnode)->color->b;
341  color[3] = (cnode)->color->a;
342  return;
343  }
344  }
345  if (have_color == false) {
346  color[0] = 1.0;
347  color[1] = 1.0;
348  color[2] = 1.0;
349  color[3] = 1.0;
350 
351  cout<<"WARNING: color "<<name<<" not defined, using default (white)"<<endl;
352  } else {
353  cout<<"WARNING: color "<<name<<" not defined, using default (hexcolor)"<<endl;
354  }
355 }
void VegaConfig::getColor ( string  section,
string  name,
float  color[4],
bool  have_color = false 
)

Definition at line 316 of file configxml.cpp.

References map_colors.

317 {
318  string hashname = section+"/"+name;
319  std::map< string, vColor >::iterator it;
320  if ( ( it = map_colors.find( hashname ) ) != map_colors.end() ) {
321  color[0] = (*it).second.r;
322  color[1] = (*it).second.g;
323  color[2] = (*it).second.b;
324  color[3] = (*it).second.a;
325  } else if (!have_color) {
326  color[0] = color[1] = color[2] = color[3] = 1.0f;
327  }
328 }
void VegaConfig::getColor ( string  name,
float  color[4],
bool  have_color = false 
)
inline

Definition at line 76 of file configxml.h.

References getColor().

77  {
78  getColor( "default", name, color, have_color );
79  }
void VegaConfig::gethColor ( string  section,
string  name,
float  color[4],
int  hexcolor 
)

Definition at line 304 of file configxml.cpp.

References float, and getColor().

305 {
306  color[3] = ( (float) (hexcolor&0xff) )/256.0;
307  color[2] = ( (float) ( (hexcolor&0xff00)>>8 ) )/256.0;
308  color[1] = ( (float) ( (hexcolor&0xff0000)>>16 ) )/256.0;
309  color[0] = ( (float) ( (hexcolor&0xff000000)>>24 ) )/256.0;
310 
311  getColor( section, name, color, true );
312 }
string VegaConfig::getVariable ( string  section,
string  name,
string  defaultvalue 
)

Definition at line 267 of file configxml.cpp.

References map_variables.

Referenced by abletodock(), FlyByWire::Accel(), accelStarHandler(), Radar::CollectRadarTracks::acquire(), ActuallyWarpTo(), GamePlanet::AddAtmosphere(), Unit::AddCargo(), GamePlanet::AddCity(), AddDocks(), HaloSystem::AddHalo(), AddLights(), AddMounts(), GamePlanet::AddRing(), addShieldMesh(), AddSounds(), Unit::AddVelocity(), Pilot::adjustSpecificRelationship(), Orders::AggressiveAI::AfterburnerJumpTurnTowards(), Orders::AggressiveAI::AggressiveAI(), AIEvents::AIEvresult::AIEvresult(), aim_assist(), AllocVerticesForSystem(), AllUnitsCloseAndEngage(), Unit::ApplyDamage(), Unit::ApplyLocalDamage(), Unit::ApplyNetDamage(), GameUnit< UnitType >::ArmorDamageSound(), Arrested(), AUDAdjustSound(), AUDInit(), AUDQueryAudability(), NetClient::authenticate(), GameCockpit::AutoLanding(), Cockpit::Autopilot(), GameCockpit::Autopilot(), Unit::AutoPilotToErrorMessage(), Background::Background(), basicRepairPrice(), PointStarVlist::BeginDrawState(), BeamXML::beginElement(), StarSystemGent::beginStar(), biModifyMouseSensitivity(), BlurBases(), bolt_draw::bolt_draw(), bootstrap_draw(), bootstrap_first_loop(), bootstrap_main_loop(), buildCargoDescription(), buyShip(), PaintText::calcLayout(), CalculateNearestWarpUnit(), Animation::CalculateOrientation(), charWidth(), checkedVisited(), ChooseNavPoint(), Orders::FireAt::ChooseTargets(), ChooseTargets(), CityLights::CityLights(), FlyByKeyboard::clamp_axis(), Unit::ClampThrust(), Unit::ClampTorque(), Unit::ClampVelocity(), BaseInterface::Room::Launch::Click(), BaseInterface::Room::Eject::Click(), Unit::Cloak(), CloseEnoughCone(), CloseEnoughToAutotrack(), CloseEnoughToNavOrDest(), Bolt::Collide(), Beam::Collide(), Unit::Collide(), Unit::CollideAll(), collideTrees::colTree(), Order::Communicate(), CommunicatingAI::CommunicatingAI(), CompileRunPython(), ComputeMinDowngradePercent(), computeStarColor(), BaseComputer::BuyUpgradeOperation::concludeTransaction(), ConfigAllows(), ConfigCondition(), BaseComputer::configureUpgradeCommitControls(), NetClient::connectLoad(), BaseComputer::constructControls(), GameStarSystem::createBackground(), CreateCargoForOwnerStarship(), BaseComputer::createCategoryCell(), CreateLists(), GameMenu::createNetworkControls(), Unit::DamageRandSys(), Unit::DealDamageToHullReturnArmor(), GameUnit< UnitType >::DealDamageToShield(), DealPossibleJumpDamage(), DealWithWarp(), Unit::DecreaseWarpEnergy(), delayucharStarHandler(), DestroyPlayerSystem(), DestroySystem(), Mission::DirectorStart(), DistanceWarrantsWarpTo(), GameCockpit::DoAutoLanding(), DockedScript(), Orders::DockingOps::DockingOps(), DockToSavedBases(), Orders::DockingOps::DockToTarget(), DoDockingOps(), DoEnterExitAni(), Pilot::DoHit(), DoParticles(), ParticlePoint::Draw(), Radar::SphereDisplay::Draw(), Halo::Draw(), Bolt::Draw(), Background::Draw(), WarpTrail::Draw(), HaloSystem::Draw(), Animation::Draw(), SpriteStarVlist::Draw(), GamePlanet::Draw(), VDU::Draw(), Stars::Draw(), GameUnit< UnitType >::Draw(), GameCockpit::Draw(), BaseInterface::Room::BaseText::Draw(), BaseInterface::Room::BaseShip::Draw(), BaseInterface::Room::BaseVSSprite::Draw(), BaseInterface::Room::BaseTalk::Draw(), BaseInterface::Room::Draw(), NavigationSystem::Draw(), BaseInterface::Draw(), ParticleTrail::DrawAndUpdate(), NavigationSystem::DrawButton(), drawChars(), NavigationSystem::DrawCursor(), DrawDamageFlash(), drawdescription(), NavigationSystem::DrawGrid(), DrawHUDSprite(), NavigationSystem::DrawMission(), GameCockpit::DrawNavSystem(), DrawNodeDescription(), GameUnit< UnitType >::DrawNow(), DrawObjectivesTextPlane(), DrawOneTargetBox(), DrawShield(), NavigationSystem::DrawShip(), NavigationSystem::DrawSystem(), Radar::SphereDisplay::DrawTrack(), Unit::EjectCargo(), Unit::EnergyData(), EstimateGain(), NavPath::evaluate(), Orders::TurretAI::Execute(), FlyByJoystick::Execute(), PlanetaryOrbit::Execute(), Orders::AggressiveAI::Execute(), Orders::FireAt::Execute(), FlyByKeyboard::Execute(), Order::Execute(), Orders::ChangeHeading::Execute(), Orders::AutoLongHaul::Execute(), EvadeLeftRightC::Execute(), FireKeyboard::Execute(), Orders::FormUp::Execute(), Orders::FormUpToOwner::Execute(), FlyByWire::Execute(), Orders::LoopAround::Execute(), Orders::FacePerpendicular::Execute(), FlyTo::Execute(), Orders::AggressiveAI::ExecuteNoEnemies(), ExecuteRequestClearenceKey(), GameUnit< UnitType >::Explode(), Unit::ExplodingProgress(), Missile::ExplosionRadius(), Unit::ExplosionRadius(), Orders::FacePerpendicular::FacePerpendicular(), Orders::FaceTargetITTS::FaceTargetITTS(), Unit::FilterDowngradeList(), Unit::FilterUpgradeList(), Radar::Sensor::FindTracksInRange(), Unit::Fire(), Orders::FireAt::FireAt(), FireBitmask(), Unit::FireEngines(), Orders::FireAt::FireWeapons(), flickerDamage(), FlyByKeyboard::FlyByKeyboard(), FlyByWire::FlyByWire(), ForceChangeTarget(), Unit::ForceDock(), GameCockpit::GameCockpit(), GameMissile::GameMissile(), Universe::Generate1(), Universe::Generate2(), GenerateAutoError(), generateStarSystem(), Pilot::getAnger(), getAutoRSize(), vs_options::getCallsign(), ROLES::getCapitalRoles(), BaseComputer::getColorForGroup(), FSM::getCommMessageMood(), getControlType(), getDefaultProgram(), FSM::GetEdgesString(), getFuelConversion(), GetFuelUsage(), getInitialZoomFactor(), Mesh::getLOD(), GetMadAt(), Unit::GetManifest(), getMasterPartListUnitName(), UnitUtil::getPhysicsPriority(), CommunicatingAI::GetRandomUnit(), UniverseUtil::getSaveInfo(), GameCockpit::getsoundending(), StarSystemGent::getStarColorFromRadius(), getStringFont(), getStringFontForHeight(), UniverseUtil::getSubVariable(), getTemplate(), BaseUtil::GetTextHeight(), Unit::getTractorability(), getUnitNameAndFgNoBase(), getVariable(), UniverseUtil::getVariable(), Unit::GetVelocityDifficultyMult(), GFXCircle(), GFXInit(), GFXShaderReloaded(), GFXTransferTexture(), GoTo(), Music::GotoSong(), HoldPositionWithRespectTo(), howFarToJump(), GameUnit< UnitType >::HullDamageSound(), Unit::ImportPartList(), Unit::IncreaseWarpEnergy(), vs_options::init(), Beam::Init(), NetClient::init(), Unit::Init(), init_opengl_extensions(), BaseInterface::InitCallbacks(), initfov(), VSFileSystem::InitMods(), Music::InitMuzak(), VSFileSystem::InitPaths(), Planet::InitPlanet(), Mesh::initTechnique(), InitUnitTables(), Unit::InsideCollideTree(), LinearPrediction::Interpolate(), UnitUtil::isCloseEnoughToDock(), isMissile(), Unit::jumpReactToCollision(), Unit::Kill(), LaunchOneParticle(), Texture::Load(), AIEvents::LoadAI(), BaseComputer::loadCargoControls(), VSFileSystem::LoadConfig(), Mesh::LoadMeshes(), BaseComputer::loadNewsControls(), Unit::LoadRow(), BaseComputer::loadSellUpgradeControls(), Nebula::LoadXML(), NetClient::loginAcctLoop(), NetClient::loginLoop(), GameCockpit::LookupUnitStat(), Orders::LoopAround::LoopAround(), Orders::LoopAroundAgro::LoopAroundAgro(), main(), MakeFogMesh(), Unit::makeMasterPartList(), StarSystemGent::MakePlanet(), Unit::massSerializer(), MatchingMood(), Unit::Computer::max_ab_speed(), max_allowable_travel_time(), Unit::Computer::max_speed(), Mount::Mount(), BaseInterface::MouseOver(), Music::Music(), Music::Mute(), MyFunction(), Nearby(), NearestSystem(), BaseComputer::newsPickerChangedSelection(), NoDockWithClear(), Orders::DockingOps::PerformDockingOperations(), Mount::PhysicsAlignedFire(), Pilot::Pilot(), Orders::FireAt::PossiblySwitchTarget(), Mesh::PostProcessLoading(), preEmptiveClientFire(), PrettyDistanceString(), Unit::PriceCargo(), Priority(), Orders::AggressiveAI::ProcessCurrentFgDirective(), Logo::ProcessDrawQueue(), Beam::ProcessDrawQueue(), Orders::AggressiveAI::ProcessLogicItem(), Slider::processMouseDown(), StaticDisplay::processMouseDown(), Picker::processMouseDown(), StarSystem::ProcessPendingJumps(), Mesh::ProcessZFarMeshes(), pushTowardsMean(), GameNebula::PutInsideCam(), Unit::rayCollide(), GameMissile::reactToCollision(), GamePlanet::reactToCollision(), Missile::reactToCollision(), Unit::reactToCollision(), StarSystemGent::readColorGrads(), Muzak::readerThread(), BaseComputer::recalcTitle(), Orders::AggressiveAI::ReCommandWing(), FlyByKeyboard::reduce_axis(), Unit::RefillWarpEnergy(), weapon_info::Refire(), Unit::RegenShields(), Orders::FireAt::ReInit(), Unit::RemoveCargo(), Unit::RemoveFromSystem(), Unit::Repair(), Unit::RepairUpgrade(), Unit::ResolveForces(), NetClient::Respawn(), RestoreEnvmapState(), RestoreGlowMapState(), Cockpit::RestoreGodliness(), RestoreSpecMapState(), RollLeftHard(), RollRightHard(), saturate(), SaturatedColor(), ScaleJumpRadius(), ScoreKill(), CommunicatingAI::selectCommunicationMessage(), sellShip(), NetServer::sendDamages(), NetClient::sendPosition(), NetServer::sendUnDock(), NetClient::SetConfigServerAddress(), SetFogMaterialColor(), ShipCommands::setkps(), FireKeyboard::SetParent(), FireKeyboard::SetShieldsOff(), FireKeyboard::SetShieldsOneThird(), FireKeyboard::SetShieldsTwoThird(), SetStartupView(), GameCockpit::SetStaticAnimation(), Unit::SetTurretAI(), NavigationSystem::Setup(), SetupGLLightGlobals(), SetupSpecMapFirstPass(), SetupViewport(), GameCockpit::SetupViewPort(), GameCockpit::Shake(), Unit::ShieldUp(), HaloSystem::ShouldDraw(), Orders::FireAt::ShouldFire(), ShoveCamBelowUnit(), BaseComputer::showPlayerInfo(), BaseComputer::showShipStats(), ShowText(), showUnitStats(), soundServerPipes(), speedStarHandler(), GameUnit< UnitType >::Split(), SpriteStarVlist::SpriteStarVlist(), Stars::Stars(), AccountServer::start(), NetServer::start(), VDU::staticable(), SwitchUnits2(), SwitchUnitsTurret(), NetClient::synchronizeTime(), TargAll(), TargNear(), TargSig(), TargUn(), CockpitKeys::TextMessageKey(), BaseUtil::Texture(), GameUnit< UnitType >::Thrust(), WeaponComparator< FORWARD >::ToggleWeaponSet(), totalShieldEnergyCapacitance(), trackPrice(), GameUnit< UnitType >::TransferUnitToSystem(), TryDock(), Unit::UnDock(), Cockpit::unitInAutoRegion(), Unit::UpAndDownGrade(), Universe::Update(), Cockpit::Update(), Cockpit::updateAttackers(), CommunicatingAI::UpdateContrabandSearch(), Beam::UpdatePhysics(), Unit::UpdatePhysics(), GameNebula::UpdatePhysics2(), Missile::UpdatePhysics2(), BaseComputer::updateTransactionControlsForSelection(), GameCockpit::UpdAutoPilot(), Unit::UpgradeMounts(), useAfterburner(), useAfterburnerToFollow(), useAfterburnerToRun(), useJitteryAutopilot(), useStroke(), GameCockpit::visitSystem(), UniverseUtil::vsConfig(), VSFS_DEBUG(), WARPENERGYMULTIPLIER(), GameUnit< UnitType >::WarpMatrix(), WarpPursuit(), WarpToP(), winsys_init(), StarSystemGent::WriteLight(), Unit::WriteUnit(), and Unit::WriteUnitString().

268 {
269  string hashname = section+"/"+name;
270  std::map< string, string >::iterator it;
271  if ( ( it = map_variables.find( hashname ) ) != map_variables.end() )
272  return (*it).second;
273 
274  else
275  return defaultval;
276 }
string VegaConfig::getVariable ( string  section,
string  subsection,
string  name,
string  defaultvalue 
)

Definition at line 254 of file configxml.cpp.

References map_variables.

255 {
256  string hashname = section+"/"+subsection+"/"+name;
257  std::map< string, string >::iterator it;
258  if ( ( it = map_variables.find( hashname ) ) != map_variables.end() )
259  return (*it).second;
260 
261  else
262  return defaultvalue;
263 }
string VegaConfig::getVariable ( configNode section,
string  name,
string  defaultval 
)
protected

Definition at line 280 of file configxml.cpp.

References easyDomNode::attr_value(), getVariable(), XMLSupport::parse_bool(), and easyDomNode::subnodes.

281 {
282  vector< easyDomNode* >::const_iterator siter;
283  for (siter = section->subnodes.begin(); siter != section->subnodes.end(); siter++) {
284  configNode *cnode = (configNode*) (*siter);
285  if ( (cnode)->attr_value( "name" ) == name )
286  return (cnode)->attr_value( "value" );
287  }
288  static bool foundshouldwarn = false;
289  static bool shouldwarn = true;
290  if (!foundshouldwarn) {
291  if (name != "debug_config") {
292  shouldwarn = XMLSupport::parse_bool( getVariable( "general", "debug_config", "true" ) );
293  foundshouldwarn = true;
294  }
295  }
296  if (shouldwarn)
297  cout<<"WARNING: no var named "<<name<<" in section "<<section->attr_value( "name" )<<" using default: "<<defaultval
298  <<endl;
299  return defaultval;
300 }
void VegaConfig::setVariable ( configNode entry,
string  value 
)

Definition at line 382 of file configxml.cpp.

References easyDomNode::set_attribute().

Referenced by GameMenu::readJoinGameControls(), and setVariable().

383 {
384  entry->set_attribute( "value", value );
385 }
bool VegaConfig::setVariable ( string  section,
string  name,
string  value 
)

Definition at line 389 of file configxml.cpp.

References findEntry(), findSection(), map_variables, setVariable(), and variables.

390 {
391  configNode *sectionnode = findSection( section, variables );
392  if (sectionnode != NULL) {
393  configNode *varnode = findEntry( name, sectionnode );
394  if (varnode != NULL)
395  //now set the thing
396  setVariable( varnode, value );
397  }
398  string hashname = section+"/"+name;
399  map_variables[hashname] = value;
400  return true;
401 }
bool VegaConfig::setVariable ( string  section,
string  subsection,
string  name,
string  value 
)

Definition at line 403 of file configxml.cpp.

References findEntry(), findSection(), map_variables, setVariable(), and variables.

404 {
405  configNode *sectionnode = findSection( section, variables );
406  if (sectionnode != NULL) {
407  configNode *subnode = findSection( name, sectionnode );
408  if (subnode != NULL) {
409  configNode *varnode = findEntry( name, subnode );
410  if (varnode != NULL)
411  //now set the thing
412  setVariable( varnode, value );
413  }
414  }
415  string hashname = section+"/"+subsection+"/"+name;
416  map_variables[hashname] = value;
417  return true;
418 }
easyDomNode* VegaConfig::Variables ( )
inline

Definition at line 87 of file configxml.h.

References variables.

88  {
89  return variables;
90  }

Member Data Documentation

int VegaConfig::axis_axis[MAX_AXIS]

Definition at line 64 of file configxml.h.

Referenced by GameVegaConfig::GameVegaConfig().

bool VegaConfig::axis_inverse[MAX_AXIS]

Definition at line 66 of file configxml.h.

int VegaConfig::axis_joy[MAX_AXIS]

Definition at line 65 of file configxml.h.

Referenced by FlyByJoystick::Execute(), and GameVegaConfig::GameVegaConfig().

configNode* VegaConfig::bindings
protected

Definition at line 95 of file configxml.h.

Referenced by checkConfig(), and ~VegaConfig().

configNode* VegaConfig::colors
protected

Definition at line 96 of file configxml.h.

Referenced by doColors(), VegaConfig(), and ~VegaConfig().

float VegaConfig::hatswitch[MAX_HATSWITCHES][MAX_VALUES]

Definition at line 69 of file configxml.h.

Referenced by GameVegaConfig::GameVegaConfig(), and ProcessJoystick().

int VegaConfig::hatswitch_axis[MAX_HATSWITCHES]

Definition at line 71 of file configxml.h.

Referenced by ProcessJoystick().

int VegaConfig::hatswitch_joystick[MAX_HATSWITCHES]

Definition at line 72 of file configxml.h.

Referenced by ProcessJoystick().

float VegaConfig::hatswitch_margin[MAX_HATSWITCHES]

Definition at line 70 of file configxml.h.

Referenced by GameVegaConfig::GameVegaConfig(), and ProcessJoystick().

int VegaConfig::hs_value_index
protected

Definition at line 99 of file configxml.h.

map< string, vColor > VegaConfig::map_colors
protected

Definition at line 98 of file configxml.h.

Referenced by checkColor(), and getColor().

map< string, string > VegaConfig::map_variables
protected

Definition at line 97 of file configxml.h.

Referenced by doVar(), getVariable(), and setVariable().

configNode* VegaConfig::variables
protected

Definition at line 94 of file configxml.h.

Referenced by doVariables(), setVariable(), Variables(), VegaConfig(), and ~VegaConfig().


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