VedVid / RAWIG

RAWIG (Roguelike Architecture, Written In Go) is ready to modify and expand roguelike architecture.
BSD 2-Clause "Simplified" License
16 stars 3 forks source link

In many cases, even if there is an error, execution is not interrupted (it's fine) and value of turnSpent is changed to true (not fine) #70

Closed VedVid closed 5 years ago

VedVid commented 5 years ago

Example: current implementation of EquipItem:

func (c *Creature) EquipItem(o *Object, slot int) (bool, error) {
    var err error
    if o == nil {
        txt := EquipNilError(c)
        err = errors.New("Creature tried to equip *Object that was nil." + txt)
    }
    if c.Equipment[slot] != nil {
        txt := EquipSlotNotNilError(c, slot)
        err = errors.New("Creature tried to equip item into already occupied slot." + txt)
    }
    turnSpent := false
    c.Equipment[slot] = o
    //remove from inventory
    turnSpent = true
    return turnSpent, err
}
VedVid commented 5 years ago

Some issues were addressed in 88d09e639e154db5e11426061f5b62b1e5dd45f4

VedVid commented 5 years ago

Closing, and creating another issue for tracking "leftovers": #78