mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Clean up reader.string
This commit is contained in:
parent
6189d2fa62
commit
fc5975bf0c
12 changed files with 58 additions and 61 deletions
|
|
@ -9,7 +9,7 @@ class M2mp extends Core {
|
|||
async run(state) {
|
||||
const body = await this.udpSend('M2MP',(buffer) => {
|
||||
const reader = this.reader(buffer);
|
||||
const header = reader.string({length: 4});
|
||||
const header = reader.string(4);
|
||||
if (header !== 'M2MP') return;
|
||||
return reader.rest();
|
||||
});
|
||||
|
|
@ -32,8 +32,7 @@ class M2mp extends Core {
|
|||
}
|
||||
|
||||
readString(reader) {
|
||||
const length = reader.uint(1);
|
||||
return reader.string({length:length-1});
|
||||
return reader.pascalString(1,-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue