#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "merc.h"
#include "db.h"
#include "recycle.h"
#include "music.h"
#include "tables.h"
#include "lookup.h"
#include "olc.h"
Include dependency graph for db.c:

Go to the source code of this file.
|
|
Value: |
|
|
Definition at line 214 of file db.c. Referenced by alloc_mem(), do_memory_freelists(), do_memory_perms(), free_mem(), and rgSize_lookup(). |
|
|
Value: if ( !str_cmp( word, string ) ) \ { \ free_string( field ); \ field = fread_string( fp ); \ fMatch = TRUE; \ break; \ } Definition at line 554 of file db.c. Referenced by new_load_area(). |
|
||||||||||||||||
|
Definition at line 3922 of file db.c. References fpReserve, IS_NPC, and send_to_char(). Referenced by do_bug(), do_help(), do_shutdown(), and do_typo(). 03923 {
03924 FILE *fp;
03925
03926 if (IS_NPC (ch) || str[0] == '\0')
03927 return;
03928
03929 fclose (fpReserve);
03930 if ((fp = fopen (file, "a")) == NULL)
03931 {
03932 perror (file);
03933 send_to_char ("Could not open the file!\n\r", ch);
03934 }
03935 else
03936 {
03937 fprintf (fp, "[%5d] %s: %s\n",
03938 ch->in_room ? ch->in_room->vnum : 0, ch->name, str);
03939 fclose (fp);
03940 }
03941
03942 fpReserve = fopen (NULL_FILE, "r");
03943 return;
03944 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 3946 of file db.c. References fpReserve. Referenced by do_dump_objects(). 03947 {
03948 FILE *fp;
03949
03950 // if (IS_NPC (ch) || str[0] == '\0')
03951 // return;
03952
03953 fclose (fpReserve);
03954 if ((fp = fopen (file, "a")) == NULL)
03955 {
03956 perror (file);
03957 // send_to_char ("Could not open the file!\n\r", ch);
03958 }
03959 else
03960 {
03961 fprintf (fp, "%s", str);
03962 fclose (fp);
03963 }
03964 fpReserve = fopen (NULL_FILE, "r");
03965 return;
03966 }
|
|
|
Definition at line 1676 of file db.c. References area_data::age, room_index_data::area, area_first, area_data::empty, get_room_index(), MAX_STRING_LENGTH, area_data::name, area_data::next, area_data::nplayer, number_range(), reset_area(), ROOM_VNUM_SCHOOL, TRUE, WIZ_RESETS, and wiznet(). Referenced by boot_db(), and update_handler(). 01677 {
01678 AREA_DATA *pArea;
01679 char buf[MAX_STRING_LENGTH];
01680
01681 for (pArea = area_first; pArea != NULL; pArea = pArea->next)
01682 {
01683
01684
01685 if (++pArea->age < 3)
01686 continue;
01687
01688 /*
01689 * Check age and reset.
01690 * Note: Mud School resets every 3 minutes (not 15).
01691 */
01692 if ((!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15))
01693 || pArea->age >= 31)
01694 {
01695 ROOM_INDEX_DATA *pRoomIndex;
01696
01697 reset_area (pArea);
01698 sprintf (buf, "%s has just been reset.", pArea->name);
01699 wiznet (buf, NULL, NULL, WIZ_RESETS, 0, 0);
01700
01701 pArea->age = number_range (0, 3);
01702 pRoomIndex = get_room_index (ROOM_VNUM_SCHOOL);
01703 if (pRoomIndex != NULL && pArea == pRoomIndex->area)
01704 pArea->age = 15 - 2;
01705 else if (pArea->nplayer == 0)
01706 pArea->empty = TRUE;
01707 }
01708
01709 }
01710
01711 return;
01712 }
|
Here is the call graph for this function:

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 646 of file db.c. References area_last, area_data::max_vnum, area_data::min_vnum, and URANGE. Referenced by load_mobiles(), load_objects(), load_old_mob(), load_old_obj(), and load_rooms(). 00647 {
00648 if (area_last->min_vnum == 0 || area_last->max_vnum == 0)
00649 area_last->min_vnum = area_last->max_vnum = vnum;
00650 if (vnum != URANGE (area_last->min_vnum, vnum, area_last->max_vnum))
00651 {
00652 if (vnum < area_last->min_vnum)
00653 area_last->min_vnum = vnum;
00654 else
00655 area_last->max_vnum = vnum;
00656 }
00657 return;
00658 }
|
|
|
Definition at line 264 of file db.c. References AREA_LIST, area_update(), bug(), weather_data::change, convert_objects(), current_area, current_time, time_info_data::day, FALSE, fBootDb, fix_exits(), fix_mobprogs(), fpArea, fread_letter(), fread_word(), time_info_data::hour, init_mm(), load_area(), load_bans(), load_clan_data(), load_classes(), load_disabled(), load_enhanced_disable(), load_game_conf(), load_helps(), load_kingdom_data(), load_mobiles(), load_mobprogs(), load_notes(), load_objects(), load_old_mob(), load_old_obj(), load_resets(), load_rooms(), load_shops(), load_socials(), load_songs(), load_specials(), load_vehicles(), MAX_SKILL, weather_data::mmhg, time_info_data::month, new_load_area(), number_range(), skill_type::pgsn, PULSE_PER_SECOND, PULSE_TICK, send_to_all_copyover(), skill_table, weather_data::sky, SKY_CLOUDLESS, SKY_CLOUDY, SKY_LIGHTNING, SKY_RAINING, str_cmp(), strArea, string_space, strspace_alloc(), SUN_DARK, SUN_LIGHT, SUN_RISE, SUN_SET, weather_data::sunlight, time_info, top_string, TRUE, twiddle(), weather_info, and time_info_data::year. Referenced by main(). 00265 {
00266
00267 /*
00268 * Init some data space stuff.
00269 */
00270 {
00271 // if ((string_space = calloc (1, MAX_STRING)) == NULL)
00272 // {
00273 // bug ("Boot_db: can't alloc %d string space.", MAX_STRING);
00274 // exit (1);
00275 // }
00276 strspace_alloc();
00277 top_string = string_space;
00278 fBootDb = TRUE;
00279 }
00280
00281 /*
00282 * Init random number generator.
00283 */
00284 {
00285 init_mm ();
00286 }
00287
00288 /*
00289 * Set time and weather.
00290 */
00291 {
00292 long lhour, lday, lmonth;
00293 send_to_all_copyover("Loading weather ");
00294 lhour = (current_time - 650336715) / (PULSE_TICK / PULSE_PER_SECOND);
00295 time_info.hour = lhour % 24;
00296 lday = lhour / 24;
00297 time_info.day = lday % 35;
00298 lmonth = lday / 35;
00299 time_info.month = lmonth % 17;
00300 time_info.year = lmonth / 17;
00301
00302 if (time_info.hour < 5)
00303 weather_info.sunlight = SUN_DARK;
00304 else if (time_info.hour < 6)
00305 weather_info.sunlight = SUN_RISE;
00306 else if (time_info.hour < 19)
00307 weather_info.sunlight = SUN_LIGHT;
00308 else if (time_info.hour < 20)
00309 weather_info.sunlight = SUN_SET;
00310 else
00311 weather_info.sunlight = SUN_DARK;
00312
00313 weather_info.change = 0;
00314 weather_info.mmhg = 960;
00315 if (time_info.month >= 7 && time_info.month <= 12)
00316 weather_info.mmhg += number_range (1, 50);
00317 else
00318 weather_info.mmhg += number_range (1, 80);
00319
00320 if (weather_info.mmhg <= 980)
00321 weather_info.sky = SKY_LIGHTNING;
00322 else if (weather_info.mmhg <= 1000)
00323 weather_info.sky = SKY_RAINING;
00324 else if (weather_info.mmhg <= 1020)
00325 weather_info.sky = SKY_CLOUDY;
00326 else
00327 weather_info.sky = SKY_CLOUDLESS;
00328
00329 }
00330 send_to_all_copyover(" Done.\n\r");
00331
00332 {
00333 //crs_info.status = 0;
00334 //crs_info.who = &str_empty[0];
00335 //crs_info.reason = &str_empty[0];
00336 //crs_info.timer = -1;
00337 }
00338 /*
00339 * Assign gsn's for skills which have them.
00340 */
00341 {
00342 int sn;
00343
00344 for (sn = 0; sn < MAX_SKILL; sn++)
00345 {
00346 if (skill_table[sn].pgsn != NULL)
00347 *skill_table[sn].pgsn = sn;
00348 }
00349 }
00350 send_to_all_copyover("Loading classes ");
00351 load_classes();
00352
00353 send_to_all_copyover("Loading BTS's Game Settings ");
00354 load_game_conf();
00355 send_to_all_copyover("\bDone.\n\r");
00356 send_to_all_copyover("Loading Kingdom Data ");
00357 load_kingdom_data();
00358 send_to_all_copyover("\bDone.\n\r");
00359 send_to_all_copyover("Loading Clan Data ");
00360 load_clan_data();
00361 send_to_all_copyover("\bDone.\n\r");
00362 /*
00363 * Read in all the area files.
00364 */
00365 {
00366 FILE *fpList;
00367 send_to_all_copyover( "Loading area files "); twiddle();
00368 if ((fpList = fopen (AREA_LIST, "r")) == NULL)
00369 {
00370 perror (AREA_LIST);
00371 exit (1);
00372 }
00373
00374 for (;;)
00375 {
00376
00377
00378 strcpy (strArea, fread_word (fpList));
00379 if (strArea[0] == '$')
00380 break;
00381
00382 if (strArea[0] == '-')
00383 {
00384 fpArea = stdin;
00385 }
00386 else
00387 {
00388 if ((fpArea = fopen (strArea, "r")) == NULL)
00389 {
00390 perror (strArea);
00391 exit (1);
00392 }
00393 }
00394
00395 current_area = NULL;
00396
00397 for (;;)
00398 {
00399 char *word;
00400
00401 if (fread_letter (fpArea) != '#')
00402 {
00403 bug ("Boot_db: # not found.", 0);
00404 exit (1);
00405 }
00406
00407 word = fread_word (fpArea);
00408
00409 if (word[0] == '$')
00410 break;
00411 else if (!str_cmp (word, "AREA")) {
00412 load_area (fpArea);
00413 }
00414 /* OLC */
00415 else if (!str_cmp (word, "AREADATA"))
00416 new_load_area (fpArea);
00417 else if (!str_cmp (word, "HELPS"))
00418 load_helps (fpArea, strArea);
00419 else if (!str_cmp (word, "MOBOLD"))
00420 load_old_mob (fpArea);
00421 else if (!str_cmp (word, "MOBILES"))
00422 load_mobiles (fpArea);
00423 else if (!str_cmp (word, "MOBPROGS"))
00424 load_mobprogs (fpArea);
00425 else if (!str_cmp (word, "OBJOLD"))
00426 load_old_obj (fpArea);
00427 else if (!str_cmp (word, "OBJECTS"))
00428 load_objects (fpArea);
00429 else if (!str_cmp (word, "RESETS"))
00430 load_resets (fpArea);
00431 else if (!str_cmp (word, "ROOMS"))
00432 load_rooms (fpArea);
00433 else if (!str_cmp (word, "SHOPS"))
00434 load_shops (fpArea);
00435 else if (!str_cmp (word, "SOCIALS"))
00436 load_socials (fpArea);
00437 else if (!str_cmp (word, "SPECIALS"))
00438 load_specials (fpArea);
00439 else
00440 {
00441 bug ("Boot_db: bad section name.", 0);
00442 exit (1);
00443 }
00444 }
00445
00446 if (fpArea != stdin)
00447 fclose (fpArea);
00448 fpArea = NULL;
00449 }
00450 fclose (fpList);
00451 send_to_all_copyover("\bDone.\n\r");
00452 }
00453
00454 /*
00455 * Fix up exits.
00456 * Declare db booting over.
00457 * Reset all areas once.
00458 * Load up the songs, notes and ban files.
00459 */
00460 {
00461 send_to_all_copyover("Fixing exits ");
00462 fix_exits ();
00463 fix_mobprogs ();
00464 fBootDb = FALSE;
00465 convert_objects (); /* ROM OLC */
00466 send_to_all_copyover("\bDone.\n\rUpdating areas ");
00467 area_update ();
00468 // load_boards();
00469 // save_notes();
00470 send_to_all_copyover("\bDone.\n\rLoading vehicles ");
00471 load_vehicles();
00472 send_to_all_copyover("Loading banned sites ");
00473 load_bans ();
00474 load_songs ();
00475 send_to_all_copyover("\bDone.\n\r");
00476 send_to_all_copyover("Loading notes ");
00477 load_notes();
00478 send_to_all_copyover("\bDone.\n\r");
00479 send_to_all_copyover("Loading disabled commands ");
00480 load_disabled();
00481 load_enhanced_disable();
00482
00483 send_to_all_copyover("\bDone.\n\r");
00484
00485
00486 }
00487
00488 return;
00489 }
|
Here is the call graph for this function:

|
||||||||||||
Here is the call graph for this function:

|
|
Definition at line 3906 of file db.c. References LOWER, MAX_STRING_LENGTH, and UPPER. Referenced by check_ban(), check_parse_name(), display_resets(), do_delete(), do_exits(), do_group(), do_guild(), do_play(), do_rename(), do_score2(), expand_arg(), load_char_obj(), REDIT(), save_char_obj(), save_resets(), and show_help(). 03907 {
03908 static char strcap[MAX_STRING_LENGTH];
03909 int i;
03910
03911 for (i = 0; str[i] != '\0'; i++)
03912 strcap[i] = LOWER (str[i]);
03913 strcap[i] = '\0';
03914 strcap[0] = UPPER (strcap[0]);
03915 return strcap;
03916 }
|
|
||||||||||||
|
Definition at line 4081 of file db.c. References MAX_PERMIT, char_data::permit, and char_data::permited_by. Referenced by do_quit(). 04082 {
04083 int pChar=0;
04084 int pChar2=0;
04085 CHAR_DATA *victim;
04086
04087 for (pChar=0;pChar < MAX_PERMIT; pChar++)
04088 {
04089 if (ch->permit[pChar] != NULL)
04090 {
04091 /* Must remove other char's stuff first! */
04092 victim = ch->permit[pChar];
04093 for (pChar2 = 0; pChar2 < MAX_PERMIT; pChar2++)
04094 {
04095 if (victim->permit[pChar2] == ch)
04096 victim->permit[pChar2] = NULL;
04097 if (victim->permited_by[pChar2] == ch)
04098 victim->permited_by[pChar2] = NULL;
04099 }
04100 ch->permit[pChar] = NULL;
04101 }
04102
04103 if (ch->permited_by[pChar] != NULL)
04104 {
04105 victim = ch->permited_by[pChar];
04106 for (pChar2 = 0; pChar2 < MAX_PERMIT; pChar2++)
04107 {
04108 if (victim->permited_by[pChar2] == ch)
04109 victim->permited_by[pChar2] = NULL;
04110 if (victim->permit[pChar2] == ch)
04111 victim->permit[pChar2] = NULL;
04112 }
04113 ch->permited_by[pChar] = NULL;
04114 }
04115 }
04116 return;
04117 }
|
|
||||||||||||
|
Definition at line 4063 of file db.c. References FALSE, get_mob_index(), IS_AFFECTED, TO_AFFECTS, and TRUE. Referenced by fread_pet(). 04064 {
04065 MOB_INDEX_DATA *petIndex;
04066
04067 petIndex = get_mob_index(vnum);
04068 if (petIndex == NULL)
04069 return FALSE;
04070
04071 if (paf->where == TO_AFFECTS)
04072 if (IS_AFFECTED(petIndex, paf->bitvector))
04073 return TRUE;
04074
04075 return FALSE;
04076 }
|
Here is the call graph for this function:

|
|
Definition at line 2629 of file db.c. References char_data::armor, current_time, char_data::description, char_data::hit, char_data::lines, char_data::logon, char_data::long_descr, char_data::mana, char_data::max_hit, char_data::max_mana, char_data::max_move, MAX_STATS, char_data::move, char_data::name, char_data::on, PAGELEN, POS_STANDING, char_data::position, char_data::prompt, char_data::short_descr, and str_empty. 02630 {
02631 static CHAR_DATA ch_zero;
02632 int i;
02633
02634 *ch = ch_zero;
02635 ch->name = &str_empty[0];
02636 ch->short_descr = &str_empty[0];
02637 ch->long_descr = &str_empty[0];
02638 ch->description = &str_empty[0];
02639 ch->prompt = &str_empty[0];
02640 ch->logon = current_time;
02641 ch->lines = PAGELEN;
02642 for (i = 0; i < 4; i++)
02643 ch->armor[i] = 100;
02644 ch->position = POS_STANDING;
02645 ch->hit = 20;
02646 ch->max_hit = 20;
02647 ch->mana = 100;
02648 ch->max_mana = 100;
02649 ch->move = 100;
02650 ch->max_move = 100;
02651 ch->on = NULL;
02652 for (i = 0; i < MAX_STATS; i++)
02653 {
02654 ch->perm_stat[i] = 25;
02655 ch->mod_stat[i] = 0;
02656 }
02657 return;
02658 }
|
|
||||||||||||
|
Definition at line 2351 of file db.c. References char_data::act, affect_to_char(), char_data::affected_by, char_data::alignment, char_data::armor, char_data::class, char_data::comm, char_data::dam_type, char_data::damage, char_data::damroll, char_data::default_pos, char_data::description, char_data::exp, char_data::form, char_data::gold, char_data::group, char_data::hit, char_data::hitroll, char_data::imm_flags, char_data::invis_level, IS_NPC, char_data::level, char_data::long_descr, char_data::mana, char_data::material, char_data::max_hit, char_data::max_mana, char_data::max_move, MAX_STATS, char_data::mod_stat, char_data::move, char_data::name, affect_data::next, char_data::off_flags, char_data::parts, char_data::perm_stat, char_data::position, char_data::practice, char_data::race, char_data::res_flags, char_data::saving_throw, char_data::sex, char_data::short_descr, char_data::silver, char_data::size, char_data::spec_fun, char_data::start_pos, str_dup(), char_data::timer, char_data::train, char_data::trust, char_data::version, char_data::vuln_flags, char_data::wait, and char_data::wimpy. Referenced by do_clone(). 02352 {
02353 int i;
02354 AFFECT_DATA *paf;
02355
02356 if (parent == NULL || clone == NULL || !IS_NPC (parent))
02357 return;
02358
02359 /* start fixing values */
02360 clone->name = str_dup (parent->name);
02361 clone->version = parent->version;
02362 clone->short_descr = str_dup (parent->short_descr);
02363 clone->long_descr = str_dup (parent->long_descr);
02364 clone->description = str_dup (parent->description);
02365 clone->group = parent->group;
02366 clone->sex = parent->sex;
02367 clone->class = parent->class;
02368 clone->race = parent->race;
02369 clone->level = parent->level;
02370 clone->trust = 0;
02371 clone->timer = parent->timer;
02372 clone->wait = parent->wait;
02373 clone->hit = parent->hit;
02374 clone->max_hit = parent->max_hit;
02375 clone->mana = parent->mana;
02376 clone->max_mana = parent->max_mana;
02377 clone->move = parent->move;
02378 clone->max_move = parent->max_move;
02379 clone->gold = parent->gold;
02380 clone->silver = parent->silver;
02381 clone->exp = parent->exp;
02382 clone->act = parent->act;
02383 clone->comm = parent->comm;
02384 clone->imm_flags = parent->imm_flags;
02385 clone->res_flags = parent->res_flags;
02386 clone->vuln_flags = parent->vuln_flags;
02387 clone->invis_level = parent->invis_level;
02388 clone->affected_by = parent->affected_by;
02389 clone->position = parent->position;
02390 clone->practice = parent->practice;
02391 clone->train = parent->train;
02392 clone->saving_throw = parent->saving_throw;
02393 clone->alignment = parent->alignment;
02394 clone->hitroll = parent->hitroll;
02395 clone->damroll = parent->damroll;
02396 clone->wimpy = parent->wimpy;
02397 clone->form = parent->form;
02398 clone->parts = parent->parts;
02399 clone->size = parent->size;
02400 clone->material = str_dup (parent->material);
02401 clone->off_flags = parent->off_flags;
02402 clone->dam_type = parent->dam_type;
02403 clone->start_pos = parent->start_pos;
02404 clone->default_pos = parent->default_pos;
02405 clone->spec_fun = parent->spec_fun;
02406
02407 for (i = 0; i < 4; i++)
02408 clone->armor[i] = parent->armor[i];
02409
02410 for (i = 0; i < MAX_STATS; i++)
02411 {
02412 clone->perm_stat[i] = parent->perm_stat[i];
02413 clone-> |