Minimum occupancy for PAX
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user