1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 16:45:20 +02:00

Add minetest.is_valid_player_name utility

This commit is contained in:
Lars Mueller
2024-08-13 02:50:36 +02:00
committed by sfan5
parent 44db47e64a
commit d3ca269c79
7 changed files with 32 additions and 15 deletions

View File

@@ -30,6 +30,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h" // strlcpy
bool is_valid_player_name(std::string_view name) {
return !name.empty() && name.size() <= PLAYERNAME_SIZE && string_allowed(name, PLAYERNAME_ALLOWED_CHARS);
}
Player::Player(const std::string &name, IItemDefManager *idef):
inventory(idef)
{