mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-02 22:08:36 -05:00
Fix parsing crash
A choice string starting with \n bypasses the >p1 prefix on line 2, sending a raw > command to BattleStream._writeLine → throws "Unrecognized command"
This commit is contained in:
parent
59709dba6c
commit
72e749479d
|
|
@ -265,22 +265,22 @@ export function getPlayerStreams(stream: BattleStream) {
|
|||
}),
|
||||
p1: new Streams.ObjectReadWriteStream({
|
||||
write(data: string) {
|
||||
void stream.write(data.replace(/(^|\n)/g, `$1>p1 `));
|
||||
void stream.write(data.replace(/([^\n]+)/g, '>p1 $1'));
|
||||
},
|
||||
}),
|
||||
p2: new Streams.ObjectReadWriteStream({
|
||||
write(data: string) {
|
||||
void stream.write(data.replace(/(^|\n)/g, `$1>p2 `));
|
||||
void stream.write(data.replace(/([^\n]+)/g, '>p2 $1'));
|
||||
},
|
||||
}),
|
||||
p3: new Streams.ObjectReadWriteStream({
|
||||
write(data: string) {
|
||||
void stream.write(data.replace(/(^|\n)/g, `$1>p3 `));
|
||||
void stream.write(data.replace(/([^\n]+)/g, '>p3 $1'));
|
||||
},
|
||||
}),
|
||||
p4: new Streams.ObjectReadWriteStream({
|
||||
write(data: string) {
|
||||
void stream.write(data.replace(/(^|\n)/g, `$1>p4 `));
|
||||
void stream.write(data.replace(/([^\n]+)/g, '>p4 $1'));
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user