View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002951 | FSSCP | design flaw | public | 2013-11-06 17:52 | 2013-12-31 05:00 |
Reporter | Goober5000 | Assigned To | Goober5000 | ||
Priority | immediate | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.1 | ||||
Target Version | 3.7.2 | ||||
Summary | 0002951: weapon_substitution_pattern is not compatible with POD struct | ||||
Description | The weapon_info struct used to be a POD (plain old data) type, but POD types may only contain other POD types. Since weapon_substitution_pattern and weapon_substitution_pattern_names are classes, they violate this requirement. There are two ways to fix this. One, the fields could be turned into arrays with an accompanying length field, similar to targeting_priorities right above it. Or two, the weapon_info struct could be turned into a class. Look at object and ship, etc. to see how this should be done. You would need to change "struct" to "class", make all the fields public, add a constructor, and add a clear() method. Then you would have to search the code for all instances of memset, vm_malloc, and vm_free that use weapon_info, and change them to clear(), new, and delete respectively. And if any other structs contain a complete weapon_info struct (as opposed to a pointer to weapon_info), those structs must be changed to classes in the same way. Your choice how to proceed, but this should be done as soon as possible. | ||||
Tags | No tags attached. | ||||
|
Since the feature never would have worked in the first place (for the same reasons as the ship template code -- see issue 0002064), I went ahead and removed it. |
|
Reopening since both Spoon and FOTG need access to the $Substitute feature, and therefore the POD issues need to be resolved ASAP. |
|
I will add that due to the urgent need for this feature, if the POD-specific aspects are not fixed this coming weekend, I will re-add the feature -- but I will add it with plain old arrays with fixed limits, not SCP_vectors. |
|
Latest SVN has the modified feature which no longer has memory corruption issues. I will say, though, that the weapon_substitution_pattern feature is very badly written and deserves a complete rewrite. |
|
Feature will no longer corrupt memory. Resolving ticket. |
fs2open: trunk r10082 2013-11-15 23:51 Ported: N/A Details Diff |
remove non-working and non-supported $substitute feature for weapons (Mantis 0002951) |
Affected Issues 0002951 |
|
mod - /trunk/fs2_open/code/ship/ship.h | Diff File | ||
mod - /trunk/fs2_open/code/weapon/weapon.h | Diff File | ||
mod - /trunk/fs2_open/code/weapon/weapons.cpp | Diff File | ||
fs2open: trunk r10269 2013-12-30 23:42 Ported: N/A Details Diff |
revert r10082 temporarily while substitute pattern feature is modified |
Affected Issues 0002951 |
|
mod - /trunk/fs2_open/code/ship/ship.h | Diff File | ||
mod - /trunk/fs2_open/code/weapon/weapon.h | Diff File | ||
mod - /trunk/fs2_open/code/weapon/weapons.cpp | Diff File | ||
fs2open: trunk r10270 2013-12-31 00:32 Ported: N/A Details Diff |
Mantis 0002951: fix memory corruption issues by changing weapon substitution patterns to use C-style arrays rather than SCP_vectors |
Affected Issues 0002951 |
|
mod - /trunk/fs2_open/code/weapon/weapon.h | Diff File | ||
mod - /trunk/fs2_open/code/weapon/weapons.cpp | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-11-06 17:52 | Goober5000 | New Issue | |
2013-11-06 17:52 | Goober5000 | Status | new => assigned |
2013-11-06 17:52 | Goober5000 | Assigned To | => iss_mneur |
2013-11-16 04:24 | Goober5000 | Changeset attached | => fs2open trunk r10082 |
2013-11-16 04:28 | Goober5000 | Note Added: 0015410 | |
2013-11-16 04:28 | Goober5000 | Assigned To | iss_mneur => Goober5000 |
2013-11-16 04:28 | Goober5000 | Status | assigned => resolved |
2013-11-16 04:28 | Goober5000 | Resolution | open => fixed |
2013-12-26 04:44 | Goober5000 | Note Added: 0015530 | |
2013-12-26 04:44 | Goober5000 | Assigned To | Goober5000 => iss_mneur |
2013-12-26 04:44 | Goober5000 | Status | resolved => assigned |
2013-12-26 04:44 | Goober5000 | Resolution | fixed => open |
2013-12-26 04:46 | Goober5000 | Note Added: 0015531 | |
2013-12-31 04:57 | Goober5000 | Changeset attached | => fs2open trunk r10270 |
2013-12-31 04:57 | Goober5000 | Changeset attached | => fs2open trunk r10269 |
2013-12-31 04:58 | Goober5000 | Note Added: 0015549 | |
2013-12-31 05:00 | Goober5000 | Note Added: 0015550 | |
2013-12-31 05:00 | Goober5000 | Assigned To | iss_mneur => Goober5000 |
2013-12-31 05:00 | Goober5000 | Status | assigned => resolved |
2013-12-31 05:00 | Goober5000 | Resolution | open => fixed |