#include "menustate.h"
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <wchar.h>
#include <libintl.h>
#include <iconv.h>
Include dependency graph for name.c:
Go to the source code of this file.
Functions | |
void | GetLocalPlayerName (rtsa_char *dest) |
Gets a copy of the local player's name. | |
void | SetLocalPlayerName (rtsa_char *name) |
Changes the local player's name to the given string. | |
static void | SetUsername () |
Set the player name to the user name stored in an enviornment variable. |
Intended to be extended with a menu item for the user to change the name.
Copyright (C) 2007 Jeff JackowskiThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/
Definition in file name.c.
void GetLocalPlayerName | ( | rtsa_char * | dest | ) |
Gets a copy of the local player's name.
If the name has not already been set by calling SetLocalPlayerName(), the user name stored in the environment variables (USER on Unix-like systems, USERNAME on Windows) will be used.
dest | A pointer to where the name will be stored. The name will be no longer than MAX_NAME_LEN - 1 and will be null terminated. |
Definition at line 86 of file name.c.
References MenuSettings_t::localPlayerName, menuSettings, rtsa_strcpy, and SetUsername().
Referenced by GameInit().
Here is the call graph for this function:
void SetLocalPlayerName | ( | rtsa_char * | name | ) |
Changes the local player's name to the given string.
name | A pointer to the string with the new name. Only the first MAX_NAME_LEN - 1 characters will be kept. If NULL or zero length, the user name stored in an environment variable (USER on Unix-like systems, USERNAME on Windows) will be set as the name. |
Definition at line 97 of file name.c.
References MenuSettings_t::localPlayerName, MAX_NAME_LEN, menuSettings, rtsa_strncpy, and SetUsername().
Here is the call graph for this function:
static void SetUsername | ( | ) | [static] |
Set the player name to the user name stored in an enviornment variable.
Known to work on Linux and Windows; will probably work on other Unix-like systems.
Definition at line 44 of file name.c.
References MenuSettings_t::localPlayerName, MAX_NAME_LEN, menuSettings, rtsa_strncpy, STRING_DEFAULTNAME, and strings.
Referenced by GetLocalPlayerName(), and SetLocalPlayerName().