Skip to content

Commit

Permalink
check in acf whether plane has door 2 enabled before using coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
hotbso committed Dec 20, 2024
1 parent 510299c commit 6062549
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion openSAM.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,14 @@ XPluginReceiveMessage(XPLMPluginID in_from, long in_msg, void *in_param)
if (acf) {
char line[200];
int got = 0;
int has_door2 = 0;
// we go the simple brute force way
while (fgets(line, sizeof(line), acf)) {
if (line == strstr(line, "P acf/_has_board_2 ")) {
if (1 != sscanf(line + 19, "%d", &has_door2))
break;
}

if (line == strstr(line, "P acf/_board_2/0 ")) {
if (1 == sscanf(line + 17, "%f", &door_info[1].x)) {
door_info[1].x *= F2M;
Expand All @@ -734,7 +740,7 @@ XPluginReceiveMessage(XPLMPluginID in_from, long in_msg, void *in_param)
}
}

if (got == 3) {
if (has_door2 && got == 3) {
n_door = 2;
log_msg("found door 2 in acf file: x: %0.2f, y: %0.2f, z: %0.2f",
door_info[1].x, door_info[1].y, door_info[1].z);
Expand Down

0 comments on commit 6062549

Please sign in to comment.