Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Possible over running of array length with ship weapons #337

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions scripts/scr_fleet_advisor/scr_fleet_advisor.gml
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ function scr_fleet_advisor(){

cn.temp[109] = string(obj_ini.ship_turrets[i]);

cn.temp[110] = obj_ini.ship_wep[i][1];
cn.temp[111] = obj_ini.ship_wep_facing[i][1];
cn.temp[112] = obj_ini.ship_wep[i][2];
cn.temp[113] = obj_ini.ship_wep_facing[i][2];
cn.temp[114] = obj_ini.ship_wep[i][3];
cn.temp[115] = obj_ini.ship_wep_facing[i][3];
cn.temp[116] = obj_ini.ship_wep[i][4];
cn.temp[117] = obj_ini.ship_wep_facing[i][4];
var facing_length = array_length(obj_ini.ship_wep_facing[i]);
var wep_length = array_length(obj_ini.ship_wep[i]);
var max_weapons = min(facing_length, wep_length, 5);

for (var s = 1; s < max_weapons; s++) {
cn.temp[110+((s-1)*2)] = obj_ini.ship_wep[i][s];
cn.temp[110+((s-1)*2)+1] = obj_ini.ship_wep_facing[i][s];
}

cn.temp[118] = $"{obj_ini.ship_carrying[i]}/{obj_ini.ship_capacity[i]}";
cn.temp[119] = "";
Expand Down