Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion game/actions/aoe_attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (a *AoeAttack) getTargetsAt(g *game.Game, tx, ty int) []*game.Entity {
targets = append(targets, ent)
}
}
algorithm.Choose(&targets, func(e *game.Entity) bool {
algorithm.Choose2(&targets, func(e *game.Entity) bool {
return e.Stats != nil
})

Expand Down
2 changes: 1 addition & 1 deletion game/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ func (e *Entity) SetGear(gear_name string) bool {
return false
}
if gear_name == "" {
algorithm.Choose(&e.Actions, func(a Action) bool {
algorithm.Choose2(&e.Actions, func(a Action) bool {
return a.String() != e.ExplorerEnt.Gear.Action
})
if e.ExplorerEnt.Gear.Condition != "" {
Expand Down
2 changes: 1 addition & 1 deletion game/los.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (g *Game) OnRound(do_scripts bool) {
g.viewer.RemoveDrawable(g.Ents[i])
}
}
algorithm.Choose(&g.Ents, func(ent *Entity) bool {
algorithm.Choose2(&g.Ents, func(ent *Entity) bool {
return ent.Stats == nil || ent.Stats.HpCur() > 0
})

Expand Down
2 changes: 1 addition & 1 deletion game/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ func setWaypoint(gp *GamePanel) lua.GoFunction {
}
wp.Name = L.ToString(-4)
// Remove any existing waypoint by the same name
algorithm.Choose(&gp.game.Waypoints, func(w waypoint) bool {
algorithm.Choose2(&gp.game.Waypoints, func(w waypoint) bool {
return w.Name != wp.Name
})
px, py := LuaToPoint(L, -2)
Expand Down
2 changes: 1 addition & 1 deletion game/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (s *Inst) ApplyCondition(c Condition) {
}

func (s *Inst) RemoveCondition(name string) {
algorithm.Choose(&s.inst.Conditions, func(c Condition) bool {
algorithm.Choose2(&s.inst.Conditions, func(c Condition) bool {
return c.Name() != name
})
}
Expand Down
2 changes: 1 addition & 1 deletion game/ui_entity_placer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func MakeEntityPlacer(game *Game, roster_names []string, roster_costs []int, min
ent := ep.ents[len(ep.ents)-1]
ep.points += ep.roster[ent.Name]
ep.ents = ep.ents[0 : len(ep.ents)-1]
algorithm.Choose(&game.Ents, func(e *Entity) bool { return e != ent })
algorithm.Choose2(&game.Ents, func(e *Entity) bool { return e != ent })
game.viewer.RemoveDrawable(ent)
}

Expand Down
2 changes: 1 addition & 1 deletion game/ui_online.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (sm *OnlineMenu) Think(g *gui.Gui, t int64) {
sm.layout.Error.err = resp.Err
base.Error().Printf("Couldn't kill game: %v", resp.Err)
} else {
algorithm.Choose(&glb.games, func(gf gameField) bool {
algorithm.Choose2(&glb.games, func(gf gameField) bool {
return gf.key != req.Game_key
})
}
Expand Down
4 changes: 2 additions & 2 deletions house/furniture_tab.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (w *FurniturePanel) onEscape() {
*w.furniture = *w.prev_object
w.prev_object = nil
} else {
algorithm.Choose(&w.Room.Furniture, func(f *Furniture) bool {
algorithm.Choose2(&w.Room.Furniture, func(f *Furniture) bool {
return f != w.furniture
})
}
Expand All @@ -128,7 +128,7 @@ func (w *FurniturePanel) Respond(ui *gui.Gui, group gui.EventGroup) bool {
// If we hit delete then we want to remove the furniture we're moving around
// from the room. If we're not moving anything around then nothing happens.
if found, event := group.FindEvent(gin.DeleteOrBackspace); found && event.Type == gin.Press {
algorithm.Choose(&w.Room.Furniture, func(f *Furniture) bool {
algorithm.Choose2(&w.Room.Furniture, func(f *Furniture) bool {
return f != w.furniture
})
w.furniture = nil
Expand Down
20 changes: 10 additions & 10 deletions house/house.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func (f *Floor) canAddDoor(target *Room, door *Door) bool {

func (f *Floor) removeInvalidDoors() {
for _, room := range f.Rooms {
algorithm.Choose(&room.Doors, func(a interface{}) bool {
algorithm.Choose2(&room.Doors, func(a interface{}) bool {
_, other_door := f.FindMatchingDoor(room, a.(*Door))
return other_door != nil && !other_door.temporary
})
Expand Down Expand Up @@ -796,7 +796,7 @@ func (hdt *houseDataTab) onEscape() {
*hdt.temp_room = *hdt.prev_room
hdt.prev_room = nil
} else {
algorithm.Choose(&hdt.house.Floors[0].Rooms, func(r *Room) bool {
algorithm.Choose2(&hdt.house.Floors[0].Rooms, func(r *Room) bool {
return r != hdt.temp_room
})
}
Expand All @@ -819,10 +819,10 @@ func (hdt *houseDataTab) Respond(ui *gui.Gui, group gui.EventGroup) bool {
for i := range hdt.temp_spawns {
spawns[hdt.temp_spawns[i]] = true
}
algorithm.Choose(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
algorithm.Choose2(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
return !spawns[s]
})
algorithm.Choose(&hdt.house.Floors[0].Rooms, func(r *Room) bool {
algorithm.Choose2(&hdt.house.Floors[0].Rooms, func(r *Room) bool {
return r != hdt.temp_room
})
hdt.temp_room = nil
Expand Down Expand Up @@ -930,7 +930,7 @@ func (hdt *houseDoorTab) Think(ui *gui.Gui, t int64) {
func (hdt *houseDoorTab) onEscape() {
if hdt.temp_door != nil {
if hdt.temp_room != nil {
algorithm.Choose(&hdt.temp_room.Doors, func(d *Door) bool {
algorithm.Choose2(&hdt.temp_room.Doors, func(d *Door) bool {
return d != hdt.temp_door
})
}
Expand All @@ -955,7 +955,7 @@ func (hdt *houseDoorTab) Respond(ui *gui.Gui, group gui.EventGroup) bool {
}

if found, event := group.FindEvent(gin.DeleteOrBackspace); found && event.Type == gin.Press {
algorithm.Choose(&hdt.temp_room.Doors, func(d *Door) bool {
algorithm.Choose2(&hdt.temp_room.Doors, func(d *Door) bool {
return d != hdt.temp_door
})
hdt.temp_room = nil
Expand All @@ -973,7 +973,7 @@ func (hdt *houseDoorTab) Respond(ui *gui.Gui, group gui.EventGroup) bool {
if cursor != nil && hdt.temp_door != nil {
room := hdt.viewer.FindClosestDoorPos(hdt.temp_door, bx, by)
if room != hdt.temp_room {
algorithm.Choose(&hdt.temp_room.Doors, func(d *Door) bool {
algorithm.Choose2(&hdt.temp_room.Doors, func(d *Door) bool {
return d != hdt.temp_door
})
hdt.temp_room = room
Expand Down Expand Up @@ -1007,7 +1007,7 @@ func (hdt *houseDoorTab) Respond(ui *gui.Gui, group gui.EventGroup) bool {
hdt.temp_door.temporary = true
room, door := hdt.house.Floors[0].FindMatchingDoor(hdt.temp_room, hdt.temp_door)
if room != nil {
algorithm.Choose(&room.Doors, func(d *Door) bool {
algorithm.Choose2(&room.Doors, func(d *Door) bool {
return d != door
})
}
Expand Down Expand Up @@ -1080,7 +1080,7 @@ func (hdt *houseRelicsTab) onEscape() {
*hdt.temp_relic = *hdt.prev_relic
hdt.prev_relic = nil
} else {
algorithm.Choose(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
algorithm.Choose2(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
return s != hdt.temp_relic
})
}
Expand Down Expand Up @@ -1167,7 +1167,7 @@ func (hdt *houseRelicsTab) Respond(ui *gui.Gui, group gui.EventGroup) bool {
}

if found, event := group.FindEvent(gin.DeleteOrBackspace); found && event.Type == gin.Press {
algorithm.Choose(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
algorithm.Choose2(&hdt.house.Floors[0].Spawns, func(s *SpawnPoint) bool {
return s != hdt.temp_relic
})
hdt.temp_relic = nil
Expand Down
4 changes: 2 additions & 2 deletions house/house_viewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (hv *HouseViewer) AddDrawable(d Drawable) {
hv.drawables = append(hv.drawables, d)
}
func (hv *HouseViewer) RemoveDrawable(d Drawable) {
algorithm.Choose(&hv.drawables, func(t Drawable) bool {
algorithm.Choose2(&hv.drawables, func(t Drawable) bool {
return t != d
})
}
Expand All @@ -133,7 +133,7 @@ func (hv *HouseViewer) AddFloorDrawable(fd FloorDrawer) {
hv.floor_drawers = append(hv.floor_drawers, fd)
}
func (hv *HouseViewer) RemoveFloorDrawable(fd FloorDrawer) {
algorithm.Choose(&hv.floor_drawers, func(t FloorDrawer) bool {
algorithm.Choose2(&hv.floor_drawers, func(t FloorDrawer) bool {
return t != fd
})
}
Expand Down
4 changes: 2 additions & 2 deletions house/wall_tab.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (w *WallPanel) onEscape() {
if w.prev_wall_texture != nil {
*w.wall_texture = *w.prev_wall_texture
} else {
algorithm.Choose(&w.room.WallTextures, func(wt *WallTexture) bool {
algorithm.Choose2(&w.room.WallTextures, func(wt *WallTexture) bool {
return wt != w.wall_texture
})
}
Expand All @@ -85,7 +85,7 @@ func (w *WallPanel) Respond(ui *gui.Gui, group gui.EventGroup) bool {
}

if found, event := group.FindEvent(gin.DeleteOrBackspace); found && event.Type == gin.Press {
algorithm.Choose(&w.room.WallTextures, func(wt *WallTexture) bool {
algorithm.Choose2(&w.room.WallTextures, func(wt *WallTexture) bool {
return wt != w.wall_texture
})
w.wall_texture = nil
Expand Down