From ab72c4126f777faf8e601b53328d563f77b8fed1 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:27:05 +0000 Subject: [PATCH] fix: Fix a bunch of ship errors caused by location (#214) more 0 to -1 lid variable conversions. as stated in title fixes: https://discord.com/channels/714022226810372107/1318240888534601758 and this https://discord.com/channels/714022226810372107/1318242740605030461 --- objects/obj_controller/Alarm_5.gml | 2 +- objects/obj_controller/KeyPress_73.gml | 2 +- objects/obj_controller/Step_0.gml | 2 +- scripts/scr_destroy_planet/scr_destroy_planet.gml | 2 +- scripts/scr_dialogue/scr_dialogue.gml | 4 +++- .../scr_draw_management_unit/scr_draw_management_unit.gml | 8 ++++---- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 2 +- scripts/scr_roster/scr_roster.gml | 2 +- scripts/scr_special_view/scr_special_view.gml | 2 +- .../scr_specialist_point_handler.gml | 2 +- scripts/scr_squads/scr_squads.gml | 4 ++-- scripts/scr_ui_advisors/scr_ui_advisors.gml | 2 +- scripts/scr_vehicle_order/scr_vehicle_order.gml | 4 ++-- 13 files changed, 20 insertions(+), 18 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 97f6cf387..fdaeba534 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -1127,7 +1127,7 @@ for(var i=1; i<=99; i++){ last_artifact = scr_add_artifact("random_nodemon","",0,obj_ini.home_name,2); } else { if (obj_ini.fleet_type != ePlayerBase.home_world){ - last_artifact = scr_add_artifact("random_nodemon","",0,obj_ini.ship_location[1],501); + last_artifact = scr_add_artifact("random_nodemon","",0,obj_ini.ship_location[0],501); } } diff --git a/objects/obj_controller/KeyPress_73.gml b/objects/obj_controller/KeyPress_73.gml index 4e86ac306..c5aceeb6c 100644 --- a/objects/obj_controller/KeyPress_73.gml +++ b/objects/obj_controller/KeyPress_73.gml @@ -25,7 +25,7 @@ scr_dialogue("lol"); // loyalty=0;loyalty_hidden=0; -// show_message(string(obj_ini.ship[0])+" location: "+string(obj_ini.ship_location[1])); +// show_message(string(obj_ini.ship[0])+" location: "+string(obj_ini.ship_location[0])); // alarm[8]=1; diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index c80ec70fd..36ed70425 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -442,7 +442,7 @@ if (unload>0){ ma_wid[q]=unload; } else if (man[q]=="vehicle") and (ma_loc[q]==selecting_location) and (ma_wid[q]<1) and(man_sel[q]!=0){ - if (b==0) then b=ma_lid[q]; + if (b==-1) then b=ma_lid[q]; var unit_id = display_unit[q][1]; var company = display_unit[q][0] obj_ini.veh_loc[company][unit_id]=obj_ini.ship_location[b]; diff --git a/scripts/scr_destroy_planet/scr_destroy_planet.gml b/scripts/scr_destroy_planet/scr_destroy_planet.gml index 08613b60f..a49965c68 100644 --- a/scripts/scr_destroy_planet/scr_destroy_planet.gml +++ b/scripts/scr_destroy_planet/scr_destroy_planet.gml @@ -52,7 +52,7 @@ function scr_destroy_planet(destruction_method) { for (var ed=0;ed0){ - repeat(obj_ini.TTRPG[0,1].planet_location){instance_create(x,y,obj_ground_mission);} + repeat(obj_ini.TTRPG[0,0].planet_location){ + instance_create(x,y,obj_ground_mission); + } } } } diff --git a/scripts/scr_draw_management_unit/scr_draw_management_unit.gml b/scripts/scr_draw_management_unit/scr_draw_management_unit.gml index de5bf6e20..85f2b3859 100644 --- a/scripts/scr_draw_management_unit/scr_draw_management_unit.gml +++ b/scripts/scr_draw_management_unit/scr_draw_management_unit.gml @@ -41,7 +41,7 @@ function scr_draw_management_unit(selected, yy=0, xx=0, draw=true){ assignment=unit.assignment(); if (assignment!="none"){ unit_location_string += $"({assignment})"; - }else if (fest_planet==0) and (fest_sid>0) and (fest_repeats>0) and (ma_lid[selected]==fest_sid){ + }else if (fest_planet==0) and (fest_sid>-1) and (fest_repeats>0) and (ma_lid[selected]==fest_sid){ unit_location_string="=Event="; eventing=true; }else if (fest_planet==1) and (fest_wid>0) and (fest_repeats>0) and (ma_wid[selected]==fest_wid) and (ma_loc[selected]==fest_star){ @@ -88,7 +88,7 @@ function scr_draw_management_unit(selected, yy=0, xx=0, draw=true){ if (ma_wid[selected]!=0){ //numeral for vehicle planet unit_location_string += scr_roman(ma_wid[selected]); - } else if (ma_lid[selected]>0){ + } else if (ma_lid[selected]>-1){ unit_location_string = obj_ini.ship[ma_lid[selected]] } health_string=string(round(ma_health[selected]))+"% HP"; @@ -267,8 +267,8 @@ function scr_draw_management_unit(selected, yy=0, xx=0, draw=true){ draw_sprite(spr_loc_icon,0,xx+427+8,yy+66); } }else{ - if (ma_lid[selected]==0) and (ma_wid[selected]>0) then draw_sprite(spr_loc_icon,0,xx+427+8,yy+66); - if (ma_lid[selected]>0) and (ma_wid[selected]==0) then draw_sprite(spr_loc_icon,1,xx+427+8,yy+66); + if (ma_lid[selected]==-1) and (ma_wid[selected]>0) then draw_sprite(spr_loc_icon,0,xx+427+8,yy+66); + if (ma_lid[selected]>-1) and (ma_wid[selected]==0) then draw_sprite(spr_loc_icon,1,xx+427+8,yy+66); } } //TODO handle recursively diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 84539f67a..2a04c836d 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -246,7 +246,7 @@ function scr_enemy_ai_d() { p_player[i]-=scr_unit_size(obj_ini.armour[com][ide],obj_ini.role[com][ide],true); obj_ini.loc[com][ide]="Mechanicus Vessel"; unit.planet_location=0; - unit.ship_location=0; + unit.ship_location=-1; techs_taken+=1; } if (unit.ship_location>-1){ diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index b864dc542..8704d72e7 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -275,7 +275,7 @@ function Roster() constructor{ } if (obj_ini.veh_lid[co][i]>-1){ if (obj_ini.veh_lid[co][i]>= array_length(obj_ini.ship_location)){ - obj_ini.veh_lid[co][i] = 0; + obj_ini.veh_lid[co][i] = -1; } if (obj_ini.ship_location[obj_ini.veh_lid[co][i]] == roster_location){ _allow=true; diff --git a/scripts/scr_special_view/scr_special_view.gml b/scripts/scr_special_view/scr_special_view.gml index 292d8f3e8..a4cedaa52 100644 --- a/scripts/scr_special_view/scr_special_view.gml +++ b/scripts/scr_special_view/scr_special_view.gml @@ -36,7 +36,7 @@ function scr_special_view(command_group) { for (var v = 0;v0){ + if (obj_ini.TTRPG[0][v].ship_location>-1){ var ham=obj_ini.TTRPG[0][v].ship_location; if (obj_ini.ship_location[ham]="Lost") then continue; } diff --git a/scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml b/scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml index 883c47950..a3dde5edb 100644 --- a/scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml +++ b/scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml @@ -433,7 +433,7 @@ function SpecialistPointHandler() constructor{ var build_loc = array_random_element(obj_controller.player_forge_data.vehicle_hanger); obj_ini.veh_loc[vehicle[0]][vehicle[1]] = build_loc[0]; obj_ini.veh_wid[vehicle[0]][vehicle[1]] = build_loc[1]; - obj_ini.veh_lid[vehicle[0]][vehicle[1]] = 0; + obj_ini.veh_lid[vehicle[0]][vehicle[1]] = -1; } scr_popup("Forge Completed",$"{item.name} X{item.count} construction finished Vehicles Waiting at hanger on {build_loc[0]} {build_loc[1]}","",""); } diff --git a/scripts/scr_squads/scr_squads.gml b/scripts/scr_squads/scr_squads.gml index d08031eb6..af698de98 100644 --- a/scripts/scr_squads/scr_squads.gml +++ b/scripts/scr_squads/scr_squads.gml @@ -735,10 +735,10 @@ function set_member_loc (loc_data){ system.p_player[member_location[1]]-=size; system.p_player[wid]+=size; planet_location = wid; - ship_location = 0; + ship_location = -1; } } else { - if (wid == 0 && lid>0){ + if (wid == 0 && lid>-1){ load_marine(lid); } } diff --git a/scripts/scr_ui_advisors/scr_ui_advisors.gml b/scripts/scr_ui_advisors/scr_ui_advisors.gml index d6990d05a..f4e57ae61 100644 --- a/scripts/scr_ui_advisors/scr_ui_advisors.gml +++ b/scripts/scr_ui_advisors/scr_ui_advisors.gml @@ -667,7 +667,7 @@ function scr_ui_advisors() { draw_text_ext(xx + 222, yy + 216, string_hash_to_newline(string(tot_ki)), -1, 396); var unit = fetch_unit([0,1]); - if (unit.ship_location = 0) then draw_text(xx + 222, yy + 380, string_hash_to_newline("Current Location: " + string(obj_ini.loc[0, 1]) + " " + string(unit.planet_location) + "#Health: " + unit.hp() + "%")); + if (unit.ship_location == -1) then draw_text(xx + 222, yy + 380, string_hash_to_newline("Current Location: " + string(obj_ini.loc[0, 1]) + " " + string(unit.planet_location) + "#Health: " + unit.hp() + "%")); if (unit.ship_location>-1) then draw_text(xx + 222, yy + 380, string_hash_to_newline($"Current Location: Onboard {obj_ini.ship[unit.ship_location]}#Health: {unit.hp()}%")); draw_text(xx + 222.5, yy + 380.5, string_hash_to_newline("Current Location:#Health:")); diff --git a/scripts/scr_vehicle_order/scr_vehicle_order.gml b/scripts/scr_vehicle_order/scr_vehicle_order.gml index a79f9301e..75add290f 100644 --- a/scripts/scr_vehicle_order/scr_vehicle_order.gml +++ b/scripts/scr_vehicle_order/scr_vehicle_order.gml @@ -5,7 +5,7 @@ function reset_vehicle_variable_arrays(company_number,i){ veh_loc[company_number][i] = ""; veh_name[company_number][i] = ""; veh_role[company_number][i] = ""; - veh_lid[company_number][i] = 0; + veh_lid[company_number][i] = -1; veh_wid[company_number][i] = 0; veh_wep1[company_number][i] = ""; veh_wep2[company_number][i] = ""; @@ -27,7 +27,7 @@ function scr_vehicle_order(company_number) { temp_loc[company_number][i] = ""; temp_name[company_number][i] = ""; temp_role[company_number][i] = ""; - temp_lid[company_number][i] = 0; + temp_lid[company_number][i] = -1; temp_wid[company_number][i] = 0; temp_wep1[company_number][i] = ""; temp_wep2[company_number][i] = "";