mirror of
https://github.com/glest/glest-source.git
synced 2025-09-27 16:09:00 +02:00
Added auto-discovery of LAN servers using UDP broadcast. (for now the client must press the A key from the join menu to trigger this)
This commit is contained in:
@@ -126,6 +126,23 @@ int64 Chrono::getCurTicks() {
|
||||
// Misc
|
||||
// =====================================
|
||||
|
||||
void Tokenize(const string& str,vector<string>& tokens,const string& delimiters) {
|
||||
// Skip delimiters at beginning.
|
||||
string::size_type lastPos = str.find_first_not_of(delimiters, 0);
|
||||
// Find first "non-delimiter".
|
||||
string::size_type pos = str.find_first_of(delimiters, lastPos);
|
||||
|
||||
while (string::npos != pos || string::npos != lastPos) {
|
||||
// Found a token, add it to the vector.
|
||||
tokens.push_back(str.substr(lastPos, pos - lastPos));
|
||||
// Skip delimiters. Note the "not_of"
|
||||
lastPos = str.find_first_not_of(delimiters, pos);
|
||||
// Find next "non-delimiter"
|
||||
pos = str.find_first_of(delimiters, lastPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This was the simplest, most portable solution i could find in 5 mins for linux
|
||||
int MessageBox(int handle, const char *msg, const char *title, int buttons) {
|
||||
char cmd[1024]="";
|
||||
|
Reference in New Issue
Block a user