Changeset 114:0e60b2a26b42 in xplra


Ignore:
Timestamp:
12/23/22 09:34:42 (17 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Modified test case originally causing X-Plane 12 to crash

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/basicctest.c

    r112 r114  
    217217    printf("\n\n");
    218218
    219     printf("Setting the number of the engines to %d...\n", numEngines + 1);
    220     if (xplra_set_int(connectionID, "sim/aircraft/engine/acf_num_engines",
    221                       numEngines + 1)<0)
    222     {
    223         goto error;
    224     }
    225     if (xplra_get_int(&numEngines, connectionID,
    226                       "sim/aircraft/engine/acf_num_engines")<0)
    227     {
    228         goto error;
    229     }
    230     printf("The new number of engines: %d\n\n", numEngines);
     219
     220    if (xplaneVersion<12000 || xplaneVersion>12005) {
     221        printf("Setting the number of the engines to %d...\n", numEngines + 1);
     222        if (xplra_set_int(connectionID, "sim/aircraft/engine/acf_num_engines",
     223                          numEngines + 1)<0)
     224        {
     225            goto error;
     226        }
     227        if (xplra_get_int(&numEngines, connectionID,
     228                          "sim/aircraft/engine/acf_num_engines")<0)
     229        {
     230            goto error;
     231        }
     232        printf("The new number of engines: %d\n\n", numEngines);
     233    } else {
     234        if (xplra_get_int(&numEngines, connectionID,
     235                          "sim/aircraft/engine/acf_num_engines")<0)
     236        {
     237            goto error;
     238        }
     239        printf("Not setting the number of engines, which is: %d\n\n", numEngines);
     240    }
    231241
    232242
  • test/basictest.cc

    r112 r114  
    159159        printf("\n\n");
    160160
    161         printf("Setting the number of the engines to %d...\n", numEngines + 1);
    162         xplane.setInt("sim/aircraft/engine/acf_num_engines", numEngines + 1);
    163         numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines");
    164         printf("The new number of engines: %d\n\n", numEngines);
     161        if (xplaneVersion<12000 || xplaneVersion>12005) {
     162            printf("Setting the number of the engines to %d...\n", numEngines + 1);
     163            xplane.setInt("sim/aircraft/engine/acf_num_engines", numEngines + 1);
     164            numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines");
     165            printf("The new number of engines: %d\n\n", numEngines);
     166        } else {
     167            numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines");
     168            printf("Not setting the number of engines, which is: %d\n\n", numEngines);
     169        }
    165170
    166171        float acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up");
Note: See TracChangeset for help on using the changeset viewer.