1 /* $Id$ */ 2 /* File: variable.c */ 3 4 /* Purpose: Angband variables */ 5 6 /* 7 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke 8 * 9 * This software may be copied and distributed for educational, research, and 10 * not for profit purposes provided that this copyright and statement are 11 * included in all such copies. 12 */ 13 14 #define SERVER 15 16 #include "angband.h" 17 18 19 /* 20 * Hack -- Link a copyright message into the executable 21 */ 22 cptr copyright[6] = 23 { 24 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke", 25 "also Copyright (c) 1997 Keldon L. Jones", 26 "", 27 "This software may be copied and distributed for educational, research,", 28 "and not for profit purposes provided that this copyright and statement", 29 "are included in all such copies." 30 }; 31 32 33 /* 34 * Hack -- Link the "version" into the executable 35 */ 36 byte version_major = SF_VERSION_MAJOR; 37 byte version_minor = SF_VERSION_MINOR; 38 byte version_patch = SF_VERSION_PATCH; 39 byte version_extra = SF_VERSION_EXTRA; 40 41 42 /* 43 * Hack -- Savefile version 44 */ 45 byte sf_major; /* Savefile's "version_major" */ 46 byte sf_minor; /* Savefile's "version_minor" */ 47 byte sf_patch; /* Savefile's "version_patch" */ 48 byte sf_extra; /* Savefile's "version_extra" */ 49 50 51 /* 52 * Hack -- Savefile information 53 */ 54 u32b sf_xtra; /* Operating system info */ 55 u32b sf_when; /* Time when savefile created */ 56 u16b sf_lives; /* Number of past "lives" with this file */ 57 u16b sf_saves; /* Number of "saves" during this life */ 58 59 60 /* 61 * Hack -- Server Savefile version 62 */ 63 byte ssf_major; /* Savefile's "version_major" */ 64 byte ssf_minor; /* Savefile's "version_minor" */ 65 byte ssf_patch; /* Savefile's "version_patch" */ 66 byte ssf_extra; /* Savefile's "version_extra" */ 67 68 byte qsf_major; /* Quest Savefile's "version_major" */ 69 byte qsf_minor; /* Quest Savefile's "version_minor" */ 70 byte qsf_patch; /* Quest Savefile's "version_patch" */ 71 byte qsf_extra; /* Quest Savefile's "version_extra" */ 72 73 /* 74 * Hack -- Run-time arguments 75 */ 76 bool server_generated; /* The character exists */ 77 bool server_dungeon; /* The character has a dungeon */ 78 //bool central_town_loaded = FALSE; 79 bool server_state_loaded; /* The server state was loaded from a savefile */ 80 bool server_saved; /* The character was just saved to a savefile */ 81 82 bool character_loaded; /* The character was loaded from a savefile */ 83 84 u32b seed_flavor; /* Hack -- consistent object colors */ 85 u32b seed_town; /* Hack -- consistent town layout */ 86 u32b seed_wild_extra; /* Hack -- random additional wilderness features (used in terrain_spot()) */ 87 88 s16b command_new; /* Command chaining from inven/equip view */ 89 90 bool create_up_stair; /* Auto-create "up stairs" */ 91 bool create_down_stair; /* Auto-create "down stairs" */ 92 93 s16b num_repro; /* Current reproducer count */ 94 s16b object_level; /* Current object creation level */ 95 s16b object_discount = 0; /* for resulting items of a stolen acquirement scroll (!) */ 96 s16b monster_level; /* Current monster creation level */ 97 s16b monster_level_min = 0; /* Current monster creation minimum level, -1 = auto, 0 = none */ 98 99 s32b turn, session_turn; /* Current game turn; session_turn is the turn this server went online, ie start of current session */ 100 s32b turn_overflow = 2000000000;/* Limit when to reset 'turn' to 1 to prevent overflow symptoms */ 101 102 #ifdef ARCADE_SERVER 103 char tron_speed = 9; 104 char tron_dark = 0; 105 char tron_forget = 0; 106 worldpos arcpos[100]; 107 #endif 108 109 s32b player_id; /* Current player ID */ 110 u32b account_id; /* Current account ID */ 111 112 u16b panic_save = 0; /* Track some special "conditions" */ 113 114 s16b signal_count = 0; /* Hack -- Count interupts */ 115 116 s16b coin_type; /* Hack -- force coin type */ 117 118 bool opening_chest; /* Hack -- prevent chest generation */ 119 s32b opening_chest_owner; 120 byte opening_chest_mode; 121 122 bool scan_monsters; /* Hack -- optimize multi-hued code, etc */ 123 bool scan_objects; /* Hack -- optimize multi-hued code, etc */ 124 125 s32b o_nxt = 1; /* Object free scanner */ 126 s32b m_nxt = 1; /* Monster free scanner */ 127 128 s32b o_max = 1; /* Object heap size */ 129 s32b m_max = 1; /* Monster heap size */ 130 131 s32b o_top = 0; /* Object top size */ 132 s32b m_top = 0; /* Monster top size */ 133 134 s32b dungeon_store_timer = 0; /* Timemout. Keeps track of its generation */ 135 s32b dungeon_store2_timer = 0; /* Timemout. Keeps track of its generation */ 136 s32b great_pumpkin_timer = 0; /* Timeout. Keeps track of its generation, for HALLOWEEN */ 137 //s32b great_pumpkin_killer = 0; /* Player who killed him last time */ 138 char great_pumpkin_killer[NAME_LEN] = { 0 }; /* Player who killed him last time */ 139 s32b great_pumpkin_duration = 0; /* How long its instance lasts till it despawns */ 140 s32b santa_claus_timer = 0; 141 bool night_surface = FALSE; 142 143 s16b MaxSimultaneousPlayers = 0; /* Tracks very high amounts of simultaneously logged-in players, 144 writes to log file then: 'SimultaneousPlayers ...' - C. Blue */ 145 146 char serverStartupTime[40]; /* String containing the clock time when the server was started */ 147 char *sST = serverStartupTime; 148 149 /* 150 * Server options, set in tomenet.cfg 151 */ 152 153 154 server_opts cfg = { 155 /* others */ 156 6, 0, 0, // runlevel, runtime, closetime (NOT config options) 157 158 /* char * */ 159 "meta.tomenet.eu",// meta_address 160 8800, // meta port 161 162 "", // bind_name 163 "changeme", // console_password 164 "DungeonWizard",// admin_wizard 165 "DungeonMaster",// dungeon_master 166 "", // wserver, 167 168 "", // pass 169 /* s32b */ 170 201, // preserve_death_level 171 300,50000, // unique_respawn_time, unique_max_respawn_time 172 2, // level_unstatic_chance, 173 174 8, // min_unstatic_level 175 -1,18348,18349,18400,// retire_timer, game_port, console_port, gw_port 176 177 10,200, // spell_interfere, spell_stack_limit 178 /* s16b */ 179 60,FALSE,3,5, // fps, players_never_expire, newbies_cannot_drop, running_speed, 180 181 25, 150, // anti_scum, dun_unusual, 182 32,32, // town_x, town_y 183 0, // town_base, 184 185 1, //dun_base 186 127, 200, 50, // dun_max, store_turns, dun_store_turns 187 /* char */ 188 3, 2, // resting_rate, party_xp_boost 189 190 0, 1, // use_pk_rules, quit_ban_mode 191 33, 67, 33, // zang_monsters, pern_monsters, cth_monsters 192 0, 67, 100, 0, // joke_monsters, cblue_monsters, vanilla_monsters, pet_monsters 193 /* bool */ 194 TRUE,TRUE, // report_to_meta, secret_dungeon_master 195 196 // anti_arts_hoard, anti_arts_house, anti_arts_wild, anti_arts_shop, anti_arts_pickup, anti_arts_send 197 FALSE,TRUE,TRUE,FALSE,TRUE,TRUE, 198 FALSE, // persistent_artifacts 199 FALSE,TRUE, // anti_cheeze_pickup, anti_cheeze_telekinesis 200 20, // surface_item_removal (minutes for scan_objs) 201 45, // dungeon_item_removal (minutes for scan_objs) 202 1440, // death_wild_item_removal 203 21060, // long_wild_item_removal 204 100, 999, 5, // dungeon_shop_chance (*10), dungeon_shop_type (999=random), dungeon_shop_timeout 205 206 FALSE, // mage_hp_bonus 207 7,FALSE,0, // door_bump_open, no_ghost, lifes (0 = infinite), 208 8,1,TRUE, // maxhouses = 50/_houses_per_player_, castles_per_player, castles_for_kings 209 TRUE,TRUE,TRUE,TRUE, // maximize, kings_etiquette, fallenkings_etiquette, strict_etiquette 210 211 FALSE,FALSE, // public_rfe, auto_purge 212 FALSE,114,0, // log_u, replace_hiscore, unikill_format 213 "", // server notes for meta list 214 FALSE, // artifact creation disabled for maintenance reasons? (arts_disabled) 215 TRUE, // total winners may not find true arts anymore? (winners_find_randarts) 216 1, // arts_level_req - Only SPECIAL_GENE arts from DROP_CHOSEN have 0. 217 FALSE, // surface_summoning is disabled by default to prevent BAD cheeze. 218 3, /* clone_summoning - how many times may a monster summon before the summmons become clones 219 (and summon -if they can do that- more clones themselves).*/ 220 3, /* henc_strictness - how easily monsters adjust their exp to their highest player encounter */ 221 1, /* bonus_calc_type - how HP are calculated (0 = old, 1 = new way) */ 222 6, /* charmode_trading_restrictions FLAGS: how restricted is trading? 0 = no exchange, +1 = ever can take (nonever&&nonpvp) items (bad idea), +2 = pvp can take ever, +4 = pvp can take nonever (double-edged) */ 223 0, /* item_awareness - how easily the player becomes aware of sofar un-identified items 224 0 = normal, 1 = seeing in standard town shop (1 to 6), 2 = seeing in any shop while carrying it, 3 = seeing in any shop */ 225 TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE, /* types of messages which will be transmitted through the world server (if available). */ 226 }; 227 228 struct combo_ban *banlist = NULL; 229 struct swear_info swear[MAX_SWEAR]; 230 char nonswear[MAX_NONSWEAR][NAME_LEN]; 231 int nonswear_affix[MAX_NONSWEAR]; 232 233 /* Temporary server feature flags (for LUA files) */ 234 u32b sflags_TEMP = 0x0; 235 236 /* 237 * Software options (set via the '=' command). See "tables.c" 238 */ 239 240 /* Option Set 1 -- User Interface */ 241 242 bool use_color; /* Use color if possible (slow) */ 243 244 /* Option Set 2 -- Disturbance */ 245 246 /* Option Set 3 -- Game-Play */ 247 248 bool auto_scum; /* Auto-scum for good levels */ 249 bool dungeon_align; /* Generate dungeons with aligned rooms */ 250 251 /* Option Set 4 -- Efficiency */ 252 253 bool avoid_other = FALSE; /* Avoid processing special colors */ 254 255 /* Special options */ 256 257 s16b hitpoint_warn; /* Hitpoint warning (0 to 9) */ 258 259 struct npc_type *Npcs[MAX_NPCS]; 260 /* The array of players */ 261 player_type **Players; 262 263 /* The party information */ 264 party_type parties[MAX_PARTIES]; 265 guild_type guilds[MAX_GUILDS]; 266 267 struct xorder_type xorders[MAX_XORDERS]; /* server quest data */ 268 269 #ifdef IRONDEEPDIVE_MIXED_TYPES 270 struct iddc_type iddc[128]; //(hardcode, ew) 271 #endif 272 273 /* The information about houses */ 274 house_type *houses; 275 s32b num_houses = 0; 276 u32b house_alloc = 0; 277 278 #ifdef PLAYER_STORES 279 store_type *fake_store; 280 int fake_store_visited[MAX_VISITED_PLAYER_STORES]; /* lock an instance while visited by a player */ 281 #endif 282 283 /* An array to access a Player's ID */ 284 int GetInd[MAX_ID]; 285 286 /* Buffer to hold the current savefile name */ 287 //char savefile[MAX_PATH_LENGTH]; 288 289 290 /* 291 * Array of grids lit by player lite (see "cave.c") 292 */ 293 /*s16b lite_n; 294 byte lite_y[LITE_MAX]; 295 byte lite_x[LITE_MAX];*/ 296 297 /* 298 * Array of grids for use by various functions (see "cave.c") 299 */ 300 s16b temp_n; 301 byte temp_y[TEMP_MAX]; 302 byte temp_x[TEMP_MAX]; 303 304 /* 305 * The number of quarks 306 */ 307 s16b quark__num; 308 309 /* 310 * The pointers to the quarks [QUARK_MAX] 311 */ 312 cptr *quark__str; 313 314 /* 315 * The array of indexes of "live" objects 316 */ 317 s16b o_fast[MAX_O_IDX]; 318 319 /* 320 * The array of indexes of "live" monsters 321 */ 322 s16b m_fast[MAX_M_IDX]; 323 324 325 /* 326 * The array of "cave grids" [MAX_WID][MAX_HGT]. 327 * Not completely allocated, that would be inefficient 328 * Not completely hardcoded, that would overflow memory 329 */ 330 /* For wilderness, I am hacking this to extend in the negative direction. 331 I currently have a huge number (4096?) of wilderness levels allocated. 332 -APD- 333 */ 334 335 /* I have moved the cave_type stuff to the wilderness and dungeon 336 level structures now. So, to reference the cave_type array for 337 the level (x,y,z) you would first check z for being zero. If it 338 is, return the wilderness cave_type array pointer. Otherwise 339 select the correct dungeon pointer and lookup the dungeon level 340 you want. Then return its cave_type array pointer. Of course, 341 use (cave_type**)zcave = getcave(struct worldpos *). 342 Evileye 343 */ 344 wilderness_type wild_info[MAX_WILD_Y][MAX_WILD_X]; /* seems my world may be a bit bigger */ 345 struct town_type *town = NULL; 346 u16b numtowns = 0; 347 348 /* 349 * The array of dungeon items [MAX_O_IDX] 350 */ 351 object_type *o_list; 352 353 /* 354 * The array of dungeon monsters [MAX_M_IDX] 355 */ 356 monster_type *m_list; 357 358 /* 359 * The array of dungeon traps [MAX_T_IDX] 360 * (elsewhere) 361 */ 362 // trap_type *t_list; 363 364 /* 365 * Hack -- Quest array 366 */ 367 xorder xo_list[MAX_XO_IDX]; 368 369 /* 370 * The stores [MAX_STORES] 371 */ 372 //store_type *store; 373 374 /* 375 * The size of "alloc_kind_table" (at most MAX_K_IDX * 4) 376 */ 377 s16b alloc_kind_size; 378 379 /* 380 * The entries in the "kind allocator table" 381 */ 382 alloc_entry *alloc_kind_table; 383 384 /* 385 * Index numbers for looking up level-specific entries 386 */ 387 s16b *alloc_kind_index_level; 388 389 390 /* 391 * The size of "alloc_race_table" (at most MAX_R_IDX) 392 */ 393 s16b alloc_race_size; 394 395 /* 396 * The entries in the "race allocator table" 397 */ 398 alloc_entry *alloc_race_table; 399 400 /* 401 * Dungeon specific race allocation tables 402 */ 403 alloc_entry **alloc_race_table_dun; 404 405 /* 406 * Index numbers for looking up level-specific entries 407 */ 408 s16b *alloc_race_index_level; 409 410 411 /* 412 * Unique monster mask arrays. 413 */ 414 char *allow_uniques; 415 char *reject_uniques; 416 417 418 /* 419 * Specify attr/char pairs for inventory items (by tval) 420 * Be sure to use "index & 0x7F" to avoid illegal access 421 */ 422 byte tval_to_attr[128]; 423 char tval_to_char[128]; 424 /* 425 * The vault generation arrays 426 */ 427 header *v_head; 428 vault_type *v_info; 429 char *v_name; 430 char spacer; 431 const char spacer2; 432 char *v_text; 433 434 /* 435 * The terrain feature arrays 436 */ 437 header *f_head; 438 feature_type *f_info; 439 char *f_name; 440 char *f_text; 441 442 /* 443 * The object kind arrays 444 */ 445 header *k_head; 446 object_kind *k_info; 447 char *k_name; 448 char *k_text; 449 450 s16b k_info_num[MAX_K_IDX]; /* mapper from internal k_idx to the N-numbers in k_info.txt */ 451 452 /* 453 * The artifact arrays 454 */ 455 header *a_head; 456 artifact_type *a_info; 457 char *a_name; 458 char *a_text; 459 460 /* 461 * The ego-item arrays 462 */ 463 header *e_head; 464 ego_item_type *e_info; 465 char *e_name; 466 char *e_text; 467 s16b *e_tval_size; 468 s16b **e_tval; 469 470 /* jk / Jir */ 471 /* the trap-arrays/variables */ 472 header *t_head; 473 trap_kind *t_info; 474 char *t_name; 475 char *t_text; 476 477 478 /* 479 * The monster race arrays 480 */ 481 header *r_head; 482 monster_race *r_info; 483 char *r_name; 484 char *r_text; 485 486 /* 487 * The monster ego race arrays 488 */ 489 #ifdef RANDUNIS 490 header *re_head; 491 monster_ego *re_info; 492 char *re_name; 493 494 #endif 495 496 /* 497 * The dungeon types arrays 498 */ 499 header *d_head; 500 dungeon_info_type *d_info; 501 char *d_name; 502 char *d_text; 503 504 /* 505 * Player skills arrays 506 */ 507 header *s_head; 508 skill_type *s_info; 509 char *s_name; 510 char *s_text; 511 512 #if 1 513 /* 514 * The store/building types arrays 515 */ 516 header *st_head; 517 store_info_type *st_info; 518 char *st_name; 519 /* char *st_text; */ 520 521 /* 522 * The building actions types arrays 523 */ 524 header *ba_head; 525 store_action_type *ba_info; 526 char *ba_name; 527 /* char *ba_text; */ 528 #endif // 0 529 530 /* 531 * The owner types arrays 532 */ 533 header *ow_head; 534 owner_type *ow_info; 535 char *ow_name; 536 /* char *ow_text; */ 537 538 539 /* 540 * Hack -- The special Angband "System Suffix" 541 * This variable is used to choose an appropriate "pref-xxx" file 542 */ 543 cptr ANGBAND_SYS = "xxx"; 544 545 /* 546 * Path name: The main "lib" directory 547 * This variable is not actually used anywhere in the code 548 */ 549 cptr ANGBAND_DIR; 550 551 552 /* 553 * Scripts 554 */ 555 cptr ANGBAND_DIR_SCPT; 556 557 /* 558 * Various data files for the game, such as the high score and 559 * the mangband logs. 560 */ 561 cptr ANGBAND_DIR_DATA; 562 563 /* 564 * Server configuration files 565 */ 566 cptr ANGBAND_DIR_CONFIG; 567 568 /* 569 * Textual template files for the "*_info" arrays (ascii) 570 * These files are portable between platforms 571 */ 572 cptr ANGBAND_DIR_GAME; 573 574 /* 575 * Various user editable text files (ascii), such as the help and greeting 576 * screen. These files may be portable between platforms 577 */ 578 cptr ANGBAND_DIR_TEXT; 579 580 /* 581 * Savefiles for current characters (binary) 582 * These files are portable between platforms 583 */ 584 cptr ANGBAND_DIR_SAVE; 585 586 /* 587 * User "preference" files (ascii) 588 * These files are rarely portable between platforms 589 */ 590 cptr ANGBAND_DIR_USER; 591 592 /* 593 * Mangband configuration file 594 * Usually it's 'tomenet.cfg' 595 */ 596 cptr MANGBAND_CFG; 597 598 /* 599 * Total Hack -- allow all items to be listed (even empty ones) 600 * This is only used by "do_cmd_inven_e()" and is cleared there. 601 */ 602 bool item_tester_full; 603 604 605 /* 606 * Here is a "pseudo-hook" used during calls to "get_item()" and 607 * "show_inven()" and "show_equip()", and the choice window routines. 608 */ 609 byte item_tester_tval; 610 611 612 /* 613 * Here is a "hook" used during calls to "get_item()" and 614 * "show_inven()" and "show_equip()", and the choice window routines. 615 */ 616 bool (*item_tester_hook)(object_type*); 617 618 619 620 /* 621 * Current "comp" function for ang_sort() 622 */ 623 bool (*ang_sort_comp)(int Ind, vptr u, vptr v, int a, int b); 624 bool (*ang_sort_extra_comp)(int Ind, vptr u, vptr v, vptr w, int a, int b); 625 626 627 /* 628 * Current "swap" function for ang_sort() 629 */ 630 void (*ang_sort_swap)(int Ind, vptr u, vptr v, int a, int b); 631 void (*ang_sort_extra_swap)(int Ind, vptr u, vptr v, vptr w, int a, int b); 632 633 634 635 /* 636 * Hack -- function hook to restrict "get_mon_num_prep()" function 637 */ 638 bool (*get_mon_num_hook)(int r_idx); 639 bool (*get_mon_num2_hook)(int r_idx); 640 641 642 643 /* 644 * Hack -- function hook to restrict "get_obj_num_prep()" function 645 */ 646 int (*get_obj_num_hook)(int k_idx, u32b resf); 647 648 /* the dungeon master movement hook, is called whenever he moves 649 * (to make building large buildings / summoning hoards of mosnters 650 * easier) 651 */ 652 //bool (*master_move_hook)(int Ind, char * args) = master_acquire; 653 //bool (*master_move_hook)(int Ind, char * args) = NULL; /*evileye - multi DMs! */ 654 655 656 /* new Hacks */ 657 int artifact_bias; 658 char summon_kin_type; 659 660 /* 661 * radius tables 662 */ 663 char tdy[662]; 664 char tdx[662]; 665 s32b tdi[18]; // PREPARE_RADIUS + 2 666 667 /* How many times project() is called in this turn? */ 668 #ifdef PROJECTION_FLUSH_LIMIT 669 s16b count_project = 0; 670 s16b count_project_times = 0; 671 #endif // PROJECTION_FLUSH_LIMIT 672 673 /* Hack -- 'default' values for obj_theme. - Jir - 674 * Only a makeshift till d_info thingie will be implemented. */ 675 obj_theme default_obj_theme = {20, 20, 20, 20}; 676 677 /* 678 * The spell list of schools 679 */ 680 s16b max_spells; 681 spell_type *school_spells; 682 s16b max_schools; 683 school_type *schools; 684 685 /* 686 * Lasting spell effects 687 */ 688 int project_interval = 0; 689 int project_time = 0; 690 s32b project_time_effect = 0; 691 effect_type effects[MAX_EFFECTS]; 692 693 694 /* 695 * Most of max_*_idx below is not used for now, but will be 696 * used in near future. - Jir - 697 */ 698 /* 699 * Maximum number of skills in s_info.txt 700 */ 701 u16b old_max_s_idx = 0; 702 u16b max_s_idx; 703 704 /* 705 * Maximum number of monsters in r_info.txt 706 */ 707 u16b max_r_idx; 708 709 /* 710 * Maximum number of ego monsters in re_info.txt 711 */ 712 u16b max_re_idx; 713 714 /* 715 * Maximum number of items in k_info.txt 716 */ 717 u16b max_k_idx; 718 719 /* 720 * Maximum number of vaults in v_info.txt 721 */ 722 u16b max_v_idx; 723 724 /* 725 * Maximum number of terrain features in f_info.txt 726 */ 727 u16b max_f_idx; 728 729 /* 730 * Maximum number of artifacts in a_info.txt 731 */ 732 u16b max_a_idx; 733 734 /* 735 * Maximum number of ego-items in e_info.txt 736 */ 737 u16b max_e_idx; 738 739 /* 740 * Maximum number of randarts in ra_info.txt 741 */ 742 u16b max_ra_idx; 743 744 /* 745 * Maximum number of dungeon types in d_info.txt 746 */ 747 u16b max_d_idx; 748 749 /* 750 * Maximum number of stores types in st_info.txt 751 */ 752 u16b max_st_idx; 753 754 /* 755 * Item sets 756 */ 757 s16b max_set_idx = 1; 758 759 /* 760 * Maximum number of players info in p_info.txt 761 */ 762 u16b max_rp_idx; 763 u16b max_rmp_idx; 764 u16b max_c_idx; 765 u16b max_mc_idx; 766 767 /* 768 * Maximum number of actions types in ba_info.txt 769 */ 770 u16b max_ba_idx; 771 772 /* 773 * Maximum number of owner types in ow_info.txt 774 */ 775 u16b max_ow_idx; 776 777 /* Maximum number of quests types in q_info.txt */ 778 u16b max_q_idx; 779 780 header *q_head; 781 quest_info *q_info; 782 char *q_name; 783 //char *q_text; 784 785 /* 786 * Maximum number of objects in the level 787 */ 788 u16b max_o_idx; 789 790 /* 791 * Maximum number of monsters in the level 792 */ 793 u16b max_m_idx; 794 795 /* 796 * Maximum number of traps in tr_info.txt 797 */ 798 u16b max_t_idx; 799 800 /* 801 * Maximum number of wilderness features in wf_info.txt 802 */ 803 u16b max_wf_idx; 804 805 /* EVILEYE GAMES */ 806 int teamscore[2]; 807 int teams[2]; // for counting players in teams - mikaelh 808 int gametype; 809 810 /* Private notes for fellow players 811 * see '/note' command in util.c. -C. Blue 812 */ 813 char priv_note[MAX_NOTES][MAX_CHARS_WIDE], priv_note_sender[MAX_NOTES][NAME_LEN], priv_note_target[MAX_NOTES][NAME_LEN]; 814 char party_note[MAX_PARTYNOTES][MAX_CHARS_WIDE], party_note_target[MAX_PARTYNOTES][NAME_LEN]; 815 char guild_note[MAX_GUILDNOTES][MAX_CHARS_WIDE], guild_note_target[MAX_GUILDNOTES][NAME_LEN]; 816 char admin_note[MAX_ADMINNOTES][MAX_CHARS], server_warning[MSG_LEN]; 817 818 /* in-game bbs :) - C. Blue */ 819 char bbs_line[BBS_LINES][MAX_CHARS_WIDE]; 820 /* party/guild-internal bbs'es: */ 821 char pbbs_line[MAX_PARTIES][BBS_LINES][MAX_CHARS_WIDE]; 822 char gbbs_line[MAX_GUILDS][BBS_LINES][MAX_CHARS_WIDE]; 823 824 int global_luck = 0; 825 int regen_boost_stamina = 4; 826 827 /* default 'updated_savegame' value for newly created chars [0]. 828 usually modified by lua (server_startup()) instead of here. */ 829 int updated_savegame_birth = 0; 830 /* like 'updated_savegame' is for players, this is for (lua) server state [0]. 831 usually modified by lua (server_startup()) instead of here. */ 832 int updated_server = 0; 833 /* for automatic artifact resets via lua */ 834 int artifact_reset = 0; 835 836 /* Watch if someone enters Nether Realm or challenges Morgoth - C. Blue 837 Dungeon masters will be paged if they're not AFK or if they have 838 'watch' as AFK reason! */ 839 bool watch_morgoth = 0; 840 bool watch_cp = 0; 841 bool watch_nr = 0; 842 843 /* for lua_bind.c */ 844 bool first_player_joined = TRUE; 845 846 /* lua-dependant 'constants' */ 847 int __lua_HHEALING; 848 int __lua_HBLESSING; 849 int __lua_MSCARE; 850 int __lua_M_FIRST; 851 int __lua_M_LAST; 852 853 /* for cron_1h (using turns % 3600 isn't precise enough, might happen that 854 one hour gets skipped, eg if transition is 1:59 -> 3:00; so now we're 855 polling the timer instead. */ 856 int cron_1h_last_hour = -1; /* -1 to call immediately after server restart */ 857 858 /* for global events (xtra1.c, slash.c) */ 859 global_event_type global_event[MAX_GLOBAL_EVENTS]; 860 int sector00separation = 0; /* some events separate sector 0,0 from the worldmap 861 to use it in a special way - WoR won't work either */ 862 int sector00downstairs = 0; /* remember that sector 0,0 contains staircases downwards at the moment */ 863 int sector00music = 0; /* special event music */ 864 int sector00wall = 0; /* outer wall tile around the sector to be displayed instead of FEAT_PERM_CLEAR */ 865 u32b sector00flags1 = 0x0, sector00flags2 = 0x0; /* floor flags */ 866 int ge_special_sector = 0; /* to make it known that a certain sector (or multiple sectors, given in 867 defines.h as WPOS_ constants) are now in special use for global events. */ 868 u32b ge_contender_buffer_ID[MAX_CONTENDER_BUFFERS]; /* Remember account IDs of players who are supposed to receive */ 869 int ge_contender_buffer_deed[MAX_CONTENDER_BUFFERS]; /* contender's deeds on different characters (Highlander Tournament!) */ 870 u32b achievement_buffer_ID[MAX_ACHIEVEMENT_BUFFERS]; /* Remember account IDs of players who are supposed to receive */ 871 int achievement_buffer_deed[MAX_ACHIEVEMENT_BUFFERS]; /* an achievement deeds on different characters (PvP Mode) */ 872 873 /* for dungeon master/wizard summoning, to override all validity checks and 874 definitely summon what his/her heart desires! - C. Blue */ 875 u32b summon_override_checks = SO_NONE; 876 /* Morgoth may override no-destroy, with his shattering hits */ 877 bool override_LF1_NO_DESTROY = FALSE; 878 879 /* the four seasons */ 880 #ifdef WINTER_SEASON /* backward code compatibility till seasons have finished being implemented...*/ 881 byte season = SEASON_WINTER; 882 #else 883 byte season = SEASON_SPRING; /* default is spring on server startup */ 884 #endif 885 886 887 /* SERVER-SIDE WEATHER AND GLOBAL CLIENT-SIDE WEATHER: */ 888 /* for snowfall during WINTER_SEASON mainly */ 889 int weather = 0; /* note: for old server-side or global-client-side weather this is a flag (0 or 1), 890 for modern client-side weather this is 0, 1 (rain), 2 (snow). */ 891 int weather_duration = 0; 892 #ifdef WINTER_SEASON /* backward code compatibility till seasons have finished being implemented...*/ 893 byte weather_frequency = WINTER_SEASON; 894 #else 895 byte weather_frequency = 2; /* <never rain/snow> 0..4 <always rain/snow> ; [2] */ 896 #endif 897 int wind_gust = 0; 898 int wind_gust_delay = 0; 899 900 901 /* NON-GLOBAL, CLIENT-SIDE WEATHER: */ 902 /* moving clouds, partially buffered client-side */ 903 int cloud_x1[MAX_CLOUDS], cloud_y1[MAX_CLOUDS], cloud_x2[MAX_CLOUDS], cloud_y2[MAX_CLOUDS], cloud_dsum[MAX_CLOUDS]; 904 int cloud_xm100[MAX_CLOUDS], cloud_ym100[MAX_CLOUDS], cloud_mdur[MAX_CLOUDS], cloud_xfrac[MAX_CLOUDS], cloud_yfrac[MAX_CLOUDS]; 905 int cloud_dur[MAX_CLOUDS], cloud_state[MAX_CLOUDS]; 906 int clouds; /* tracking variable */ 907 int max_clouds_seasonal = MAX_CLOUDS; /* maximum number of clouds to use depending 908 on current season, thereby determining the 909 weather frequency (ie rain/snow probability). */ 910 /* Winds. Moving clouds and determining direction and speed of raindrops and snowflakes. 911 Winds affect a very large area, so we need only few of them. 912 It's efficient if we reduce the possible winds a bit, sufficient should be: 913 For raindrops and snowflakes: 914 Just west and east. 915 For cloud movement: 916 All sorts of directions, todo: implement. */ 917 int wind_dur[16], wind_dir[16]; 918 919 920 /* special seasons */ 921 int season_halloween = 0; 922 int season_xmas = 0; 923 int season_newyearseve = 0; 924 925 /* for controlling fireworks on NEW_YEARS_EVE */ 926 int fireworks = 0; 927 int fireworks_delay = 0; 928 929 930 char last_chat_line[MSG_LEN]; /* What was said */ 931 char last_chat_owner[NAME_LEN]; /* Who said it */ 932 // char last_chat_prev[MSG_LEN]; /* What was said before the above*/ 933 934 auction_type *auctions; 935 u32b auction_alloc; 936 937 int store_debug_mode = 0, store_debug_quickmotion = 10, store_debug_startturn = 0; 938 939 /* Array used by everyone_lite_later_spot */ 940 struct worldspot *lite_later; 941 int lite_later_alloc; 942 int lite_later_num; 943 944 /* Timers for specific events - C. Blue */ 945 int timer_pvparena1 = 1, timer_pvparena2 = 1, timer_pvparena3 = 0; /* defaults */ 946 947 /* Recall-shutdown timer for /shutrec */ 948 int shutdown_recall_timer = 0, shutdown_recall_state = 0; 949 950 #ifdef MONSTER_ASTAR 951 astar_list_open astar_info_open[ASTAR_MAX_INSTANCES]; 952 astar_list_closed astar_info_closed[ASTAR_MAX_INSTANCES]; 953 #endif 954 955 #ifdef USE_SOUND_2010 956 /* copy the audio_sfx[] array from audio.lua over, otherwise 957 Sound() calls in functions that are called from within LUA 958 (such as fire_ball()) will cause LUA errors. - C. Blue */ 959 char audio_sfx[SOUND_MAX_2010][30]; 960 #endif 961 962 /* nserver.c players' connection array */ 963 //connection_t **Conn = NULL; 964 965 /* Ironman Deep Dive Challenge */ 966 int deep_dive_level[IDDC_HIGHSCORE_SIZE]; 967 //char deep_dive_name[IDDC_HIGHSCORE_SIZE][NAME_LEN]; /* store just the name */ 968 char deep_dive_name[IDDC_HIGHSCORE_SIZE][MAX_CHARS]; /* store name, race, class, level */ 969 char deep_dive_char[IDDC_HIGHSCORE_SIZE][MAX_CHARS]; /* scoreboard-despam: store character name */ 970 char deep_dive_account[IDDC_HIGHSCORE_SIZE][MAX_CHARS]; /* scoreboard-despam: store account name */ 971 int deep_dive_class[IDDC_HIGHSCORE_SIZE]; /* scoreboard-despam: store class */ 972 973 /* Global projection counter for m_ptr->hit_proj_id */ 974 int mon_hit_proj_id, mon_hit_proj_id2; 975 976 /* remember school for each spell */ 977 int spell_school[512]; 978 /* Also remeber the first and last school of each magic resort */ 979 int SCHOOL_HOFFENSE, SCHOOL_HSUPPORT; 980 int SCHOOL_DRUID_ARCANE, SCHOOL_DRUID_PHYSICAL; 981 int SCHOOL_ASTRAL; 982 int SCHOOL_PPOWER, SCHOOL_MINTRUSION; 983 984 #ifdef DUNGEON_VISIT_BONUS 985 # ifdef DUNGEON_VISIT_BONUS_DEPTHRANGE 986 u16b depthrange_visited[20]; //(levels 0..9 each, so [19] := 190..199) 987 # endif 988 int dungeon_id_max = 0; 989 /* Note: doubling MAX_D_IDX to also account for possible custom dungeons ("Wilderness") along with the default d_info[] dungeons */ 990 int dungeon_x[MAX_D_IDX * 2], dungeon_y[MAX_D_IDX * 2]; 991 u16b dungeon_visit_frequency[MAX_D_IDX * 2]; /* how often players enter this dungeon */ 992 bool dungeon_tower[MAX_D_IDX * 2], dungeon_visit_check[MAX_D_IDX * 2]; 993 int dungeon_bonus[MAX_D_IDX * 2]; 994 #endif 995 996 bool censor_swearing = TRUE, censor_swearing_identity = TRUE; 997 bool jails_enabled = TRUE; 998 bool allow_requesting_estate = FALSE; 999 int netherrealm_wpos_x = 0, netherrealm_wpos_y = 0, netherrealm_wpos_z = 0, netherrealm_start = 0, netherrealm_end = 0; 1000 int valinor_wpos_x = 0, valinor_wpos_y = 0, valinor_wpos_z = 0; 1001 int hallsofmandos_wpos_x = 0, hallsofmandos_wpos_y = 0, hallsofmandos_wpos_z = 0; 1002 bool nether_realm_collapsing = FALSE; 1003 int nrc_x, nrc_y, netherrealm_end_wz; 1004 1005 bool sauron_weakened = FALSE, sauron_weakened_iddc = FALSE; 1006 int __audio_sfx_max, __audio_mus_max; 1007 1008 /* character names temporarily reserved for specific accounts */ 1009 char reserved_name_character[MAX_RESERVED_NAMES][NAME_LEN]; 1010 char reserved_name_account[MAX_RESERVED_NAMES][NAME_LEN]; 1011 int reserved_name_timeout[MAX_RESERVED_NAMES]; 1012