mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Improved server commands and added player permissions.
--HG-- extra : rebase_source : 178fe08f10b7de3ebaba088bd24faad795114216
This commit is contained in:
parent
dadac0e79f
commit
248d7c8469
8 changed files with 454 additions and 70 deletions
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <jthread.h>
|
||||
#include <jmutex.h>
|
||||
#include <jmutexautolock.h>
|
||||
|
@ -731,6 +732,19 @@ inline std::string wide_to_narrow(const std::wstring& wcs)
|
|||
return *mbs;
|
||||
}
|
||||
|
||||
// Split a string using the given delimiter. Returns a vector containing
|
||||
// the component parts.
|
||||
inline std::vector<std::wstring> str_split(const std::wstring &str, wchar_t delimiter)
|
||||
{
|
||||
std::vector<std::wstring> parts;
|
||||
std::wstringstream sstr(str);
|
||||
std::wstring part;
|
||||
while(std::getline(sstr, part, delimiter))
|
||||
parts.push_back(part);
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
See test.cpp for example cases.
|
||||
wraps degrees to the range of -360...360
|
||||
|
@ -791,6 +805,11 @@ inline s32 stoi(std::string s)
|
|||
return atoi(s.c_str());
|
||||
}
|
||||
|
||||
inline s32 stoi(std::wstring s)
|
||||
{
|
||||
return atoi(wide_to_narrow(s).c_str());
|
||||
}
|
||||
|
||||
inline float stof(std::string s)
|
||||
{
|
||||
float f;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue