mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 16:34:51 +01:00
Fix MsgSysCreateObject stage lookup
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Andoryuuta/Erupe/network/mhfpacket"
|
||||
@@ -89,6 +90,11 @@ func fixedSizeShiftJIS(text string, size int) []byte {
|
||||
return out
|
||||
}
|
||||
|
||||
// TODO(Andoryuuta): Fix/move/remove me!
|
||||
func stripNullTerminator(x string) string {
|
||||
return strings.SplitN(x, "\x00", 2)[0]
|
||||
}
|
||||
|
||||
func handleMsgHead(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgSysReserve01(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -344,7 +350,7 @@ func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) {
|
||||
// Get the current stage.
|
||||
s.server.stagesLock.RLock()
|
||||
defer s.server.stagesLock.RUnlock()
|
||||
stage, ok := s.server.stages[s.stageID]
|
||||
stage, ok := s.server.stages[stripNullTerminator(s.stageID)]
|
||||
if !ok {
|
||||
s.logger.Fatal("StageID not in the stages map!", zap.String("stageID", s.stageID))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user