Skip to content

[C++] Unnecessary/Incorrect foreach_break and foreach_return #30

@Lavesiime

Description

@Lavesiime

In the C API, foreach loops are handled through macros, where the foreach_break and foreach_return macros serve a purpose as they need to call RSDK.BreakForeachLoop() before exiting the loop. In the C++ API, however, foreach loops are handled by first constructing an std::list of all entities in GameObject::GetEntities, and then the loop code is ran after the entire entity list has been formed. Despite this, however, the C++ GameAPI bindings still include the foreach_break and foreach_return macros, despite simply break and return being all that's needed. Beyond being unnecessary, these macros incorrectly include calls to RSDK::RSDKTable->BreakForeachLoop(), which decrement the foreach stack pointer despite the GetActive/AllEntities loop already being completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions