Add todo for GetArray subscript operator

This commit is contained in:
Vasilii Rogin 2023-04-24 16:17:33 +03:00
parent f03f7bdacc
commit 75eecf7da3
3 changed files with 9 additions and 1 deletions

View File

@ -3293,6 +3293,11 @@ float ProgramValue::asFloat() const
} }
} }
bool ProgramValue::isString() const
{
return opcode == VALUE_TYPE_STRING || opcode == VALUE_TYPE_DYNAMIC_STRING;
}
ProgramValue::ProgramValue() ProgramValue::ProgramValue()
{ {
opcode = VALUE_TYPE_INT; opcode = VALUE_TYPE_INT;

View File

@ -157,6 +157,7 @@ public:
bool isEmpty() const; bool isEmpty() const;
bool isInt() const; bool isInt() const;
bool isFloat() const; bool isFloat() const;
bool isString() const;
float asFloat() const; float asFloat() const;
bool isPointer() const; bool isPointer() const;
int asInt() const; int asInt() const;

View File

@ -22,6 +22,7 @@
#include "svga.h" #include "svga.h"
#include "tile.h" #include "tile.h"
#include "worldmap.h" #include "worldmap.h"
#include <stdexcept>
#include <string.h> #include <string.h>
namespace fallout { namespace fallout {
@ -543,7 +544,8 @@ static void opGetArray(Program* program)
if (arrayId.isInt()) { if (arrayId.isInt()) {
auto value = GetArray(arrayId.integerValue, key); auto value = GetArray(arrayId.integerValue, key);
programStackPushValue(program, value); programStackPushValue(program, value);
} else { } else if (arrayId.isString()) {
throw std::invalid_argument("String subscript is not implemented yet!");
} }
} }