Atrinik Server 2.5
Data Structures | Defines | Functions | Variables
server/init.c File Reference
#include <global.h>

Go to the source code of this file.

Data Structures

struct  Command_Line_Options

Defines

#define INIT_C
#define EXTERN
#define ARCHETYPE_LEVEL_UP   "level_up"

Functions

static void usage ()
static void help ()
static void init_beforeplay ()
static void fatal_signal (int make_core)
static void init_signals ()
static void dump_level_colors_table ()
static void init_environ ()
static void init_defaults ()
static void init_dynamic ()
static void init_clocks ()
static void init_strings ()
void free_strings ()
void init_library ()
void init_globals ()
void write_todclock ()
static void parse_args (int argc, char *argv[], int pass)
static void load_settings ()
void init (int argc, char **argv)
void compile_info ()

Variables

struct Settings settings
int world_darkness
unsigned long todtick
archetypelevel_up_arch = NULL
struct Command_Line_Options options []

Detailed Description

Server initialization, settings loading, command line handling and such.

Definition in file init.c.


Define Documentation

#define ARCHETYPE_LEVEL_UP   "level_up"

Name of the archetype to use for the level up effect.

Definition at line 81 of file init.c.


Function Documentation

void compile_info ( )

Dump compilation information, activated with the -o flag.

It writes out information on how Imakefile and config.h was configured at compile time.

Definition at line 1086 of file init.c.

static void dump_level_colors_table ( ) [static]

Dump level colors table.

Definition at line 1269 of file init.c.

static void fatal_signal ( int  make_core) [static]

General signal handling. Will exit() in any case.

Parameters:
make_coreIf set abort() instead of exit() to generate a core dump.

Definition at line 1233 of file init.c.

void free_strings ( )

Free the string constants.

Definition at line 132 of file init.c.

static void help ( ) [static]

Show help about the command line options.

Definition at line 953 of file init.c.

void init ( int  argc,
char **  argv 
)

This is the main server initialization function.

Called only once, when starting the program.

Parameters:
argcLength of argv.
argvArguments.

Definition at line 894 of file init.c.

static void init_beforeplay ( ) [static]

Initialize before playing.

Definition at line 1013 of file init.c.

static void init_clocks ( ) [static]

Initializes the gametime and TOD counters.

Called by init_library().

Definition at line 335 of file init.c.

static void init_defaults ( ) [static]

Initializes global variables which can be changed by options.

Called by init_library().

Definition at line 286 of file init.c.

static void init_dynamic ( ) [static]

Initializes first_map_path from the archetype collection.

Definition at line 293 of file init.c.

static void init_environ ( ) [static]

Initializes values from the environmental variables.

Needs to be called very early, since command line options should overwrite these if specified.

Definition at line 190 of file init.c.

void init_globals ( )

Initializes all global variables. Might use environment variables as default for some of them.

Definition at line 247 of file init.c.

void init_library ( )

It is vital that init_library() is called by any functions using this library.

If you want to lessen the size of the program using the library, you can replace the call to init_library() with init_globals() and init_function_pointers(). Good idea to also call init_vars() and init_hash_table() if you are doing any object loading.

Definition at line 154 of file init.c.

static void init_signals ( ) [static]

Setup the signal handlers.

Definition at line 1251 of file init.c.

static void init_strings ( ) [static]

Initialize the ::shstr_cons structure.

Definition at line 96 of file init.c.

static void load_settings ( ) [static]

This loads the settings file.

There could be debate whether this should be here or in the common directory - but since only the server needs this information, having it here probably makes more sense.

Definition at line 746 of file init.c.

static void parse_args ( int  argc,
char *  argv[],
int  pass 
) [static]

Parse command line arguments.

Note since this may be called before the library has been set up, we don't use any of crossfires built in logging functions.

Parameters:
argcLength of argv.
argv[]Arguments.
passInitialization pass arguments to use.

Definition at line 679 of file init.c.

static void usage ( ) [static]

Show the usage.

Definition at line 946 of file init.c.

void write_todclock ( )

Write out the current time to a file so time does not reset every time the server reboots.

Definition at line 314 of file init.c.


Variable Documentation

Pointer to archetype that is used as effect when player levels up.

Definition at line 78 of file init.c.

Valid command line options.

The way this system works is pretty simple - parse_args takes the options passed to the program and a pass number. If an option matches both in name and in pass (and we have enough options), we call the associated function. This makes writing a multi pass system very easy, and it is very easy to add in new options.

Definition at line 615 of file init.c.

You unfortunately need to looking in include/global.h to see what these correspond to.

Definition at line 39 of file init.c.

unsigned long todtick

Time of day tick.

Definition at line 75 of file init.c.

World's darkness value.

Definition at line 72 of file init.c.