Start displaying characters on maps
This commit is contained in:
@@ -94,6 +94,42 @@ type HasAction struct {
|
||||
bits bitfield.BitField
|
||||
}
|
||||
|
||||
var (
|
||||
cTypes = map[CharacterType]string{
|
||||
CharacterTypeTactical: "Tactical",
|
||||
CharacterTypeAssault: "Assault",
|
||||
CharacterTypeDevastator: "Devastator",
|
||||
CharacterTypeTerminator: "Terminator",
|
||||
CharacterTypeApothecary: "Apothecary",
|
||||
CharacterTypeTechmarine: "Techmarine",
|
||||
CharacterTypeChaplain: "Chaplain",
|
||||
CharacterTypeLibrarian: "Librarian",
|
||||
CharacterTypeCaptain: "Captain",
|
||||
CharacterTypeChaosMarine: "Chaos Marine",
|
||||
CharacterTypeChaosLord: "Chaos Lord",
|
||||
CharacterTypeChaosChaplain: "Chaos Chaplain",
|
||||
CharacterTypeChaosSorcerer: "Chaos Sorcerer",
|
||||
CharacterTypeChaosTerminator: "Chaos Terminator",
|
||||
CharacterTypeKhorneBerserker: "Knorne Berserker",
|
||||
CharacterTypeBloodThirster: "Bloodthirster",
|
||||
CharacterTypeBloodLetter: "Bloodletter",
|
||||
CharacterTypeFleshHound: "Flesh Hound",
|
||||
CharacterTypeLordOfChange: "Lord of Change",
|
||||
CharacterTypeFlamer: "Flamer",
|
||||
CharacterTypePinkHorror: "Pink Horror",
|
||||
CharacterTypeBlueHorror: "Blue Horror",
|
||||
CharacterTypeChaosCultist: "Cultist",
|
||||
}
|
||||
)
|
||||
|
||||
func (c CharacterType) String() string {
|
||||
if str, ok := cTypes[c]; ok {
|
||||
return str
|
||||
}
|
||||
|
||||
return "Unknown Character"
|
||||
}
|
||||
|
||||
func LoadHasAction(filename string) (*HasAction, error) {
|
||||
scanner, err := asciiscan.New(filename)
|
||||
if err != nil {
|
||||
@@ -161,6 +197,17 @@ func (h *HasAction) Actions(c CharacterType) []AnimAction {
|
||||
return out
|
||||
}
|
||||
|
||||
// FIXME: Too slow
|
||||
func (h *HasAction) Index(c CharacterType, requestedAction AnimAction) int {
|
||||
for i, action := range h.Actions(c) {
|
||||
if action == requestedAction {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
func (h *HasAction) Print() {
|
||||
fmt.Println(" Tac Ass Dev Term Apo Tech Chp Lib Cpt CMar CLrd CChp CSrc CTrm Kbz BTh BL FHnd LoC Flm PHr BHr Cult")
|
||||
for a := AnimActionStart; a <= AnimActionEnd; a++ {
|
||||
|
Reference in New Issue
Block a user