Skip to content

GameInfo::Get_Max_Players creates unnecessary copy #956

Open
@xezon

Description

@xezon

MapMetaData data is an unnecessary copy.

int GameInfo::Get_Max_Players() const
{
    if (g_theMapCache == nullptr) {
        return -1;
    }

    Utf8String str(m_mapName);
    str.To_Lower();

    auto it = g_theMapCache->find(str);

    if (it == g_theMapCache->end()) {
        return -1;
    } else {
        MapMetaData data = it->second;
        return data.m_numPlayers;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions