1
0
Fork 0

Compare commits

...

3 Commits

2 changed files with 23 additions and 9 deletions

View File

@ -84,7 +84,7 @@ struct EnginePreviewWindow : Window {
/* Get size of engine sprite, on loan from depot_gui.cpp */
EngineID engine = static_cast<EngineID>(this->window_number);
EngineImageType image_type = EIT_PURCHASE;
EngineImageType image_type = EIT_PREVIEW;
uint x, y;
int x_offs, y_offs;

View File

@ -858,18 +858,32 @@ SQInteger ScriptList::_get(HSQUIRRELVM vm)
SQInteger ScriptList::_set(HSQUIRRELVM vm)
{
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
return sq_throwerror(vm, "you can only assign integers to this list");
}
SQInteger idx, val;
SQInteger idx;
sq_getinteger(vm, 2, &idx);
if (sq_gettype(vm, 3) == OT_NULL) {
this->RemoveItem(idx);
return 0;
/* Retrieve the return value */
SQInteger val;
switch (sq_gettype(vm, 3)) {
case OT_NULL:
this->RemoveItem(idx);
return 0;
case OT_BOOL: {
SQBool v;
sq_getbool(vm, 3, &v);
val = v ? 1 : 0;
break;
}
case OT_INTEGER:
sq_getinteger(vm, 3, &val);
break;
default:
return sq_throwerror(vm, "you can only assign integers to this list");
}
sq_getinteger(vm, 3, &val);
if (!this->HasItem(idx)) {
this->AddItem(idx, val);
return 0;