Skip to content

Commit b92572d

Browse files
committed
InspectMapTreeInfo fix: LMU data indexes need to start at 1
1 parent 6f9fedb commit b92572d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/game_interpreter_control_variables.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ int ControlVariables::InspectMapTreeInfo(InspectMapTreeInfoOp op, int map_id, in
621621
case InspectMapTreeInfoOp::Troop_Id:
622622
{
623623
// TODO: provide a way to conveniently copy values into a range of variables ("ControlVarArrayEx"?)
624-
if (arg1 >= 0 && arg1 < static_cast<int>(map_info.encounters.size())) {
625-
return map_info.encounters[arg1].troop_id;
624+
if (arg1 >= 1 && arg1 <= static_cast<int>(map_info.encounters.size())) {
625+
return map_info.encounters[arg1 - 1].troop_id;
626626
}
627627
return 0;
628628
}
@@ -634,15 +634,15 @@ int ControlVariables::InspectMapTreeInfo(InspectMapTreeInfoOp op, int map_id, in
634634
case InspectMapTreeInfoOp::Arena_Height:
635635
{
636636
// TODO: provide a way to conveniently copy values into a range of variables ("ControlVarArrayEx"?)
637-
if (arg1 < 0) {
637+
if (arg1 <= 0) {
638638
return 0;
639639
}
640640

641641
int cnt_arenas = 0;
642642
for (unsigned int i = 0; i < lcf::Data::treemap.maps.size(); ++i) {
643643
auto& map = lcf::Data::treemap.maps[i];
644644
if (map.parent_map == map_info.ID && map.type == lcf::rpg::TreeMap::MapType_area) {
645-
if (arg1 < cnt_arenas) {
645+
if (arg1 <= cnt_arenas) {
646646
cnt_arenas++;
647647
continue;
648648
}

0 commit comments

Comments
 (0)