refactor map
This commit is contained in:
+3
-3
@@ -89,7 +89,7 @@ can_place_tower :: proc(world: ^World, gx, gy: int, kind: Tower_Kind) -> bool {
|
||||
if world.phase != .Build do return false
|
||||
arch := get_archetype(kind)
|
||||
if world.economy.gold < arch.cost do return false
|
||||
if !footprint_fits_map(&world.world_map, gx, gy, arch.footprint_w, arch.footprint_h) do return false
|
||||
if !footprint_fits_map(&world.world_map.current_map, gx, gy, arch.footprint_w, arch.footprint_h) do return false
|
||||
if footprint_blocked(world, gx, gy, arch.footprint_w, arch.footprint_h) do return false
|
||||
return true
|
||||
}
|
||||
@@ -113,7 +113,7 @@ footprint_center :: proc(gx, gy, footprint_w, footprint_h: int) -> Vec2 {
|
||||
}
|
||||
}
|
||||
|
||||
footprint_fits_map :: proc(world_map: ^Map, gx, gy, footprint_w, footprint_h: int) -> bool {
|
||||
footprint_fits_map :: proc(world_map: ^World_Map, gx, gy, footprint_w, footprint_h: int) -> bool {
|
||||
if gx < 0 || gy < 0 do return false
|
||||
if gx + footprint_w > MAP_W do return false
|
||||
if gy + footprint_h > MAP_H do return false
|
||||
@@ -208,7 +208,7 @@ find_target_slot :: proc(tower: Tower, world: ^World) -> int {
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
e := &world.combat.enemies[i]
|
||||
if !e.active do continue
|
||||
if e.path_index >= len(world.path) do continue
|
||||
if e.path_index >= len(world.world_map.path) do continue
|
||||
|
||||
d := distance(tower.position, e.position)
|
||||
_, range := tower_stats_at_level(tower)
|
||||
|
||||
Reference in New Issue
Block a user