Esempio n. 1
0
func main() {
	for i := range tracks.ElementNames {
		seg := tracks.TS_MAP[tracks.SegmentType(i)]
		elem := tracks.Element{
			Segment: seg,
		}
		if !tracks.Valid(seg) {
			continue
		}
		fmt.Println(len(elem.Possibilities()))
	}
}
Esempio n. 2
0
File: td4.go Progetto: silky/rct
// Parse the serialized data into a TrackElement struct
// When the end of ride is encountered a EndOfRide error is returned
func parseElement(rawElement []byte) (te tracks.Element, e error) {
	if len(rawElement) != 2 {
		return tracks.Element{}, errors.New("invalid length for element input")
	}
	te.Segment = &tracks.Segment{
		Type: tracks.SegmentType(rawElement[0]),
	}
	if te.Segment.Type == tracks.ELEM_END_OF_RIDE {
		return tracks.Element{}, EndOfRide
	}
	q := int(rawElement[1])
	te.ChainLift = q>>7 == 1
	te.InvertedTrack = q>>6 == 1
	te.Station = q>>3 == 1
	te.StationNumber = q & 3

	te.BoostMagnitude = float32(q&15) * 7.6
	te.Rotation = (q&15)*45 - 180
	return
}