Show classic puzzles button in menu after player has opened it from community site

This commit is contained in:
ROllerozxa 2025-03-29 17:05:50 +01:00
commit b410bd72da
4 changed files with 27 additions and 10 deletions

View file

@ -930,16 +930,10 @@ tproject_step(void)
G->state.modified = true;
} break;
case ACTION_MAIN_MENU_PKG: {
int type = VOID_TO_INT(data);
if (type == 0) {
P.s_menu_pkg->set_pkg(LEVEL_MAIN, 7);
} else {
P.s_menu_pkg->set_pkg(LEVEL_MAIN, 9);
}
case ACTION_MAIN_MENU_PKG:
P.s_menu_pkg->set_pkg(LEVEL_MAIN, 7);
tms::set_screen(P.s_menu_pkg);
} break;
break;
case ACTION_SET_MODE:
G->set_mode(VOID_TO_INT(data));

View file

@ -7,6 +7,7 @@
#include "widget_manager.hh"
#include "text.hh"
#include "game-message.hh"
#include "settings.hh"
#define MAX_X 8.f
#define MIN_X -8.f
@ -68,7 +69,7 @@ menu_play::menu_play()
this->wdg_browse_community->add();
this->wdg_browse_community->resize_percentage(
_tms.window_width, 0.45,
_tms.window_width, 0.50,
_tms.window_height, 0.20);
this->wdg_open = this->wm->create_widget(
@ -209,7 +210,22 @@ menu_play::render()
void
menu_play::refresh_widgets()
{
this->wm->remove_all();
menu_base::refresh_widgets();
this->wdg_back->add();
this->wdg_version->add();
this->wdg_username->add();
this->wdg_message->add();
this->wdg_bithack->add();
this->wdg_settings->add();
this->wdg_browse_community->add();
this->wdg_open->add();
this->wdg_open_latest_state->add();
if (settings["has_opened_classic_puzzles"]->v.b)
this->wdg_puzzles->add();
this->wm->rearrange();
}

View file

@ -7,6 +7,7 @@
#include "ui.hh"
#include "misc.hh"
#include "widget_manager.hh"
#include "settings.hh"
#include <unistd.h>
@ -145,6 +146,10 @@ menu_pkg::menu_pkg()
bool
menu_pkg::set_pkg(int type, uint32_t id)
{
if (type == LEVEL_MAIN && id == 7) {
settings["has_opened_classic_puzzles"]->v.b = true;
}
tms_infof("set pkg");
if (!(this->pkg.open(type,id))) {
tms_errorf("could not open package!");

View file

@ -121,6 +121,8 @@ _settings::init()
this->add("score_ask_before_submitting", S_BOOL, false);
this->add("score_automatically_submit", S_BOOL, true);
this->add("has_opened_classic_puzzles", S_BOOL, false);
sprintf(this->filename, "%s/settings.ini", tms_storage_path());
FILE *fh;