From 632916444f80e4e75a513e622856a90822426f7c Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 27 May 2024 12:59:41 -0400 Subject: [PATCH] More code refactoring... --- source/core.adb | 4 ++-- source/core.ads | 4 ++-- source/world.adb | 28 ++++++++++++++-------------- source/world.ads | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/core.adb b/source/core.adb index 5704317..5e1a6a2 100644 --- a/source/core.adb +++ b/source/core.adb @@ -419,8 +419,8 @@ package body core is ------------------------------------------------------------------------------------------ - procedure increment (value : in out integer) is begin value := value + 1; end increment; - procedure decrement (value : in out integer) is begin value := value - 1; end decrement; + procedure increment (value : in out integer; super : in natural := 1) is begin value := value + super; end increment; + procedure decrement (value : in out integer; super : in natural := 1) is begin value := value - super; end decrement; ------------------------------------------------------------------------------------------ diff --git a/source/core.ads b/source/core.ads index f7b083c..29af3b5 100644 --- a/source/core.ads +++ b/source/core.ads @@ -189,8 +189,8 @@ package core is procedure save_point (here : in core.io.file_type; data : in point); procedure load_point (here : in core.io.file_type; data : out point); - procedure increment (value : in out integer); - procedure decrement (value : in out integer); + procedure increment (value : in out integer; super : in natural := 1); + procedure decrement (value : in out integer; super : in natural := 1); procedure idle_skip; diff --git a/source/world.adb b/source/world.adb index 700a44f..8f38cec 100644 --- a/source/world.adb +++ b/source/world.adb @@ -89,7 +89,7 @@ package body world is end loop; end loop; -- - if core.animation_time = 0 then draw_tiles_timer := core.time - time; end if; + if core.animation_time = 0 then draw_tiles_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_tiles; ------------------------------------------------------------------------------------------ @@ -156,7 +156,7 @@ package body world is end if; end loop; -- - if core.animation_time = 0 then draw_landmarks_timer := core.time - time; end if; + if core.animation_time = 0 then draw_landmarks_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_landmarks; ------------------------------------------------------------------------------------------ @@ -204,7 +204,7 @@ package body world is end if; end loop; -- - if core.animation_time = 0 then draw_locations_timer := core.time - time; end if; + if core.animation_time = 0 then draw_locations_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_locations; ------------------------------------------------------------------------------------------ @@ -226,7 +226,7 @@ package body world is end if; end loop; -- - if core.animation_time = 0 then draw_constructions_timer := core.time - time; end if; + if core.animation_time = 0 then draw_constructions_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_constructions; ------------------------------------------------------------------------------------------ @@ -257,7 +257,7 @@ package body world is end if; end loop; -- - if core.animation_time = 0 then draw_equipments_timer := core.time - time; end if; + if core.animation_time = 0 then draw_equipments_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_equipments; ------------------------------------------------------------------------------------------ @@ -290,7 +290,7 @@ package body world is end if; end loop; -- - if core.animation_time = 0 then draw_units_timer := core.time - time; end if; + if core.animation_time = 0 then draw_units_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw_units; ------------------------------------------------------------------------------------------ @@ -316,7 +316,7 @@ package body world is end loop; end loop; -- - if core.animation_time = 0 then draw_views_timer := core.time - time; end if; + if core.animation_time = 0 then draw_views_timer := natural (1_000_000.0 * (core.time - time)); end if; end darken_map; ------------------------------------------------------------------------------------------ @@ -656,7 +656,7 @@ package body world is draw_units (offset, view_from, view_to); darken_map (offset, view_from, view_to); -- - if core.animation_time = 0 then draw_world_timer := core.time - time; end if; + if core.animation_time = 0 then draw_world_timer := natural (1_000_000.0 * (core.time - time)); end if; end draw; ------------------------------------------------------------------------------------------ @@ -757,12 +757,12 @@ package body world is ------------------------------------------------------------------------------------------ - procedure resource_cheat_1 is begin map.chads (1).resources (resource.gold) := map.chads (1).resources (resource.gold) + 127; end resource_cheat_1; - procedure resource_cheat_2 is begin map.chads (1).resources (resource.wood) := map.chads (1).resources (resource.wood) + 127; end resource_cheat_2; - procedure resource_cheat_3 is begin map.chads (1).resources (resource.stone) := map.chads (1).resources (resource.stone) + 127; end resource_cheat_3; - procedure resource_cheat_4 is begin map.chads (1).resources (resource.metal) := map.chads (1).resources (resource.metal) + 127; end resource_cheat_4; - procedure resource_cheat_5 is begin map.chads (1).resources (resource.leather) := map.chads (1).resources (resource.leather) + 127; end resource_cheat_5; - procedure resource_cheat_6 is begin map.chads (1).resources (resource.gem) := map.chads (1).resources (resource.gem) + 127; end resource_cheat_6; + procedure resource_cheat_1 is begin core.increment (map.chads (1).resources (resource.gold).value, 20); end resource_cheat_1; + procedure resource_cheat_2 is begin core.increment (map.chads (1).resources (resource.wood).value, 10); end resource_cheat_2; + procedure resource_cheat_3 is begin core.increment (map.chads (1).resources (resource.stone).value, 10); end resource_cheat_3; + procedure resource_cheat_4 is begin core.increment (map.chads (1).resources (resource.metal).value, 10); end resource_cheat_4; + procedure resource_cheat_5 is begin core.increment (map.chads (1).resources (resource.leather).value, 10); end resource_cheat_5; + procedure resource_cheat_6 is begin core.increment (map.chads (1).resources (resource.gem).value, 10); end resource_cheat_6; ------------------------------------------------------------------------------------------ diff --git a/source/world.ads b/source/world.ads index 6c6a48d..0358373 100644 --- a/source/world.ads +++ b/source/world.ads @@ -114,14 +114,14 @@ package world is map : information; - draw_tiles_timer : float := 0.0; - draw_views_timer : float := 0.0; - draw_landmarks_timer : float := 0.0; - draw_locations_timer : float := 0.0; - draw_constructions_timer : float := 0.0; - draw_equipments_timer : float := 0.0; - draw_units_timer : float := 0.0; - draw_world_timer : float := 0.0; + draw_tiles_timer : natural := 0; + draw_views_timer : natural := 0; + draw_landmarks_timer : natural := 0; + draw_locations_timer : natural := 0; + draw_constructions_timer : natural := 0; + draw_equipments_timer : natural := 0; + draw_units_timer : natural := 0; + draw_world_timer : natural := 0; drawn_tiles : natural := 0; drawn_views : natural := 0;