aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2008-02-03 17:06:45 +0000
committerNicola Mettifogo2008-02-03 17:06:45 +0000
commitfea63a51814f169150a472a7195b8872f5929c79 (patch)
treee0d1ce88571679ac7bfa5a95a31a9f6f4d0ee68a /engines/parallaction
parent4c117772bd2dc6866b61d498848cf178a659218f (diff)
downloadscummvm-rg350-fea63a51814f169150a472a7195b8872f5929c79.tar.gz
scummvm-rg350-fea63a51814f169150a472a7195b8872f5929c79.tar.bz2
scummvm-rg350-fea63a51814f169150a472a7195b8872f5929c79.zip
Fixed maximum token length for the parser.
svn-id: r30776
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/graphics.cpp8
-rw-r--r--engines/parallaction/parallaction.cpp2
-rw-r--r--engines/parallaction/parallaction.h2
-rw-r--r--engines/parallaction/parser.cpp4
-rw-r--r--engines/parallaction/parser.h3
5 files changed, 10 insertions, 9 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index dd5ae4349b..23361cfcde 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -699,11 +699,11 @@ void Gfx::getStringExtent(char *text, uint16 maxwidth, int16* width, int16* heig
uint16 blankWidth = _font->getStringWidth(" ");
uint16 tokenWidth = 0;
- char token[40];
+ char token[MAX_TOKEN_LEN];
while (strlen(text) != 0) {
- text = parseNextToken(text, token, 40, " ", true);
+ text = parseNextToken(text, token, MAX_TOKEN_LEN, " ", true);
tokenWidth = _font->getStringWidth(token);
w += tokenWidth;
@@ -969,14 +969,14 @@ void Gfx::drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16
uint16 blankWidth = _font->getStringWidth(" ");
uint16 tokenWidth = 0;
- char token[40];
+ char token[MAX_TOKEN_LEN];
if (wrapwidth == -1)
wrapwidth = _vm->_screenWidth;
while (strlen(text) > 0) {
- text = parseNextToken(text, token, 40, " ", true);
+ text = parseNextToken(text, token, MAX_TOKEN_LEN, " ", true);
if (!scumm_stricmp(token, "%p")) {
lines++;
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index d22981b37d..af5f0f2cfd 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -49,7 +49,7 @@ uint16 _mouseButtons = 0;
char _saveData1[30] = { '\0' };
uint16 _language = 0;
-char _slideText[2][40];
+char _slideText[2][MAX_TOKEN_LEN];
uint32 _engineFlags = 0;
uint16 _score = 1;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index a4979a5583..8c6e33c983 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -150,7 +150,7 @@ extern uint32 _engineFlags;
extern Command *_forwardedCommands[];
extern char _forwardedAnimationNames[][20];
extern uint16 _numForwards;
-extern char _slideText[][40];
+extern char _slideText[][MAX_TOKEN_LEN];
extern uint16 _introSarcData3; // sarcophagus stuff to be saved
extern uint16 _introSarcData2; // sarcophagus stuff to be saved
extern char _saveData1[];
diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp
index 20b979c15d..2d92635cd6 100644
--- a/engines/parallaction/parser.cpp
+++ b/engines/parallaction/parser.cpp
@@ -28,7 +28,7 @@
namespace Parallaction {
-char _tokens[20][40];
+char _tokens[20][MAX_TOKEN_LEN];
Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {
}
@@ -153,7 +153,7 @@ uint16 Script::fillTokens(char* line) {
uint16 i = 0;
while (strlen(line) > 0 && i < 20) {
- line = parseNextToken(line, _tokens[i], 40, " \t\n");
+ line = parseNextToken(line, _tokens[i], MAX_TOKEN_LEN, " \t\n");
line = Common::ltrim(line);
i++;
}
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index f566017c9a..f19e4fc905 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -34,7 +34,8 @@ namespace Parallaction {
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk, bool ignoreQuotes = false);
-extern char _tokens[][40];
+#define MAX_TOKEN_LEN 50
+extern char _tokens[][MAX_TOKEN_LEN];
class Script {