Skip to content

Commit

Permalink
FLOOR(x, 1) to Floor()
Browse files Browse the repository at this point in the history
replace FLOOR(x, 1) use with simpler Floor() define, in 515 all Floor() use can be replaced by native floor()
  • Loading branch information
Doubleumc committed Jan 11, 2024
1 parent 8fab189 commit ae64bd1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions code/__HELPERS/_time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
return "right now"
if(second < 60)
return "[second] second[(second != 1)? "s":""]"
var/minute = FLOOR(second / 60, 1)
var/minute = Floor(second / 60)
second = FLOOR(MODULUS(second, 60), round_seconds_to)
var/secondT
if(second)
secondT = " and [second] second[(second != 1)? "s":""]"
if(minute < 60)
return "[minute] minute[(minute != 1)? "s":""][secondT]"
var/hour = FLOOR(minute / 60, 1)
var/hour = Floor(minute / 60)
minute = MODULUS(minute, 60)
var/minuteT
if(minute)
minuteT = " and [minute] minute[(minute != 1)? "s":""]"
if(hour < 24)
return "[hour] hour[(hour != 1)? "s":""][minuteT][secondT]"
var/day = FLOOR(hour / 24, 1)
var/day = Floor(hour / 24)
hour = MODULUS(hour, 24)
var/hourT
if(hour)
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ SUBSYSTEM_DEF(minimaps)
else if(yval < smallest_y)
smallest_y = yval

minimaps_by_z["[level]"].x_offset = FLOOR((SCREEN_PIXEL_SIZE-largest_x-smallest_x) / MINIMAP_SCALE, 1)
minimaps_by_z["[level]"].y_offset = FLOOR((SCREEN_PIXEL_SIZE-largest_y-smallest_y) / MINIMAP_SCALE, 1)
minimaps_by_z["[level]"].x_offset = Floor((SCREEN_PIXEL_SIZE-largest_x-smallest_x) / MINIMAP_SCALE)
minimaps_by_z["[level]"].y_offset = Floor((SCREEN_PIXEL_SIZE-largest_y-smallest_y) / MINIMAP_SCALE)

icon_gen.Shift(EAST, minimaps_by_z["[level]"].x_offset)
icon_gen.Shift(NORTH, minimaps_by_z["[level]"].y_offset)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
if("purchase_document")
if(!photocopier)
return
var/purchase_tier = FLOOR(text2num(params["purchase_document"]), 1)
var/purchase_tier = Floor(text2num(params["purchase_document"]))
if(purchase_tier <= 0 || purchase_tier > 5)
return
if(purchase_tier > GLOB.chemical_data.clearance_level)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/fulton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ GLOBAL_LIST_EMPTY(deployed_fultons)
original_location = get_turf(attached_atom)
playsound(loc, 'sound/items/fulton.ogg', 50, 1)
reservation = SSmapping.RequestBlockReservation(3, 3, turf_type_override = /turf/open/space)
var/middle_x = reservation.bottom_left_coords[1] + FLOOR((reservation.top_right_coords[1] - reservation.bottom_left_coords[1]) / 2, 1)
var/middle_y = reservation.bottom_left_coords[2] + FLOOR((reservation.top_right_coords[2] - reservation.bottom_left_coords[2]) / 2, 1)
var/middle_x = reservation.bottom_left_coords[1] + Floor((reservation.top_right_coords[1] - reservation.bottom_left_coords[1]) / 2)
var/middle_y = reservation.bottom_left_coords[2] + Floor((reservation.top_right_coords[2] - reservation.bottom_left_coords[2]) / 2)
var/turf/space_tile = locate(middle_x, middle_y, reservation.bottom_left_coords[3])
if(!space_tile)
visible_message(SPAN_WARNING("[src] begins beeping like crazy. Something is wrong!"))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/buildmode/buildmode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
var/pos_idx = 0
for(var/thing in elements)
var/x = pos_idx % switch_width
var/y = FLOOR(pos_idx / switch_width, 1)
var/y = Floor(pos_idx / switch_width)
var/atom/movable/screen/buildmode/B = new buttontype(src, thing)
// extra .5 for a nice offset look
B.screen_loc = "NORTH-[(1 + 0.5 + y*1.5)],WEST+[0.5 + x*1.5]"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/suits/marine_armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
if(. != CHECKS_PASSED)
return
set_light_range(initial(light_range))
set_light_power(FLOOR(initial(light_power) * 0.5, 1))
set_light_power(Floor(initial(light_power) * 0.5))
set_light_on(toggle_on)
flags_marine_armor ^= ARMOR_LAMP_ON

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

if(isliving(M))
var/mob/living/player = M
serialized["health"] = FLOOR((player.health / player.maxHealth * 100), 1)
serialized["health"] = Floor(player.health / player.maxHealth * 100)

if(isxeno(player))
var/mob/living/carbon/xenomorph/xeno = player
Expand All @@ -126,7 +126,7 @@
var/obj/item/card/id/id_card = human.get_idcard()
var/datum/species/human_species = human.species
var/max_health = human_species.total_health != human.maxHealth ? human_species.total_health : human.maxHealth
serialized["health"] = FLOOR((player.health / max_health * 100), 1)
serialized["health"] = Floor(player.health / max_health * 100)

serialized["job"] = id_card?.assignment ? id_card.assignment : human.job
serialized["nickname"] = human.real_name
Expand Down

0 comments on commit ae64bd1

Please sign in to comment.