Minimum occupancy for PAX
This commit is contained in:
parent
9000d516ae
commit
dee5447bed
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tfdidesign-md11-load-manager",
|
||||
"version": "0.1.122",
|
||||
"version": "0.1.129",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@ -30,7 +30,7 @@ export default {
|
||||
},
|
||||
plugins: [
|
||||
replace({
|
||||
'process.env.NODE_ENV': `"${targetEnv}"`,
|
||||
'process.env.NODE_ENV': targetEnv,
|
||||
preventAssignment: true,
|
||||
}),
|
||||
versionInjector(),
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -21,7 +21,7 @@ const Pax: FC<PaxProps> = ({ 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<PaxProps> = ({ 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
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user