Changeset 17:2b7d9b08ce3f in xplra for test/basictest.cc


Ignore:
Timestamp:
01/31/13 16:56:18 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 3 'hg:/home/ivaradi/xplane/hg/xplra' '/'>, 'public')
Message:

Setting of scalar values works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/basictest.cc

    r16 r17  
    133133        printf("\n\n");
    134134
     135        printf("Setting the number of the engines to %d...\n", numEngines + 1);
     136        xplane.setInt("sim/aircraft/engine/acf_num_engines", numEngines + 1);
     137        numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines");
     138        printf("The new number of engines: %d\n\n", numEngines);
     139
     140        float acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up");
     141        printf("Setting the aircraft elevator up control from %f to %f...\n",
     142               acfElevUp, acfElevUp + 15.0);
     143        xplane.setFloat("sim/aircraft/controls/acf_elev_up", acfElevUp);
     144        acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up");
     145        printf("The aircraft elevator up control set to %f\n\n", acfElevUp);
     146
     147        double acfElevDown = xplane.getDouble("sim/flightmodel/position/local_x");
     148        printf("Setting the aircraft elevator down control from %f to %f...\n",
     149               acfElevDown, acfElevDown + 15.0);
     150        xplane.setDouble("sim/flightmodel/position/local_x", acfElevDown + 15.0);
     151        acfElevDown = xplane.getDouble("sim/flightmodel/position/local_x");
     152        printf("The aircraft elevator down control set to %f\n\n", acfElevDown);
     153
     154        try {
     155            printf("Querying an invalid dataref...\n");
     156            xplane.getInt("sim/aircraft/engine/num_engines");
     157            printf("\n>>>>>>>>>>>> Succeeded!!!!!!!!!!!!!!!!!!!!!!\n\n");
     158        } catch(const ProtocolException& exception) {
     159            printf("Exception caugth: %s\n\n", exception.what());
     160        }
     161
     162
    135163        return 0;
    136164    } catch(const Exception& exception) {
Note: See TracChangeset for help on using the changeset viewer.