Skip to content

Commit 686e7ac

Browse files
committed
Fixed platformer levels appearing in the roulette
1 parent 50c6600 commit 686e7ac

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [1.6.0-beta.4] - 2024-02-06
9+
10+
### Fixed
11+
12+
- Platformer levels appearing in the roulette
13+
814
## [1.6.0-beta.3] - 2024-02-04
915

1016
### Added

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"win": "2.204",
55
"android": "2.205"
66
},
7-
"version": "v1.6.0-beta.3",
7+
"version": "v1.6.0-beta.4",
88
"id": "spaghettdev.gd-roulette",
99
"name": "GD-Roulette",
1010
"developer": "SpaghettDev",

src/listfetcher/ListFetcher.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void ListFetcher::getRandomNormalListLevel(int stars, matjson::Value& json, std:
1515
if (stars > 10)
1616
{
1717
json = {};
18+
error = "Invalid request given to the ListFetcher";
1819
isFetching = false;
1920
return;
2021
}
@@ -32,24 +33,20 @@ void ListFetcher::getRandomNormalListLevel(int stars, matjson::Value& json, std:
3233
.then([&, stars](auto const& fjson) {
3334
json = fjson;
3435

35-
// TODO: support platformer levels
36-
// Prevent auto levels from appearing in the Easy difficulty, and platformer levels because idk how this roulette would work with them lol!
36+
// Prevent auto levels from appearing in the Easy difficulty, and platformer levels because this roulette doesn't work with them lol!
3737
if (!json.is_null())
3838
{
39-
if (stars == 1)
40-
{
41-
matjson::Array& arr = json.as_array();
42-
43-
arr.erase(
44-
std::remove_if(
45-
arr.begin(), arr.end(),
46-
[](const auto& level) {
47-
return level.template get<std::string>("difficulty") == "Auto" || level.template get<bool>("platformer");
48-
}
49-
),
50-
arr.end()
51-
);
52-
}
39+
matjson::Array& arr = json.as_array();
40+
41+
arr.erase(
42+
std::remove_if(
43+
arr.begin(), arr.end(),
44+
[=](const auto& level) {
45+
return (stars == 1 ? level.template get<std::string>("difficulty") == "Auto" : false) || level.template get<bool>("platformer");
46+
}
47+
),
48+
arr.end()
49+
);
5350

5451
json = json[roulette::utils::randomInt(0, json.as_array().size() - 1)];
5552
}

0 commit comments

Comments
 (0)