From bbac28b5d3ee41ca297bfd43e984cf71ac1f0791 Mon Sep 17 00:00:00 2001 From: vincibrv Date: Tue, 26 Nov 2024 13:25:27 +0100 Subject: [PATCH] implemented switch --- .../tacmap_panel/tacmap_admin_panel_tgui.dm | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm index a5f26c52616c..5a8ebef4dc34 100644 --- a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -132,40 +132,53 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) switch(action) if("recache") - var/is_uscm = params["uscm"] + var/page = params["page"] var/datum/flattened_tacmap/selected_flat - if(is_uscm) - if(uscm_selection == LATEST_SELECTION) - return TRUE - selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] - else - if(xeno_selection == LATEST_SELECTION) - return TRUE - selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] + switch(page) + if(0) + if(uscm_selection == LATEST_SELECTION) + return TRUE + selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] + if(1) + if(xeno_selection == LATEST_SELECTION) + return TRUE + selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] + if(2) + if(upp_selection == LATEST_SELECTION) + return TRUE + selected_flat = GLOB.upp_flat_tacmap_data[upp_selection + 1] SSassets.transport.send_assets(client_user, selected_flat.asset_key) last_update_time = world.time return TRUE if("change_selection") - var/is_uscm = params["uscm"] - if(is_uscm) - uscm_selection = params["index"] - else - xeno_selection = params["index"] + var/page = params["page"] + switch(page) + if(0) + uscm_selection = params["index"] + if(1) + xeno_selection = params["index"] + if(2) + upp_selection = params["index"] last_update_time = world.time return TRUE if("delete") - var/is_uscm = params["uscm"] + var/page = params["page"] var/datum/svg_overlay/selected_svg - if(is_uscm) - if(uscm_selection == LATEST_SELECTION) - return TRUE - selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] - else - if(xeno_selection == LATEST_SELECTION) - return TRUE - selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] + switch(page) + if(0) + if(uscm_selection == LATEST_SELECTION) + return TRUE + selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] + if(1) + if(xeno_selection == LATEST_SELECTION) + return TRUE + selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] + if(2) + if(upp_selection == LATEST_SELECTION) + return TRUE + selected_svg = GLOB.upp_svg_tacmap_data[upp_selection + 1] selected_svg.svg_data = null last_update_time = world.time message_admins("[key_name_admin(usr)] deleted the tactical map drawing by [selected_svg.ckey].")