refactor: 重构入参类型引用
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-05 07:24:36 +08:00
committed by cnb
parent 34bc35a6b2
commit 6510e4e09b
31 changed files with 108 additions and 117 deletions

View File

@@ -16,7 +16,7 @@ import (
)
// EnterMap 处理玩家进入地图。
func (h Controller) EnterMap(data *space.InInfo, c *player.Player) (result *info.SimpleInfo, err errorcode.ErrorCode) {
func (h Controller) EnterMap(data *EnterMapInboundInfo, c *player.Player) (result *info.SimpleInfo, err errorcode.ErrorCode) {
if c.Info.MapID != data.MapId {
atomic.StoreUint32(&c.Canmon, 2)
c.MapNPC.Reset(6 * time.Second)
@@ -39,7 +39,7 @@ func (h Controller) EnterMap(data *space.InInfo, c *player.Player) (result *info
return nil, -1
}
func (h Controller) GetMapHot(data *maphot.InInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) {
func (h Controller) GetMapHot(data *GetMapHotInboundInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) {
result = &maphot.OutInfo{
HotInfos: space.GetMapHot(),
}
@@ -47,7 +47,7 @@ func (h Controller) GetMapHot(data *maphot.InInfo, c *player.Player) (result *ma
}
// LeaveMap 处理玩家离开地图。
func (h Controller) LeaveMap(data *space.LeaveMapInboundInfo, c *player.Player) (result *info.LeaveMapOutboundInfo, err errorcode.ErrorCode) {
func (h Controller) LeaveMap(data *LeaveMapInboundInfo, c *player.Player) (result *info.LeaveMapOutboundInfo, err errorcode.ErrorCode) {
atomic.StoreUint32(&c.Canmon, 0)
c.GetSpace().LeaveMap(c) // 从当前空间移除玩家。
@@ -57,7 +57,7 @@ func (h Controller) LeaveMap(data *space.LeaveMapInboundInfo, c *player.Player)
}
// GetMapPlayerList 获取当前地图内的玩家列表与地图广播信息。
func (h Controller) GetMapPlayerList(data *space.ListMapPlayerInboundInfo, c *player.Player) (result *info.ListMapPlayerOutboundInfo, err errorcode.ErrorCode) {
func (h Controller) GetMapPlayerList(data *ListMapPlayerInboundInfo, c *player.Player) (result *info.ListMapPlayerOutboundInfo, err errorcode.ErrorCode) {
result = &info.ListMapPlayerOutboundInfo{
Player: c.GetSpace().GetInfo(c),
}
@@ -71,7 +71,7 @@ func (h Controller) GetMapPlayerList(data *space.ListMapPlayerInboundInfo, c *pl
}
// AttackBoss 调试扣减当前地图广播BOSS血量。
func (h Controller) AttackBoss(data *space.AttackBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
func (h Controller) AttackBoss(data *AttackBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
for i := 0; i < len(c.GetSpace().MapBossSInfo.INFO); i++ {
if atomic.LoadInt32(&c.GetSpace().MapBossSInfo.INFO[i].Hp) > 0 {
atomic.AddInt32(&c.GetSpace().MapBossSInfo.INFO[i].Hp, -1)