Refactor world gold and combat
This commit is contained in:
+5
-5
@@ -59,8 +59,8 @@ get_enemy_archetype :: proc(kind: Enemy_Kind, wave: int) -> Enemy_Archetype {
|
||||
acquire_enemy :: proc(world: ^World) -> ^Enemy {
|
||||
// create an object pool with fixed slots to reuse instead of allocate/free every spawn
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
if !world.enemies[i].active {
|
||||
return &world.enemies[i]
|
||||
if !world.combat.enemies[i].active {
|
||||
return &world.combat.enemies[i]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ update_enemies :: proc(world: ^World, dt: f32) {
|
||||
if len(world.path) < 2 do return
|
||||
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
e := &world.enemies[i]
|
||||
e := &world.combat.enemies[i]
|
||||
if !e.active do continue
|
||||
|
||||
if e.path_index >= len(world.path) {
|
||||
@@ -118,7 +118,7 @@ update_enemies :: proc(world: ^World, dt: f32) {
|
||||
active_enemy_count :: proc(world: ^World) -> int {
|
||||
count := 0
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
if world.enemies[i].active do count += 1
|
||||
if world.combat.enemies[i].active do count += 1
|
||||
}
|
||||
|
||||
return count
|
||||
@@ -126,7 +126,7 @@ active_enemy_count :: proc(world: ^World) -> int {
|
||||
|
||||
render_enemies :: proc(world: ^World) {
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
e := world.enemies[i]
|
||||
e := world.combat.enemies[i]
|
||||
if !e.active do continue
|
||||
color := rl.MAROON
|
||||
size := 11
|
||||
|
||||
Reference in New Issue
Block a user