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

Method onMouseUp

src/openrct2-ui/windows/ServerList.cpp:124–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 void onMouseUp(WidgetIndex widgetIndex) override
125 {
126 switch (widgetIndex)
127 {
128 case WIDX_CLOSE:
129 close();
130 break;
131 case WIDX_PLAYER_NAME_INPUT:
132 WindowStartTextbox(*this, widgetIndex, _playerName, kMaxPlayerNameLength);
133 break;
134 case WIDX_LIST:
135 {
136 int32_t serverIndex = selectedListItem;
137 if (serverIndex >= 0 && serverIndex < static_cast<int32_t>(_serverList.GetCount()))
138 {
139 const auto& server = _serverList.GetServer(serverIndex);
140 if (server.IsVersionValid())
141 {
142 JoinServer(server.Address);
143 }
144 else
145 {
146 Formatter ft;
147 ft.Add<const char*>(server.Version.c_str());
148 ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft);
149 }
150 }
151 break;
152 }
153 case WIDX_FETCH_SERVERS:
154 ServerListFetchServersBegin();
155 break;
156 case WIDX_ADD_SERVER:
157 textInputOpen(widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, kStringIdNone, 0, 128);
158 break;
159 case WIDX_START_SERVER:
160 ContextOpenWindow(WindowClass::serverStart);
161 break;
162 }
163 }
164
165 void onResize() override
166 {

Callers

nothing calls this directly

Calls 6

WindowStartTextboxFunction · 0.85
JoinServerFunction · 0.85
ContextShowErrorFunction · 0.85
ContextOpenWindowFunction · 0.85
IsVersionValidMethod · 0.80
GetCountMethod · 0.45

Tested by

no test coverage detected