Skip to content

Commit 9b9ea74

Browse files
Remove warnings caused by recent deprecations (#1379)
* Fix clamp warnings * Battle of wits * This one too * Always the platform code
1 parent d993b56 commit 9b9ea74

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

loader/include/Geode/utils/cocos.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,9 @@ namespace geode::cocos {
887887
*/
888888
inline cocos2d::ccColor3B lighten3B(cocos2d::ccColor3B const& color, int amount) {
889889
return {
890-
static_cast<GLubyte>(utils::clamp(color.r + amount, 0, 255)),
891-
static_cast<GLubyte>(utils::clamp(color.g + amount, 0, 255)),
892-
static_cast<GLubyte>(utils::clamp(color.b + amount, 0, 255)),
890+
static_cast<GLubyte>(std::clamp(color.r + amount, 0, 255)),
891+
static_cast<GLubyte>(std::clamp(color.g + amount, 0, 255)),
892+
static_cast<GLubyte>(std::clamp(color.b + amount, 0, 255)),
893893
};
894894
}
895895

loader/src/loader/ModImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ Result<> Mod::Impl::uninstall(bool deleteSaveData) {
387387

388388
if (this->isInternal()) {
389389
utils::game::launchLoaderUninstaller(deleteSaveData);
390-
utils::game::exit();
390+
utils::game::exit(true);
391391
return Ok();
392392
}
393393

loader/src/loader/SettingNodeV3.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class NumberSettingNodeV3 : public SettingValueNodeV3<S> {
6666
auto min = this->getSetting()->getMinValue().value_or(-100);
6767
auto max = this->getSetting()->getMaxValue().value_or(+100);
6868
auto range = max - min;
69-
return static_cast<float>(clamp(static_cast<double>(value - min) / range, 0.0, 1.0));
69+
return static_cast<float>(std::clamp(static_cast<double>(value - min) / range, 0.0, 1.0));
7070
}
7171
ValueType valueFromSlider(float num) {
7272
auto min = this->getSetting()->getMinValue().value_or(-100);

loader/src/platform/windows/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void updateGeode() {
2424
std::filesystem::exists(updatesDir / "GeodeUpdater.exe"))
2525
std::filesystem::rename(updatesDir / "GeodeUpdater.exe", workingDir / "GeodeUpdater.exe");
2626

27-
utils::game::restart();
27+
utils::game::restart(true);
2828
}
2929

3030
void patchDelayLoad() {

loader/src/ui/mods/GeodeStyle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ bool GeodeTabSprite::init(const char* iconFrame, const char* text, float width,
256256
this->addChildAtPosition(m_icon, Anchor::Left, ccp(16, 0), false);
257257

258258
m_label = CCLabelBMFont::create(text, "bigFont.fnt");
259-
m_label->limitLabelWidth(this->getContentWidth() - 45, clamp(width * .0045f, .35f, .55f), .1f);
259+
m_label->limitLabelWidth(this->getContentWidth() - 45, std::clamp(width * .0045f, .35f, .55f), .1f);
260260
m_label->setAnchorPoint({ .5f, .5f });
261261
this->addChildAtPosition(m_label, Anchor::Left, ccp((itemSize.width - iconSize.width) / 2 + iconSize.width, 0), false);
262262

loader/src/ui/mods/ModsLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void ModsStatusNode::onRestart(CCObject*) {
327327
// Delayed by 2 frames - one is needed to render the "Restarting text"
328328
Loader::get()->queueInMainThread([] {
329329
// the other never finishes rendering because the game actually restarts at this point
330-
game::restart();
330+
game::restart(true);
331331
});
332332
});
333333
}

loader/src/ui/mods/settings/ModSettingsPopup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void ModSettingsPopup::onRestart(CCObject*) {
216216
// Delayed by 2 frames - one is needed to render the "Restarting text"
217217
Loader::get()->queueInMainThread([] {
218218
// the other never finishes rendering because the game actually restarts at this point
219-
game::restart();
219+
game::restart(true);
220220
});
221221
});
222222
}

loader/src/ui/nodes/MDPopup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void MDPopup::onBtn(CCObject* sender) {
6565
}
6666

6767
float MDPopup::estimateHeight(std::string const& content) {
68-
return clamp(string::count(content, '\n') * 50.f, 180.f, 280.f);
68+
return std::clamp(string::count(content, '\n') * 50.f, 180.f, 280.f);
6969
}
7070

7171
MDPopup* MDPopup::create(

loader/src/utils/cocos.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,15 @@ CCRect geode::cocos::calculateChildCoverage(CCNode* parent) {
426426
}
427427

428428
void geode::cocos::limitNodeSize(CCNode* spr, CCSize const& size, float def, float min) {
429-
spr->setScale(clamp(std::min(size.height / spr->getContentHeight(), size.width / spr->getContentWidth()), min, def));
429+
spr->setScale(std::clamp(std::min(size.height / spr->getContentHeight(), size.width / spr->getContentWidth()), min, def));
430430
}
431431

432432
void geode::cocos::limitNodeWidth(CCNode* spr, float width, float def, float min) {
433-
spr->setScale(clamp(width / spr->getContentSize().width, min, def));
433+
spr->setScale(std::clamp(width / spr->getContentSize().width, min, def));
434434
}
435435

436436
void geode::cocos::limitNodeHeight(CCNode* spr, float height, float def, float min) {
437-
spr->setScale(clamp(height / spr->getContentSize().height, min, def));
437+
spr->setScale(std::clamp(height / spr->getContentSize().height, min, def));
438438
}
439439

440440
bool geode::cocos::nodeIsVisible(CCNode* node) {

0 commit comments

Comments
 (0)