Crossfire Server, Branch 1.12
R12190
|
Time-related functions. More...
Go to the source code of this file.
Functions | |
static void | dawn_to_dusk (const timeofday_t *tod) |
Compute the darkness level for all loaded maps in the game. | |
void | set_darkness_map (mapstruct *m) |
Set the darkness level for a map, based on the time of the day. | |
int | similar_direction (int a, int b) |
Is direction a similar to direction b? Find out in this exciting function below. | |
void | tick_the_clock (void) |
This performs the basic function of advancing the clock one tick forward. | |
Variables | |
static const int | season_timechange [5][HOURS_PER_DAY] |
How to alter darkness, based on time of day and season. | |
unsigned long | todtick |
Ingame time. |
Time-related functions.
Definition in file weather.c.
static void dawn_to_dusk | ( | const timeofday_t * | tod | ) | [static] |
Compute the darkness level for all loaded maps in the game.
tod | time of day to compute darkness for. |
Definition at line 85 of file weather.c.
References change_map_light(), first_map, _timeofday::hour, mapdef::next, mapdef::outdoor, _timeofday::season, and season_timechange.
Referenced by tick_the_clock().
void set_darkness_map | ( | mapstruct * | m | ) |
Set the darkness level for a map, based on the time of the day.
m | map to alter. |
Definition at line 61 of file weather.c.
References change_map_light(), mapdef::darkness, get_tod(), _timeofday::hour, HOURS_PER_DAY, mapdef::outdoor, _timeofday::season, and season_timechange.
int similar_direction | ( | int | a, |
int | b | ||
) |
Is direction a similar to direction b? Find out in this exciting function below.
a | |
b | directions to compare. |
Definition at line 132 of file weather.c.
Referenced by player_fire_bow().
void tick_the_clock | ( | void | ) |
This performs the basic function of advancing the clock one tick forward.
Every 20 ticks, the clock is saved to disk. It is also saved on shutdown. Any time dependant functions should be called from this function, and probably be passed tod as an argument. Please don't modify tod in the dependant function.
Definition at line 111 of file weather.c.
References dawn_to_dusk(), get_tod(), todtick, and write_todclock().
Referenced by block_until_new_connection(), and do_specials().
const int season_timechange[5][HOURS_PER_DAY] [static] |
{ { 0, 0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0 } }
How to alter darkness, based on time of day and season.
Definition at line 46 of file weather.c.
Referenced by dawn_to_dusk(), and set_darkness_map().