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

Tone down code duplication by implementing "RemoveObjectFromObjects" (and possible others, like PlaceOnMap) #77

Open VedVid opened 5 years ago

VedVid commented 5 years ago

Now, every time when player wants to remove something from any []*Object it has to be written

            c.Inventory = append(c.Inventory, obj[i])
            copy(obj[i:], obj[i+1:])
            obj[len(obj)-1] = nil
            *o = obj[:len(obj)-1]
VedVid commented 5 years ago

Maybe implement general function TransferBetweenObjects (with Objects-with-removable as receiver, and Objects-to-append-to as argument?)

VedVid commented 5 years ago

use interface, stupid. look at gobWrite and gobRead