mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-09-30 05:59:46 +00:00
fix a tsc compiler bug where # in middle of event was interpreted as start of new one
This commit is contained in:
parent
662dc2adbf
commit
9a0009101f
|
@ -1736,10 +1736,11 @@ impl TextScript {
|
||||||
) -> GameResult<Vec<u8>> {
|
) -> GameResult<Vec<u8>> {
|
||||||
let mut bytecode = Vec::new();
|
let mut bytecode = Vec::new();
|
||||||
let mut char_buf = Vec::with_capacity(16);
|
let mut char_buf = Vec::with_capacity(16);
|
||||||
|
let mut allow_next_event = false;
|
||||||
|
|
||||||
while let Some(&chr) = iter.peek() {
|
while let Some(&chr) = iter.peek() {
|
||||||
match chr {
|
match chr {
|
||||||
b'#' => {
|
b'#' if allow_next_event => {
|
||||||
if !char_buf.is_empty() {
|
if !char_buf.is_empty() {
|
||||||
TextScript::put_string(&mut char_buf, &mut bytecode, encoding);
|
TextScript::put_string(&mut char_buf, &mut bytecode, encoding);
|
||||||
}
|
}
|
||||||
|
@ -1749,6 +1750,7 @@ impl TextScript {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
b'<' => {
|
b'<' => {
|
||||||
|
allow_next_event = false;
|
||||||
if !char_buf.is_empty() {
|
if !char_buf.is_empty() {
|
||||||
TextScript::put_string(&mut char_buf, &mut bytecode, encoding);
|
TextScript::put_string(&mut char_buf, &mut bytecode, encoding);
|
||||||
}
|
}
|
||||||
|
@ -1766,7 +1768,14 @@ impl TextScript {
|
||||||
b'\r' => {
|
b'\r' => {
|
||||||
iter.next();
|
iter.next();
|
||||||
}
|
}
|
||||||
|
b'\n' => {
|
||||||
|
allow_next_event = true;
|
||||||
|
char_buf.push(chr);
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
allow_next_event = false;
|
||||||
char_buf.push(chr);
|
char_buf.push(chr);
|
||||||
|
|
||||||
iter.next();
|
iter.next();
|
||||||
|
|
Loading…
Reference in a new issue