View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001778 | FSSCP | gameplay | public | 2008-09-26 13:28 | 2008-10-05 22:00 |
Reporter | KeldorKatarn | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.9 | ||||
Fixed in Version | 3.6.10 | ||||
Summary | 0001778: ai_link_primaries problem | ||||
Description | The $AI Always Links Energy Weapons and $AI Maybe Links Energy Weapons AI Profile settings are not interpreted correctly: if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { comparing the ship's absolute energy level to a percentage doesn't do much good, so this must be: if (shipp->weapon_energy * 100.0f / sip->max_weapon_reserve > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { | ||||
Additional Information | Fix attached | ||||
Tags | No tags attached. | ||||
2008-09-26 13:28
|
ai_link_primaries_fix.patch (863 bytes)
Index: code/ai/aicode.cpp =================================================================== --- code/ai/aicode.cpp (revision 4831) +++ code/ai/aicode.cpp (working copy) @@ -6549,9 +6554,9 @@ } // regular lasers - if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { + if (shipp->weapon_energy * 100.0f / sip->max_weapon_reserve > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { shipp->flags |= SF_PRIMARY_LINKED; - } else if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) { + } else if (shipp->weapon_energy * 100.0f / sip->max_weapon_reserve > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) { if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f) shipp->flags |= SF_PRIMARY_LINKED; } |
|
Good catch. Add an ai_profiles flag and I can commit this patch. |
|
I don't understand.. this is not retail. This was added by someone in FS_Open and uses above AI Profile lines to get the values. Why does this need an additional ai_profiles flag? It was a bug, this doesn't add a feature. The original feature was buggy. |
|
This *is* a retail feature. Go back and read the code more carefully. Compare it to the original source code release. The only difference between retail and SCP is that in retail the percentages were defined in the code, and in SCP the percentages are defined in ai_profiles so that they can be edited. |
|
I see, so this bug was already in retail. I will make this a flag then alright. Edit: New patch attached. Feel free to change the comment line again to something more appropriate if you think that is needed. |
2008-09-28 03:27
|
ai_link_primaries_fix_new.patch (3,133 bytes)
Index: code/ai/ai_profiles.cpp =================================================================== --- code/ai/ai_profiles.cpp (revision 4835) +++ code/ai/ai_profiles.cpp (working copy) @@ -335,6 +335,8 @@ set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT); + set_flag(profile, "$smart linked fire management:", AIPF_SMART_LINKED_FIRE_MANAGEMENT); + set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE); set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS); Index: code/ai/ai_profiles.h =================================================================== --- code/ai/ai_profiles.h (revision 4835) +++ code/ai/ai_profiles.h (working copy) @@ -78,6 +78,7 @@ #define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE (1 << 17) #define AIPF_ALLOW_MULTI_EVENT_SCORING (1 << 18) #define AIPF_SMART_AFTERBURNER_MANAGEMENT (1 << 19) +#define AIPF_SMART_LINKED_FIRE_MANAGEMENT (1 << 20) #define MAX_AI_PROFILES 5 Index: code/ai/aicode.cpp =================================================================== --- code/ai/aicode.cpp (revision 4835) +++ code/ai/aicode.cpp (working copy) @@ -6554,9 +6554,11 @@ } // regular lasers - if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { + if (!(The_mission.ai_profile->flags & AIPF_SMART_LINKED_FIRE_MANAGEMENT) && shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level] || + The_mission.ai_profile->flags & AIPF_SMART_LINKED_FIRE_MANAGEMENT && shipp->weapon_energy * 100.0f / sip->max_weapon_reserve > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) { shipp->flags |= SF_PRIMARY_LINKED; - } else if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) { + } else if (!(The_mission.ai_profile->flags & AIPF_SMART_LINKED_FIRE_MANAGEMENT) && shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level] || + The_mission.ai_profile->flags & AIPF_SMART_LINKED_FIRE_MANAGEMENT && shipp->weapon_energy * 100.0f / sip->max_weapon_reserve > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) { if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f) shipp->flags |= SF_PRIMARY_LINKED; } Index: code/globalincs/def_files.cpp =================================================================== --- code/globalincs/def_files.cpp (revision 4835) +++ code/globalincs/def_files.cpp (working copy) @@ -816,6 +816,10 @@ ;; instead of afterburning until fuel is exhausted \n\ $smart afterburner management: NO \n\ \n\ +;; if set, the AI will properly link primaries according to \n\ +;; specified percentages of energy levels instead of retail behavior \n\ +$smart linked fire management: NO \n\ + \n\ ;; if set, allows an AI ship to switch to rapid fire for dumbfire \n\ ;; missiles \n\ $allow rapid secondary dumbfire: NO \n\ |
|
Is this ok now? |
|
Mostly. I tweaked it, then committed. |
|
Note withdrawn. Missread |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-09-26 13:28 | KeldorKatarn | New Issue | |
2008-09-26 13:28 | KeldorKatarn | File Added: ai_link_primaries_fix.patch | |
2008-09-27 05:54 | Goober5000 | Note Added: 0009711 | |
2008-09-27 05:57 | Goober5000 | Status | new => confirmed |
2008-09-27 11:54 | KeldorKatarn | Note Added: 0009718 | |
2008-09-28 00:28 | Goober5000 | Note Added: 0009724 | |
2008-09-28 02:59 | KeldorKatarn | Note Added: 0009728 | |
2008-09-28 03:27 | KeldorKatarn | File Added: ai_link_primaries_fix_new.patch | |
2008-09-28 03:28 | KeldorKatarn | Note Edited: 0009728 | |
2008-09-29 14:38 | KeldorKatarn | Note Added: 0009740 | |
2008-10-01 00:44 | Goober5000 | Note Added: 0009752 | |
2008-10-01 00:44 | Goober5000 | Status | confirmed => resolved |
2008-10-01 00:44 | Goober5000 | Resolution | open => fixed |
2008-10-01 00:44 | Goober5000 | Fixed in Version | => 3.6.10 |
2008-10-01 15:23 | KeldorKatarn | Status | resolved => feedback |
2008-10-01 15:23 | KeldorKatarn | Resolution | fixed => reopened |
2008-10-01 15:46 | KeldorKatarn | Note Added: 0009757 | |
2008-10-01 15:48 | KeldorKatarn | Note Edited: 0009757 | |
2008-10-05 22:00 | Goober5000 | Status | feedback => resolved |
2008-10-05 22:00 | Goober5000 | Resolution | reopened => fixed |