mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
fix possible integer bounding issues
This commit is contained in:
@@ -69,7 +69,7 @@ func CSVRemove(csv string, v int) string {
|
|||||||
func CSVContains(csv string, v int) bool {
|
func CSVContains(csv string, v int) bool {
|
||||||
s := strings.Split(csv, ",")
|
s := strings.Split(csv, ",")
|
||||||
for i := 0; i < len(s); i++ {
|
for i := 0; i < len(s); i++ {
|
||||||
j, _ := strconv.ParseInt(s[i], 10, 64)
|
j, _ := strconv.ParseInt(s[i], 10, 32)
|
||||||
if int(j) == v {
|
if int(j) == v {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ func CSVElems(csv string) []int {
|
|||||||
}
|
}
|
||||||
s := strings.Split(csv, ",")
|
s := strings.Split(csv, ",")
|
||||||
for i := 0; i < len(s); i++ {
|
for i := 0; i < len(s); i++ {
|
||||||
j, _ := strconv.ParseInt(s[i], 10, 64)
|
j, _ := strconv.ParseInt(s[i], 10, 32)
|
||||||
r = append(r, int(j))
|
r = append(r, int(j))
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
|
|||||||
@@ -298,8 +298,8 @@ func parseChatCommand(s *Session, command string) {
|
|||||||
case commands["Teleport"].Prefix:
|
case commands["Teleport"].Prefix:
|
||||||
if commands["Teleport"].Enabled {
|
if commands["Teleport"].Enabled {
|
||||||
if len(args) > 2 {
|
if len(args) > 2 {
|
||||||
x, _ := strconv.Atoi(args[1])
|
x, _ := strconv.ParseInt(args[1], 10, 16)
|
||||||
y, _ := strconv.Atoi(args[2])
|
y, _ := strconv.ParseInt(args[2], 10, 16)
|
||||||
payload := byteframe.NewByteFrame()
|
payload := byteframe.NewByteFrame()
|
||||||
payload.SetLE()
|
payload.SetLE()
|
||||||
payload.WriteUint8(2) // SetState type(position == 2)
|
payload.WriteUint8(2) // SetState type(position == 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user