/*
* Set time and weather.
*/
{
int lhour,
lday,
lmonth;
lhour = ( current_time - 650336715 ) / ( PULSE_TICK / PULSE_PER_SECOND );
wiley=> SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 650336715 * INTERVAL '1 second';
?column?
————————
1990-08-10 21:05:15-04
(1 row)
/*
* Check age and reset.
* Note: Mud School resets every 3 minutes (not 15).
*/
<: 2008-10-25 19:23:57.004 : BOOT (comm.c;main,208)
: RaM is ready to rock on port 4000.
<: 2008-10-25 19:23:57.005 : RESET : mud school has just been reset.
<: 2008-10-25 19:25:57.970 : RESET : mud school has just been reset.
<: 2008-10-25 19:27:58.935 : RESET : mud school has just been reset.
<: 2008-10-25 19:28:07.091 : FATAL (comm.c;proper_exit,2207)
: Shutdown by SYSTEM – Received SIGINT or SIGTERM.
quixadhal@virt2:~/svn/ram-project/src$ egrep '\\r\\n' *.c
act_info.c: "\n\r============================================================\n\r\n\r" );
act_wiz.c: send_to_char( "You cannot abbreviate the prefix command.\r\n", ch );
act_wiz.c: send_to_char( "You have no prefix to clear.\r\n", ch );
act_wiz.c: send_to_char( "Prefix removed.\r\n", ch );
act_wiz.c: sprintf( buf, "Prefix changed to %s.\r\n", argument );
act_wiz.c: sprintf( buf, "Prefix set to %s.\r\n", argument );
alias.c: send_to_char( "Line to long, prefix not processed.\r\n", ch );
alias.c: send_to_char( "Alias substitution too long. Truncated.\r\n", ch );
fight.c: send_to_char( "You have been KILLED!!\n\r\n\r", victim );
However, it's a non-intrusive container class that implements by default a self balancing binary tree. (Which is perfect for this problem.) Since we all know a balance binary tree gives us logarithmic search times.
Another interesting feature of a map in C++ is being able to assign it multiple types to be the "key". Such as
Not really practical for our case, but still interesting.
Multimaps are also interesting. It allows a single key to point to multiple instances of a type. Such as the key being a room vnum, and the multiple objects being the CHAR_DATA*'s inside of said room. boost library uses a 2way map that I actually employ that lets you lookup the key by value or, like one way maps, value by key.