mirror of
https://github.com/glest/glest-source.git
synced 2025-09-30 09:29:25 +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:
@@ -1,7 +1,7 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
// Copyright (C) 2001-2008 Martio Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
@@ -186,6 +186,23 @@ void PlatformExceptionHandler::install(string dumpFileName){
|
||||
// =====================================================
|
||||
// class 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);
|
||||
}
|
||||
}
|
||||
|
||||
void findDirs(const vector<string> &paths, vector<string> &results, bool errorOnNotFound) {
|
||||
results.clear();
|
||||
int pathCount = paths.size();
|
||||
|
Reference in New Issue
Block a user