Skip to content

Commit

Permalink
Fixed an issue with aliases in slot names causing textbox overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinopony committed Jun 11, 2024
1 parent 7a1f17e commit 072364d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.21)

project(randstalker_archipelago VERSION 1.3.3 LANGUAGES CXX)
project(randstalker_archipelago VERSION 1.3.4 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![version](https://img.shields.io/badge/Version-1.3.3-blue)
![version](https://img.shields.io/badge/Version-1.3.4-blue)
<a href="https://discord.gg/XNA76xc9sU">
<img src="https://img.shields.io/badge/-Discord-lightgrey?logo=discord" alt="Join Discord">
</a>
Expand Down
14 changes: 13 additions & 1 deletion src/preset_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ static json build_world_json(const json& slot_data, const json& locations_data,
if(prices.contains(item_source_name))
output["price"] = prices.at(item_source_name);
if(data["player"] != player_name)
output["player"] = data["player"];
{
std::string real_player_name = data["player"];

// This is a hacky fix to extract the alias part from the name in cases where slot name fetched from server
// looks like "Player Alias (Real Slot Name Causing A Really Long String)".
// This was causing textbox overflows in some places, and you really don't want that to happen for the game
// to remain stable.
auto pos = real_player_name.find(" (");
if (pos != std::string::npos)
real_player_name = real_player_name.substr(0, pos);

output["player"] = real_player_name;
}

world["itemSources"][item_source_name] = output;
}
Expand Down

0 comments on commit 072364d

Please sign in to comment.