func (store *LocationStore) Load() error { var query string = "SELECT t.idlocation, t.name, t.idmusic, p.position FROM location t LEFT JOIN pokecenter p ON p.idpokecenter = t.idpokecenter" result, err := puh.DBQuerySelect(query) if err != nil { return err } defer puh.DBFree() for { row := result.FetchMap() if row == nil { break } idlocation := puh.DBGetInt(row["idlocation"]) name := puh.DBGetString(row["name"]) music := puh.DBGetInt(row["idmusic"]) pokecenter := puh.DBGetInt64(row["position"]) // Hash pcposition := pos.NewPositionFromHash(pokecenter) location := &Location{ID: idlocation, Name: name, Music: music, PokeCenter: pcposition} store.addLocation(location) } return nil }
func (m *Map) GetTile(_hash int64) (*Tile, bool) { mapId := pos.NewPositionFromHash(_hash).Z tiles := m.tiles[mapId] tile, found := tiles[_hash] return tile, found }