mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 08:55:45 +00:00
MOHAWK: Implement LB add,addAt,setAt.
This commit is contained in:
parent
82ff40c548
commit
2657d14636
@ -835,14 +835,14 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
|
|||||||
{ "isWorldWrap", 0 },
|
{ "isWorldWrap", 0 },
|
||||||
{ "newList", &LBCode::cmdNewList },
|
{ "newList", &LBCode::cmdNewList },
|
||||||
{ "deleteList", 0 },
|
{ "deleteList", 0 },
|
||||||
{ "add", 0 },
|
{ "add", &LBCode::cmdAdd },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ "addAt", 0 },
|
{ "addAt", &LBCode::cmdAddAt },
|
||||||
{ "getAt", 0 },
|
{ "getAt", 0 },
|
||||||
// 0x30
|
// 0x30
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ "getIndex", 0 },
|
{ "getIndex", 0 },
|
||||||
{ "setAt", 0 },
|
{ "setAt", &LBCode::cmdSetAt },
|
||||||
{ "listLen", &LBCode::cmdListLen },
|
{ "listLen", &LBCode::cmdListLen },
|
||||||
{ "deleteAt", &LBCode::cmdDeleteAt },
|
{ "deleteAt", &LBCode::cmdDeleteAt },
|
||||||
{ "clearList", &LBCode::cmdUnimplemented },
|
{ "clearList", &LBCode::cmdUnimplemented },
|
||||||
@ -1125,6 +1125,46 @@ void LBCode::cmdNewList(const Common::Array<LBValue> ¶ms) {
|
|||||||
_stack.push(Common::SharedPtr<LBList>(new LBList));
|
_stack.push(Common::SharedPtr<LBList>(new LBList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LBCode::cmdAdd(const Common::Array<LBValue> ¶ms) {
|
||||||
|
if (params.size() != 2)
|
||||||
|
error("incorrect number of parameters (%d) to add", params.size());
|
||||||
|
|
||||||
|
if (params[0].type != kLBValueList || !params[0].list)
|
||||||
|
error("invalid lbx object passed to add");
|
||||||
|
|
||||||
|
params[0].list->array.push_back(params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LBCode::cmdAddAt(const Common::Array<LBValue> ¶ms) {
|
||||||
|
if (params.size() != 3)
|
||||||
|
error("incorrect number of parameters (%d) to addAt", params.size());
|
||||||
|
|
||||||
|
if (params[0].type != kLBValueList || !params[0].list)
|
||||||
|
error("invalid lbx object passed to addAt");
|
||||||
|
|
||||||
|
if (params[1].type != kLBValueInteger || params[1].integer < 1)
|
||||||
|
error("invalid index passed to addAt");
|
||||||
|
|
||||||
|
if ((uint)params[1].integer > params[0].list->array.size())
|
||||||
|
params[0].list->array.resize(params[1].integer);
|
||||||
|
params[0].list->array.insert_at(params[1].integer - 1, params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LBCode::cmdSetAt(const Common::Array<LBValue> ¶ms) {
|
||||||
|
if (params.size() != 3)
|
||||||
|
error("incorrect number of parameters (%d) to setAt", params.size());
|
||||||
|
|
||||||
|
if (params[0].type != kLBValueList || !params[0].list)
|
||||||
|
error("invalid lbx object passed to setAt");
|
||||||
|
|
||||||
|
if (params[1].type != kLBValueInteger || params[1].integer < 1)
|
||||||
|
error("invalid index passed to setAt");
|
||||||
|
|
||||||
|
if ((uint)params[1].integer > params[0].list->array.size())
|
||||||
|
params[0].list->array.resize(params[1].integer);
|
||||||
|
params[0].list->array[params[1].integer - 1] = params[2];
|
||||||
|
}
|
||||||
|
|
||||||
void LBCode::cmdListLen(const Common::Array<LBValue> ¶ms) {
|
void LBCode::cmdListLen(const Common::Array<LBValue> ¶ms) {
|
||||||
if (params.size() != 1)
|
if (params.size() != 1)
|
||||||
error("incorrect number of parameters (%d) to listLen", params.size());
|
error("incorrect number of parameters (%d) to listLen", params.size());
|
||||||
|
@ -265,6 +265,9 @@ public:
|
|||||||
void cmdMove(const Common::Array<LBValue> ¶ms);
|
void cmdMove(const Common::Array<LBValue> ¶ms);
|
||||||
void cmdSetDragParams(const Common::Array<LBValue> ¶ms);
|
void cmdSetDragParams(const Common::Array<LBValue> ¶ms);
|
||||||
void cmdNewList(const Common::Array<LBValue> ¶ms);
|
void cmdNewList(const Common::Array<LBValue> ¶ms);
|
||||||
|
void cmdAdd(const Common::Array<LBValue> ¶ms);
|
||||||
|
void cmdAddAt(const Common::Array<LBValue> ¶ms);
|
||||||
|
void cmdSetAt(const Common::Array<LBValue> ¶ms);
|
||||||
void cmdListLen(const Common::Array<LBValue> ¶ms);
|
void cmdListLen(const Common::Array<LBValue> ¶ms);
|
||||||
void cmdDeleteAt(const Common::Array<LBValue> ¶ms);
|
void cmdDeleteAt(const Common::Array<LBValue> ¶ms);
|
||||||
void cmdSetPlayParams(const Common::Array<LBValue> ¶ms);
|
void cmdSetPlayParams(const Common::Array<LBValue> ¶ms);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user