Commit aa487faa5876a4c4f32574fa528845276dcb825d
1 parent
73a0cde0
null
Showing
5 changed files
with
9 additions
and
8 deletions
Show diff stats
cmd/gameserver/service/agent.go
... | ... | @@ -100,7 +100,7 @@ func (c *Agent) SendMsg(errCode int32, cmd uint32, msg interface{}, preserve uin |
100 | 100 | if msg == nil || errCode != 0 { |
101 | 101 | return c.Send(errCode, cmd, nil, preserve) |
102 | 102 | } |
103 | - return c.SendPB(errCode, cmd, msg.(proto.Message), preserve) | |
103 | + return c.SendPB(errCode, pb.ProtoCode(cmd), msg.(proto.Message), preserve) | |
104 | 104 | } |
105 | 105 | |
106 | 106 | func (c *Agent) OnMessage(msg components.IMessage) error { | ... | ... |
common/components/conn.go
... | ... | @@ -7,6 +7,7 @@ import ( |
7 | 7 | "net" |
8 | 8 | "pro2d/common" |
9 | 9 | "pro2d/common/logger" |
10 | + "pro2d/pb" | |
10 | 11 | "sync" |
11 | 12 | "sync/atomic" |
12 | 13 | "time" |
... | ... | @@ -141,12 +142,12 @@ func (c *Connection) Send(errCode int32, cmd uint32, data []byte, preserve uint3 |
141 | 142 | } |
142 | 143 | } |
143 | 144 | |
144 | -func (c *Connection) SendPB(errCode int32, cmd uint32, data proto.Message, preserve uint32) error { | |
145 | +func (c *Connection) SendPB(errCode int32, cmd pb.ProtoCode, data proto.Message, preserve uint32) error { | |
145 | 146 | pbData, err := proto.Marshal(data) |
146 | 147 | if err != nil { |
147 | 148 | return err |
148 | 149 | } |
149 | - buf, err := c.splitter.Pack(cmd, pbData, errCode, preserve) | |
150 | + buf, err := c.splitter.Pack(uint32(cmd), pbData, errCode, preserve) | |
150 | 151 | if err != nil { |
151 | 152 | return err |
152 | 153 | } | ... | ... |
common/components/icompontents.go
... | ... | @@ -53,7 +53,7 @@ type ( |
53 | 53 | Start() |
54 | 54 | Stop() |
55 | 55 | Send(errCode int32, cmd uint32, b []byte, preserve uint32) error |
56 | - SendPB(errCode int32, cmd uint32, b proto.Message, preserve uint32) error | |
56 | + SendPB(errCode int32, cmd pb.ProtoCode, b proto.Message, preserve uint32) error | |
57 | 57 | SendSuccess(cmd uint32, b []byte, preserve uint32) error |
58 | 58 | CustomChan() chan<- func() |
59 | 59 | ... | ... |
models/role.go
... | ... | @@ -208,7 +208,7 @@ func (m *RoleModel) UpdateProperties(property map[string]interface{}, notify boo |
208 | 208 | Role: role, |
209 | 209 | } |
210 | 210 | if m.GetConn() != nil && notify { |
211 | - m.GetConn().SendPB(0, uint32(pb.ProtoCode_RoleUpdatePropertyNty), update, 0) | |
211 | + m.GetConn().SendPB(0, pb.ProtoCode_RoleUpdatePropertyNty, update, 0) | |
212 | 212 | } |
213 | 213 | } |
214 | 214 | ... | ... |
models/rolePlugin.go
... | ... | @@ -65,7 +65,7 @@ func (m *RoleModel) AddItem(key string, count int32, param *pb.LogConf) bool { |
65 | 65 | } |
66 | 66 | |
67 | 67 | if m.GetConn() != nil { |
68 | - m.GetConn().SendPB(0, uint32(pb.ProtoCode_RoleUpdateItemsNty), &pb.RoleUpdateItemsNty{Items: fmt.Sprintf("%s=%d", key, num)}, 0) | |
68 | + m.GetConn().SendPB(0, pb.ProtoCode_RoleUpdateItemsNty, &pb.RoleUpdateItemsNty{Items: fmt.Sprintf("%s=%d", key, num)}, 0) | |
69 | 69 | } |
70 | 70 | |
71 | 71 | return true |
... | ... | @@ -99,7 +99,7 @@ func (m *RoleModel) AddItems(params common.IMapStringNum, logconf *pb.LogConf) b |
99 | 99 | m.SetProperty("items", common.MapNumToString(m.Items)) |
100 | 100 | |
101 | 101 | if m.GetConn() != nil { |
102 | - m.GetConn().SendPB(0, uint32(pb.ProtoCode_RoleUpdateItemsNty), &pb.RoleUpdateItemsNty{Items: common.MapToString(tmp)}, 0) | |
102 | + m.GetConn().SendPB(0, pb.ProtoCode_RoleUpdateItemsNty, &pb.RoleUpdateItemsNty{Items: common.MapToString(tmp)}, 0) | |
103 | 103 | } |
104 | 104 | |
105 | 105 | return true |
... | ... | @@ -386,7 +386,7 @@ func (m *RoleModel) InsertEmail(email *pb.Email) error { |
386 | 386 | |
387 | 387 | nty := &pb.EmailNewNty{Emails: email} |
388 | 388 | if m.GetConn() != nil { |
389 | - m.GetConn().SendPB(0, uint32(pb.ProtoCode_EmailNewNty), nty, 0) | |
389 | + m.GetConn().SendPB(0, pb.ProtoCode_EmailNewNty, nty, 0) | |
390 | 390 | } |
391 | 391 | return nil |
392 | 392 | } | ... | ... |