 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
60 #define NUM_ACCOUNT_CHAR_FIELDS 8
69 #define ACCOUNT_DIR "account"
83 fp = fopen(fname,
"r");
88 LOG(
llevInfo,
"Warning: Unable to open %s: %s\n", fname, strerror(errno));
95 if (
buf[0] ==
'#')
continue;
98 cp = strchr(
buf,
'\n');
114 ac->
level = strtoul(tmp[3], (
char**) NULL, 10);
118 ac->
isDead = strtoul(tmp[7], (
char**) NULL, 10);
120 chars->
chars.push_back(ac);
137 if (strcmp(account->account_name, account_name) == 0) {
173 if (chars->
chars.empty()) {
182 fprintf(fp,
"# IMPORTANT: Do not edit this file while the server is running. This file is\n"
183 "# only read when the server starts, and any changes will be overwritten when\n"
184 "# the server exits.\n");
185 for (
auto ac : chars->
chars) {
186 fprintf(fp,
"%s:%s:%s:%d:%s:%s:%s:%d\n",
187 ac->name, ac->character_class, ac->race, ac->level,
188 ac->face, ac->party, ac->map, ac->isDead);
215 for (
auto ch : chars->
chars) {
216 if (!strcmp(ch->name, pl->
ob->
name)) {
298 chars->
chars.push_back(ap);
320 auto ch = std::find_if(chars->
chars.begin(), chars->
chars.end(), [&] (
const auto ch) { return !strcmp(ch->name, pl_name); });
322 if (ch == chars->
chars.end())
326 chars->
chars.erase(ch);
357 for (
auto ap : chars->
chars) {
397 for (
auto ac : chars->
chars) {
398 if (strcmp(ac->name, op->
name) == 0) {
435 for (
auto ac : chars->
chars) {
436 if (strcmp(ac->name,
player) == 0) {
sstring name
Face name, as used by archetypes and such.
struct Settings settings
Global settings.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int of_close(OutputFile *of)
Closes an output file.
int unmake_perma_dead(char *account, char *player)
This will edit the character account information so that the character that was just resurrected in p...
FILE * of_open(OutputFile *of, const char *fname)
Opens an output file.
sstring race
< Class of this character
static std::vector< Account_Chars * > chars_loaded
Current character information in use.
struct archetype * arch
Pointer to archetype.
object * ob
The object representing the player.
struct mapstruct * map
Pointer to the map in which this object is present.
sstring account_name
Account the information is for.
void account_char_free(Account_Chars *chars)
This frees all data associated with the character information.
player * get_player(player *p)
Create a player's object, initialize a player's structure.
int16_t level
Level of creature or object.
One character in an account.
std::vector< Account_Char * > chars
Characters of the account.
struct player * contr
Pointer to the player which control this object.
sstring character_class
< Name of this character/player
int make_perma_dead(object *op)
This will edit the character account information so that the character that just died in permadeath w...
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings.
object clone
An object from which to do object_copy()
sstring add_string(const char *str)
This will add 'str' to the hash table.
#define NUM_ACCOUNT_CHAR_FIELDS
Number of fields in the accounts file.
const Face * face
Face with colors.
char * account_name
Name of the account logged in on this socket.
void account_char_add(Account_Chars *chars, player *pl)
This adds a player to the list of accounts.
char * partyname
Party name.
char maplevel[MAX_BUF]
On which level is the player?
#define MAX_BUF
Used for all kinds of things.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
sstring party
< Face of this character
sstring name
The name of the object, obviously...
uint8_t isDead
< Last map this character was on
#define ACCOUNT_DIR
Name of the directory containing account information.
char * name
Name of map as given by its creator.
sstring face
< Level of this character
void account_char_save(Account_Chars *chars)
Saves the character information for the given account.
void account_char_remove(Account_Chars *chars, const char *pl_name)
This removes a character on this account.
sstring map
< Character this party belonged to
partylist * party
Party this player is part of.
uint8_t level
< Race of this character
Structure handling character information for an account.
socket_struct * socket
Socket information for this player.
static void account_char_load_from_file(Account_Chars *chars)
Load characters for a Account_Chars structure.
uint8_t ref_count
Number of pointers on this structure.
Account_Chars * account_char_load(const char *account_name)
For a given account name, load the character information and return it.
const char * localdir
Read/write data files.