Commit bd0c82b7 authored by fallenstardust's avatar fallenstardust

auto trim hostname and port when joining host

parent bcf1430a
......@@ -175,6 +175,13 @@ public:
return focus && focus->hasType(type);
}
void TrimText(irr::gui::IGUIElement* editbox) const {
irr::core::stringw text(editbox->getText());
text.trim();
editbox->setText(text.c_str());
}
template<typename T>
static std::vector<T> TokenizeString(T input, const T& token);
......
......@@ -76,6 +76,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case BUTTON_JOIN_HOST: {
bot_mode = false;
mainGame->TrimText(mainGame->ebJoinHost);
mainGame->TrimText(mainGame->ebJoinPort);
char ip[20];
const wchar_t* pstr = mainGame->ebJoinHost->getText();
BufferIO::CopyWStr(pstr, ip, 16);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment