31 lines
1.3 KiB
C

#pragma once
#ifndef __INTELLISENSE__
# define MODULE_EXPORT __attribute__( ( visibility( "default" ) ) )
# define MODULE_WASM_MODNAME(mod) __attribute__((import_module(mod)))
#else
# define MODULE_EXPORT
# define MODULE_WASM_MODNAME(mod)
# define __attribute__(x)
# define __restrict__
#endif
#include <math.h>
#include <algorithm>
#include "types.h"
//ZFW Entry, fill pax first (pax+bag), rest is cargo
void distribute(paxPayloadData_t* const targetPayload, const FuelData_t* const fuel, const double ZFWTarget, const double CGTarget, bool isImperial);
//SimBrief Entry, SB pax count and total cargo
void distribute(paxPayloadData_t* const targetPayload, const FuelData_t* const fuel, unsigned short numPax, unsigned int cargo, const double CGTarget, bool isImperial);
// Updates pax stations with their respective weights
// Used internally and used for Station Entry (pax only, cargo is ste directly)
// STATION WEIGHTS ARE NOT NORMALISED TO POUNDS
void generatePayload(paxPayloadData_t* const targetPayload, const bool isImperial);
// Normalise to Pounds
// For Station Entry: CALL AFTER `generatePayload`
void normalisePayload(paxPayloadData_t* const targetPayload, const bool isImperial);
void calculateCGs(const paxPayloadData_t* const targetPayload, const FuelData_t* fuel, double* const ZFWCG, double* const TOCG, const bool isImperial);