View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003105 | FSSCP | design flaw | public | 2014-09-11 23:39 | 2014-09-13 03:17 |
Reporter | MageKing17 | Assigned To | MageKing17 | ||
Priority | low | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Target Version | 3.7.2 | ||||
Summary | 0003105: radarsetup.cpp radar_plot_object() creates a copy of a ship_info object instead of using a pointer to it | ||||
Description | Fortunately, this is less of a problem than it could be due to the default assignment operator behavior being to use the assignment operator for every attribute of the class, and none of the problematic ones are referenced in this function. Still, it's an unnecessary copy operation, and should almost certainly be a pointer instead. Patch attached. | ||||
Additional Information | Assigning to niffiwan per conversation on #scp, but if anybody else wants to review and commit it, feel free. | ||||
Tags | No tags attached. | ||||
|
radarsetup.cpp.patch (1,169 bytes)
Index: code/radar/radarsetup.cpp =================================================================== --- code/radar/radarsetup.cpp (revision 11071) +++ code/radar/radarsetup.cpp (working copy) @@ -315,14 +315,14 @@ if (awacs_level < 1.0f) b->flags |= BLIP_DRAW_DISTORTED; - ship_info Iff_ship_info = Ship_info[Ships[objp->instance].ship_info_index]; + ship_info *Iff_ship_info = &Ship_info[Ships[objp->instance].ship_info_index]; - if (Iff_ship_info.radar_image_2d_idx >= 0 || Iff_ship_info.radar_color_image_2d_idx >= 0) + if (Iff_ship_info->radar_image_2d_idx >= 0 || Iff_ship_info->radar_color_image_2d_idx >= 0) { - b->radar_image_2d = Iff_ship_info.radar_image_2d_idx; - b->radar_color_image_2d = Iff_ship_info.radar_color_image_2d_idx; - b->radar_image_size = Iff_ship_info.radar_image_size; - b->radar_projection_size = Iff_ship_info.radar_projection_size_mult; + b->radar_image_2d = Iff_ship_info->radar_image_2d_idx; + b->radar_color_image_2d = Iff_ship_info->radar_color_image_2d_idx; + b->radar_image_size = Iff_ship_info->radar_image_size; + b->radar_projection_size = Iff_ship_info->radar_projection_size_mult; } } |
|
looks good to me and tests OK. |
|
Fix committed to trunk@11074. |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-09-11 23:39 | MageKing17 | New Issue | |
2014-09-11 23:39 | MageKing17 | Status | new => assigned |
2014-09-11 23:39 | MageKing17 | Assigned To | => niffiwan |
2014-09-11 23:39 | MageKing17 | File Added: radarsetup.cpp.patch | |
2014-09-11 23:39 | MageKing17 | Status | assigned => code review |
2014-09-13 03:16 | niffiwan | Note Added: 0016277 | |
2014-09-13 03:16 | niffiwan | Assigned To | niffiwan => MageKing17 |
2014-09-13 03:16 | niffiwan | Status | code review => assigned |
2014-09-13 03:17 | niffiwan | Note Edited: 0016277 | |
2014-09-13 03:17 | niffiwan | Changeset attached | => fs2open trunk r11074 |
2014-09-13 03:17 | niffiwan | Note Added: 0016278 | |
2014-09-13 03:17 | niffiwan | Status | assigned => resolved |
2014-09-13 03:17 | niffiwan | Resolution | open => fixed |