diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/atragmx.c | 17 | ||||
| -rw-r--r-- | src/main.c | 10 |
2 files changed, 10 insertions, 17 deletions
diff --git a/src/atragmx.c b/src/atragmx.c index 1b39dbc..7f5ff6d 100644 --- a/src/atragmx.c +++ b/src/atragmx.c @@ -3,10 +3,13 @@ #include <math.h> #include <string.h> +#include <assert.h> + #include "ballistics.h" #include "constants.h" #include "atragmx.h" #include "ace.h" +#include "context.h" #include "vector.h" #include "misc.h" @@ -76,6 +79,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { ctx_range.range_card.card = calloc(ctx_range.range_card.records, sizeof(RangeCardRecord)); + assert(ctx_range.range_card.card); Vec3 wind1 = { .x = cos(270 - ctx->atmosphere.wind_dir * 30) @@ -155,7 +159,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { bullet.pos = vec3_add(bullet.pos, vec3_mul(bullet.velocity, bullet.deltaT * 0.5)); - sln->time_of_flight = sln->time_of_flight + bullet.deltaT; + sln->time_of_flight += bullet.deltaT; // continue here if (ctx->store_range_card) { @@ -206,7 +210,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { if (ace->ballistics->enabled && bullet.pos.y > 0) { // Coriolis local_solution.h_coriolis_deflection = - 0.0000729 * bullet.pos.y * local_solution.time_of_flight + 0.0000729 * bullet.pos.y * sln->time_of_flight * sin(ctx->target.latitude); local_solution.h_coriolis = @@ -230,7 +234,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { local_solution.spin_deflection = ctx->gun.twist_dir * 0.0254 * 1.25 * (ctx->stability_factor + 1.2) - * pow(local_solution.time_of_flight, 1.83); + * pow(sln->time_of_flight, 1.83); local_solution.spin_drift = - atan(local_solution.spin_deflection / bullet.pos.y); @@ -256,7 +260,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { (ctx_range.range_card.card+ctx_range.n)->lead = sln->lead; (ctx_range.range_card.card+ctx_range.n)->time_of_flight - = local_solution.time_of_flight; + = sln->time_of_flight; (ctx_range.range_card.card+ctx_range.n)->bullet_speed = bullet.speed; (ctx_range.range_card.card+ctx_range.n)->kinetic_energy = kinetic_energy; @@ -273,7 +277,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { if (ace->ballistics->enabled && bullet.pos.y > 0) { // Coriolis local_solution.h_coriolis_deflection = 0.0000729 * bullet.pos.y * - local_solution.time_of_flight * + sln->time_of_flight * sin(ctx->target.latitude); local_solution.h_coriolis = @@ -294,7 +298,7 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { // Spin drift local_solution.spin_deflection = ctx->gun.twist_dir * 0.0254 * 1.25 * (ctx->stability_factor + 1.2) * - pow(local_solution.time_of_flight, 1.83); + pow(sln->time_of_flight, 1.83); local_solution.spin_drift = -atan(local_solution.spin_deflection / bullet.pos.y); @@ -307,7 +311,6 @@ ATragMXSolution *ATragMXCalcSolution(ATragMXContext *ctx, ace_config *ace) { sln->windage.w1 = local_solution.windage.w1 * 60.0; sln->windage.w2 = local_solution.windage.w2 * 60.0; sln->lead = local_solution.lead; - sln->time_of_flight = local_solution.time_of_flight; sln->remaining_velocity = bullet.speed; sln->remaining_energy = kinetic_energy; sln->coriolis_vdrift = local_solution.v_coriolis * 60.0; diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 6a74fa7..0000000 --- a/src/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "context.h" -#include "atragmx.h" - -int main(int argc, char** argv) { - printf("Hello, %s\n", argv[0]); - exit(EXIT_SUCCESS); -} |
