Skip to content

Commit a7f0420

Browse files
committed
Ensure all units get marked as dirty on init
1 parent cc1d18b commit a7f0420

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/models/ground.nim

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ proc fire(self: Ground, append = false) {.gcsafe.} =
1919
)
2020

2121
state.units += add_to
22-
add_to.global_flags += Dirty
2322
elif state.tool == PlaceBot and state.bot_at(self.target_point).is_nil:
2423
var t = Transform.init(origin = self.target_point)
25-
var bot = Bot.init(transform = t)
26-
state.units += bot
27-
bot.global_flags += Dirty
24+
state.units += Bot.init(transform = t)
2825

2926
proc init*(_: type Ground, node: Spatial): Ground =
3027
let self = Ground(

src/models/units.nim

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ proc init_unit*[T: Unit](self: T, shared = true) =
4242

4343
self.init_shared
4444
self.global_flags += Visible
45+
self.global_flags += Dirty
4546

4647
proc position*(self: Unit): Vector3 =
4748
if Global in self.global_flags:

0 commit comments

Comments
 (0)