Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Cargo space should make sense (tm).

  • Loading branch information...
commit 05c41e642afb1cce05104b24f3fecf858a021070 1 parent d1a3148
@bobbens bobbens authored
Showing with 6 additions and 2 deletions.
  1. +1 −0  src/pilot.h
  2. +1 −1  src/pilot_cargo.c
  3. +4 −1 src/pilot_outfit.c
View
1  src/pilot.h
@@ -278,6 +278,7 @@ typedef struct Pilot_ {
double cpu; /**< Amount of CPU the pilot has left. */
double cpu_max; /**< Maximum amount of CPU the pilot has. */
double crew; /**< Crew amount the player has (display it as (int)floor(), but it's analogue. */
+ double cap_cargo; /**< Pilot's cargo capacity. */
/* Movement */
double thrust; /**< Pilot's thrust in px/s^2. */
View
2  src/pilot_cargo.c
@@ -201,7 +201,7 @@ int pilot_cargoUsed( Pilot* pilot )
void pilot_cargoCalc( Pilot* pilot )
{
pilot->mass_cargo = pilot_cargoUsed( pilot );
- pilot->cargo_free = pilot->ship->cap_cargo - pilot->mass_cargo;
+ pilot->cargo_free = pilot->cap_cargo - pilot->mass_cargo;
pilot->solid->mass = pilot->ship->mass + pilot->stats.cargo_inertia * pilot->mass_cargo + pilot->mass_outfit;
pilot_updateMass( pilot );
}
View
5 src/pilot_outfit.c
@@ -810,6 +810,8 @@ void pilot_calcStats( Pilot* pilot )
pilot->speed_base = pilot->ship->speed;
/* crew */
pilot->crew = pilot->ship->crew;
+ /* cargo */
+ pilot->cap_cargo = pilot->ship->cap_cargo;
/* health */
ac = (pilot->armour_max > 0.) ? pilot->armour / pilot->armour_max : 0.;
sc = (pilot->shield_max > 0.) ? pilot->shield / pilot->shield_max : 0.;
@@ -875,7 +877,7 @@ void pilot_calcStats( Pilot* pilot )
/* Fuel. */
pilot->fuel_max += o->u.mod.fuel;
/* Misc. */
- pilot->cargo_free += o->u.mod.cargo;
+ pilot->cap_cargo += o->u.mod.cargo;
pilot->mass_outfit += o->u.mod.mass_rel * pilot->ship->mass;
pilot->crew += o->u.mod.crew_rel * pilot->ship->crew;
/*
@@ -967,6 +969,7 @@ void pilot_calcStats( Pilot* pilot )
/* Misc. */
pilot->dmg_absorb = MAX( 0., pilot->dmg_absorb );
pilot->crew *= s->crew_mod;
+ pilot->cap_cargo *= s->cargo_mod;
/*
* Flat increases.
Please sign in to comment.
Something went wrong with that request. Please try again.