pepegasort

This commit is contained in:
Letter N
2021-03-07 14:11:09 +08:00
parent 22b33d1a6e
commit 8c3c259850
2 changed files with 29 additions and 6 deletions
+25 -3
View File
@@ -229,7 +229,14 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set category = "OOC"
set desc = "View the last round end report you've seen"
SSticker.show_roundend_report(src, TRUE)
SSticker.show_roundend_report(src, report_type = PERSONAL_LAST_ROUND)
/client/proc/show_servers_last_roundend_report()
set name = "Server's Last Round"
set category = "OOC"
set desc = "View the last round end report from this server"
SSticker.show_roundend_report(src, report_type = SERVER_LAST_ROUND)
/client/verb/fit_viewport()
set name = "Fit Viewport"
@@ -241,8 +248,20 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
var/aspect_ratio = view_size[1] / view_size[2]
// Calculate desired pixel width using window size and aspect ratio
var/sizes = params2list(winget(src, "mainwindow.split;mapwindow", "size"))
var/map_size = splittext(sizes["mapwindow.size"], "x")
var/list/sizes = params2list(winget(src, "mainwindow.split;mapwindow", "size"))
// Client closed the window? Some other error? This is unexpected behaviour, let's
// CRASH with some info.
if(!sizes["mapwindow.size"])
CRASH("sizes does not contain mapwindow.size key. This means a winget failed to return what we wanted. --- sizes var: [sizes] --- sizes length: [length(sizes)]")
var/list/map_size = splittext(sizes["mapwindow.size"], "x")
// Looks like we expect mapwindow.size to be "ixj" where i and j are numbers.
// If we don't get our expected 2 outputs, let's give some useful error info.
if(length(map_size) != 2)
CRASH("map_size of incorrect length --- map_size var: [map_size] --- map_size length: [length(map_size)]")
var/height = text2num(map_size[2])
var/desired_width = round(height * aspect_ratio)
if (text2num(map_size[1]) == desired_width)
@@ -252,6 +271,9 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
var/split_size = splittext(sizes["mainwindow.split.size"], "x")
var/split_width = text2num(split_size[1])
// Avoid auto-resizing the statpanel and chat into nothing.
desired_width = min(desired_width, split_width - 300)
// Calculate and apply a best estimate
// +4 pixels are for the width of the splitter's handle
var/pct = 100 * (desired_width + 4) / split_width