mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-11 09:00:23 -07:00
Clamp forcemovement values in packet to avoid divide-by-zero errors in the client
This commit is contained in:
parent
c3d48ff36e
commit
df5b260f5f
1 changed files with 3 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ import core.api.*
|
|||
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.reflect.*
|
||||
import kotlin.math.max
|
||||
|
||||
sealed class PlayerFlags530 (p: Int, o: Int, f: EntityFlag) : EFlagProvider (530, EFlagType.Player, p, o, f) {
|
||||
class Chat : PlayerFlags530 (0x80, 0, EntityFlag.Chat) {
|
||||
|
|
@ -145,8 +146,8 @@ sealed class PlayerFlags530 (p: Int, o: Int, f: EntityFlag) : EFlagProvider (530
|
|||
buffer.p1add (context.dest.getSceneX(l))
|
||||
buffer.p1 (context.dest.getSceneY(l))
|
||||
//arrival times (in client cycles)
|
||||
buffer.ip2 (context.startArrive) //# of client cycles to start location
|
||||
buffer.ip2 (context.startArrive + context.destArrive) //# of client cycles to end location
|
||||
buffer.ip2 (max(1, context.startArrive)) //# of client cycles to start location
|
||||
buffer.ip2 (max(2, context.startArrive + context.destArrive)) //# of client cycles to end location
|
||||
buffer.p1neg (context.direction.toInteger()) //direction of movement
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue