mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
修复未在队伍角色无法更换时装的问题
顺便给获取scene的都判断了下nil
This commit is contained in:
@@ -340,6 +340,10 @@ func (w *World) AddPlayer(player *model.Player, sceneId uint32) {
|
||||
}
|
||||
}
|
||||
scene := w.GetSceneById(sceneId)
|
||||
if scene == nil {
|
||||
logger.Error("scene is nil, sceneId: %v", sceneId)
|
||||
return
|
||||
}
|
||||
scene.AddPlayer(player)
|
||||
w.InitPlayerTeamEntityId(player)
|
||||
}
|
||||
@@ -459,6 +463,10 @@ func (w *World) GetWorldAvatarByEntityId(avatarEntityId uint32) *WorldAvatar {
|
||||
// InitPlayerWorldAvatar 初始化某玩家在世界队伍中的所有角色
|
||||
func (w *World) InitPlayerWorldAvatar(player *model.Player) {
|
||||
scene := w.GetSceneById(player.SceneId)
|
||||
if scene == nil {
|
||||
logger.Error("scene is nil, sceneId: %v", player.SceneId)
|
||||
return
|
||||
}
|
||||
for _, worldAvatar := range w.GetWorldAvatarList() {
|
||||
if worldAvatar.uid != player.PlayerID {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user