name.c File Reference

Implements the interface to store and change the player's name. More...

#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.


Detailed Description

Implements the interface to store and change the player's name.

Intended to be extended with a menu item for the user to change the name.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

This 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.


Function Documentation

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.

Parameters:
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.
Author:
Jeff Jackowski

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.

Parameters:
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.
Author:
Jeff Jackowski

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.

Postcondition:
localPlayerName contains the user name as a null terminated string up to MAX_NAME_LEN bytes long.
Author:
Jeff Jackowski.

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().


Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2