diff --git a/PackageSources/js-bundle/package.json b/PackageSources/js-bundle/package.json index f916fec..5692586 100644 --- a/PackageSources/js-bundle/package.json +++ b/PackageSources/js-bundle/package.json @@ -1,6 +1,6 @@ { "name": "tfdidesign-md11-load-manager", - "version": "0.1.122", + "version": "0.1.129", "description": "", "main": "index.js", "type": "module", diff --git a/PackageSources/js-bundle/rollup.config.js b/PackageSources/js-bundle/rollup.config.js index f823634..064a727 100644 --- a/PackageSources/js-bundle/rollup.config.js +++ b/PackageSources/js-bundle/rollup.config.js @@ -30,7 +30,7 @@ export default { }, plugins: [ replace({ - 'process.env.NODE_ENV': `"${targetEnv}"`, + 'process.env.NODE_ENV': targetEnv, preventAssignment: true, }), versionInjector(), diff --git a/PackageSources/js-bundle/src/App.tsx b/PackageSources/js-bundle/src/App.tsx index 8bfb721..1528ede 100644 --- a/PackageSources/js-bundle/src/App.tsx +++ b/PackageSources/js-bundle/src/App.tsx @@ -23,9 +23,9 @@ const App: FC = () => { setWASMData(JSON.parse(data)); }, []); useEffect(() => { - console.log('TFDi MD-11 Load Manager version [VI]{version}[/VI]:', process.env.NODE_ENV, '[VI]{date}[/VI]'); + console.log('[KHOFMANN TFDi MD-11 Load Manager] JS Version [VI]{version}[/VI]: process.env.NODE_ENV [VI]{date}[/VI]'); - console.log('Initializing CommBus'); + console.log('[KHOFMANN TFDi MD-11 Load Manager] Initializing CommBus'); const commBus = RegisterViewListener('JS_LISTENER_COMM_BUS'); @@ -35,7 +35,7 @@ const App: FC = () => { Coherent.call(COHERENT_COMM_BUS_WASM_CALL, TFDI_SIMBRIEF_USERNAME_CALL, 'null'); return () => { - console.log('De-Initializing CommBus'); + console.log('[KHOFMANN TFDi MD-11 Load Manager] De-Initializing CommBus'); commBus.off(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback); commBus.off(COMM_BUS_LIVE_DATA_EVENT, wasmCallback); diff --git a/PackageSources/js-bundle/src/components/pax/Pax.tsx b/PackageSources/js-bundle/src/components/pax/Pax.tsx index 833dcad..f072fe1 100644 --- a/PackageSources/js-bundle/src/components/pax/Pax.tsx +++ b/PackageSources/js-bundle/src/components/pax/Pax.tsx @@ -21,7 +21,7 @@ const Pax: FC = ({ WASMData, username }) => { const [deboardingState, setDeboardingState] = useState(1); useEffect(() => { - if (WASMData.GSX.boardingState > 1 && WASMData.GSX.boardingState < GSX_SERVICE_CALLED) return; + if (WASMData.GSX.boardingState > 1 && WASMData.GSX.boardingState < GSX_SERVICE_CALLED) return; setBoardingState(WASMData.GSX.boardingState); setDeboardingState(1); @@ -83,12 +83,6 @@ const Pax: FC = ({ WASMData, username }) => { // DEBOARDING not called, disabled // BOTH done - console.log( - 'GSXActive', - (boardingState >= GSX_SERVICE_CALLED || deboardingState >= GSX_SERVICE_CALLED) && - deboardingState !== GSX_SERVICE_FINISHED - ); - return ( (boardingState >= GSX_SERVICE_CALLED || deboardingState >= GSX_SERVICE_CALLED) && deboardingState !== GSX_SERVICE_FINISHED diff --git a/PackageSources/wasm-module/load-manager.cpp b/PackageSources/wasm-module/load-manager.cpp index 54bca84..4448a60 100644 --- a/PackageSources/wasm-module/load-manager.cpp +++ b/PackageSources/wasm-module/load-manager.cpp @@ -28,7 +28,7 @@ extern "C" MSFS_CALLBACK void module_init(void) { } log(stdout, "Logfile created.\n"); - log(stdout, "Version" VERSION_STRING"startup.\n"); + log(stdout, "WASM Version " VERSION_STRING " startup.\n"); UserData = new UserData_t(); GSXData = new GSXData_t(); diff --git a/PackageSources/wasm-module/load-manager.h b/PackageSources/wasm-module/load-manager.h index 7b80540..17deae6 100644 --- a/PackageSources/wasm-module/load-manager.h +++ b/PackageSources/wasm-module/load-manager.h @@ -32,7 +32,7 @@ /******************************** Constants ********************************/ // Module identification #define MODULE_NAME "[KHOFMANN TFDi MD-11 Load Manager] " -#define VERSION_STRING " 1.0 " +#define VERSION_STRING "1.1" // COMM BUS #define COMM_BUS_LIVE_DATA_EVENT "khofmann_tfdi_md-11_load_manager_live_data" #define COMM_BUS_UPDATE_TARGET_EVENT "khofmann_tfdi_md-11_load_manager_update_target" diff --git a/PackageSources/wasm-module/pax.cpp b/PackageSources/wasm-module/pax.cpp index 9f51266..10413b0 100644 --- a/PackageSources/wasm-module/pax.cpp +++ b/PackageSources/wasm-module/pax.cpp @@ -106,19 +106,25 @@ void distribute(paxPayloadData_t* const targetPayload, const FuelData_t* const f } // Refinement pax count = MAX_PAX; + + unsigned char minBusiness1 = round(targetPayload->paxCount.business1 / 3); + unsigned char minBusiness2 = round(targetPayload->paxCount.business2 / 3); + unsigned char minEconomy1 = round(targetPayload->paxCount.economy1 / 3); + unsigned char minEconomy2 = round(targetPayload->paxCount.economy2 / 3); + while (count > 0) { generatePayload(targetPayload, userData->isImperial, userOptions); calculateCGs(targetPayload, fuel, &targetPayload->ZFWCG, &targetPayload->TOCG, userData->isImperial); // in front of target if (targetPayload->ZFWCG < targetPayload->CGTarget - CG_TOLERANCE) { - if (targetPayload->paxCount.business1 > 0) { + if (targetPayload->paxCount.business1 > minBusiness1) { targetPayload->paxCount.business1--; } - else if (targetPayload->paxCount.business2 > 0) { + else if (targetPayload->paxCount.business2 > minBusiness2) { targetPayload->paxCount.business2--; } - else if (targetPayload->paxCount.economy1 > 0) { + else if (targetPayload->paxCount.economy1 > minEconomy1) { targetPayload->paxCount.economy1--; } else { @@ -140,13 +146,13 @@ void distribute(paxPayloadData_t* const targetPayload, const FuelData_t* const f } // behind target else if (targetPayload->ZFWCG > targetPayload->CGTarget + CG_TOLERANCE) { - if (targetPayload->paxCount.economy2 > 0) { + if (targetPayload->paxCount.economy2 > minEconomy2) { targetPayload->paxCount.economy2--; } - else if (targetPayload->paxCount.economy1 > 0) { + else if (targetPayload->paxCount.economy1 > minEconomy1) { targetPayload->paxCount.economy1--; } - else if (targetPayload->paxCount.business2 > 0) { + else if (targetPayload->paxCount.business2 > minBusiness2) { targetPayload->paxCount.business2--; } else {