WAGE: Handle null strings in toString and improve consistency

This commit is contained in:
Willem Jan Palenstijn 2017-12-08 12:33:40 +01:00 committed by Eugene Sandulenko
parent f35cb961f2
commit c6c39d5578
2 changed files with 15 additions and 4 deletions

View File

@ -63,13 +63,24 @@ static Common::String toString(const Designed *d) {
return d->toString();
}
Common::String Script::Operand::toString() {
static Common::String toString(const Common::String *d) {
if (!d)
return "<NULL>";
else
return *d;
}
static Common::String toString(int16 val) {
return Common::String::format("%d", val);
}
Common::String Script::Operand::toString() const {
switch(_type) {
case NUMBER:
return Common::String::format("%d", _value.number);
return Wage::toString(_value.number);
case STRING:
case TEXT_INPUT:
return *_value.string;
return Wage::toString(_value.string);
case OBJ:
return Wage::toString(_value.obj);
case CHR:

View File

@ -119,7 +119,7 @@ private:
delete _value.string;
}
Common::String toString();
Common::String toString() const;
};
struct ScriptText {