Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: niffiwan on September 17, 2011, 06:30:30 am

Title: Patch for Mantis 2468
Post by: niffiwan on September 17, 2011, 06:30:30 am
Here's a simple patch for mantis 2468 (http://scp.indiegames.us/mantis/view.php?id=2468) - the change-ship SEXP doesn't switch the ships armour type.  Both bigchunk1 & myself have tested it and it seems to work as expected.

Funnily enough, the subsystems armour types were being switched, but not the base ship armours  :)

Please let me know if you have any feedback on the patch.

Code: [Select]
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp (revision 7735)
+++ code/ship/ship.cpp (working copy)
@@ -8756,6 +8756,12 @@
  Assert(sp->ship_max_hull_strength > 0.0f);
  Assert(objp->hull_strength > 0.0f);
 
+ // niffiwan: set new armor types
+ sp->armor_type_idx = sip->armor_type_idx;
+ sp->shield_armor_type_idx = sip->shield_armor_type_idx;
+ sp->collision_damage_type_idx = sip->collision_damage_type_idx;
+ sp->debris_damage_type_idx = sip->debris_damage_type_idx;
+
  // subsys stuff done only after hull stuff is set
  // if the subsystem list is not currently empty, then we need to clear it out first.
  ship_subsystems_delete(sp);
@@ -16718,4 +16724,4 @@
 void init_path_metadata(path_metadata& metadata)
 {
  vm_vec_zero(&metadata.departure_rvec);
-}
\ No newline at end of file
+}

[attachment deleted by ninja]
Title: Re: Patch for Mantis 2468
Post by: Echelon9 on September 18, 2011, 12:23:54 am
Committed, thanks niffiwan.