Permalink
Browse files

yet more robustness when faced with broken dialog scripts

Also handle the mergestrings case properly when an argument is not
terminated with quotes. Fixes udvith.dlg in BG2.
  • Loading branch information...
1 parent cad7110 commit c6dd6c51a208c4c028f6200858c5d6b8b4c2fde8 @fizzet fizzet committed May 19, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 gemrb/core/GameScript/GSUtils.cpp
@@ -1640,7 +1640,7 @@ Action* GenerateActionCore(const char *src, const char *str, unsigned short acti
i=0;
}
//breaking on ',' in case of a monkey attack
- //fixes bg1:melicamp.dlg, bg1:sharte.dlg
+ //fixes bg1:melicamp.dlg, bg1:sharte.dlg, bg2:udvith.dlg
//if strings ever need a , inside, this is a FIXME
while (*src != '"' && *src !=',') {
if (*src == 0) {
@@ -1654,6 +1654,9 @@ Action* GenerateActionCore(const char *src, const char *str, unsigned short acti
}
src++;
}
+ if (*src == '"') {
+ src++;
+ }
*dst = 0;
//reading the context part
if (mergestrings) {
@@ -1672,7 +1675,7 @@ Action* GenerateActionCore(const char *src, const char *str, unsigned short acti
}
//this works only if there are no spaces
- if (*src++!='"' || *src++!=',' || *src++!='"') {
+ if (*src++!=',' || *src++!='"') {
break;
}
//reading the context string
@@ -1687,8 +1690,8 @@ Action* GenerateActionCore(const char *src, const char *str, unsigned short acti
}
src++;
}
+ src++; //skipping "
}
- src++; //skipping "
stringsCount++;
}
break;

0 comments on commit c6dd6c5

Please sign in to comment.