Files
GaCy-GO/internal/gameserver/scene_entrance_anchor.go
T

23 lines
741 B
Go

package gameserver
import "gac-hkrpg-go/internal/common"
// An entrance identifies a particular room even when several rooms share a
// floor. Its start anchor must take precedence over that floor's checkpoints.
func sceneEntranceAnchor(res *common.JsonConfig, entryID, floorID uint32) (common.AnchorItem, bool) {
entrance, exists := res.MapEntrances[entryID]
if !exists || entrance.FloorID != floorID {
return common.AnchorItem{}, false
}
if entrance.StartAnchorID == 0 {
anchor, exists := res.SceneDefaultAnchors[floorID]
return anchor, exists && anchor.ID != 0
}
for _, anchor := range res.SceneAnchors[entryID] {
if anchor.ID == entrance.StartAnchorID {
return anchor, true
}
}
return common.AnchorItem{}, false
}