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);
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");
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)) {
273 if (
pl->ob->map &&
pl->ob->map->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) {
389 if (!
pl->socket->account_name) {
398 if (strcmp(
ac->name,
op->name) == 0) {
436 if (strcmp(
ac->name,
player) == 0) {
void LOG(LogLevel logLevel, const char *format,...)
int of_close(OutputFile *of)
int unmake_perma_dead(char *account, char *player)
FILE * of_open(OutputFile *of, const char *fname)
static std::vector< Account_Chars * > chars_loaded
void account_char_free(Account_Chars *chars)
player * get_player(player *p)
std::vector< Account_Char * > chars
int make_perma_dead(object *op)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
sstring add_string(const char *str)
#define NUM_ACCOUNT_CHAR_FIELDS
void account_char_add(Account_Chars *chars, player *pl)
void free_string(sstring str)
void account_char_save(Account_Chars *chars)
void account_char_remove(Account_Chars *chars, const char *pl_name)
static void account_char_load_from_file(Account_Chars *chars)
Account_Chars * account_char_load(const char *account_name)