~jtaylor/ubuntu/oneiric/flightgear/fix-749249

« back to all changes in this revision

Viewing changes to src/FDM/JSBSim/FGEngine.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-11-26 12:31:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20051126123123-dhs3dijy6nd257up
Tags: 0.9.8-3ubuntu1
adapt gl/glu dependencies for Xorg

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
namespace JSBSim {
62
62
 
63
 
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.11 2004/09/11 12:41:05 ehofman Exp $";
 
63
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.13 2004/12/16 12:47:20 ehofman Exp $";
64
64
static const char *IdHdr = ID_ENGINE;
65
65
 
66
66
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87
87
  TrimMode = false;
88
88
  FuelFlow_gph = 0.0;
89
89
  FuelFlow_pph = 0.0;
 
90
  FuelFreeze = false;
90
91
 
91
92
  FDMExec = exec;
92
93
  State = FDMExec->GetState();
99
100
  Output = FDMExec->GetOutput();
100
101
 
101
102
  PropertyManager = FDMExec->GetPropertyManager();
102
 
 
 
103
  
 
104
  char property_name[80];
 
105
  snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
 
106
  PropertyManager->Tie( property_name, &Thrust);
 
107
  
103
108
  Debug(0);
104
109
}
105
110
 
107
112
 
108
113
FGEngine::~FGEngine()
109
114
{
 
115
  if (Thruster) delete Thruster;
 
116
 
 
117
  char property_name[80];
 
118
  snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
 
119
  PropertyManager->Untie( property_name);
 
120
  
110
121
  Debug(1);
111
122
}
112
123
 
118
129
 
119
130
void FGEngine::ConsumeFuel(void)
120
131
{
 
132
  if (FuelFreeze) return;
 
133
  unsigned int i;
121
134
  double Fshortage, Oshortage, TanksWithFuel;
122
135
  FGTank* Tank;
123
136
 
125
138
  Fshortage = Oshortage = TanksWithFuel = 0.0;
126
139
 
127
140
  // count how many assigned tanks have fuel
128
 
  for (unsigned int i=0; i<SourceTanks.size(); i++) {
 
141
  for (i=0; i<SourceTanks.size(); i++) {
129
142
    Tank = Propulsion->GetTank(SourceTanks[i]);
130
143
    if (Tank->GetContents() > 0.0) {
131
144
      ++TanksWithFuel;
133
146
  }
134
147
  if (!TanksWithFuel) return;
135
148
 
136
 
  for (unsigned int i=0; i<SourceTanks.size(); i++) {
 
149
  for (i=0; i<SourceTanks.size(); i++) {
137
150
    Tank = Propulsion->GetTank(SourceTanks[i]);
138
151
    if (Tank->GetType() == FGTank::ttFUEL) {
139
152
       Fshortage += Tank->Drain(CalcFuelNeed()/TanksWithFuel);