Skip to content

Commit

Permalink
InspectMapTreeInfo fix: LMU data indexes need to start at 1
Browse files Browse the repository at this point in the history
  • Loading branch information
florianessl committed Feb 1, 2025
1 parent 6f9fedb commit b92572d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game_interpreter_control_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,8 @@ int ControlVariables::InspectMapTreeInfo(InspectMapTreeInfoOp op, int map_id, in
case InspectMapTreeInfoOp::Troop_Id:
{
// TODO: provide a way to conveniently copy values into a range of variables ("ControlVarArrayEx"?)
if (arg1 >= 0 && arg1 < static_cast<int>(map_info.encounters.size())) {
return map_info.encounters[arg1].troop_id;
if (arg1 >= 1 && arg1 <= static_cast<int>(map_info.encounters.size())) {
return map_info.encounters[arg1 - 1].troop_id;
}
return 0;
}
Expand All @@ -634,15 +634,15 @@ int ControlVariables::InspectMapTreeInfo(InspectMapTreeInfoOp op, int map_id, in
case InspectMapTreeInfoOp::Arena_Height:
{
// TODO: provide a way to conveniently copy values into a range of variables ("ControlVarArrayEx"?)
if (arg1 < 0) {
if (arg1 <= 0) {
return 0;
}

int cnt_arenas = 0;
for (unsigned int i = 0; i < lcf::Data::treemap.maps.size(); ++i) {
auto& map = lcf::Data::treemap.maps[i];
if (map.parent_map == map_info.ID && map.type == lcf::rpg::TreeMap::MapType_area) {
if (arg1 < cnt_arenas) {
if (arg1 <= cnt_arenas) {
cnt_arenas++;
continue;
}
Expand Down

0 comments on commit b92572d

Please sign in to comment.