Skip to content

Commit

Permalink
fix the most annoying crash of all time
Browse files Browse the repository at this point in the history
  • Loading branch information
TechStudent10 committed Dec 12, 2024
1 parent 6b39a8d commit 915adf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/layers/Lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool LobbyLayer::init(std::string code) {
auto director = CCDirector::sharedDirector();
auto size = director->getWinSize();

mainLayer = CCLayer::create();
mainLayer = CCNode::create();
mainLayer->setContentSize(size);

background = CCSprite::create("GJ_gradientBG.png");
Expand Down Expand Up @@ -269,7 +269,7 @@ void LobbyLayer::unregisterListeners() {

LobbyLayer::~LobbyLayer() {
unregisterListeners();
if (mainLayer) mainLayer->release();
// if (mainLayer) mainLayer->release();
}

void LobbyLayer::refresh(LobbyInfo info, bool isFirstRefresh) {
Expand All @@ -284,7 +284,7 @@ void LobbyLayer::refresh(LobbyInfo info, bool isFirstRefresh) {
auto listWidth = size.width / 1.5f;

if (!mainLayer) return;
mainLayer->retain();
// mainLayer->retain();

if (isFirstRefresh) {
titleLabel = CCLabelBMFont::create(
Expand Down Expand Up @@ -313,12 +313,12 @@ void LobbyLayer::refresh(LobbyInfo info, bool isFirstRefresh) {
mainLayer->addChild(menu);
}

if (titleLabel) titleLabel->setString(
fmt::format("{} ({})",
info.settings.name,
Mod::get()->getSettingValue<bool>("hide-code") ? "......" : info.code
).c_str()
);
// if (titleLabel) titleLabel->setString(
// fmt::format("{} ({})",
// info.settings.name,
// Mod::get()->getSettingValue<bool>("hide-code") ? "......" : info.code
// ).c_str()
// );

if (!playerList && !isFirstRefresh) return;
if (playerList) playerList->removeFromParent();
Expand Down
2 changes: 1 addition & 1 deletion src/layers/Lobby.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CR_DLL LobbyLayer : public CCLayer {
CCMenuItemSpriteExtra* startBtn;

LoadingCircle* loadingCircle;
CCLayer* mainLayer;
CCNode* mainLayer;

bool init(std::string code);
void keyBackClicked();
Expand Down

0 comments on commit 915adf6

Please sign in to comment.