1
0
Fork 0

YASIM: minor corrections and safeguards.

This commit is contained in:
Henning Stahlke 2017-06-13 21:05:41 +02:00
parent ea8bfba98a
commit 3ac90ee866
3 changed files with 11 additions and 5 deletions

View file

@ -211,7 +211,7 @@ bool Atmosphere::test() {
fprintf(stderr, "Columns = %d\n", numColumns);
fprintf(stderr, "Rows = %d\n", rows);
for (int alt = 0; alt < maxTableIndex(); alt++) {
for (int alt = 0; alt <= maxTableIndex(); alt++) {
float density = calcStdDensity(data[alt][PRESSURE], data[alt][TEMPERATURE]);
float delta = data[alt][DENSITY] - density;
fprintf(stderr, "%d : %f \n", alt, delta);

View file

@ -132,11 +132,12 @@ void ControlMap::setInput(int input, float val)
int ControlMap::getOutputHandle(void* obj, int type)
{
for(int i=0; i<_outputs.size(); i++) {
OutRec* o = (OutRec*)_outputs.get(i);
if(o->object == obj && o->type == type)
return i;
OutRec* o = (OutRec*)_outputs.get(i);
if(o->object == obj && o->type == type)
return i;
}
return 0;
fprintf(stderr, "ControlMap::getOutputHandle cannot find *%d, type %d \n", obj, type);
return -1;
}
void ControlMap::setTransitionTime(int handle, float time)

View file

@ -1,6 +1,8 @@
#ifndef _VECTOR_HPP
#define _VECTOR_HPP
#include <stdio.h>
#include <cassert>
//
// Excruciatingly simple vector-of-pointers class. Easy & useful.
// No support for addition of elements anywhere but at the end of the
@ -46,11 +48,14 @@ inline int Vector::add(void* p)
inline void* Vector::get(int i) const
{
assert(i >= 0 and i < _sz);
return _array[i];
}
inline void Vector::set(int i, void* p)
{
assert(i >= 0 and i < _sz);
_array[i] = p;
}