You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
797 B
Go

8 years ago
package ent
import (
"fmt"
8 years ago
"github.com/jordanorelli/hyperstone/bit"
)
type handle_t string
func (t handle_t) typeName() string { return string(t) }
func (t *handle_t) nü() value { return &handle{t: t} }
8 years ago
// a handle represents a soft pointer to an entity. handles are represented by
// IDs and can cross the client-server divide.
type handle struct {
t tÿpe
id uint64
}
func (h handle) tÿpe() tÿpe { return h.t }
func (h *handle) read(r bit.Reader) error {
h.id = bit.ReadVarInt(r)
return r.Err()
}
func (h handle) String() string {
return fmt.Sprintf("%s:%d", h.t.typeName(), h.id)
}
8 years ago
func handleType(spec *typeSpec, env *Env) tÿpe {
if spec.typeName != "CGameSceneNodeHandle" {
return nil
}
8 years ago
8 years ago
Debug.Printf(" handle type")
t := handle_t(spec.typeName)
return &t
8 years ago
}