When parsing and compiling a script, return the length in an output parameter instead so the method can return a boolean to indicate success.

This fixes #221 where a script with no code would fail.
This commit is contained in:
smallmodel 2024-04-08 21:00:48 +02:00
parent 9eec50d69f
commit e3beec985e
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
3 changed files with 41 additions and 32 deletions

View file

@ -163,8 +163,8 @@ public:
char *Preprocess(char *sourceBuffer);
void Preclean(char *processedBuffer);
size_t Parse(GameScript *m_GameScript, char *sourceBuffer, const char *type);
size_t Compile(GameScript *m_GameScript, unsigned char *progBuffer);
bool Parse(GameScript *m_GameScript, char *sourceBuffer, const char *type, size_t& outLength);
bool Compile(GameScript *m_GameScript, unsigned char *progBuffer, size_t& outLength);
static str GetLine(str content, int line);