ADD: lastip

This commit is contained in:
Kolyah35
2026-03-15 20:54:28 +03:00
parent fadcf3a7d0
commit a50877af9e
7 changed files with 66 additions and 55 deletions

View File

@@ -79,6 +79,8 @@ OptionInt keyMenuCancel("key.menu.cancel", 8);
OptionBool firstLaunch("firstLaunch", true);
OptionString lastIp("lastip");
void Options::initTable() {
m_options[OPTIONS_DIFFICULTY] = &difficulty;
m_options[OPTIONS_HIDEGUI] = &hidegui;
@@ -158,6 +160,7 @@ void Options::initTable() {
m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint;
m_options[OPTIONS_AUTOJUMP] = &autoJump;
m_options[OPTIONS_LAST_IP] = &lastIp;
}
void Options::set(OptionId key, const std::string& value) {

View File

@@ -81,6 +81,7 @@ enum OptionId {
OPTIONS_KEY_MENU_CANCEL,
OPTIONS_FIRST_LAUNCH,
OPTIONS_LAST_IP,
// Should be last!
OPTIONS_COUNT

View File

@@ -5,6 +5,8 @@
#include "ProgressScreen.h"
#include "../Font.h"
#include "../../../network/RakNetInstance.h"
#include "client/Options.h"
#include "client/gui/Screen.h"
#include "client/gui/components/TextBox.h"
#include "network/ClientSideNetworkHandler.h"
@@ -31,7 +33,7 @@ void JoinByIPScreen::buttonClicked(Button* button)
minecraft->joinMultiplayerFromString(tIP.text);
{
minecraft->options.set(OPTIONS_LAST_IP, tIP.text);
bJoin.active = false;
bBack.active = false;
minecraft->setScreen(new ProgressScreen());
@@ -55,6 +57,7 @@ bool JoinByIPScreen::handleBackEvent(bool isDown)
void JoinByIPScreen::tick()
{
Screen::tick();
bJoin.active = !tIP.text.empty();
}
@@ -78,6 +81,8 @@ void JoinByIPScreen::init()
tabButtons.push_back(&bBack);
tabButtons.push_back(&bHeader);
#endif
tIP.text = minecraft->options.getStringValue(OPTIONS_LAST_IP);
}
void JoinByIPScreen::setupPositions() {