Skip to content

Commit b3c4255

Browse files
committed
refactor -weapon_spew_stats
This splits out the stat calculation and MediaVP text generation into their own functions so that they can be used elsewhere.
1 parent ce31a33 commit b3c4255

2 files changed

Lines changed: 260 additions & 253 deletions

File tree

code/weapon/weapon.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,5 +1086,15 @@ bool weapon_multilock_can_lock_on_target(object* shooter, object* target_objp, w
10861086
// Return whether the weapon has a target it is currently homing on
10871087
bool weapon_has_homing_object(weapon* wp);
10881088

1089+
// Variant type for weapon stat values: numeric, boolean, or string
1090+
using weapon_stat_value = std::variant<float, bool, SCP_string>;
1091+
1092+
// Returns a map of combat stats for a single weapon (keyed by column name).
1093+
// Works for any weapon type (primary, secondary, beam).
1094+
SCP_map<SCP_string, weapon_stat_value> weapon_get_stats(const weapon_info &wi);
1095+
1096+
// Returns MVP-style human-readable text block for a single weapon.
1097+
SCP_string weapon_get_stats_text(const weapon_info &wi);
1098+
10891099

10901100
#endif

0 commit comments

Comments
 (0)