[Add] Mods can now add cargo. Fixed rmOutfit bug.
This commit is contained in:
parent
6ec1a2a407
commit
052c40897c
@ -398,6 +398,11 @@ static void outfits_sell(char* str) {
|
|||||||
dialogue_alert("You can't sell something you don't have!");
|
dialogue_alert("You can't sell something you don't have!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Can't sell when you are using it.
|
||||||
|
else if(outfit_isMod(outfit) && (player->cargo_free < outfit->u.mod.cargo * q)) {
|
||||||
|
dialogue_alert("You currently have cargo in this modification.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player->credits += outfit->price * pilot_rmOutfit(player, outfit, q);
|
player->credits += outfit->price * pilot_rmOutfit(player, outfit, q);
|
||||||
outfits_update(NULL);
|
outfits_update(NULL);
|
||||||
@ -936,8 +941,8 @@ static void spaceport_refuel(char* str) {
|
|||||||
(void)str;
|
(void)str;
|
||||||
|
|
||||||
if(player->credits < refuel_price()) {
|
if(player->credits < refuel_price()) {
|
||||||
dialogue_alert("Need more Scred",
|
// Player is out of moniez after landing D:
|
||||||
"You seem to not have enough Scred to refuel your ship");
|
dialogue_alert("You seem to not have enough scred to refuel your ship.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +323,9 @@ static void outfit_parseSMod(Outfit* tmp, const xmlNodePtr parent) {
|
|||||||
else if(xml_isNode(node, "energy_regen"))
|
else if(xml_isNode(node, "energy_regen"))
|
||||||
tmp->u.mod.energy_regen = xml_getFloat(node)/60.0;
|
tmp->u.mod.energy_regen = xml_getFloat(node)/60.0;
|
||||||
|
|
||||||
|
// Misc.
|
||||||
|
xmlr_int(node, "cargo", tmp->u.mod.cargo);
|
||||||
|
|
||||||
} while((node = node->next));
|
} while((node = node->next));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,9 @@ typedef struct Outfit_ {
|
|||||||
double shield, shield_regen;
|
double shield, shield_regen;
|
||||||
double energy, energy_regen;
|
double energy, energy_regen;
|
||||||
double fuel;
|
double fuel;
|
||||||
|
|
||||||
|
// Misc.
|
||||||
|
int cargo; // Cargo space to add.
|
||||||
} mod;
|
} mod;
|
||||||
struct { // Afterburner.
|
struct { // Afterburner.
|
||||||
double thrust_perc, thrust_abs; // Percent and absolute thrust bonus.
|
double thrust_perc, thrust_abs; // Percent and absolute thrust bonus.
|
||||||
|
@ -546,6 +546,7 @@ int pilot_rmOutfit(Pilot* pilot, Outfit* outfit, int quantity) {
|
|||||||
|
|
||||||
pilot_setSecondary(pilot, s);
|
pilot_setSecondary(pilot, s);
|
||||||
}
|
}
|
||||||
|
pilot_calcStats(pilot); // Recalculate stats.
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
WARN("Failure attempting to remove %d '%s' from pilot '%s'",
|
WARN("Failure attempting to remove %d '%s' from pilot '%s'",
|
||||||
@ -619,6 +620,8 @@ static void pilot_calcStats(Pilot* pilot) {
|
|||||||
pilot->energy_regen += o->u.mod.energy_regen * q;
|
pilot->energy_regen += o->u.mod.energy_regen * q;
|
||||||
// Fuel.
|
// Fuel.
|
||||||
pilot->fuel_max += o->u.mod.fuel * q;
|
pilot->fuel_max += o->u.mod.fuel * q;
|
||||||
|
// Misc.
|
||||||
|
pilot->cargo_free += o->u.mod.cargo * q;
|
||||||
}
|
}
|
||||||
else if(outfit_isAfterburner(pilot->outfits[i].outfit)) {
|
else if(outfit_isAfterburner(pilot->outfits[i].outfit)) {
|
||||||
// Set the afterburner.
|
// Set the afterburner.
|
||||||
|
Loading…
Reference in New Issue
Block a user