MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / onMouseUp

Method onMouseUp

src/openrct2-ui/windows/ServerStart.cpp:91–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 String::safeUtf8Copy(_greeting, Config::Get().network.serverGreeting.c_str(), sizeof(_greeting));
90 }
91 void onMouseUp(WidgetIndex widgetIndex) override
92 {
93 switch (widgetIndex)
94 {
95 case WIDX_CLOSE:
96 close();
97 break;
98 case WIDX_PORT_INPUT:
99 WindowStartTextbox(*this, widgetIndex, _port, 6);
100 break;
101 case WIDX_NAME_INPUT:
102 WindowStartTextbox(*this, widgetIndex, _name, 64);
103 break;
104 case WIDX_DESCRIPTION_INPUT:
105 WindowStartTextbox(*this, widgetIndex, _description, Network::kMaxServerDescriptionLength);
106 break;
107 case WIDX_GREETING_INPUT:
108 WindowStartTextbox(*this, widgetIndex, _greeting, kChatInputSize);
109 break;
110 case WIDX_PASSWORD_INPUT:
111 WindowStartTextbox(*this, widgetIndex, _password, 32);
112 break;
113 case WIDX_MAXPLAYERS_INCREASE:
114 if (Config::Get().network.maxplayers < 255)
115 {
116 Config::Get().network.maxplayers++;
117 }
118 Config::Save();
119 invalidate();
120 break;
121 case WIDX_MAXPLAYERS_DECREASE:
122 if (Config::Get().network.maxplayers > 1)
123 {
124 Config::Get().network.maxplayers--;
125 }
126 Config::Save();
127 invalidate();
128 break;
129 case WIDX_ADVERTISE_CHECKBOX:
130 Config::Get().network.advertise = !Config::Get().network.advertise;
131 Config::Save();
132 invalidate();
133 break;
134 case WIDX_START_SERVER:
135 Network::SetPassword(_password);
136 ScenarioselectOpen(ScenarioSelectCallback);
137 break;
138 case WIDX_LOAD_SERVER:
139 Network::SetPassword(_password);
140 auto intent = Intent(WindowClass::loadsave);
141 intent.PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::load);
142 intent.PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::park);
143 intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(LoadSaveCallback));
144 ContextOpenIntent(&intent);
145 break;
146 }
147 }
148 void onPrepareDraw() override

Callers

nothing calls this directly

Calls 8

WindowStartTextboxFunction · 0.85
SaveFunction · 0.85
SetPasswordFunction · 0.85
ScenarioselectOpenFunction · 0.85
ContextOpenIntentFunction · 0.85
invalidateFunction · 0.50
IntentClass · 0.50
PutExtraMethod · 0.45

Tested by

no test coverage detected