Only in src-280: A-mac-h.c
Only in src-280: A-mac-h.pch
Only in src-280: A-win-h.pch
Only in src-280: Makefile
Only in src-280: Makefile.acn
Only in src-280: Makefile.ami
Only in src-280: Makefile.emx
Only in src-280: Makefile.ibm
Only in src-280: Makefile.lsl
Only in src-280: Makefile.old
Only in src-280: Makefile.wat
Only in src-280: Makefile.win
Only in src-280: angband.h
diff -r src-280/birth.c mangband-000/src/server/birth.c
12a13,14
> #define SERVER
>
43c45
< static birther prev;
---
> /*static birther prev;*/
290c292,293
< static void save_prev_data(void)
---
> #if 0
> static void save_prev_data(int Ind)
291a295
> player_type *p_ptr = Players[Ind];
313c317
< strcpy(prev.history[i], history[i]);
---
> strcpy(prev.history[i], p_ptr->history[i]);
315a320
> #endif
321c326,327
< static void load_prev_data(void)
---
> #if 0
> static void load_prev_data(int Ind)
322a329
> player_type *p_ptr = Players[Ind];
346c353
< strcpy(temp.history[i], history[i]);
---
> strcpy(temp.history[i], p_ptr->history[i]);
369c376
< strcpy(history[i], prev.history[i]);
---
> strcpy(p_ptr->history[i], prev.history[i]);
393a401
> #endif
401c409,410
< static void choose_sex(void)
---
> #if 0
> static void choose_sex(int Ind)
402a412
> player_type *p_ptr = Players[Ind];
412c422
< c = inkey();
---
> c = inkey(Ind);
437a448
> #endif
443c454,455
< static void choose_race(void)
---
> #if 0
> static void choose_race(int Ind)
444a457
> player_type *p_ptr = Players[Ind];
473c486
< c = inkey();
---
> c = inkey(Ind);
494a508
> #endif
501c515,516
< static void choose_class(void)
---
> #if 0
> static void choose_class(int Ind)
502a518
> player_type *p_ptr = Players[Ind];
543c559
< c = inkey();
---
> c = inkey(Ind);
567a584
> #endif
579c596
< static int adjust_stat(int value, s16b amount, int auto_roll)
---
> static int adjust_stat(int int value, s16b amount, int auto_roll)
580a598
> player_type *p_ptr = Players[Ind];
645c663
< static void get_stats(void)
---
> static void get_stats(int Ind)
646a665
> player_type *p_ptr = Players[Ind];
709c728
< static void get_extra(void)
---
> static void get_extra(int Ind)
710a730
> player_type *p_ptr = Players[Ind];
736c756
< player_hp[0] = p_ptr->hitdie;
---
> p_ptr->player_hp[0] = p_ptr->hitdie;
745c765
< player_hp[i] = player_hp[i-1] + j;
---
> p_ptr->player_hp[i] = p_ptr->player_hp[i-1] + j;
751,752c771,772
< if (player_hp[PY_MAX_LEVEL-1] < min_value) continue;
< if (player_hp[PY_MAX_LEVEL-1] > max_value) continue;
---
> if (p_ptr->player_hp[PY_MAX_LEVEL-1] < min_value) continue;
> if (p_ptr->player_hp[PY_MAX_LEVEL-1] > max_value) continue;
763c783
< static void get_history(void)
---
> static void get_history(int Ind)
764a785
> player_type *p_ptr = Players[Ind];
774c795
< for (i = 0; i < 4; i++) history[i][0] = '\0';
---
> for (i = 0; i < 4; i++) p_ptr->history[i][0] = '\0';
899c920
< strcpy(history[i++], s);
---
> strcpy(p_ptr->history[i++], s);
915c936
< strcpy(history[i++], s);
---
> strcpy(p_ptr->history[i++], s);
926c947
< static void get_ahw(void)
---
> static void get_ahw(int Ind)
927a949,950
> player_type *p_ptr = Players[Ind];
>
952c975
< static void get_money(void)
---
> static void get_money(int Ind)
953a977
> player_type *p_ptr = Players[Ind];
1025c1049
< static void player_wipe(void)
---
> static void player_wipe(int Ind)
1026a1051,1052
> player_type *p_ptr = Players[Ind];
> object_type *old_inven;
1029a1056,1058
> /* Hack -- save the inventory pointer */
> old_inven = p_ptr->inventory;
>
1032a1062,1064
> /* Hack -- reset the inventory pointer */
> p_ptr->inventory = old_inven;
>
1036c1068
< strcpy(history[i], "");
---
> strcpy(p_ptr->history[i], "");
1039d1070
<
1041c1072
< total_weight = 0;
---
> p_ptr->total_weight = 0;
1044,1045c1075,1076
< inven_cnt = 0;
< equip_cnt = 0;
---
> p_ptr->inven_cnt = 0;
> p_ptr->equip_cnt = 0;
1050c1081
< invwipe(&inventory[i]);
---
> invwipe(&p_ptr->inventory[i]);
1054,1110d1084
< /* Start with no artifacts made yet */
< for (i = 0; i < MAX_A_IDX; i++)
< {
< artifact_type *a_ptr = &a_info[i];
< a_ptr->cur_num = 0;
< }
<
<
< /* Start with no quests */
< for (i = 0; i < MAX_Q_IDX; i++)
< {
< q_list[i].level = 0;
< }
<
< /* Add a special quest */
< q_list[0].level = 99;
<
< /* Add a second quest */
< q_list[1].level = 100;
<
<
< /* Reset the "objects" */
< for (i = 1; i < MAX_K_IDX; i++)
< {
< object_kind *k_ptr = &k_info[i];
<
< /* Reset "tried" */
< k_ptr->tried = FALSE;
<
< /* Reset "aware" */
< k_ptr->aware = FALSE;
< }
<
<
< /* Reset the "monsters" */
< for (i = 1; i < MAX_R_IDX; i++)
< {
< monster_race *r_ptr = &r_info[i];
<
< /* Hack -- Reset the counter */
< r_ptr->cur_num = 0;
<
< /* Hack -- Reset the max counter */
< r_ptr->max_num = 100;
<
< /* Hack -- Reset the max counter */
< if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 1;
<
< /* Clear player kills */
< r_ptr->r_pkills = 0;
< }
<
<
< /* Hack -- no ghosts */
< r_info[MAX_R_IDX-1].max_num = 0;
<
<
1116,1119c1090,1093
< spell_learned1 = spell_learned2 = 0L;
< spell_worked1 = spell_worked2 = 0L;
< spell_forgotten1 = spell_forgotten2 = 0L;
< for (i = 0; i < 64; i++) spell_order[i] = 99;
---
> p_ptr->spell_learned1 = p_ptr->spell_learned2 = 0L;
> p_ptr->spell_worked1 = p_ptr->spell_worked2 = 0L;
> p_ptr->spell_forgotten1 = p_ptr->spell_forgotten2 = 0L;
> for (i = 0; i < 64; i++) p_ptr->spell_order[i] = 99;
1131c1105
< total_winner = FALSE;
---
> p_ptr->total_winner = FALSE;
1137c1111
< noscore = 0;
---
> p_ptr->noscore = 0;
1200c1174
< static void player_outfit(void)
---
> static void player_outfit(int Ind)
1201a1176
> player_type *p_ptr = Players[Ind];
1234a1210,1213
> static void player_location(int Ind)
> {
> player_type *p_ptr = Players[Ind];
> int y, x, i, d;
1235a1215,1220
> /* Memorize the town */
> for (y = 0; y < SCREEN_HGT; y++)
> {
> for (x = 0; x < SCREEN_WID; x++)
> {
> byte *w_ptr = &p_ptr->cave_flag[y][x];
1236a1222,1297
> *w_ptr |= CAVE_MARK;
> }
> }
>
> /* Place the player correctly in the town */
> for (i = 0; i < 35; i++)
> {
> d = (i + 4) / 35;
>
> /* Pick a location */
> scatter(0, &y, &x, level_start_y[0], level_start_x[0], d, 0);
>
> if (!cave_naked_bold(0, y, x)) continue;
>
> break;
> }
>
> #ifdef 0
> while (TRUE)
> {
> p_ptr->px = rand_range(3, SCREEN_WID - 4);
> p_ptr->py = rand_range(3, SCREEN_HGT - 4);
>
> /* Require a "naked" floor grid */
> if (cave_naked_bold(0, p_ptr->py, p_ptr->px)) break;
> }
> #endif
>
> /* Set the player's location */
> p_ptr->py = y;
> p_ptr->px = x;
>
> /* Update the location's player index */
> cave[0][p_ptr->py][p_ptr->px].p_idx = Ind;
>
> /* Show him to everybody */
> everyone_lite_spot(0, p_ptr->py, p_ptr->px);
>
> /* Set his "current activities" variables */
> p_ptr->current_spell = p_ptr->current_rod = p_ptr->current_activation = -1;
>
> /* Set the player's "panel" information */
> p_ptr->max_panel_rows = 0;
> p_ptr->max_panel_cols = 0;
>
> p_ptr->panel_row = p_ptr->max_panel_rows;
> p_ptr->panel_col = p_ptr->max_panel_cols;
>
> p_ptr->cur_hgt = SCREEN_HGT;
> p_ptr->cur_wid = SCREEN_WID;
>
> /* Set the rest of the panel information */
> panel_bounds(Ind);
>
> /* Update the players on each depth info */
> players_on_depth[0]++;
>
> /* Tell the server to redraw the player's display */
> p_ptr->redraw |= PR_MAP;
> p_ptr->redraw |= PR_BASIC;
>
> /* Update his bonuses and torch radius */
> p_ptr->update |= (PU_BONUS | PU_TORCH);
>
> /* Update his inventory, equipment, and spell info */
> p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL);
>
> /* This guy is alive now */
> p_ptr->alive = TRUE;
>
> /* Update his viewing area */
> update_view(Ind);
> }
>
>
>
1247c1308
< void player_birth(void)
---
> bool player_birth(int cptr name, cptr pass, int conn, int race, int class, int sex)
1249c1310
< int n, i;
---
> player_type *p_ptr;
1253,1254d1313
< bool flag;
<
1258d1316
< char buf[80];
1259a1318
> MAKE(Players[Ind], player_type);
1261c1320
< start_over:
---
> C_MAKE(Players[Ind]->inventory, INVEN_TOTAL, object_type);
1262a1322,1323
> if (Players[Ind]->inventory == NULL)
> quit("ERROR: Player inventory pointer is NULL!");
1263a1325,1326
> p_ptr = Players[Ind];
>
1265c1328
< player_wipe();
---
> player_wipe(Ind);
1266a1330,1337
> /* Copy his name and connection info */
> strcpy(p_ptr->name, name);
> strcpy(p_ptr->pass, pass);
> p_ptr->conn = conn;
>
> /* Verify his name and create a savefile name */
> process_player_name(TRUE);
>
1270a1342,1343
> /* Attempt to load from a savefile */
> character_loaded = FALSE;
1271a1345,1379
> if (!load_player(Ind))
> {
> /* Loading failed badly */
> return FALSE;
> }
>
> if (character_loaded)
> {
> /* Loading succeeded */
> player_location(Ind);
> return TRUE;
> }
>
> /* Else, loading failed, but we just create a new character */
>
> /* Hack -- rewipe the player info if load failed */
> player_wipe(Ind);
>
> /* Copy his name and connection info */
> strcpy(p_ptr->name, name);
> strcpy(p_ptr->pass, pass);
> p_ptr->conn = conn;
>
> /* Reprocess his name */
> process_player_name(TRUE);
>
> p_ptr->prace = race;
> p_ptr->pclass = class;
> p_ptr->male = sex;
>
> rp_ptr = &race_info[race];
> cp_ptr = &class_info[class];
> mp_ptr = &magic_info[class];
>
> #if 0
1282c1390
< c_put_str(TERM_L_BLUE, player_name, 2, 15);
---
> c_put_str(TERM_L_BLUE, p_ptr->name, 2, 15);
1289c1397
< choose_sex();
---
> choose_sex(Ind);
1293c1401
< choose_race();
---
> choose_race(Ind);
1297c1405
< choose_class();
---
> choose_class(Ind);
1304c1412
< c = inkey();
---
> c = inkey(Ind);
1324c1432
< c = inkey();
---
> c = inkey(Ind);
1337a1446
> #endif
1346c1455
< c = inkey();
---
> c = inkey(Ind);
1565c1674
< if (inkey()) break;
---
> if (inkey(Ind)) break;
1575c1684
< get_stats();
---
> get_stats(Ind);
1583c1692
< get_extra();
---
> get_extra(Ind);
1586c1695
< get_ahw();
---
> get_ahw(Ind);
1589c1698
< get_history();
---
> get_history(Ind);
1592c1701
< get_money();
---
> get_money(Ind);
1593a1703
> #if 0
1598c1708
< p_ptr->update |= (PU_BONUS | PU_HP);
---
> /*p_ptr->update |= (PU_BONUS | PU_HP);*/
1601c1711
< update_stuff();
---
> /*update_stuff(Ind);*/
1604c1714
< display_player(use_history);
---
> /*display_player(use_history);*/
1615c1725
< c = inkey();
---
> c = inkey(Ind);
1626c1736
< load_prev_data();
---
> load_prev_data(Ind);
1652a1763
> #endif
1656a1768
> #if 0
1658c1770,1771
< save_prev_data();
---
> save_prev_data(Ind);
> #endif
1661a1775,1777
>
> /* We're always done */
> break;
1663a1780
> #if 0
1669c1786
< get_name();
---
> get_name(Ind);
1675c1792
< c = inkey();
---
> c = inkey(Ind);
1690a1808
> #endif
1693c1811
< player_outfit();
---
> player_outfit(Ind);
1694a1813,1814
> /* Set his location, panel, etc. */
> player_location(Ind);
1696,1707c1816,1817
< /* Shops */
< for (n = 0; n < MAX_STORES; n++)
< {
< /* Initialize */
< store_init(n);
<
< /* Ignore home */
< if (n == MAX_STORES - 1) continue;
<
< /* Maintain the shop (ten times) */
< for (i = 0; i < 10; i++) store_maint(n);
< }
---
> /* Success */
> return TRUE;
diff -r src-280/cave.c mangband-000/src/server/cave.c
4a5
> #define SERVER
71c72
< bool los(int y1, int x1, int y2, int x2)
---
> bool los(int Depth, int y1, int x1, int y2, int x2)
120c121
< if (!cave_floor_bold(ty, x1)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, x1)) return (FALSE);
129c130
< if (!cave_floor_bold(ty, x1)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, x1)) return (FALSE);
145c146
< if (!cave_floor_bold(y1, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, y1, tx)) return (FALSE);
154c155
< if (!cave_floor_bold(y1, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, y1, tx)) return (FALSE);
173c174
< if (cave_floor_bold(y1 + sy, x1)) return (TRUE);
---
> if (cave_floor_bold(Depth, y1 + sy, x1)) return (TRUE);
182c183
< if (cave_floor_bold(y1, x1 + sx)) return (TRUE);
---
> if (cave_floor_bold(Depth, y1, x1 + sx)) return (TRUE);
218c219
< if (!cave_floor_bold(ty, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, tx)) return (FALSE);
229c230
< if (!cave_floor_bold(ty, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, tx)) return (FALSE);
265c266
< if (!cave_floor_bold(ty, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, tx)) return (FALSE);
276c277
< if (!cave_floor_bold(ty, tx)) return (FALSE);
---
> if (!cave_floor_bold(Depth, ty, tx)) return (FALSE);
330c331
< bool player_can_see_bold(int y, int x)
---
> bool player_can_see_bold(int int y, int x)
331a333,334
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
334a338
> byte *w_ptr;
340c344,345
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
343c348
< if (c_ptr->info & CAVE_LITE) return (TRUE);
---
> if (*w_ptr & CAVE_LITE) return (TRUE);
352c357
< if (cave_floor_bold(y, x)) return (TRUE);
---
> if (cave_floor_bold(Depth, y, x)) return (TRUE);
355,356c360,361
< yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y;
< xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x;
---
> yy = (y < p_ptr->py) ? (y + 1) : (y > p_ptr->py) ? (y - 1) : y;
> xx = (x < p_ptr->px) ? (x + 1) : (x > p_ptr->px) ? (x - 1) : x;
359c364
< if (cave[yy][xx].info & CAVE_GLOW)
---
> if (cave[Depth][yy][xx].info & CAVE_GLOW)
374c379
< bool no_lite(void)
---
> bool no_lite(int Ind)
376c381,382
< return (!player_can_see_bold(py, px));
---
> player_type *p_ptr = Players[Ind];
> return (!player_can_see_bold(p_ptr->py, p_ptr->px));
391c397
< "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
---
> "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
447a454,459
> /*
> * Return the correct "color" of another player
> */
> static byte player_color(int Ind)
> {
> player_type *p_ptr = Players[Ind];
448a461,486
> if (!strcmp(Players[Ind]->name, "BEAST"))
> {
> return (randint(14) + 1);
> }
>
> switch (p_ptr->pclass)
> {
> case CLASS_WARRIOR:
> return TERM_UMBER;
> case CLASS_MAGE:
> return TERM_RED;
> case CLASS_PRIEST:
> return TERM_GREEN;
> case CLASS_ROGUE:
> return TERM_BLUE;
> case CLASS_RANGER:
> return TERM_L_WHITE;
> case CLASS_PALADIN:
> return TERM_L_BLUE;
> }
>
> /* Oops */
> return TERM_WHITE;
> }
>
>
570c608
< void map_info(int y, int x, byte *ap, char *cp)
---
> void map_info(int int y, int x, byte *ap, char *cp)
571a610,612
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
572a614
> byte *w_ptr;
583c625,626
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
593,594c636,637
< if ((c_ptr->info & CAVE_MARK) ||
< (((c_ptr->info & CAVE_LITE) ||
---
> if ((*w_ptr & CAVE_MARK) ||
> (((*w_ptr & CAVE_LITE) ||
596c639
< (c_ptr->info & CAVE_VIEW))) &&
---
> (*w_ptr & CAVE_VIEW))) &&
603c646
< (*cp) = f_ptr->z_char;
---
> (*cp) = f_ptr->f_char;
606c649
< a = f_ptr->z_attr;
---
> a = f_ptr->f_attr;
609c652
< if (view_special_lite && (a == TERM_WHITE))
---
> if (/*view_special_lite && */(a == TERM_WHITE))
619c662
< else if (c_ptr->info & CAVE_LITE)
---
> else if (*w_ptr & CAVE_LITE)
622c665
< if (view_yellow_lite)
---
> if (/*view_yellow_lite*/ TRUE)
637c680
< else if (!(c_ptr->info & CAVE_VIEW))
---
> else if (!(*w_ptr & CAVE_VIEW))
659c702
< (*ap) = f_ptr->z_attr;
---
> (*ap) = f_ptr->f_attr;
662c705
< (*cp) = f_ptr->z_char;
---
> (*cp) = f_ptr->f_char;
670c713
< if (c_ptr->info & CAVE_MARK)
---
> if (*w_ptr & CAVE_MARK)
679c722
< (*cp) = f_ptr->z_char;
---
> (*cp) = f_ptr->f_char;
682c725
< a = f_ptr->z_attr;
---
> a = f_ptr->f_attr;
695c738
< else if (c_ptr->info & CAVE_LITE)
---
> else if (*w_ptr & CAVE_LITE)
709c752
< if (!(c_ptr->info & CAVE_VIEW))
---
> if (!(*w_ptr & CAVE_VIEW))
728,729c771,772
< yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y;
< xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x;
---
> yy = (y < p_ptr->py) ? (y + 1) : (y > p_ptr->py) ? (y - 1) : y;
> xx = (x < p_ptr->px) ? (x + 1) : (x > p_ptr->px) ? (x - 1) : x;
732c775
< if (!(cave[yy][xx].info & CAVE_GLOW))
---
> if (!(cave[Depth][yy][xx].info & CAVE_GLOW))
752c795
< (*ap) = f_ptr->z_attr;
---
> (*ap) = f_ptr->f_attr;
755c798
< (*cp) = f_ptr->z_char;
---
> (*cp) = f_ptr->f_char;
774c817
< if (o_ptr->marked)
---
> if (p_ptr->obj_vis[c_ptr->o_idx])
794c837
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[c_ptr->m_idx])
879a923,949
>
> if (c_ptr->p_idx)
> {
> int p2x, p2y;
>
> /* Second player's location */
> p2x = Players[c_ptr->p_idx]->px;
> p2y = Players[c_ptr->p_idx]->py;
>
> /* Is that player visible? */
> if (player_has_los_bold(p2y, p2x) || p_ptr->telepathy)
> {
> c = '@';
>
> a = player_color(c_ptr->p_idx);
>
> (*cp) = c;
>
> (*ap) = a;
>
> if (p_ptr->image)
> {
> /* Change the other player into a hallucination */
> image_monster(ap, cp);
> }
> }
> }
885a956,957
> *
> * Don't like this --KLJ--
890,891c962,963
< row -= panel_row_prt;
< col -= panel_col_prt;
---
> /*row -= panel_row_prt;
> col -= panel_col_prt;*/
894c966
< Term_gotoxy(col, row);
---
> /*Term_gotoxy(col, row);*/
900a973,974
> *
> * Don't like this either --KLJ--
905,906c979,980
< if (panel_contains(y, x))
< {
---
> /*if (panel_contains(y, x))
> {*/
908c982
< if (!use_color) a = TERM_WHITE;
---
> /* if (!use_color) a = TERM_WHITE;*/
911,912c985,986
< Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);
< }
---
> /*Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);
> }*/
944c1018
< void note_spot(int y, int x)
---
> void note_spot(int int y, int x)
946c1020,1023
< cave_type *c_ptr = &cave[y][x];
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
> cave_type *c_ptr = &cave[Depth][y][x];
> byte *w_ptr = &p_ptr->cave_flag[y][x];
952,953d1028
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
955c1030
< if (!(o_ptr->marked))
---
> if (!(p_ptr->obj_vis[c_ptr->o_idx]))
961c1036,1037
< o_ptr->marked = TRUE;
---
> p_ptr->obj_vis[c_ptr->o_idx] = TRUE;
>
968c1044
< if (!(c_ptr->info & CAVE_MARK))
---
> if (!(*w_ptr & CAVE_MARK))
977c1053
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
984c1060
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
991c1067
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
997a1074,1109
> void note_spot_depth(int Depth, int y, int x)
> {
> int i;
>
> for (i = 1; i < NumPlayers + 1; i++)
> {
> if (Players[i]->conn == NOT_CONNECTED)
> continue;
>
> if (Players[i]->dun_depth == Depth)
> {
> note_spot(i, y, x);
> }
> }
> }
>
> void everyone_lite_spot(int Depth, int y, int x)
> {
> int i;
>
> /* Check everyone */
> for (i = 1; i < NumPlayers + 1; i++)
> {
> /* If he's not playing, skip him */
> if (Players[i]->conn == NOT_CONNECTED)
> continue;
>
> /* If he's not here, skip him */
> if (Players[i]->dun_depth != Depth)
> continue;
>
> /* Actually lite that spot for that player */
> lite_spot(i, y, x);
> }
> }
>
998a1111,1133
> * Wipe the "CAVE_MARK" bit in everyone's array
> */
> void everyone_forget_spot(int Depth, int y, int x)
> {
> int i;
>
> /* Check everyone */
> for (i = 1; i < NumPlayers + 1; i++)
> {
> /* If he's not playing, skip him */
> if (Players[i]->conn == NOT_CONNECTED)
> continue;
>
> /* If he's not here, skip him */
> if (Players[i]->dun_depth != Depth)
> continue;
>
> /* Forget the spot */
> Players[i]->cave_flag[y][x] &= ~CAVE_MARK;
> }
> }
>
> /*
1001c1136
< void lite_spot(int y, int x)
---
> void lite_spot(int int y, int x)
1002a1138,1141
> player_type *p_ptr = Players[Ind];
>
> int dispx, dispy;
>
1010c1149
< if ((y == py) && (x == px))
---
> if ((y == p_ptr->py) && (x == p_ptr->px))
1015c1154
< a = r_ptr->x_attr;
---
> a = r_ptr->d_attr;
1018c1157
< c = r_ptr->x_char;
---
> c = r_ptr->d_char;
1030a1170,1172
> dispx = x - p_ptr->panel_col_prt;
> dispy = y - p_ptr->panel_row_prt;
>
1032c1174,1186
< Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);
---
> /*Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);*/
> if (p_ptr->scr_info[dispy][dispx].c != c || p_ptr->scr_info[dispy][dispx].a != a || (x == p_ptr->px && y==p_ptr->py))
> {
> if (dispx < 0 || dispx > 80)
> printf("dispx = %d.\n", dispx);
> if (dispy < 0 || dispy > 25)
> printf("dispy = %d.\n", dispy);
>
> p_ptr->scr_info[dispy][dispx].c = c;
> p_ptr->scr_info[dispy][dispx].a = a;
>
> (void)Send_char(dispx, dispy, a, c);
> }
1046c1200
< void prt_map(void)
---
> void prt_map(int Ind)
1047a1202,1203
> player_type *p_ptr = Players[Ind];
>
1048a1205
> int dispx, dispy;
1050,1051d1206
< int v;
<
1053c1208
< (void)Term_get_cursor(&v);
---
> /*(void)Term_get_cursor(&v);*/
1056c1211
< (void)Term_set_cursor(0);
---
> /*(void)Term_set_cursor(0);*/
1059c1214
< for (y = panel_row_min; y <= panel_row_max; y++)
---
> for (y = p_ptr->panel_row_min; y <= p_ptr->panel_row_max; y++)
1062c1217
< for (x = panel_col_min; x <= panel_col_max; x++)
---
> for (x = p_ptr->panel_col_min; x <= p_ptr->panel_col_max; x++)
1072a1228,1230
> dispx = x - p_ptr->panel_col_prt;
> dispy = y - p_ptr->panel_row_prt;
>
1074c1232,1238
< Term_draw(x-panel_col_prt, y-panel_row_prt, a, c);
---
> if (p_ptr->scr_info[dispy][dispx].c != c || p_ptr->scr_info[dispy][dispx].a != a)
> {
> p_ptr->scr_info[dispy][dispx].c = c;
> p_ptr->scr_info[dispy][dispx].a = a;
>
> (void)Send_char(dispx, dispy, a, c);
> }
1079c1243
< lite_spot(py, px);
---
> lite_spot(p_ptr->py, p_ptr->px);
1082c1246
< (void)Term_set_cursor(v);
---
> /*(void)Term_set_cursor(v);*/
1191c1355
< void display_map(int *cy, int *cx)
---
> void display_map(int int *cy, int *cx)
1192a1357,1358
> player_type *p_ptr = Players[Ind];
>
1233c1399
< for (i = 0; i < cur_wid; ++i)
---
> for (i = 0; i < p_ptr->cur_wid; ++i)
1235c1401
< for (j = 0; j < cur_hgt; ++j)
---
> for (j = 0; j < p_ptr->cur_hgt; ++j)
1281c1447
< Term_gotoxy(0, y);
---
> /*Term_gotoxy(0, y);*/
1293c1459,1467
< Term_addch(ta, tc);
---
> /* Efficiency -- Redraw that grid of the map */
>
> if (p_ptr->scr_info[y][x].c != tc || p_ptr->scr_info[y][x].a != ta)
> {
> p_ptr->scr_info[y][x].c = tc;
> p_ptr->scr_info[y][x].a = ta;
>
> (void)Send_char(x, y, ta, tc);
> }
1299,1300c1473,1474
< (*cy) = py / RATIO + 1;
< (*cx) = px / RATIO + 1;
---
> (*cy) = p_ptr->py / RATIO + 1;
> (*cx) = p_ptr->px / RATIO + 1;
1314c1488
< void do_cmd_view_map(void)
---
> void do_cmd_view_map(int Ind)
1315a1490
> player_type *p_ptr = Players[Ind];
1319c1494
< character_icky = TRUE;
---
> /*character_icky = TRUE;*/
1322c1497
< Term_save();
---
> /*Term_save();*/
1325c1500
< prt("Please wait...", 0, 0);
---
> /*prt("Please wait...", 0, 0);*/
1328c1503
< Term_fresh();
---
> /*Term_fresh();*/
1331c1506
< Term_clear();
---
> /*Term_clear();*/
1337c1512
< put_str("Hit any key to continue", 23, 23);
---
> /*put_str("Hit any key to continue", 23, 23);*/
1358c1533,1539
< Term_draw(cx, cy, a, c);
---
> if (p_ptr->scr_info[cy][cx].c != c || p_ptr->scr_info[cy][cx].a != a)
> {
> p_ptr->scr_info[cy][cx].c = c;
> p_ptr->scr_info[cy][cx].a = a;
>
> (void)Send_char(cx, cy, a, c);
> }
1362c1543
< move_cursor(cy, cx);
---
> /*move_cursor(cy, cx);*/
1365c1546
< inkey();
---
> /*inkey();*/
1368c1549
< Term_load();
---
> /*Term_load();*/
1371c1552
< character_icky = FALSE;
---
> /*character_icky = FALSE;*/
1599c1780
< void forget_lite(void)
---
> void forget_lite(int Ind)
1600a1782,1784
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1604c1788
< if (!lite_n) return;
---
> if (!(p_ptr->lite_n)) return;
1607c1791
< for (i = 0; i < lite_n; i++)
---
> for (i = 0; i < p_ptr->lite_n; i++)
1609,1610c1793,1794
< y = lite_y[i];
< x = lite_x[i];
---
> y = p_ptr->lite_y[i];
> x = p_ptr->lite_x[i];
1613c1797
< cave[y][x].info &= ~CAVE_LITE;
---
> p_ptr->cave_flag[y][x] &= ~CAVE_LITE;
1616c1800
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1620c1804
< lite_n = 0;
---
> p_ptr->lite_n = 0;
1630a1815,1818
> *
> * Note that I'm assuming that we can use "p_ptr", because this macro
> * should only be called from functions that have it defined at the
> * top. --KLJ--
1633,1636c1821,1824
< cave[Y][X].info |= CAVE_LITE; \
< lite_y[lite_n] = (Y); \
< lite_x[lite_n] = (X); \
< lite_n++
---
> p_ptr->cave_flag[Y][X] |= CAVE_LITE; \
> p_ptr->lite_y[p_ptr->lite_n] = (Y); \
> p_ptr->lite_x[p_ptr->lite_n] = (X); \
> p_ptr->lite_n++
1667c1855
< void update_lite(void)
---
> void update_lite(int Ind)
1668a1857,1858
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1678c1868
< forget_lite();
---
> forget_lite(Ind);
1681c1871
< lite_spot(py, px);
---
> lite_spot(p_ptr->py, p_ptr->px);
1691c1881
< for (i = 0; i < lite_n; i++)
---
> for (i = 0; i < p_ptr->lite_n; i++)
1693,1694c1883,1884
< y = lite_y[i];
< x = lite_x[i];
---
> y = p_ptr->lite_y[i];
> x = p_ptr->lite_x[i];
1697c1887
< cave[y][x].info &= ~CAVE_LITE;
---
> p_ptr->cave_flag[y][x] &= ~CAVE_LITE;
1700c1890
< cave[y][x].info |= CAVE_TEMP;
---
> cave[Depth][y][x].info |= CAVE_TEMP;
1703,1705c1893,1895
< temp_y[temp_n] = y;
< temp_x[temp_n] = x;
< temp_n++;
---
> p_ptr->temp_y[p_ptr->temp_n] = y;
> p_ptr->temp_x[p_ptr->temp_n] = x;
> p_ptr->temp_n++;
1709c1899
< lite_n = 0;
---
> p_ptr->lite_n = 0;
1715c1905
< cave_lite_hack(py, px);
---
> cave_lite_hack(p_ptr->py, p_ptr->px);
1721,1724c1911,1914
< cave_lite_hack(py+1, px);
< cave_lite_hack(py-1, px);
< cave_lite_hack(py, px+1);
< cave_lite_hack(py, px-1);
---
> cave_lite_hack(p_ptr->py+1, p_ptr->px);
> cave_lite_hack(p_ptr->py-1, p_ptr->px);
> cave_lite_hack(p_ptr->py, p_ptr->px+1);
> cave_lite_hack(p_ptr->py, p_ptr->px-1);
1727,1730c1917,1920
< cave_lite_hack(py+1, px+1);
< cave_lite_hack(py+1, px-1);
< cave_lite_hack(py-1, px+1);
< cave_lite_hack(py-1, px-1);
---
> cave_lite_hack(p_ptr->py+1, p_ptr->px+1);
> cave_lite_hack(p_ptr->py+1, p_ptr->px-1);
> cave_lite_hack(p_ptr->py-1, p_ptr->px+1);
> cave_lite_hack(p_ptr->py-1, p_ptr->px-1);
1737c1927
< if (cave_floor_bold(py+1, px))
---
> if (cave_floor_bold(Depth, p_ptr->py+1, p_ptr->px))
1739,1741c1929,1931
< cave_lite_hack(py+2, px);
< cave_lite_hack(py+2, px+1);
< cave_lite_hack(py+2, px-1);
---
> cave_lite_hack(p_ptr->py+2, p_ptr->px);
> cave_lite_hack(p_ptr->py+2, p_ptr->px+1);
> cave_lite_hack(p_ptr->py+2, p_ptr->px-1);
1745c1935
< if (cave_floor_bold(py-1, px))
---
> if (cave_floor_bold(Depth, p_ptr->py-1, p_ptr->px))
1747,1749c1937,1939
< cave_lite_hack(py-2, px);
< cave_lite_hack(py-2, px+1);
< cave_lite_hack(py-2, px-1);
---
> cave_lite_hack(p_ptr->py-2, p_ptr->px);
> cave_lite_hack(p_ptr->py-2, p_ptr->px+1);
> cave_lite_hack(p_ptr->py-2, p_ptr->px-1);
1753c1943
< if (cave_floor_bold(py, px+1))
---
> if (cave_floor_bold(Depth, p_ptr->py, p_ptr->px+1))
1755,1757c1945,1947
< cave_lite_hack(py, px+2);
< cave_lite_hack(py+1, px+2);
< cave_lite_hack(py-1, px+2);
---
> cave_lite_hack(p_ptr->py, p_ptr->px+2);
> cave_lite_hack(p_ptr->py+1, p_ptr->px+2);
> cave_lite_hack(p_ptr->py-1, p_ptr->px+2);
1761c1951
< if (cave_floor_bold(py, px-1))
---
> if (cave_floor_bold(Depth, p_ptr->py, p_ptr->px-1))
1763,1765c1953,1955
< cave_lite_hack(py, px-2);
< cave_lite_hack(py+1, px-2);
< cave_lite_hack(py-1, px-2);
---
> cave_lite_hack(p_ptr->py, p_ptr->px-2);
> cave_lite_hack(p_ptr->py+1, p_ptr->px-2);
> cave_lite_hack(p_ptr->py-1, p_ptr->px-2);
1781c1971
< if (cave_floor_bold(py+1, px+1))
---
> if (cave_floor_bold(Depth, p_ptr->py+1, p_ptr->px+1))
1783c1973
< cave_lite_hack(py+2, px+2);
---
> cave_lite_hack(p_ptr->py+2, p_ptr->px+2);
1787c1977
< if (cave_floor_bold(py+1, px-1))
---
> if (cave_floor_bold(Depth, p_ptr->py+1, p_ptr->px-1))
1789c1979
< cave_lite_hack(py+2, px-2);
---
> cave_lite_hack(p_ptr->py+2, p_ptr->px-2);
1793c1983
< if (cave_floor_bold(py-1, px+1))
---
> if (cave_floor_bold(Depth, p_ptr->py-1, p_ptr->px+1))
1795c1985
< cave_lite_hack(py-2, px+2);
---
> cave_lite_hack(p_ptr->py-2, p_ptr->px+2);
1799c1989
< if (cave_floor_bold(py-1, px-1))
---
> if (cave_floor_bold(Depth, p_ptr->py-1, p_ptr->px-1))
1801c1991
< cave_lite_hack(py-2, px-2);
---
> cave_lite_hack(p_ptr->py-2, p_ptr->px-2);
1805c1995
< min_y = py - p;
---
> min_y = p_ptr->py - p;
1809,1810c1999,2000
< max_y = py + p;
< if (max_y > cur_hgt-1) max_y = cur_hgt-1;
---
> max_y = p_ptr->py + p;
> if (max_y > p_ptr->cur_hgt-1) max_y = p_ptr->cur_hgt-1;
1813c2003
< min_x = px - p;
---
> min_x = p_ptr->px - p;
1817,1818c2007,2008
< max_x = px + p;
< if (max_x > cur_wid-1) max_x = cur_wid-1;
---
> max_x = p_ptr->px + p;
> if (max_x > p_ptr->cur_wid-1) max_x = p_ptr->cur_wid-1;
1825,1826c2015,2016
< int dy = (py > y) ? (py - y) : (y - py);
< int dx = (px > x) ? (px - x) : (x - px);
---
> int dy = (p_ptr->py > y) ? (p_ptr->py - y) : (y - p_ptr->py);
> int dx = (p_ptr->px > x) ? (p_ptr->px - x) : (x - p_ptr->px);
1851c2041
< for (i = 0; i < lite_n; i++)
---
> for (i = 0; i < p_ptr->lite_n; i++)
1853,1854c2043,2044
< y = lite_y[i];
< x = lite_x[i];
---
> y = p_ptr->lite_y[i];
> x = p_ptr->lite_x[i];
1857c2047
< if (cave[y][x].info & CAVE_TEMP) continue;
---
> if (cave[Depth][y][x].info & CAVE_TEMP) continue;
1863c2053
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1867c2057
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
1869,1870c2059,2060
< y = temp_y[i];
< x = temp_x[i];
---
> y = p_ptr->temp_y[i];
> x = p_ptr->temp_x[i];
1873c2063
< cave[y][x].info &= ~CAVE_TEMP;
---
> cave[Depth][y][x].info &= ~CAVE_TEMP;
1876c2066
< if (cave[y][x].info & CAVE_LITE) continue;
---
> if (p_ptr->cave_flag[y][x] & CAVE_LITE) continue;
1879c2069
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1883c2073
< temp_n = 0;
---
> p_ptr->temp_n = 0;
1895c2085
< void forget_view(void)
---
> void forget_view(int Ind)
1896a2087,2088
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1899c2091
< cave_type *c_ptr;
---
> byte *w_ptr;
1902c2094
< if (!view_n) return;
---
> if (!(p_ptr->view_n)) return;
1905c2097
< for (i = 0; i < view_n; i++)
---
> for (i = 0; i < p_ptr->view_n; i++)
1907,1908c2099,2100
< int y = view_y[i];
< int x = view_x[i];
---
> int y = p_ptr->view_y[i];
> int x = p_ptr->view_x[i];
1911c2103
< c_ptr = &cave[y][x];
---
> w_ptr = &p_ptr->cave_flag[y][x];
1914c2106
< c_ptr->info &= ~CAVE_VIEW;
---
> *w_ptr &= ~CAVE_VIEW;
1917c2109
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1921c2113
< view_n = 0;
---
> p_ptr->view_n = 0;
1930a2123,2124
> *
> * I'm again assuming that using p_ptr is OK (see above) --KLJ--
1932,1936c2126,2130
< #define cave_view_hack(C,Y,X) \
< (C)->info |= CAVE_VIEW; \
< view_y[view_n] = (Y); \
< view_x[view_n] = (X); \
< view_n++
---
> #define cave_view_hack(W,Y,X) \
> (*(W)) |= CAVE_VIEW; \
> p_ptr->view_y[p_ptr->view_n] = (Y); \
> p_ptr->view_x[p_ptr->view_n] = (X); \
> p_ptr->view_n++
1957c2151
< static bool update_view_aux(int y, int x, int y1, int x1, int y2, int x2)
---
> static bool update_view_aux(int int y, int x, int y1, int x1, int y2, int x2)
1958a2153,2154
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1961a2158
> byte *w_ptr;
1965a2163,2164
> byte *g1_w_ptr;
> byte *g2_w_ptr;
1968,1969c2167,2168
< g1_c_ptr = &cave[y1][x1];
< g2_c_ptr = &cave[y2][x2];
---
> g1_c_ptr = &cave[Depth][y1][x1];
> g2_c_ptr = &cave[Depth][y2][x2];
1970a2170,2171
> g1_w_ptr = &p_ptr->cave_flag[y1][x1];
> g2_w_ptr = &p_ptr->cave_flag[y2][x2];
1971a2173
>
1981,1982c2183,2184
< v1 = (f1 && (g1_c_ptr->info & CAVE_VIEW));
< v2 = (f2 && (g2_c_ptr->info & CAVE_VIEW));
---
> v1 = (f1 && (*(g1_w_ptr) & CAVE_VIEW));
> v2 = (f2 && (*(g2_w_ptr) & CAVE_VIEW));
1989c2191,2192
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2005c2208
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2013c2216
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2024c2227
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2033c2236
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2040c2243
< if (los(py, px, y, x))
---
> if (los(Depth, p_ptr->py, p_ptr->px, y, x))
2042c2245
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2143a2347,2349
> *
> * Well, I for one don't understand it, so I'm hoping I didn't screw anything
> * up while trying to do this. --KLJ--
2145c2351
< void update_view(void)
---
> void update_view(int Ind)
2146a2353,2355
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
2153,2154c2362,2363
< int y_max = cur_hgt - 1;
< int x_max = cur_wid - 1;
---
> int y_max = p_ptr->cur_hgt - 1;
> int x_max = p_ptr->cur_wid - 1;
2156a2366
> byte *w_ptr;
2162c2372
< if (view_reduce_view && !dun_level)
---
> if (view_reduce_view && !Depth)
2185c2395
< for (n = 0; n < view_n; n++)
---
> for (n = 0; n < p_ptr->view_n; n++)
2187,2188c2397,2398
< y = view_y[n];
< x = view_x[n];
---
> y = p_ptr->view_y[n];
> x = p_ptr->view_x[n];
2191c2401,2402
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2194c2405
< c_ptr->info &= ~(CAVE_VIEW);
---
> *w_ptr &= ~(CAVE_VIEW);
2200,2202c2411,2413
< temp_y[temp_n] = y;
< temp_x[temp_n] = x;
< temp_n++;
---
> p_ptr->temp_y[p_ptr->temp_n] = y;
> p_ptr->temp_x[p_ptr->temp_n] = x;
> p_ptr->temp_n++;
2206c2417
< view_n = 0;
---
> p_ptr->view_n = 0;
2212,2213c2423,2424
< y = py;
< x = px;
---
> y = p_ptr->py;
> x = p_ptr->px;
2216c2427,2428
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2222c2434
< cave_view_hack(c_ptr, y, x);
---
> cave_view_hack(w_ptr, y, x);
2233c2445,2446
< c_ptr = &cave[y+d][x+d];
---
> c_ptr = &cave[Depth][y+d][x+d];
> w_ptr = &p_ptr->cave_flag[y+d][x+d];
2235c2448
< cave_view_hack(c_ptr, y+d, x+d);
---
> cave_view_hack(w_ptr, y+d, x+d);
2242c2455,2456
< c_ptr = &cave[y+d][x-d];
---
> c_ptr = &cave[Depth][y+d][x-d];
> w_ptr = &p_ptr->cave_flag[y+d][x-d];
2244c2458
< cave_view_hack(c_ptr, y+d, x-d);
---
> cave_view_hack(w_ptr, y+d, x-d);
2251c2465,2466
< c_ptr = &cave[y-d][x+d];
---
> c_ptr = &cave[Depth][y-d][x+d];
> w_ptr = &p_ptr->cave_flag[y-d][x+d];
2253c2468
< cave_view_hack(c_ptr, y-d, x+d);
---
> cave_view_hack(w_ptr, y-d, x+d);
2260c2475,2476
< c_ptr = &cave[y-d][x-d];
---
> c_ptr = &cave[Depth][y-d][x-d];
> w_ptr = &p_ptr->cave_flag[y-d][x-d];
2262c2478
< cave_view_hack(c_ptr, y-d, x-d);
---
> cave_view_hack(w_ptr, y-d, x-d);
2272c2488,2489
< c_ptr = &cave[y+d][x];
---
> c_ptr = &cave[Depth][y+d][x];
> w_ptr = &p_ptr->cave_flag[y+d][x];
2274c2491
< cave_view_hack(c_ptr, y+d, x);
---
> cave_view_hack(w_ptr, y+d, x);
2284c2501,2502
< c_ptr = &cave[y-d][x];
---
> c_ptr = &cave[Depth][y-d][x];
> w_ptr = &p_ptr->cave_flag[y-d][x];
2286c2504
< cave_view_hack(c_ptr, y-d, x);
---
> cave_view_hack(w_ptr, y-d, x);
2296c2514,2515
< c_ptr = &cave[y][x+d];
---
> c_ptr = &cave[Depth][y][x+d];
> w_ptr = &p_ptr->cave_flag[y][x+d];
2298c2517
< cave_view_hack(c_ptr, y, x+d);
---
> cave_view_hack(w_ptr, y, x+d);
2308c2527,2528
< c_ptr = &cave[y][x-d];
---
> c_ptr = &cave[Depth][y][x-d];
> w_ptr = &p_ptr->cave_flag[y][x-d];
2310c2530
< cave_view_hack(c_ptr, y, x-d);
---
> cave_view_hack(w_ptr, y, x-d);
2559c2779
< for (n = 0; n < view_n; n++)
---
> for (n = 0; n < p_ptr->view_n; n++)
2561,2562c2781,2782
< y = view_y[n];
< x = view_x[n];
---
> y = p_ptr->view_y[n];
> x = p_ptr->view_x[n];
2565c2785
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2577c2797
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
2581c2801
< for (n = 0; n < temp_n; n++)
---
> for (n = 0; n < p_ptr->temp_n; n++)
2583,2584c2803,2804
< y = temp_y[n];
< x = temp_x[n];
---
> y = p_ptr->temp_y[n];
> x = p_ptr->temp_x[n];
2587c2807,2808
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2593c2814
< if (c_ptr->info & CAVE_VIEW) continue;
---
> if (*w_ptr & CAVE_VIEW) continue;
2596c2817
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
2600c2821,2826
< temp_n = 0;
---
> p_ptr->temp_n = 0;
>
> /* XXX XXX XXX Mega-Hack -- Redraw player's spot every time */
> /* This keeps the network connection "active" even if nothing is */
> /* happening -- KLJ */
> lite_spot(p_ptr->py, p_ptr->px);
2622c2848
< static int flow_n = 0;
---
> /*static int flow_n = 0;*/
2795c3021
< void map_area(void)
---
> void map_area(int Ind)
2796a3023,3024
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
2799a3028
> byte *w_ptr;
2803,2806c3032,3035
< y1 = panel_row_min - randint(10);
< y2 = panel_row_max + randint(10);
< x1 = panel_col_min - randint(20);
< x2 = panel_col_max + randint(20);
---
> y1 = p_ptr->panel_row_min - randint(10);
> y2 = p_ptr->panel_row_max + randint(10);
> x1 = p_ptr->panel_col_min - randint(20);
> x2 = p_ptr->panel_col_max + randint(20);
2810c3039
< if (y2 > cur_hgt-2) y2 = cur_hgt-2;
---
> if (y2 > p_ptr->cur_hgt-2) y2 = p_ptr->cur_hgt-2;
2812c3041
< if (x2 > cur_wid-2) x2 = cur_wid-2;
---
> if (x2 > p_ptr->cur_wid-2) x2 = p_ptr->cur_wid-2;
2819c3048,3049
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2828c3058
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
2834c3064,3065
< c_ptr = &cave[y+ddy_ddd[i]][x+ddx_ddd[i]];
---
> c_ptr = &cave[Depth][y+ddy_ddd[i]][x+ddx_ddd[i]];
> w_ptr = &p_ptr->cave_flag[y+ddy_ddd[i]][x+ddx_ddd[i]];
2840c3071
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
2872c3103
< void wiz_lite(void)
---
> void wiz_lite(int Ind)
2873a3105,3106
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
2876a3110
> byte *w_ptr;
2880c3114
< for (y = 1; y < cur_hgt-1; y++)
---
> for (y = 1; y < p_ptr->cur_hgt-1; y++)
2883c3117
< for (x = 1; x < cur_wid-1; x++)
---
> for (x = 1; x < p_ptr->cur_wid-1; x++)
2886c3120,3121
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
2891,2892d3125
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
2894c3127
< o_ptr->marked = TRUE;
---
> p_ptr->obj_vis[c_ptr->o_idx]= TRUE;
2907c3140,3141
< c_ptr = &cave[yy][xx];
---
> c_ptr = &cave[Depth][yy][xx];
> w_ptr = &p_ptr->cave_flag[yy][xx];
2916c3150
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
2923c3157
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
2944c3178
< void wiz_dark(void)
---
> void wiz_dark(int Ind)
2945a3180,3181
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
2950c3186
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < p_ptr->cur_hgt; y++)
2952c3188
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < p_ptr->cur_wid; x++)
2954c3190,3191
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
> byte *w_ptr = &p_ptr->cave_flag[y][x];
2957c3194
< c_ptr->info &= ~CAVE_MARK;
---
> *w_ptr &= ~CAVE_MARK;
2962,2963d3198
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
2965c3200
< o_ptr->marked = FALSE;
---
> p_ptr->obj_vis[c_ptr->o_idx] = FALSE;
3097c3332
< bool projectable(int y1, int x1, int y2, int x2)
---
> bool projectable(int Depth, int y1, int x1, int y2, int x2)
3108c3343
< if (dist && !cave_floor_bold(y, x)) break;
---
> if (dist && !cave_floor_bold(Depth, y, x)) break;
3135c3370
< void scatter(int *yp, int *xp, int y, int x, int d, int m)
---
> void scatter(int Depth, int *yp, int *xp, int y, int x, int d, int m)
3150c3385,3386
< if (!in_bounds(y, x)) continue;
---
> if (!in_bounds(Depth, y, x)) continue;
>
3156c3392
< if (los(y, x, ny, nx)) break;
---
> if (los(Depth, y, x, ny, nx)) break;
3168a3405,3406
> *
> * This is currently disabled --KLJ--
3173c3411
< health_who = m_idx;
---
> /*health_who = m_idx;*/
3176c3414
< p_ptr->redraw |= (PR_HEALTH);
---
> /*p_ptr->redraw |= (PR_HEALTH);*/
3182a3421,3422
> *
> * Monster recall is disabled for now --KLJ--
3187c3427
< recent_idx = r_idx;
---
> /*recent_idx = r_idx;*/
3190c3430
< p_ptr->window |= (PW_MONSTER);
---
> /*p_ptr->window |= (PW_MONSTER);*/
3205c3445
< void disturb(int stop_search, int unused_flag)
---
> void disturb(int int stop_search, int unused_flag)
3206a3447,3448
> player_type *p_ptr = Players[Ind];
>
3212a3455
> #if 0
3221a3465
> #endif
3234c3478
< if (running)
---
> if (p_ptr->running)
3237c3481
< running = 0;
---
> p_ptr->running = 0;
diff -r src-280/cmd1.c mangband-000/src/server/cmd1.c
12a13,14
> #define SERVER
>
80c82
< s16b critical_shot(int weight, int plus, int dam)
---
> s16b critical_shot(int int weight, int plus, int dam)
81a84,85
> player_type *p_ptr = Players[Ind];
>
119c123
< s16b critical_norm(int weight, int plus, int dam)
---
> s16b critical_norm(int int weight, int plus, int dam)
120a125,126
> player_type *p_ptr = Players[Ind];
>
198c204
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_ANIMAL;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_ANIMAL;*/
207c213
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_EVIL;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_EVIL;*/
216c222
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_UNDEAD;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_UNDEAD;*/
225c231
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DEMON;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DEMON;*/
234c240
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_ORC;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_ORC;*/
243c249
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_TROLL;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_TROLL;*/
252c258
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_GIANT;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_GIANT;*/
261c267
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DRAGON;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DRAGON;*/
270c276
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DRAGON;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_DRAGON;*/
282c288
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_ACID;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_ACID;*/
298c304
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_ELEC;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_ELEC;*/
314c320
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_FIRE;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_FIRE;*/
330c336
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_COLD;
---
> /*if (m_ptr->ml) r_ptr->r_flags3 |= RF3_IM_COLD;*/
353c359
< void search(void)
---
> void search(int Ind)
354a361,363
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
365c374
< if (p_ptr->blind || no_lite()) chance = chance / 10;
---
> if (p_ptr->blind || no_lite(Ind)) chance = chance / 10;
369c378
< for (y = (py - 1); y <= (py + 1); y++)
---
> for (y = (p_ptr->py - 1); y <= (p_ptr->py + 1); y++)
371c380
< for (x = (px - 1); x <= (px + 1); x++)
---
> for (x = (p_ptr->px - 1); x <= (p_ptr->px + 1); x++)
377c386
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
386c395
< pick_trap(y, x);
---
> pick_trap(Depth, y, x);
408c417
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
443c452
< void carry(int pickup)
---
> void carry(int int pickup)
445c454,455
< cave_type *c_ptr = &cave[py][px];
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
446a457,458
> cave_type *c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
>
481c493
< delete_object(py, px);
---
> delete_object(Depth, p_ptr->py, p_ptr->px);
506a519
> #if 0
513a527
> #endif
524c538
< o_ptr = &inventory[slot];
---
> o_ptr = &(p_ptr->inventory[slot]);
533c547
< delete_object(py, px);
---
> delete_object(Depth, p_ptr->py, p_ptr->px);
548c562
< static int check_hit(int power)
---
> static int check_hit(int int power)
549a564,565
> player_type *p_ptr = Players[Ind];
>
576c592
< static void hit_trap(void)
---
> static void hit_trap(int Ind)
577a594,596
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
580a600
> byte *w_ptr;
589c609,610
< c_ptr = &cave[py][px];
---
> c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
> w_ptr = &p_ptr->cave_flag[p_ptr->py][p_ptr->px];
606,607c627,642
< new_level_flag = TRUE;
< dun_level++;
---
> p_ptr->new_level_flag = TRUE;
>
> /* The player is gone */
> cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show everyone that he's left */
> everyone_lite_spot(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
>
> /* Reduce the number of players on this depth */
> players_on_depth[p_ptr->dun_depth]--;
>
> p_ptr->dun_depth++;
>
> /* Increase the number of players on this next depth */
> players_on_depth[p_ptr->dun_depth]++;
>
702,704c737,739
< c_ptr->info &= ~CAVE_MARK;
< note_spot(py, px);
< lite_spot(py, px);
---
> *w_ptr &= ~CAVE_MARK;
> note_spot(p_ptr->py, p_ptr->px);
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
708c743
< (void)summon_specific(py, px, dun_level, 0);
---
> (void)summon_specific(Depth, p_ptr->py, p_ptr->px, Depth, 0);
849c884
< void py_attack(int y, int x)
---
> void py_attack(int int y, int x)
850a886,888
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
853c891
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
880c918
< if (m_ptr->ml) recent_track(m_ptr->r_idx);
---
> if (p_ptr->mon_vis[c_ptr->m_idx]) recent_track(m_ptr->r_idx);
883c921
< if (m_ptr->ml) health_track(c_ptr->m_idx);
---
> if (p_ptr->mon_vis[c_ptr->m_idx]) health_track(c_ptr->m_idx);
898c936
< o_ptr = &inventory[INVEN_WIELD];
---
> o_ptr = &(p_ptr->inventory[INVEN_WIELD]);
909c947
< if (test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
---
> if (test_hit_norm(chance, r_ptr->ac, p_ptr->mon_vis[c_ptr->m_idx]))
957c995
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_NO_CONF;
---
> if (p_ptr->mon_vis[c_ptr->m_idx]) r_ptr->r_flags3 |= RF3_NO_CONF;
985c1023
< if (fear && m_ptr->ml)
---
> if (fear && p_ptr->mon_vis[c_ptr->m_idx])
996c1034
< if (do_quake) earthquake(py, px, 10);
---
> if (do_quake) earthquake(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 10);
1012c1050
< void move_player(int dir, int do_pickup)
---
> void move_player(int int dir, int do_pickup)
1013a1052,1054
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1018a1060
> byte *w_ptr;
1022,1023c1064,1065
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
1026c1068,1069
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
1034a1078,1088
> /* Bump into other players */
> if (c_ptr->p_idx)
> {
> msg_format("You bump into %s.", Players[c_ptr->p_idx]->name);
> msg_format(c_ptr->p_idx, "%s bumps into you.", p_ptr->name);
>
> /* Disturb both parties */
> disturb(1, 0);
> disturb(c_ptr->p_idx, 1, 0);
> }
>
1036c1090
< if (c_ptr->m_idx)
---
> else if (c_ptr->m_idx)
1043c1097
< else if (!cave_floor_bold(y, x))
---
> else if (!cave_floor_bold(Depth, y, x))
1049,1050c1103,1104
< if (!(c_ptr->info & CAVE_MARK) &&
< (p_ptr->blind || !(c_ptr->info & CAVE_LITE)))
---
> if (!(*w_ptr & CAVE_MARK) &&
> (p_ptr->blind || !(*w_ptr & CAVE_LITE)))
1056,1057c1110,1111
< c_ptr->info |= CAVE_MARK;
< lite_spot(y, x);
---
> *w_ptr |= CAVE_MARK;
> everyone_lite_spot(Depth, y, x);
1064,1065c1118,1119
< c_ptr->info |= CAVE_MARK;
< lite_spot(y, x);
---
> *w_ptr |= CAVE_MARK;
> everyone_lite_spot(Depth, y, x);
1072,1073c1126,1127
< c_ptr->info |= CAVE_MARK;
< lite_spot(y, x);
---
> *w_ptr |= CAVE_MARK;
> everyone_lite_spot(Depth, y, x);
1106,1107c1160,1161
< oy = py;
< ox = px;
---
> oy = p_ptr->py;
> ox = p_ptr->px;
1110,1111c1164,1165
< py = y;
< px = x;
---
> p_ptr->py = y;
> p_ptr->px = x;
1112a1167,1170
> /* Update the player indices */
> cave[Depth][oy][ox].p_idx = 0;
> cave[Depth][y][x].p_idx = Ind;
>
1114c1172
< lite_spot(py, px);
---
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
1117c1175
< lite_spot(oy, ox);
---
> everyone_lite_spot(Depth, oy, ox);
1120c1178
< verify_panel();
---
> verify_panel(Ind);
1136c1194
< search();
---
> search(Ind);
1142c1200
< search();
---
> search(Ind);
1169c1227
< pick_trap(py, px);
---
> pick_trap(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
1172c1230
< hit_trap();
---
> hit_trap(Ind);
1183c1241
< hit_trap();
---
> hit_trap(Ind);
1192c1250
< static int see_wall(int dir, int y, int x)
---
> static int see_wall(int int dir, int y, int x)
1193a1252,1254
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1199c1260
< if (!in_bounds2(y, x)) return (FALSE);
---
> if (!in_bounds2(Depth, y, x)) return (FALSE);
1202c1263
< if (cave_floor_bold(y, x)) return (FALSE);
---
> if (cave_floor_bold(Depth, y, x)) return (FALSE);
1205c1266
< if (!(cave[y][x].info & CAVE_MARK)) return (FALSE);
---
> if (!(p_ptr->cave_flag[y][x] & CAVE_MARK)) return (FALSE);
1215c1276
< static int see_nothing(int dir, int y, int x)
---
> static int see_nothing(int dir, int int y, int x)
1216a1278,1280
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1222c1286
< if (!in_bounds2(y, x)) return (TRUE);
---
> if (!in_bounds2(Depth, y, x)) return (TRUE);
1225c1289
< if (cave[y][x].info & CAVE_MARK) return (FALSE);
---
> if (p_ptr->cave_flag[y][x] & CAVE_MARK) return (FALSE);
1228c1292
< if (!cave_floor_bold(y, x)) return (TRUE);
---
> if (!cave_floor_bold(Depth, y, x)) return (TRUE);
1387c1451
< static byte find_current;
---
> /*static byte find_current;*/
1392c1456
< static byte find_prevdir;
---
> /*static byte find_prevdir;*/
1397c1461
< static bool find_openarea;
---
> /*static bool find_openarea;*/
1402,1403c1466,1467
< static bool find_breakright;
< static bool find_breakleft;
---
> /*static bool find_breakright;
> static bool find_breakleft;*/
1421c1485
< static void run_init(int dir)
---
> static void run_init(int int dir)
1422a1487,1488
> player_type *p_ptr = Players[Ind];
>
1428c1494
< find_current = dir;
---
> p_ptr->find_current = dir;
1431c1497
< find_prevdir = dir;
---
> p_ptr->find_prevdir = dir;
1434c1500
< find_openarea = TRUE;
---
> p_ptr->find_openarea = TRUE;
1437c1503
< find_breakright = find_breakleft = FALSE;
---
> p_ptr->find_breakright = p_ptr->find_breakleft = FALSE;
1444,1445c1510,1511
< row = py + ddy[dir];
< col = px + ddx[dir];
---
> row = p_ptr->py + ddy[dir];
> col = p_ptr->px + ddx[dir];
1451c1517
< if (see_wall(cycle[i+1], py, px))
---
> if (see_wall(cycle[i+1], p_ptr->py, p_ptr->px))
1453c1519
< find_breakleft = TRUE;
---
> p_ptr->find_breakleft = TRUE;
1458c1524
< find_breakleft = TRUE;
---
> p_ptr->find_breakleft = TRUE;
1463c1529
< if (see_wall(cycle[i-1], py, px))
---
> if (see_wall(cycle[i-1], p_ptr->py, p_ptr->px))
1465c1531
< find_breakright = TRUE;
---
> p_ptr->find_breakright = TRUE;
1470c1536
< find_breakright = TRUE;
---
> p_ptr->find_breakright = TRUE;
1475c1541
< if (find_breakleft && find_breakright)
---
> if (p_ptr->find_breakleft && p_ptr->find_breakright)
1478c1544
< find_openarea = FALSE;
---
> p_ptr->find_openarea = FALSE;
1485c1551
< find_prevdir = cycle[i - 1];
---
> p_ptr->find_prevdir = cycle[i - 1];
1489c1555
< find_prevdir = cycle[i + 1];
---
> p_ptr->find_prevdir = cycle[i + 1];
1498c1564
< find_prevdir = cycle[i - 2];
---
> p_ptr->find_prevdir = cycle[i - 2];
1502c1568
< find_prevdir = cycle[i + 2];
---
> p_ptr->find_prevdir = cycle[i + 2];
1514c1580
< static bool run_test(void)
---
> static bool run_test(int Ind)
1515a1582,1584
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1522a1592
> byte *w_ptr;
1530c1600
< prev_dir = find_prevdir;
---
> prev_dir = p_ptr->find_prevdir;
1542,1543c1612,1613
< row = py + ddy[new_dir];
< col = px + ddx[new_dir];
---
> row = p_ptr->py + ddy[new_dir];
> col = p_ptr->px + ddx[new_dir];
1545c1615,1616
< c_ptr = &cave[row][col];
---
> c_ptr = &cave[Depth][row][col];
> w_ptr = &p_ptr->cave_flag[row][col];
1551,1552d1621
< monster_type *m_ptr = &m_list[c_ptr->m_idx];
<
1554c1623
< if (m_ptr->ml) return (TRUE);
---
> if (p_ptr->mon_vis[c_ptr->m_idx]) return (TRUE);
1560,1561d1628
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
1563c1630
< if (o_ptr->marked) return (TRUE);
---
> if (p_ptr->obj_vis[c_ptr->o_idx]) return (TRUE);
1571c1638
< if (c_ptr->info & CAVE_MARK)
---
> if (*w_ptr & CAVE_MARK)
1643c1710
< if (inv || cave_floor_bold(row, col))
---
> if (inv || cave_floor_bold(Depth, row, col))
1646c1713
< if (find_openarea)
---
> if (p_ptr->find_openarea)
1688c1755
< if (find_openarea)
---
> if (p_ptr->find_openarea)
1693c1760
< find_breakright = TRUE;
---
> p_ptr->find_breakright = TRUE;
1699c1766
< find_breakleft = TRUE;
---
> p_ptr->find_breakleft = TRUE;
1707c1774
< if (find_openarea)
---
> if (p_ptr->find_openarea)
1714,1715c1781,1782
< row = py + ddy[new_dir];
< col = px + ddx[new_dir];
---
> row = p_ptr->py + ddy[new_dir];
> col = p_ptr->px + ddx[new_dir];
1718c1785
< if (!(cave[row][col].info & CAVE_MARK) || cave_floor_bold(row, col))
---
> if (!(p_ptr->cave_flag[row][col] & CAVE_MARK) || cave_floor_bold(Depth, row, col))
1721c1788
< if (find_breakright)
---
> if (p_ptr->find_breakright)
1731c1798
< if (find_breakleft)
---
> if (p_ptr->find_breakleft)
1743,1744c1810,1811
< row = py + ddy[new_dir];
< col = px + ddx[new_dir];
---
> row = p_ptr->py + ddy[new_dir];
> col = p_ptr->px + ddx[new_dir];
1747c1814
< if (!(cave[row][col].info & CAVE_MARK) || cave_floor_bold(row, col))
---
> if (!(p_ptr->cave_flag[row][col] & CAVE_MARK) || cave_floor_bold(Depth, row, col))
1750c1817
< if (find_breakleft)
---
> if (p_ptr->find_breakleft)
1760c1827
< if (find_breakright)
---
> if (p_ptr->find_breakright)
1782c1849
< find_current = option;
---
> p_ptr->find_current = option;
1785c1852
< find_prevdir = option;
---
> p_ptr->find_prevdir = option;
1792c1859
< find_current = option;
---
> p_ptr->find_current = option;
1795c1862
< find_prevdir = option2;
---
> p_ptr->find_prevdir = option2;
1802,1803c1869,1870
< row = py + ddy[option];
< col = px + ddx[option];
---
> row = p_ptr->py + ddy[option];
> col = p_ptr->px + ddx[option];
1816,1817c1883,1884
< find_current = option;
< find_prevdir = option2;
---
> p_ptr->find_current = option;
> p_ptr->find_prevdir = option2;
1830,1831c1897,1898
< find_current = option2;
< find_prevdir = option2;
---
> p_ptr->find_current = option2;
> p_ptr->find_prevdir = option2;
1838,1839c1905,1906
< find_current = option;
< find_prevdir = option2;
---
> p_ptr->find_current = option;
> p_ptr->find_prevdir = option2;
1846c1913
< if (see_wall(find_current, py, px))
---
> if (see_wall(p_ptr->find_current, p_ptr->py, p_ptr->px))
1861c1928
< void run_step(int dir)
---
> void run_step(int int dir)
1862a1930,1931
> player_type *p_ptr = Players[Ind];
>
1867c1936
< if (see_wall(dir, py, px))
---
> if (see_wall(dir, p_ptr->py, p_ptr->px))
1890c1959
< if (run_test())
---
> if (run_test(Ind))
1901c1970
< if (--running <= 0) return;
---
> if (--(p_ptr->running) <= 0) return;
1904d1972
< energy_use = 100;
1905a1974,1978
> /* To make running more efficient in exploring the dungeon, people can
> * now run twice as fast as normal --KLJ--
> */
> p_ptr->energy_use = 20;
>
1907c1980
< move_player(find_current, always_pickup);
---
> move_player(p_ptr->find_current, always_pickup);
diff -r src-280/cmd2.c mangband-000/src/server/cmd2.c
12a13,14
> #define SERVER
>
20c22
< void do_cmd_go_up(void)
---
> void do_cmd_go_up(int Ind)
21a24,26
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
25c30
< c_ptr = &cave[py][px];
---
> c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
33a39,48
> /* Remove the player from the old location */
> c_ptr->p_idx = 0;
>
> /* Show everyone that's he left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
35c50
< energy_use = 100;
---
> p_ptr->energy_use = 100;
39a55,57
> /* A player has left this depth */
> players_on_depth[p_ptr->dun_depth]--;
>
41,42c59
< dun_level--;
< new_level_flag = TRUE;
---
> p_ptr->dun_depth--;
43a61,65
> /* And another player has entered this depth */
> players_on_depth[p_ptr->dun_depth]++;
>
> p_ptr->new_level_flag = TRUE;
>
52c74
< void do_cmd_go_down(void)
---
> void do_cmd_go_down(int Ind)
53a76,78
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
57c82
< c_ptr = &cave[py][px];
---
> c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
65a91,100
> /* Remove the player from the old location */
> c_ptr->p_idx = 0;
>
> /* Show everyone that's he left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
67c102
< energy_use = 100;
---
> p_ptr->energy_use = 100;
71a107,109
> /* A player has left this depth */
> players_on_depth[p_ptr->dun_depth]--;
>
73,74c111
< dun_level++;
< new_level_flag = TRUE;
---
> p_ptr->dun_depth++;
75a113,117
> /* Another player has entered this depth */
> players_on_depth[p_ptr->dun_depth]++;
>
> p_ptr->new_level_flag = TRUE;
>
85c127
< void do_cmd_search(void)
---
> void do_cmd_search(int Ind)
86a129,130
> player_type *p_ptr = Players[Ind];
>
91c135
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
101c145
< energy_use = 100;
---
> p_ptr->energy_use = 100;
104c148
< search();
---
> search(Ind);
111c155
< void do_cmd_toggle_search(void)
---
> void do_cmd_toggle_search(int Ind)
112a157,158
> player_type *p_ptr = Players[Ind];
>
153c199
< static void chest_death(int y, int x, object_type *o_ptr)
---
> static void chest_death(int int y, int x, object_type *o_ptr)
154a201,203
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
181c230
< scatter(&ny, &nx, y, x, d, 0);
---
> scatter(Depth, &ny, &nx, y, x, d, 0);
184c233
< if (!cave_clean_bold(ny, nx)) continue;
---
> if (!cave_clean_bold(Depth, ny, nx)) continue;
195c244
< place_gold(ny, nx);
---
> place_gold(Depth, ny, nx);
201c250
< place_object(ny, nx, FALSE, FALSE);
---
> place_object(Depth, ny, nx, FALSE, FALSE);
205c254
< object_level = dun_level;
---
> object_level = Depth;
214c263
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
217c266
< if ((ny == py) && (nx == px))
---
> if ((ny == p_ptr->py) && (nx == p_ptr->px))
242c291
< static void chest_trap(int y, int x, object_type *o_ptr)
---
> static void chest_trap(int int y, int x, object_type *o_ptr)
243a293,294
> player_type *p_ptr = Players[Ind];
>
299c350
< (void)summon_specific(y, x, dun_level, 0);
---
> (void)summon_specific(p_ptr->dun_depth, y, x, p_ptr->dun_depth, 0);
322c373
< void do_cmd_open(void)
---
> void do_cmd_open(int int dir)
324c375,378
< int y, x, i, j, dir;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
> int y, x, i, j;
337c391
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
347c401
< if (get_rep_dir(&dir))
---
> if (dir)
350,351c404,405
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
354c408
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
372c426
< energy_use = 100;
---
> p_ptr->energy_use = 100;
385c439
< energy_use = 100;
---
> p_ptr->energy_use = 100;
400c454
< if (p_ptr->blind || no_lite()) i = i / 10;
---
> if (p_ptr->blind || no_lite(Ind)) i = i / 10;
442c496
< energy_use = 100;
---
> p_ptr->energy_use = 100;
452c506
< energy_use = 100;
---
> p_ptr->energy_use = 100;
458c512
< if (p_ptr->blind || no_lite()) i = i / 10;
---
> if (p_ptr->blind || no_lite(Ind)) i = i / 10;
486c540
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
516c570
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
531c585
< void do_cmd_close(void)
---
> void do_cmd_close(int int dir)
533c587,590
< int y, x, dir;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
> int y, x;
543c600
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
553c610
< if (get_rep_dir(&dir))
---
> if (dir)
556,557c613,614
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
560c617
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
580c637
< energy_use = 100;
---
> p_ptr->energy_use = 100;
593c650
< energy_use = 100;
---
> p_ptr->energy_use = 100;
602c659
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
624c681
< static bool twall(int y, int x)
---
> static bool twall(int int y, int x)
626c683,684
< cave_type *c_ptr = &cave[y][x];
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
627a686,688
> cave_type *c_ptr = &cave[Depth][y][x];
> byte *w_ptr = &p_ptr->cave_flag[y][x];
>
629c690
< if (cave_floor_bold(y, x)) return (FALSE);
---
> if (cave_floor_bold(Depth, y, x)) return (FALSE);
635c696
< c_ptr->info &= ~CAVE_MARK;
---
> *w_ptr &= ~CAVE_MARK;
641c702
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
662c723
< void do_cmd_tunnel(void)
---
> void do_cmd_tunnel(int int dir)
664c725,726
< int y, x, dir;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
665a728,729
> int y, x;
>
677c741
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
687c751
< if (get_rep_dir(&dir))
---
> if (dir)
690,691c754,755
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
694c758
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
697c761
< old_floor = cave_floor_bold(y, x);
---
> old_floor = cave_floor_bold(Depth, y, x);
700c764
< if (cave_floor_bold(y, x))
---
> if (cave_floor_bold(Depth, y, x))
717c781
< energy_use = 100;
---
> p_ptr->energy_use = 100;
730c794
< energy_use = 100;
---
> p_ptr->energy_use = 100;
788c852
< place_gold(y, x);
---
> place_gold(Depth, y, x);
794c858
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
837c901
< place_object(y, x, FALSE, FALSE);
---
> place_object(Depth, y, x, FALSE, FALSE);
848c912
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
867c931
< search();
---
> search(Ind);
872c936
< if (old_floor != cave_floor_bold(y, x))
---
> if (old_floor != cave_floor_bold(Depth, y, x))
887c951
< void do_cmd_disarm(void)
---
> void do_cmd_disarm(int int dir)
889c953,954
< int y, x, i, j, dir, power;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
890a956,957
> int y, x, i, j, power;
>
891a959
> byte *w_ptr;
901c969
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
911c979
< if (get_rep_dir(&dir))
---
> if (dir)
914,915c982,983
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
918c986,987
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
936c1005
< energy_use = 100;
---
> p_ptr->energy_use = 100;
949c1018
< energy_use = 100;
---
> p_ptr->energy_use = 100;
955c1024
< if (p_ptr->blind || no_lite()) i = i / 10;
---
> if (p_ptr->blind || no_lite(Ind)) i = i / 10;
1013c1082
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1019c1088
< if (p_ptr->blind || no_lite()) i = i / 10;
---
> if (p_ptr->blind || no_lite(Ind)) i = i / 10;
1046c1115
< c_ptr->info &= ~CAVE_MARK;
---
> *w_ptr &= ~CAVE_MARK;
1052c1121
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1105c1174
< void do_cmd_bash(void)
---
> void do_cmd_bash(int int dir)
1107c1176,1177
< int y, x, dir;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1108a1179,1180
> int y, x;
>
1120c1192
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
1130c1202
< if (get_rep_dir(&dir))
---
> if (dir)
1133,1134c1205,1206
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
1137c1209
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1151c1223
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1164c1236
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1204c1276
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1248c1320
< static bool get_spike(int *ip)
---
> static bool get_spike(int int *ip)
1249a1322,1323
> player_type *p_ptr = Players[Ind];
>
1255c1329
< object_type *o_ptr = &inventory[i];
---
> object_type *o_ptr = &(p_ptr->inventory[i]);
1279c1353
< void do_cmd_spike(void)
---
> void do_cmd_spike(int int dir)
1281c1355,1356
< int y, x, dir, item;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1282a1358,1359
> int y, x, item;
>
1287c1364
< if (get_rep_dir(&dir))
---
> if (dir)
1290,1291c1367,1368
< y = py + ddy[dir];
< x = px + ddx[dir];
---
> y = p_ptr->py + ddy[dir];
> x = p_ptr->px + ddx[dir];
1294c1371
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1315c1392
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1328c1405
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1352c1429
< void do_cmd_walk(int pickup)
---
> void do_cmd_walk(int int dir, int pickup)
1354c1431
< int dir;
---
> player_type *p_ptr = Players[Ind];
1363c1440
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
1373c1450
< if (get_rep_dir(&dir))
---
> if (dir)
1376c1453
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1394c1471
< void do_cmd_run(void)
---
> void do_cmd_run(int int dir)
1396c1473
< int dir;
---
> player_type *p_ptr = Players[Ind];
1397a1475,1476
> /*printf("Starting run for player %d with direction %d.\n", dir);*/
>
1406c1485
< if (get_rep_dir(&dir))
---
> if (dir)
1409c1488
< running = (command_arg ? command_arg : 1000);
---
> p_ptr->running = (command_arg ? command_arg : 1000);
1412a1492,1494
>
> /* Reset player's energy */
> p_ptr->energy = 0;
1422c1504
< void do_cmd_stay(int pickup)
---
> void do_cmd_stay(int int pickup)
1424c1506,1507
< cave_type *c_ptr = &cave[py][px];
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1425a1509
> cave_type *c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
1426a1511
>
1431c1516
< command_rep = command_arg - 1;
---
> /*command_rep = command_arg - 1;*/
1442c1527
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1448c1533
< search();
---
> search(Ind);
1454c1539
< search();
---
> search(Ind);
1481a1567
> #if 0
1542a1629
> #endif
1621c1708
< void do_cmd_fire(void)
---
> void do_cmd_fire(int int dir, int item)
1623c1710,1712
< int dir, item;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1641c1730
< int msec = delay_factor * delay_factor * delay_factor;
---
> /*int msec = delay_factor * delay_factor * delay_factor;*/
1645c1734
< j_ptr = &inventory[INVEN_BOW];
---
> j_ptr = &(p_ptr->inventory[INVEN_BOW]);
1658,1664d1746
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Fire which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to fire.");
< return;
< }
<
1668c1750
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
1676,1677c1758,1762
< /* Get a direction (or cancel) */
< if (!get_aim_dir(&dir)) return;
---
> if (o_ptr->tval != p_ptr->tval_ammo)
> {
> msg_print("You cannot fire that!");
> return;
> }
1776c1861
< energy_use = (100 / thits);
---
> p_ptr->energy_use = (100 / thits);
1780,1781c1865,1866
< y = py;
< x = px;
---
> y = p_ptr->py;
> x = p_ptr->px;
1784,1785c1869,1870
< tx = px + 99 * ddx[dir];
< ty = py + 99 * ddy[dir];
---
> tx = p_ptr->px + 99 * ddx[dir];
> ty = p_ptr->py + 99 * ddy[dir];
1788c1873
< if ((dir == 5) && target_okay())
---
> if ((dir == 5) && target_okay(Ind))
1790,1791c1875,1876
< tx = target_col;
< ty = target_row;
---
> tx = p_ptr->target_col;
> ty = p_ptr->target_row;
1796c1881
< handle_stuff();
---
> handle_stuff(Ind);
1808c1893
< mmove2(&ny, &nx, py, px, ty, tx);
---
> mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx);
1811c1896
< if (!cave_floor_bold(ny, nx)) break;
---
> if (!cave_floor_bold(Depth, ny, nx)) break;
1825c1910,1911
< print_rel(missile_char, missile_attr, y, x);
---
> /* Sorry, this will come back later --KLJ-- */
> /*print_rel(missile_char, missile_attr, y, x);
1830c1916
< Term_fresh();
---
> Term_fresh();*/
1837c1923
< Term_xtra(TERM_XTRA_DELAY, msec);
---
> /*Term_xtra(TERM_XTRA_DELAY, msec);*/
1842c1928
< if (cave[y][x].m_idx)
---
> if (cave[Depth][y][x].m_idx)
1844c1930
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
1850c1936
< visible = m_ptr->ml;
---
> visible = p_ptr->mon_vis[c_ptr->m_idx];
1856c1942
< if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml))
---
> if (test_hit_fire(chance - cur_dis, r_ptr->ac, visible))
1893c1979
< if (m_ptr->ml) recent_track(m_ptr->r_idx);
---
> if (visible) recent_track(m_ptr->r_idx);
1896c1982
< if (m_ptr->ml) health_track(c_ptr->m_idx);
---
> if (visible) health_track(c_ptr->m_idx);
1926c2012
< if (fear && m_ptr->ml)
---
> if (fear && visible)
1951c2037
< drop_near(o_ptr, j, y, x);
---
> drop_near(o_ptr, j, Depth, y, x);
1965c2051
< void do_cmd_throw(void)
---
> void do_cmd_throw(int int dir, int item)
1967c2053,2055
< int dir, item;
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1983c2071
< int msec = delay_factor * delay_factor * delay_factor;
---
> /*int msec = delay_factor * delay_factor * delay_factor;*/
1986,1992d2073
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Throw which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to throw.");
< return;
< }
<
1996c2077
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
2004,2005d2084
< /* Get a direction (or cancel) */
< if (!get_aim_dir(&dir)) return;
2007d2085
<
2058c2136
< energy_use = 100;
---
> p_ptr->energy_use = 100;
2062,2063c2140,2141
< y = py;
< x = px;
---
> y = p_ptr->py;
> x = p_ptr->px;
2066,2067c2144,2145
< tx = px + 99 * ddx[dir];
< ty = py + 99 * ddy[dir];
---
> tx = p_ptr->px + 99 * ddx[dir];
> ty = p_ptr->py + 99 * ddy[dir];
2070c2148
< if ((dir == 5) && target_okay())
---
> if ((dir == 5) && target_okay(Ind))
2072,2073c2150,2151
< tx = target_col;
< ty = target_row;
---
> tx = p_ptr->target_col;
> ty = p_ptr->target_row;
2078c2156
< handle_stuff();
---
> handle_stuff(Ind);
2090c2168
< mmove2(&ny, &nx, py, px, ty, tx);
---
> mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx);
2107c2185
< print_rel(missile_char, missile_attr, y, x);
---
> /*print_rel(missile_char, missile_attr, y, x);
2112c2190
< Term_fresh();
---
> Term_fresh();*/
2119c2197
< Term_xtra(TERM_XTRA_DELAY, msec);
---
> /*Term_xtra(TERM_XTRA_DELAY, msec);*/
2124c2202
< if (cave[y][x].m_idx)
---
> if (cave[Depth][y][x].m_idx)
2126c2204
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
2132c2210
< visible = m_ptr->ml;
---
> visible = p_ptr->mon_vis[c_ptr->m_idx];
2138c2216
< if (test_hit_fire(chance - cur_dis, r_ptr->ac, m_ptr->ml))
---
> if (test_hit_fire(chance - cur_dis, r_ptr->ac, visible))
2175c2253
< if (m_ptr->ml) recent_track(m_ptr->r_idx);
---
> if (visible) recent_track(m_ptr->r_idx);
2178c2256
< if (m_ptr->ml) health_track(c_ptr->m_idx);
---
> if (visible) health_track(c_ptr->m_idx);
2208c2286
< if (fear && m_ptr->ml)
---
> if (fear && visible)
2233c2311
< drop_near(o_ptr, j, y, x);
---
> drop_near(o_ptr, j, Depth, y, x);
diff -r src-280/cmd3.c mangband-000/src/server/cmd3.c
12a13,14
> #define SERVER
>
24c26
< static void inven_takeoff(int item, int amt)
---
> static void inven_takeoff(int int item, int amt)
25a28,29
> player_type *p_ptr = Players[Ind];
>
37c41
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
82a87,89
>
> /* Window stuff */
> p_ptr->window |= (PW_EQUIP);
91c98
< static void inven_drop(int item, int amt)
---
> static void inven_drop(int int item, int amt)
92a100,101
> player_type *p_ptr = Players[Ind];
>
102c111
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
150c159
< drop_near(&tmp_obj, 0, py, px);
---
> drop_near(&tmp_obj, 0, p_ptr->dun_depth, p_ptr->py, p_ptr->px);
163a173,174
> *
> * This is handled by the client now --KLJ--
167c178
< char out_val[160];
---
> /*char out_val[160];*/
171c182
< command_wrk = FALSE;
---
> /*command_wrk = FALSE;*/
175c186
< Term_save();
---
> /*Term_save();*/
178c189
< item_tester_full = TRUE;
---
> /*item_tester_full = TRUE;*/
181c192
< show_inven();
---
> /*show_inven();*/
184c195
< item_tester_full = FALSE;
---
> /*item_tester_full = FALSE;*/
187,188c198,199
< sprintf(out_val, "Inventory (carrying %d.%d pounds). Command: ",
< total_weight / 10, total_weight % 10);
---
> /*sprintf(out_val, "Inventory (carrying %d.%d pounds). Command: ",
> total_weight / 10, total_weight % 10);*/
191c202
< prt(out_val, 0, 0);
---
> /*prt(out_val, 0, 0);*/
194c205
< command_new = inkey();
---
> /*command_new = inkey();*/
197c208
< Term_load();
---
> /*Term_load();*/
201,202c212,213
< if (command_new == ESCAPE)
< {
---
> /*if (command_new == ESCAPE)
> {*/
204c215
< command_new = 0;
---
> /*command_new = 0;
206c217
< }
---
> }*/
209,210c220,221
< else
< {
---
> /*else
> {*/
212,213c223,224
< command_see = TRUE;
< }
---
> /*command_see = TRUE;
> }*/
218a230,231
> *
> * This is handled be the client --KLJ--
222c235
< char out_val[160];
---
> /*char out_val[160];*/
226c239
< command_wrk = TRUE;
---
> /*command_wrk = TRUE;*/
230c243
< Term_save();
---
> /*Term_save();*/
233c246
< item_tester_full = TRUE;
---
> /*item_tester_full = TRUE;*/
236c249
< show_equip();
---
> /*show_equip();*/
239c252
< item_tester_full = FALSE;
---
> /*item_tester_full = FALSE;*/
242,243c255,256
< sprintf(out_val, "Equipment (carrying %d.%d pounds). Command: ",
< total_weight / 10, total_weight % 10);
---
> /*sprintf(out_val, "Equipment (carrying %d.%d pounds). Command: ",
> total_weight / 10, total_weight % 10);*/
246c259
< prt(out_val, 0, 0);
---
> /*prt(out_val, 0, 0);*/
249c262
< command_new = inkey();
---
> /*command_new = inkey();*/
252c265
< Term_load();
---
> /*Term_load();*/
256,257c269,270
< if (command_new == ESCAPE)
< {
---
> /*if (command_new == ESCAPE)
> {*/
259c272
< command_new = 0;
---
> /*command_new = 0;
261c274
< }
---
> }*/
264,265c277,278
< else
< {
---
> /*else
> {*/
267,268c280,281
< command_see = TRUE;
< }
---
> /*command_see = TRUE;
> }*/
275c288
< static bool item_tester_hook_wear(object_type *o_ptr)
---
> static bool item_tester_hook_wear(int object_type *o_ptr)
288c301
< void do_cmd_wield(void)
---
> void do_cmd_wield(int int item)
290c303,305
< int item, slot;
---
> player_type *p_ptr = Players[Ind];
>
> int slot;
300c315
< item_tester_hook = item_tester_hook_wear;
---
> /*item_tester_hook = item_tester_hook_wear;*/
302,307d316
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Wear/Wield which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing you can wear or wield.");
< return;
< }
312c321
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
321a331,336
> if (!item_tester_hook_wear(o_ptr))
> {
> msg_print("You may not wield that item.");
> return;
> }
>
326c341
< if (cursed_p(&inventory[slot]))
---
> if (cursed_p(&(p_ptr->inventory[slot])))
329c344
< object_desc(o_name, &inventory[slot], FALSE, 0);
---
> object_desc(o_name, &(p_ptr->inventory[slot]), FALSE, 0);
338a354
> #if 0
340c356
< if ((inven_cnt >= INVEN_PACK) &&
---
> if ((p_ptr->inven_cnt >= INVEN_PACK) &&
346a363
> #endif
350c367
< energy_use = 100;
---
> p_ptr->energy_use = 100;
371c388
< o_ptr = &inventory[slot];
---
> o_ptr = &(p_ptr->inventory[slot]);
374c391
< if (inventory[slot].k_idx) inven_takeoff(slot, 255);
---
> if (p_ptr->inventory[slot].k_idx) inven_takeoff(slot, 255);
382c399
< total_weight += o_ptr->weight;
---
> p_ptr->total_weight += o_ptr->weight;
385c402
< equip_cnt++;
---
> p_ptr->equip_cnt++;
439c456
< void do_cmd_takeoff(void)
---
> void do_cmd_takeoff(int int item)
441c458
< int item;
---
> player_type *p_ptr = Players[Ind];
445a463
> #if 0
447c465
< if (inven_cnt >= INVEN_PACK)
---
> if (p_ptr->inven_cnt >= INVEN_PACK)
452a471
> #endif
455,461d473
< /* Get an item (from equip) */
< if (!get_item(&item, "Take off which item? ", TRUE, FALSE, FALSE))
< {
< if (item == -2) msg_print("You are not wearing anything to take off.");
< return;
< }
<
465c477
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
487c499
< energy_use = 50;
---
> p_ptr->energy_use = 50;
497c509
< void do_cmd_drop(void)
---
> void do_cmd_drop(int int item, int quantity)
499c511
< int item, amt = 1;
---
> player_type *p_ptr = Players[Ind];
504,510d515
< /* Get an item (from equip or inven) */
< if (!get_item(&item, "Drop which item? ", TRUE, TRUE, FALSE))
< {
< if (item == -2) msg_print("You have nothing to drop.");
< return;
< }
<
514c519
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
535,539d539
< /* See how many items */
< if (o_ptr->number > 1)
< {
< /* Get a quantity */
< amt = get_quantity(NULL, o_ptr->number);
541,545c541
< /* Allow user abort */
< if (amt <= 0) return;
< }
<
<
---
> #if 0
547c543
< if (cave[py][px].o_idx)
---
> if (cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].o_idx)
552a549
> #endif
556c553
< energy_use = 50;
---
> p_ptr->energy_use = 50;
559c556
< inven_drop(item, amt);
---
> inven_drop(item, quantity);
567c564
< void do_cmd_destroy(void)
---
> void do_cmd_destroy(int int item, int quantity)
569c566,567
< int item, amt = 1;
---
> player_type *p_ptr = Players[Ind];
>
578d575
< char out_val[160];
580d576
<
585,591d580
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Destroy which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to destroy.");
< return;
< }
<
595c584
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
605,615d593
< /* See how many items */
< if (o_ptr->number > 1)
< {
< /* Get a quantity */
< amt = get_quantity(NULL, o_ptr->number);
<
< /* Allow user abort */
< if (amt <= 0) return;
< }
<
<
618c596
< o_ptr->number = amt;
---
> o_ptr->number = quantity;
621a600
> #if 0
628a608
> #endif
631c611
< energy_use = 100;
---
> p_ptr->energy_use = 100;
666c646
< inven_item_increase(item, -amt);
---
> inven_item_increase(item, -quantity);
674c654
< floor_item_increase(0 - item, -amt);
---
> floor_item_increase(0 - item, -quantity);
684c664
< void do_cmd_observe(void)
---
> void do_cmd_observe(int int item)
686c666
< int item;
---
> player_type *p_ptr = Players[Ind];
693,699d672
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Examine which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to examine.");
< return;
< }
<
703c676
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
726a700
> #if 0
728a703
> #endif
737c712
< void do_cmd_uninscribe(void)
---
> void do_cmd_uninscribe(int int item)
739c714
< int item;
---
> player_type *p_ptr = Players[Ind];
744,750d718
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Un-inscribe which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to un-inscribe.");
< return;
< }
<
754c722
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
787c755
< void do_cmd_inscribe(void)
---
> void do_cmd_inscribe(int int item, cptr inscription)
789c757
< int item;
---
> player_type *p_ptr = Players[Ind];
795d762
< char out_val[80];
797,804d763
<
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Inscribe which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to inscribe.");
< return;
< }
<
808c767
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
824,825c783,784
< /* Start with nothing */
< strcpy(out_val, "");
---
> /* Save the inscription */
> o_ptr->note = quark_add(inscription);
827,832c786,787
< /* Use old inscription */
< if (o_ptr->note)
< {
< /* Start with the old inscription */
< strcpy(out_val, quark_str(o_ptr->note));
< }
---
> /* Combine the pack */
> p_ptr->notice |= (PN_COMBINE);
834,845c789,790
< /* Get a new inscription (possibly empty) */
< if (get_string("Inscription: ", out_val, 80))
< {
< /* Save the inscription */
< o_ptr->note = quark_add(out_val);
<
< /* Combine the pack */
< p_ptr->notice |= (PN_COMBINE);
<
< /* Window stuff */
< p_ptr->window |= (PW_INVEN | PW_EQUIP);
< }
---
> /* Window stuff */
> p_ptr->window |= (PW_INVEN | PW_EQUIP);
870c815
< static void do_cmd_refill_lamp(void)
---
> static void do_cmd_refill_lamp(int int item)
872c817
< int item;
---
> player_type *p_ptr = Players[Ind];
881,887d825
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Refill with which flask? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no flasks of oil.");
< return;
< }
<
891c829
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
899a838,842
> if (!item_tester_hook(o_ptr))
> {
> msg_print("You cannot refill with that!");
> return;
> }
900a844
>
902c846
< energy_use = 50;
---
> p_ptr->energy_use = 50;
905c849
< j_ptr = &inventory[INVEN_LITE];
---
> j_ptr = &(p_ptr->inventory[INVEN_LITE]);
959c903
< static void do_cmd_refill_torch(void)
---
> static void do_cmd_refill_torch(int int item)
961c905
< int item;
---
> player_type *p_ptr = Players[Ind];
970,976d913
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Refuel with which torch? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no extra torches.");
< return;
< }
<
980c917
< o_ptr = &inventory[item];
---
> o_ptr = &(p_ptr->inventory[item]);
988a926,930
> if (!item_tester_hook(o_ptr))
> {
> msg_print("You cannot refill with that!");
> return;
> }
989a932
>
991c934
< energy_use = 50;
---
> p_ptr->energy_use = 50;
994c937
< j_ptr = &inventory[INVEN_LITE];
---
> j_ptr = &(p_ptr->inventory[INVEN_LITE]);
1041c984
< void do_cmd_refill(void)
---
> void do_cmd_refill(int int item)
1042a986,987
> player_type *p_ptr = Players[Ind];
>
1046c991
< o_ptr = &inventory[INVEN_LITE];
---
> o_ptr = &(p_ptr->inventory[INVEN_LITE]);
1057c1002
< do_cmd_refill_lamp();
---
> do_cmd_refill_lamp(item);
1063c1008
< do_cmd_refill_torch();
---
> do_cmd_refill_torch(item);
1081c1026
< void do_cmd_target(void)
---
> void do_cmd_target(int int dir)
1084c1029
< if (target_set())
---
> if (target_set(dir))
1090c1035
< msg_print("Target Aborted.");
---
> /*msg_print("Target Aborted.");*/
1114c1059
< static int do_cmd_look_aux(int y, int x)
---
> static int do_cmd_look_aux(int int y, int x)
1116c1061,1062
< cave_type *c_ptr = &cave[y][x];
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
1117a1064,1066
> cave_type *c_ptr = &cave[Depth][y][x];
> byte *w_ptr = &p_ptr->cave_flag[y][x];
>
1140c1089
< if ((y == py) && (x == px))
---
> if ((y == p_ptr->py) && (x == p_ptr->px))
1150c1099
< if (!(c_ptr->info & CAVE_MARK)) feat = FEAT_NONE;
---
> if (!(*w_ptr & CAVE_MARK)) feat = FEAT_NONE;
1155c1104
< if (c_ptr->m_idx && m_ptr->ml)
---
> if (c_ptr->m_idx && p_ptr->mon_vis[c_ptr->m_idx])
1167c1116
< handle_stuff();
---
> handle_stuff(Ind);
1170c1119,1120
< sprintf(out_val, "%s%s%s (%s) [(r)ecall]",
---
> /* No prompt for recall --KLJ-- */
> sprintf(out_val, "%s%s%s (%s)",
1172d1121
< prt(out_val, 0, 0);
1173a1123,1125
> /* Send this as a message to player --KLJ--*/
> msg_print(out_val);
>
1175,1176c1127,1129
< move_cursor_relative(y, x);
< query = inkey();
---
> /* Nope --KLJ-- */
> /*move_cursor_relative(y, x);
> query = inkey();*/
1178,1195d1130
< /* Recall as needed */
< while (query == 'r')
< {
< /* Recall */
< Term_save();
< screen_roff(m_ptr->r_idx);
< Term_addstr(-1, TERM_WHITE, " --pause--");
< query = inkey();
< Term_load();
<
< /* Continue if desired */
< if (query != ' ') return (query);
<
< /* Get a new command */
< move_cursor_relative(y, x);
< query = inkey();
< }
<
1218c1153
< if (c_ptr->o_idx && o_ptr->marked)
---
> if (c_ptr->o_idx && p_ptr->obj_vis[c_ptr->o_idx])
1224,1227c1159,1161
< sprintf(out_val, "%s%s%s. --pause--", s1, s2, o_name);
< prt(out_val, 0, 0);
< move_cursor_relative(y, x);
< query = inkey();
---
> sprintf(out_val, "%s%s%s.", s1, s2, o_name);
> /* Send a message instead --KLJ-- */
> msg_print(out_val);
1228a1163,1165
> /*move_cursor_relative(y, x);
> query = inkey();*/
>
1268,1271c1205
< sprintf(out_val, "%s%s%s%s. --pause--", s1, p1, p2, name);
< prt(out_val, 0, 0);
< move_cursor_relative(y, x);
< query = inkey();
---
> sprintf(out_val, "%s%s%s%s.", s1, p1, p2, name);
1272a1207,1209
> /* Send a message to the player --KLJ-- */
> msg_print(out_val);
>
1286c1223
< * Hack -- determine if a given location is "interesting"
---
> * Hack -- determine if a given location is "interesting" to a player
1288c1225
< static bool do_cmd_look_accept(int y, int x)
---
> static bool do_cmd_look_accept(int int y, int x)
1289a1227,1229
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
1290a1231
> byte *w_ptr;
1294c1235
< if ((y == py) && (x == px)) return (TRUE);
---
> if ((y == p_ptr->py) && (x == p_ptr->px)) return (TRUE);
1298c1239,1240
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
1303,1304d1244
< monster_type *m_ptr = &m_list[c_ptr->m_idx];
<
1306c1246
< if (m_ptr->ml) return (TRUE);
---
> if (p_ptr->mon_vis[c_ptr->m_idx]) return (TRUE);
1312,1313d1251
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
1315c1253
< if (o_ptr->marked) return (TRUE);
---
> if (p_ptr->obj_vis[c_ptr->o_idx]) return (TRUE);
1319c1257
< if (c_ptr->info & CAVE_MARK)
---
> if (*w_ptr & CAVE_MARK)
1366c1304
< void do_cmd_look(void)
---
> void do_cmd_look(int int dir)
1368c1306
< int y, x, i, d, m;
---
> player_type *p_ptr = Players[Ind];
1370c1308
< bool done = FALSE;
---
> int y, x, i;
1391,1394c1329,1330
< temp_n = 0;
<
< /* Scan the current panel */
< for (y = panel_row_min; y <= panel_row_max; y++)
---
> /* Only if this is the first time, or if we've been asked to reset */
> if (dir == 0)
1396,1399c1332
< for (x = panel_col_min; x <= panel_col_max; x++)
< {
< /* Require line of sight, unless "look" is "expanded" */
< if (!expand_look && !player_has_los_bold(y, x)) continue;
---
> p_ptr->temp_n = 0;
1401,1440c1334,1335
< /* Require interesting contents */
< if (!do_cmd_look_accept(y, x)) continue;
<
< /* Save the location */
< temp_x[temp_n] = x;
< temp_y[temp_n] = y;
< temp_n++;
< }
< }
<
< /* Paranoia */
< if (!temp_n)
< {
< msg_print("You see nothing special.");
< return;
< }
<
<
< /* Set the sort hooks */
< ang_sort_comp = ang_sort_comp_distance;
< ang_sort_swap = ang_sort_swap_distance;
<
< /* Sort the positions */
< ang_sort(temp_x, temp_y, temp_n);
<
<
< /* Start near the player */
< m = 0;
<
< /* Interact */
< while (!done)
< {
< /* Describe and Prompt */
< query = do_cmd_look_aux(temp_y[m], temp_x[m]);
<
< /* Assume no "direction" */
< d = 0;
<
< /* Analyze (non "recall") command */
< switch (query)
---
> /* Scan the current panel */
> for (y = p_ptr->panel_row_min; y <= p_ptr->panel_row_max; y++)
1442,1443c1337
< case ESCAPE:
< case 'q':
---
> for (x = p_ptr->panel_col_min; x <= p_ptr->panel_col_max; x++)
1445,1446c1339,1348
< done = TRUE;
< break;
---
> /* Require line of sight, unless "look" is "expanded" */
> if (!expand_look && !player_has_los_bold(y, x)) continue;
>
> /* Require interesting contents */
> if (!do_cmd_look_accept(y, x)) continue;
>
> /* Save the location */
> p_ptr->temp_x[p_ptr->temp_n] = x;
> p_ptr->temp_y[p_ptr->temp_n] = y;
> p_ptr->temp_n++;
1447a1350
> }
1449,1459c1352,1353
< case '*':
< case '+':
< case ' ':
< {
< if (++m == temp_n)
< {
< m = 0;
< if (!expand_list) done = TRUE;
< }
< break;
< }
---
> /* Start near the player */
> p_ptr->look_index = 0;
1461,1476c1355,1359
< case '-':
< {
< if (m-- == 0)
< {
< m = temp_n - 1;
< if (!expand_list) done = TRUE;
< }
< break;
< }
<
< default:
< {
< d = keymap_dirs[query & 0x7F];
< if (!d) bell();
< break;
< }
---
> /* Paranoia */
> if (!p_ptr->temp_n)
> {
> msg_print("You see nothing special.");
> return;
1477a1361,1369
>
>
> /* Set the sort hooks */
> ang_sort_comp = ang_sort_comp_distance;
> ang_sort_swap = ang_sort_swap_distance;
>
> /* Sort the positions */
> ang_sort(p_ptr->temp_x, p_ptr->temp_y, p_ptr->temp_n);
> }
1479,1483c1371,1375
< /* Motion */
< if (d)
< {
< /* Find a new grid if possible */
< i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
---
> /* Motion */
> if (dir)
> {
> /* Find a new grid if possible */
> i = target_pick(p_ptr->temp_y[p_ptr->look_index], p_ptr->temp_x[p_ptr->look_index], ddy[dir], ddx[dir]);
1485,1487c1377,1378
< /* Use that grid */
< if (i >= 0) m = i;
< }
---
> /* Use that grid */
> if (i >= 0) p_ptr->look_index = i;
1490,1491c1381,1382
< /* Clear the prompt */
< prt("", 0, 0);
---
> /* Describe and Prompt */
> query = do_cmd_look_aux(p_ptr->temp_y[p_ptr->look_index], p_ptr->temp_x[p_ptr->look_index]);
1500c1391
< void do_cmd_locate(void)
---
> void do_cmd_locate(int int dir)
1502c1393
< int dir, y1, x1, y2, x2;
---
> player_type *p_ptr = Players[Ind];
1503a1395,1396
> int y1, x1, y2, x2;
>
1510,1511c1403,1404
< y2 = y1 = panel_row;
< x2 = x1 = panel_col;
---
> y2 = y1 = p_ptr->panel_row;
> x2 = x1 = p_ptr->panel_col;
1513,1514c1406,1407
< /* Show panels until done */
< while (1)
---
> /* Describe the location */
> if ((y2 == y1) && (x2 == x1))
1516,1526c1409,1416
< /* Describe the location */
< if ((y2 == y1) && (x2 == x1))
< {
< tmp_val[0] = '\0';
< }
< else
< {
< sprintf(tmp_val, "%s%s of",
< ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
< ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
< }
---
> tmp_val[0] = '\0';
> }
> else
> {
> sprintf(tmp_val, "%s%s of",
> ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
> ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
> }
1528,1531c1418,1421
< /* Prepare to ask which way to look */
< sprintf(out_val,
< "Map sector [%d,%d], which is%s your sector. Direction?",
< y2, x2, tmp_val);
---
> /* Prepare to ask which way to look */
> sprintf(out_val,
> "Map sector [%d,%d], which is%s your sector. Direction?",
> y2, x2, tmp_val);
1533,1534c1423
< /* Assume no direction */
< dir = 0;
---
> msg_print(out_val);
1536,1539c1425,1426
< /* Get a direction */
< while (!dir)
< {
< char command;
---
> /* No direction */
> if (!dir) return;
1541,1542c1428,1430
< /* Get a command (or Cancel) */
< if (!get_com(out_val, &command)) break;
---
> /* Apply the motion */
> y2 += ddy[dir];
> x2 += ddx[dir];
1544,1545c1432,1434
< /* Extract direction */
< dir = keymap_dirs[command & 0x7F];
---
> /* Verify the row */
> if (y2 > p_ptr->max_panel_rows) y2 = p_ptr->max_panel_rows;
> else if (y2 < 0) y2 = 0;
1547,1549c1436,1438
< /* Error */
< if (!dir) bell();
< }
---
> /* Verify the col */
> if (x2 > p_ptr->max_panel_cols) x2 = p_ptr->max_panel_cols;
> else if (x2 < 0) x2 = 0;
1551,1587d1439
< /* No direction */
< if (!dir) break;
<
< /* Apply the motion */
< y2 += ddy[dir];
< x2 += ddx[dir];
<
< /* Verify the row */
< if (y2 > max_panel_rows) y2 = max_panel_rows;
< else if (y2 < 0) y2 = 0;
<
< /* Verify the col */
< if (x2 > max_panel_cols) x2 = max_panel_cols;
< else if (x2 < 0) x2 = 0;
<
< /* Handle "changes" */
< if ((y2 != panel_row) || (x2 != panel_col))
< {
< /* Save the new panel info */
< panel_row = y2;
< panel_col = x2;
<
< /* Recalculate the boundaries */
< panel_bounds();
<
< /* Update stuff */
< p_ptr->update |= (PU_MONSTERS);
<
< /* Redraw map */
< p_ptr->redraw |= (PR_MAP);
<
< /* Handle stuff */
< handle_stuff();
< }
< }
<
<
1589c1441
< verify_panel();
---
> verify_panel(Ind);
1601c1453
< handle_stuff();
---
> handle_stuff(Ind);
1721c1573,1574
< static bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
---
> #if 0
> static bool ang_sort_comp_hook(int vptr u, vptr v, int a, int b)
1731a1585
> Ind = Ind;
1787a1642
> #endif
1796c1651,1652
< static void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
---
> #if 0
> static void ang_sort_swap_hook(int vptr u, vptr v, int a, int b)
1804a1661,1662
> Ind = Ind;
>
1809a1668
> #endif
1812d1670
<
1814,1865c1672
< * Hack -- Display the "name" and "attr/chars" of a monster race
< */
< static void roff_top(int r_idx)
< {
< monster_race *r_ptr = &r_info[r_idx];
<
< byte a1, a2;
< char c1, c2;
<
<
< /* Access the chars */
< c1 = r_ptr->d_char;
< c2 = r_ptr->x_char;
<
< /* Access the attrs */
< a1 = r_ptr->d_attr;
< a2 = r_ptr->x_attr;
<
< /* Hack -- fake monochrome */
< if (!use_color) a1 = TERM_WHITE;
< if (!use_color) a2 = TERM_WHITE;
<
<
< /* Clear the top line */
< Term_erase(0, 0, 255);
<
< /* Reset the cursor */
< Term_gotoxy(0, 0);
<
< /* A title (use "The" for non-uniques) */
< if (!(r_ptr->flags1 & RF1_UNIQUE))
< {
< Term_addstr(-1, TERM_WHITE, "The ");
< }
<
< /* Dump the name */
< Term_addstr(-1, TERM_WHITE, (r_name + r_ptr->name));
<
< /* Append the "standard" attr/char info */
< Term_addstr(-1, TERM_WHITE, " ('");
< Term_addch(a1, c1);
< Term_addstr(-1, TERM_WHITE, "')");
<
< /* Append the "optional" attr/char info */
< Term_addstr(-1, TERM_WHITE, "/('");
< Term_addch(a2, c2);
< Term_addstr(-1, TERM_WHITE, "'):");
< }
<
<
< /*
< * Identify a character, allow recall of monsters
---
> * Identify a character
1867,1873d1673
< * Several "special" responses recall "mulitple" monsters:
< * ^A (all monsters)
< * ^U (all unique monsters)
< * ^N (all non-unique monsters)
< *
< * The responses may be sorted in several ways, see below.
< *
1876c1676
< void do_cmd_query_symbol(void)
---
> void do_cmd_query_symbol(int char sym)
1878,1879c1678
< int i, n, r_idx;
< char sym, query;
---
> int i;
1882,1884d1680
< bool all = FALSE;
< bool uniq = FALSE;
< bool norm = FALSE;
1886c1682,1684
< bool recall = FALSE;
---
> /* If no symbol, abort --KLJ-- */
> if (!sym)
> return;
1888,1894d1685
< u16b why = 0;
< u16b who[MAX_R_IDX];
<
<
< /* Get a character, or abort */
< if (!get_com("Enter character to be identified: ", &sym)) return;
<
1902c1693
< if (sym == KTRL('A'))
---
> if (ident_info[i])
1904,1918d1694
< all = TRUE;
< strcpy(buf, "Full monster list.");
< }
< else if (sym == KTRL('U'))
< {
< all = uniq = TRUE;
< strcpy(buf, "Unique monster list.");
< }
< else if (sym == KTRL('N'))
< {
< all = norm = TRUE;
< strcpy(buf, "Non-unique monster list.");
< }
< else if (ident_info[i])
< {
1927,2072c1703
< prt(buf, 0, 0);
<
<
< /* Collect matching monsters */
< for (n = 0, i = 1; i < MAX_R_IDX-1; i++)
< {
< monster_race *r_ptr = &r_info[i];
<
< /* Nothing to recall */
< if (!cheat_know && !r_ptr->r_sights) continue;
<
< /* Require non-unique monsters if needed */
< if (norm && (r_ptr->flags1 & RF1_UNIQUE)) continue;
<
< /* Require unique monsters if needed */
< if (uniq && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
<
< /* Collect "appropriate" monsters */
< if (all || (r_ptr->d_char == sym)) who[n++] = i;
< }
<
< /* Nothing to recall */
< if (!n) return;
<
<
< /* Prompt XXX XXX XXX */
< put_str("Recall details? (k/p/y/n): ", 0, 40);
<
< /* Query */
< query = inkey();
<
< /* Restore */
< prt(buf, 0, 0);
<
<
< /* Sort by kills (and level) */
< if (query == 'k')
< {
< why = 4;
< query = 'y';
< }
<
< /* Sort by level */
< if (query == 'p')
< {
< why = 2;
< query = 'y';
< }
<
< /* Catch "escape" */
< if (query != 'y') return;
<
<
< /* Sort if needed */
< if (why)
< {
< /* Select the sort method */
< ang_sort_comp = ang_sort_comp_hook;
< ang_sort_swap = ang_sort_swap_hook;
<
< /* Sort the array */
< ang_sort(who, &why, n);
< }
<
<
< /* Start at the end */
< i = n - 1;
<
< /* Scan the monster memory */
< while (1)
< {
< /* Extract a race */
< r_idx = who[i];
<
< /* Hack -- Auto-recall */
< recent_track(r_idx);
<
< /* Hack -- Handle stuff */
< handle_stuff();
<
< /* Hack -- Begin the prompt */
< roff_top(r_idx);
<
< /* Hack -- Complete the prompt */
< Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
<
< /* Interact */
< while (1)
< {
< /* Recall */
< if (recall)
< {
< /* Save the screen */
< Term_save();
<
< /* Recall on screen */
< screen_roff(who[i]);
<
< /* Hack -- Complete the prompt (again) */
< Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
< }
<
< /* Command */
< query = inkey();
<
< /* Unrecall */
< if (recall)
< {
< /* Restore */
< Term_load();
< }
<
< /* Normal commands */
< if (query != 'r') break;
<
< /* Toggle recall */
< recall = !recall;
< }
<
< /* Stop scanning */
< if (query == ESCAPE) break;
<
< /* Move to "prev" monster */
< if (query == '-')
< {
< if (++i == n)
< {
< i = 0;
< if (!expand_list) break;
< }
< }
<
< /* Move to "next" monster */
< else
< {
< if (i-- == 0)
< {
< i = n - 1;
< if (!expand_list) break;
< }
< }
< }
<
<
< /* Re-display the identity */
< prt(buf, 0, 0);
---
> msg_print(buf);
diff -r src-280/cmd4.c mangband-000/src/server/cmd4.c
12a13,14
> #define SERVER
>
22a25,26
> *
> * This doesn't need to be in the server --KLJ--
26,88d29
< int j;
<
< term *old = Term;
<
<
< /* Hack -- react to changes */
< Term_xtra(TERM_XTRA_REACT, 0);
<
<
< /* Verify the keymap */
< keymap_init();
<
<
< /* Combine and Reorder the pack (later) */
< p_ptr->notice |= (PN_COMBINE | PN_REORDER);
<
<
< /* Update torch */
< p_ptr->update |= (PU_TORCH);
<
< /* Update stuff */
< p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
<
< /* Forget lite/view */
< p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
<
< /* Update lite/view */
< p_ptr->update |= (PU_VIEW | PU_LITE);
<
< /* Update monsters */
< p_ptr->update |= (PU_MONSTERS);
<
< /* Redraw everything */
< p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP);
<
< /* Window stuff */
< p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
<
< /* Window stuff */
< p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_MONSTER | PW_OBJECT);
<
< /* Hack -- update */
< handle_stuff();
<
<
< /* Redraw every window */
< for (j = 0; j < 8; j++)
< {
< /* Dead window */
< if (!ang_term[j]) continue;
<
< /* Activate */
< Term_activate(ang_term[j]);
<
< /* Redraw */
< Term_redraw();
<
< /* Refresh */
< Term_fresh();
<
< /* Restore */
< Term_activate(old);
< }
93a35,36
> *
> * This isn't allowed anymore --KLJ--
97,180d39
< char c;
<
< bool flag;
<
< bool history = FALSE;
<
< char tmp[160];
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
< /* Get command */
< for (flag = FALSE; !flag; )
< {
< /* Display the player */
< display_player(history);
<
< /* Prompt */
< prt("['C' to change name, 'F' to dump file, 'H' for history, or ESCAPE]", 21, 2);
<
< /* Query */
< c = inkey();
<
< /* Handle */
< switch (c)
< {
< case 'C':
< case 'c':
< {
< get_name();
< flag = TRUE;
< break;
< }
<
< case 'F':
< case 'f':
< {
< sprintf(tmp, "%s.txt", player_base);
< if (get_string("File name: ", tmp, 80))
< {
< if (tmp[0] && (tmp[0] != ' '))
< {
< file_character(tmp, FALSE);
< }
< }
< break;
< }
<
< case 'H':
< case 'h':
< {
< history = !history;
< break;
< }
<
< case ESCAPE:
< case ' ':
< case '\n':
< case '\r':
< {
< flag = TRUE;
< break;
< }
<
< default:
< {
< bell();
< break;
< }
< }
<
< /* Flush messages */
< msg_print(NULL);
< }
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
185a45,46
> *
> * This should be handled by the client --KLJ--
189,190d49
< /* Recall one message XXX XXX XXX */
< prt(format("> %s", message_str(0)), 0, 0);
207a67,68
> *
> * This is in the client code --KLJ--
211,383d71
< int i, j, k, n, q;
<
< char shower[80] = "";
< char finder[80] = "";
<
<
< /* Total messages */
< n = message_num();
<
< /* Start on first message */
< i = 0;
<
< /* Start at leftmost edge */
< q = 0;
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
< /* Process requests until done */
< while (1)
< {
< /* Clear screen */
< Term_clear();
<
< /* Dump up to 20 lines of messages */
< for (j = 0; (j < 20) && (i + j < n); j++)
< {
< byte a = TERM_WHITE;
<
< cptr str = message_str(i+j);
<
< /* Apply horizontal scroll */
< str = (strlen(str) >= q) ? (str + q) : "";
<
< /* Handle "shower" */
< if (shower[0] && strstr(str, shower)) a = TERM_YELLOW;
<
< /* Dump the messages, bottom to top */
< Term_putstr(0, 21-j, -1, a, str);
< }
<
< /* Display header XXX XXX XXX */
< prt(format("Message Recall (%d-%d of %d), Offset %d",
< i, i+j-1, n, q), 0, 0);
<
< /* Display prompt (not very informative) */
< prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", 23, 0);
<
< /* Get a command */
< k = inkey();
<
< /* Exit on Escape */
< if (k == ESCAPE) break;
<
< /* Hack -- Save the old index */
< j = i;
<
< /* Horizontal scroll */
< if (k == '4')
< {
< /* Scroll left */
< q = (q >= 40) ? (q - 40) : 0;
<
< /* Success */
< continue;
< }
<
< /* Horizontal scroll */
< if (k == '6')
< {
< /* Scroll right */
< q = q + 40;
<
< /* Success */
< continue;
< }
<
< /* Hack -- handle show */
< if (k == '=')
< {
< /* Prompt */
< prt("Show: ", 23, 0);
<
< /* Get a "shower" string, or continue */
< if (!askfor_aux(shower, 80)) continue;
<
< /* Okay */
< continue;
< }
<
< /* Hack -- handle find */
< if (k == '/')
< {
< int z;
<
< /* Prompt */
< prt("Find: ", 23, 0);
<
< /* Get a "finder" string, or continue */
< if (!askfor_aux(finder, 80)) continue;
<
< /* Scan messages */
< for (z = i + 1; z < n; z++)
< {
< cptr str = message_str(z);
<
< /* Handle "shower" */
< if (strstr(str, finder))
< {
< /* New location */
< i = z;
<
< /* Done */
< break;
< }
< }
< }
<
< /* Recall 1 older message */
< if ((k == '8') || (k == '\n') || (k == '\r'))
< {
< /* Go newer if legal */
< if (i + 1 < n) i += 1;
< }
<
< /* Recall 10 older messages */
< if (k == '+')
< {
< /* Go older if legal */
< if (i + 10 < n) i += 10;
< }
<
< /* Recall 20 older messages */
< if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
< {
< /* Go older if legal */
< if (i + 20 < n) i += 20;
< }
<
< /* Recall 20 newer messages */
< if ((k == 'n') || (k == KTRL('N')))
< {
< /* Go newer (if able) */
< i = (i >= 20) ? (i - 20) : 0;
< }
<
< /* Recall 10 newer messages */
< if (k == '-')
< {
< /* Go newer (if able) */
< i = (i >= 10) ? (i - 10) : 0;
< }
<
< /* Recall 1 newer messages */
< if (k == '2')
< {
< /* Go newer (if able) */
< i = (i >= 1) ? (i - 1) : 0;
< }
<
< /* Hack -- Error of some kind */
< if (i == j) bell();
< }
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
387d74
<
389,798d75
< * Number of cheating options
< */
< #define CHEAT_MAX 6
<
< /*
< * Cheating options
< */
< static option_type cheat_info[CHEAT_MAX] =
< {
< { &cheat_peek, FALSE, 255, 0x01, 0x00,
< "cheat_peek", "Peek into object creation" },
<
< { &cheat_hear, FALSE, 255, 0x02, 0x00,
< "cheat_hear", "Peek into monster creation" },
<
< { &cheat_room, FALSE, 255, 0x04, 0x00,
< "cheat_room", "Peek into dungeon creation" },
<
< { &cheat_xtra, FALSE, 255, 0x08, 0x00,
< "cheat_xtra", "Peek into something else" },
<
< { &cheat_know, FALSE, 255, 0x10, 0x00,
< "cheat_know", "Know complete monster info" },
<
< { &cheat_live, FALSE, 255, 0x20, 0x00,
< "cheat_live", "Allow player to avoid death" }
< };
<
<
< /*
< * Interact with some options for cheating
< */
< static void do_cmd_options_cheat(cptr info)
< {
< char ch;
<
< int i, k = 0, n = CHEAT_MAX;
<
< char buf[80];
<
<
< /* Clear screen */
< Term_clear();
<
< /* Interact with the player */
< while (TRUE)
< {
< /* Prompt XXX XXX XXX */
< sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
< prt(buf, 0, 0);
<
< /* Display the options */
< for (i = 0; i < n; i++)
< {
< byte a = TERM_WHITE;
<
< /* Color current option */
< if (i == k) a = TERM_L_BLUE;
<
< /* Display the option text */
< sprintf(buf, "%-48s: %s (%s)",
< cheat_info[i].o_desc,
< (*cheat_info[i].o_var ? "yes" : "no "),
< cheat_info[i].o_text);
< c_prt(a, buf, i + 2, 0);
< }
<
< /* Hilite current option */
< move_cursor(k + 2, 50);
<
< /* Get a key */
< ch = inkey();
<
< /* Analyze */
< switch (ch)
< {
< case ESCAPE:
< {
< return;
< }
<
< case '-':
< case '8':
< {
< k = (n + k - 1) % n;
< break;
< }
<
< case ' ':
< case '\n':
< case '\r':
< case '2':
< {
< k = (k + 1) % n;
< break;
< }
<
< case 'y':
< case 'Y':
< case '6':
< {
< noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
< (*cheat_info[k].o_var) = TRUE;
< k = (k + 1) % n;
< break;
< }
<
< case 'n':
< case 'N':
< case '4':
< {
< (*cheat_info[k].o_var) = FALSE;
< k = (k + 1) % n;
< break;
< }
<
< default:
< {
< bell();
< break;
< }
< }
< }
< }
<
<
< /*
< * Interact with some options
< */
< static void do_cmd_options_aux(int page, cptr info)
< {
< char ch;
<
< int i, k = 0, n = 0;
<
< int opt[24];
<
< char buf[80];
<
<
< /* Lookup the options */
< for (i = 0; i < 24; i++) opt[i] = 0;
<
< /* Scan the options */
< for (i = 0; option_info[i].o_desc; i++)
< {
< /* Notice options on this "page" */
< if (option_info[i].o_page == page) opt[n++] = i;
< }
<
<
< /* Clear screen */
< Term_clear();
<
< /* Interact with the player */
< while (TRUE)
< {
< /* Prompt XXX XXX XXX */
< sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
< prt(buf, 0, 0);
<
< /* Display the options */
< for (i = 0; i < n; i++)
< {
< byte a = TERM_WHITE;
<
< /* Color current option */
< if (i == k) a = TERM_L_BLUE;
<
< /* Display the option text */
< sprintf(buf, "%-48s: %s (%s)",
< option_info[opt[i]].o_desc,
< (*option_info[opt[i]].o_var ? "yes" : "no "),
< option_info[opt[i]].o_text);
< c_prt(a, buf, i + 2, 0);
< }
<
< /* Hilite current option */
< move_cursor(k + 2, 50);
<
< /* Get a key */
< ch = inkey();
<
< /* Analyze */
< switch (ch)
< {
< case ESCAPE:
< {
< return;
< }
<
< case '-':
< case '8':
< {
< k = (n + k - 1) % n;
< break;
< }
<
< case ' ':
< case '\n':
< case '\r':
< case '2':
< {
< k = (k + 1) % n;
< break;
< }
<
< case 'y':
< case 'Y':
< case '6':
< {
< (*option_info[opt[k]].o_var) = TRUE;
< k = (k + 1) % n;
< break;
< }
<
< case 'n':
< case 'N':
< case '4':
< {
< (*option_info[opt[k]].o_var) = FALSE;
< k = (k + 1) % n;
< break;
< }
<
< default:
< {
< bell();
< break;
< }
< }
< }
< }
<
<
< /*
< * Modify the "window" options
< */
< static void do_cmd_options_win(void)
< {
< int i, j, d;
<
< int y = 0;
< int x = 0;
<
< char ch;
<
< bool go = TRUE;
<
< u32b old_flag[8];
<
<
< /* Memorize old flags */
< for (j = 0; j < 8; j++)
< {
< /* Acquire current flags */
< old_flag[j] = window_flag[j];
< }
<
<
< /* Clear screen */
< Term_clear();
<
< /* Interact */
< while (go)
< {
< /* Prompt XXX XXX XXX */
< prt("Window flags (
, t, y, n, ESC) ", 0, 0);
<
< /* Display the windows */
< for (j = 0; j < 8; j++)
< {
< byte a = TERM_WHITE;
<
< cptr s = ang_term_name[j];
<
< /* Use color */
< if (use_color && (j == x)) a = TERM_L_BLUE;
<
< /* Window name, staggered, centered */
< Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
< }
<
< /* Display the options */
< for (i = 0; i < 16; i++)
< {
< byte a = TERM_WHITE;
<
< cptr str = window_flag_desc[i];
<
< /* Use color */
< if (use_color && (i == y)) a = TERM_L_BLUE;
<
< /* Unused option */
< if (!str) str = "(Unused option)";
<
< /* Flag name */
< Term_putstr(0, i + 5, -1, a, str);
<
< /* Display the windows */
< for (j = 0; j < 8; j++)
< {
< byte a = TERM_WHITE;
<
< char c = '.';
<
< /* Use color */
< if (use_color && (i == y) && (j == x)) a = TERM_L_BLUE;
<
< /* Active flag */
< if (window_flag[j] & (1L << i)) c = 'X';
<
< /* Flag value */
< Term_putch(35 + j * 5, i + 5, a, c);
< }
< }
<
< /* Place Cursor */
< Term_gotoxy(35 + x * 5, y + 5);
<
< /* Get key */
< ch = inkey();
<
< /* Analyze */
< switch (ch)
< {
< case ESCAPE:
< {
< go = FALSE;
< break;
< }
<
< case 'T':
< case 't':
< {
< /* Clear windows */
< for (j = 0; j < 8; j++)
< {
< window_flag[j] &= ~(1L << y);
< }
<
< /* Clear flags */
< for (i = 0; i < 16; i++)
< {
< window_flag[x] &= ~(1L << i);
< }
<
< /* Fall through */
< }
<
< case 'y':
< case 'Y':
< {
< /* Ignore screen */
< if (x == 0) break;
<
< /* Set flag */
< window_flag[x] |= (1L << y);
< break;
< }
<
< case 'n':
< case 'N':
< {
< /* Clear flag */
< window_flag[x] &= ~(1L << y);
< break;
< }
<
< default:
< {
< d = keymap_dirs[ch & 0x7F];
<
< x = (x + ddx[d] + 8) % 8;
< y = (y + ddy[d] + 16) % 16;
<
< if (!d) bell();
< }
< }
< }
<
< /* Notice changes */
< for (j = 0; j < 8; j++)
< {
< term *old = Term;
<
< /* Dead window */
< if (!ang_term[j]) continue;
<
< /* Ignore non-changes */
< if (window_flag[j] == old_flag[j]) continue;
<
< /* Activate */
< Term_activate(ang_term[j]);
<
< /* Erase */
< Term_clear();
<
< /* Refresh */
< Term_fresh();
<
< /* Restore */
< Term_activate(old);
< }
< }
<
<
<
<
< /*
802a80,81
> *
> * Any options that can be changed will be client-only --KLJ--
806,951d84
< int k;
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
<
< /* Interact */
< while (1)
< {
< /* Clear screen */
< Term_clear();
<
< /* Why are we here */
< prt("Angband options", 2, 0);
<
< /* Give some choices */
< prt("(1) User Interface Options", 4, 5);
< prt("(2) Disturbance Options", 5, 5);
< prt("(3) Game-Play Options", 6, 5);
< prt("(4) Efficiency Options", 7, 5);
<
< /* Cheating */
< if (can_be_wizard) prt("(C) Cheating Options", 8, 5);
<
< /* Window flags */
< prt("(W) Window flags", 9, 5);
<
< /* Special choices */
< prt("(D) Base Delay Factor", 11, 5);
< prt("(H) Hitpoint Warning", 12, 5);
<
< /* Prompt */
< prt("Command: ", 14, 0);
<
< /* Get command */
< k = inkey();
<
< /* Exit */
< if (k == ESCAPE) break;
<
< /* General Options */
< if (k == '1')
< {
< /* Process the general options */
< do_cmd_options_aux(1, "User Interface Options");
< }
<
< /* Disturbance Options */
< else if (k == '2')
< {
< /* Process the running options */
< do_cmd_options_aux(2, "Disturbance Options");
< }
<
< /* Inventory Options */
< else if (k == '3')
< {
< /* Process the running options */
< do_cmd_options_aux(3, "Game-Play Options");
< }
<
< /* Efficiency Options */
< else if (k == '4')
< {
< /* Process the efficiency options */
< do_cmd_options_aux(4, "Efficiency Options");
< }
<
< /* Cheating Options XXX XXX XXX */
< else if ((k == 'C') && can_be_wizard)
< {
< /* Process the cheating options */
< do_cmd_options_cheat("Cheaters never win");
< }
<
< /* Window flags */
< else if (k == 'W')
< {
< /* Spawn */
< do_cmd_options_win();
< }
<
< /* Hack -- Delay Speed */
< else if (k == 'D')
< {
< /* Prompt */
< prt("Command: Base Delay Factor", 14, 0);
<
< /* Get a new value */
< while (1)
< {
< int msec = delay_factor * delay_factor * delay_factor;
< prt(format("Current base delay factor: %d (%d msec)",
< delay_factor, msec), 18, 0);
< prt("Delay Factor (0-9 or ESC to accept): ", 16, 0);
< k = inkey();
< if (k == ESCAPE) break;
< if (isdigit(k)) delay_factor = D2I(k);
< else bell();
< }
< }
<
< /* Hack -- hitpoint warning factor */
< else if (k == 'H')
< {
< /* Prompt */
< prt("Command: Hitpoint Warning", 14, 0);
<
< /* Get a new value */
< while (1)
< {
< prt(format("Current hitpoint warning: %d0%%",
< hitpoint_warn), 18, 0);
< prt("Hitpoint Warning (0-9 or ESC to accept): ", 16, 0);
< k = inkey();
< if (k == ESCAPE) break;
< if (isdigit(k)) hitpoint_warn = D2I(k);
< else bell();
< }
< }
<
< /* Unknown option */
< else
< {
< /* Oops */
< bell();
< }
<
< /* Flush messages */
< msg_print(NULL);
< }
<
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
<
<
< /* Verify the keymap */
< keymap_init();
959a93,94
> *
> * This is client-side --KLJ--
963,972d97
< char buf[80];
<
< /* Default */
< strcpy(buf, "");
<
< /* Ask for a "user pref command" */
< if (!get_string("Pref: ", buf, 80)) return;
<
< /* Process that pref command */
< (void)process_pref_file_aux(buf);
976,977d100
< #ifdef ALLOW_MACROS
<
979,1102d101
< * Hack -- append all current macros to the given file
< */
< static errr macro_dump(cptr fname)
< {
< int i;
<
< FILE *fff;
<
< char buf[1024];
<
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, fname);
<
< /* File type is "TEXT" */
< FILE_TYPE(FILE_TYPE_TEXT);
<
< /* Append to the file */
< fff = my_fopen(buf, "a");
<
< /* Failure */
< if (!fff) return (-1);
<
<
< /* Skip space */
< fprintf(fff, "\n\n");
<
< /* Start dumping */
< fprintf(fff, "# Automatic macro dump\n\n");
<
< /* Dump them */
< for (i = 0; i < macro__num; i++)
< {
< /* Start the macro */
< fprintf(fff, "# Macro '%d'\n\n", i);
<
< /* Extract the action */
< ascii_to_text(buf, macro__act[i]);
<
< /* Dump the macro */
< fprintf(fff, "A:%s\n", buf);
<
< /* Extract the action */
< ascii_to_text(buf, macro__pat[i]);
<
< /* Dump command macros */
< if (macro__cmd[i]) fprintf(fff, "C:%s\n", buf);
<
< /* Dump normal macros */
< else fprintf(fff, "P:%s\n", buf);
<
< /* End the macro */
< fprintf(fff, "\n\n");
< }
<
< /* Start dumping */
< fprintf(fff, "\n\n\n\n");
<
<
< /* Close */
< my_fclose(fff);
<
< /* Success */
< return (0);
< }
<
<
< /*
< * Hack -- ask for a "trigger" (see below)
< *
< * Note the complex use of the "inkey()" function from "util.c".
< *
< * Note that both "flush()" calls are extremely important.
< */
< static void do_cmd_macro_aux(char *buf)
< {
< int i, n = 0;
<
< char tmp[1024];
<
<
< /* Flush */
< flush();
<
< /* Do not process macros */
< inkey_base = TRUE;
<
< /* First key */
< i = inkey();
<
< /* Read the pattern */
< while (i)
< {
< /* Save the key */
< buf[n++] = i;
<
< /* Do not process macros */
< inkey_base = TRUE;
<
< /* Do not wait for keys */
< inkey_scan = TRUE;
<
< /* Attempt to read a key */
< i = inkey();
< }
<
< /* Terminate */
< buf[n] = '\0';
<
< /* Flush */
< flush();
<
<
< /* Convert the trigger */
< ascii_to_text(tmp, buf);
<
< /* Hack -- display the trigger */
< Term_addstr(-1, TERM_WHITE, tmp);
< }
<
< #endif
<
<
< /*
1107a107,108
> *
> * Macros are handled by the client --KLJ--
1111,1378d111
< int i;
<
< char tmp[160];
<
< char buf[1024];
<
<
< /* File type is "TEXT" */
< FILE_TYPE(FILE_TYPE_TEXT);
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
< /* Process requests until done */
< while (1)
< {
< /* Clear screen */
< Term_clear();
<
< /* Describe */
< Term_putstr(0, 2, -1, TERM_WHITE, "Interact with Macros");
<
<
< /* Describe that action */
< Term_putstr(0, 18, -1, TERM_WHITE, "Current action (if any) shown below:");
<
< /* Analyze the current action */
< ascii_to_text(buf, macro__buf);
<
< /* Display the current action */
< Term_putstr(0, 20, -1, TERM_WHITE, buf);
<
<
< /* Selections */
< Term_putstr(5, 4, -1, TERM_WHITE, "(1) Load a user pref file");
< #ifdef ALLOW_MACROS
< Term_putstr(5, 5, -1, TERM_WHITE, "(2) Dump macros");
< Term_putstr(5, 6, -1, TERM_WHITE, "(3) Enter a new action");
< Term_putstr(5, 7, -1, TERM_WHITE, "(4) Query a macro action");
< Term_putstr(5, 8, -1, TERM_WHITE, "(5) Create a command macro");
< Term_putstr(5, 9, -1, TERM_WHITE, "(6) Create a normal macro");
< Term_putstr(5, 10, -1, TERM_WHITE, "(7) Create an identity macro");
< Term_putstr(5, 11, -1, TERM_WHITE, "(8) Create an empty macro");
< Term_putstr(5, 12, -1, TERM_WHITE, "(9) Define a special keymap");
< #endif /* ALLOW_MACROS */
<
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: ");
<
< /* Get a command */
< i = inkey();
<
< /* Leave */
< if (i == ESCAPE) break;
<
< /* Load a 'macro' file */
< else if (i == '1')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Load a user pref file");
<
< /* Get a filename, handle ESCAPE */
< Term_putstr(0, 16, -1, TERM_WHITE, "File: ");
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Ask for a file */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Process the given filename */
< (void)process_pref_file(tmp);
< }
<
< #ifdef ALLOW_MACROS
<
< /* Save a 'macro' file */
< else if (i == '2')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Save a macro file");
<
< /* Get a filename, handle ESCAPE */
< Term_putstr(0, 16, -1, TERM_WHITE, "File: ");
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Ask for a file */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Drop priv's */
< safe_setuid_drop();
<
< /* Dump the macros */
< (void)macro_dump(tmp);
<
< /* Grab priv's */
< safe_setuid_grab();
< }
<
< /* Enter a new action */
< else if (i == '3')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Enter a new action");
<
< /* Go to the correct location */
< Term_gotoxy(0, 20);
<
< /* Hack -- limit the value */
< tmp[80] = '\0';
<
< /* Get an encoded action */
< if (!askfor_aux(buf, 80)) continue;
<
< /* Extract an action */
< text_to_ascii(macro__buf, buf);
< }
<
< /* Query a macro action */
< else if (i == '4')
< {
<
< #if 0
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Query a macro action");
<
< /* Prompt */
< Term_putstr(0, 16, -1, TERM_WHITE, "Enter a macro trigger: ");
<
< /* Get a macro trigger */
< do_cmd_macro_aux(buf);
< #endif
<
< /* XXX XXX XXX */
< msg_print("Command not ready.");
< }
<
< /* Create a command macro */
< else if (i == '5')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create a command macro");
<
< /* Prompt */
< Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: ");
<
< /* Get a macro trigger */
< do_cmd_macro_aux(buf);
<
< /* Link the macro */
< macro_add(buf, macro__buf, TRUE);
<
< /* Message */
< msg_print("Created a new command macro.");
< }
<
< /* Create a normal macro */
< else if (i == '6')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create a normal macro");
<
< /* Prompt */
< Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: ");
<
< /* Get a macro trigger */
< do_cmd_macro_aux(buf);
<
< /* Link the macro */
< macro_add(buf, macro__buf, FALSE);
<
< /* Message */
< msg_print("Created a new normal macro.");
< }
<
< /* Create an identity macro */
< else if (i == '7')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create an identity macro");
<
< /* Prompt */
< Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: ");
<
< /* Get a macro trigger */
< do_cmd_macro_aux(buf);
<
< /* Link the macro */
< macro_add(buf, buf, FALSE);
<
< /* Message */
< msg_print("Created a new identity macro.");
< }
<
< /* Create an empty macro */
< else if (i == '8')
< {
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create an empty macro");
<
< /* Prompt */
< Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: ");
<
< /* Get a macro trigger */
< do_cmd_macro_aux(buf);
<
< /* Link the macro */
< macro_add(buf, "", FALSE);
<
< /* Message */
< msg_print("Created a new empty macro.");
< }
<
< /* Define a keymap */
< else if (i == '9')
< {
< char i1, i2, i3;
<
< /* Flush the input */
< flush();
<
< /* Get the trigger */
< if (get_com("Type the trigger keypress: ", &i1) &&
< get_com("Type the resulting keypress: ", &i2) &&
< get_com("Type a direction (or zero): ", &i3))
< {
< /* Acquire the array index */
< int k = (i1 & 0x7F);
< int r = (i2 & 0x7F);
< int d = (i3 & 0x7F);
<
< /* Analyze the result key */
< keymap_cmds[k] = r;
<
< /* Hack -- Analyze the "direction" (always allow numbers) */
< keymap_dirs[k] = (isdigit(d) ? (d - '0') : keymap_dirs[d]);
<
< /* Success */
< msg_format("Keypress 0x%02x mapped to 0x%02x (direction %d)",
< k, keymap_cmds[k], keymap_dirs[k]);
< }
< }
<
< #endif /* ALLOW_MACROS */
<
< /* Oops */
< else
< {
< /* Oops */
< bell();
< }
<
< /* Flush messages */
< msg_print(NULL);
< }
<
<
< /* Load the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
1384a118,119
> *
> * This is (of course) a client-side thing --KLJ--
1388,1833d122
< int i;
<
< FILE *fff;
<
< char tmp[160];
<
< char buf[1024];
<
<
< /* File type is "TEXT" */
< FILE_TYPE(FILE_TYPE_TEXT);
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
<
< /* Interact until done */
< while (1)
< {
< /* Clear screen */
< Term_clear();
<
< /* Ask for a choice */
< prt("Interact with Visuals", 2, 0);
<
< /* Give some choices */
< prt("(1) Load a user pref file", 4, 5);
< #ifdef ALLOW_VISUALS
< prt("(2) Dump monster attr/chars", 5, 5);
< prt("(3) Dump object attr/chars", 6, 5);
< prt("(4) Dump feature attr/chars", 7, 5);
< prt("(5) (unused)", 8, 5);
< prt("(6) Change monster attr/chars", 9, 5);
< prt("(7) Change object attr/chars", 10, 5);
< prt("(8) Change feature attr/chars", 11, 5);
< prt("(9) (unused)", 12, 5);
< #endif
< prt("(0) Reset visuals", 13, 5);
<
< /* Prompt */
< prt("Command: ", 15, 0);
<
< /* Prompt */
< i = inkey();
<
< /* Done */
< if (i == ESCAPE) break;
<
< /* Load a 'pref' file */
< else if (i == '1')
< {
< /* Prompt */
< prt("Command: Load a user pref file", 15, 0);
<
< /* Prompt */
< prt("File: ", 17, 0);
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Query */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Process the given filename */
< (void)process_pref_file(tmp);
< }
<
< #ifdef ALLOW_VISUALS
<
< /* Dump monster attr/chars */
< else if (i == '2')
< {
< /* Prompt */
< prt("Command: Dump monster attr/chars", 15, 0);
<
< /* Prompt */
< prt("File: ", 17, 0);
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Get a filename */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, tmp);
<
< /* Drop priv's */
< safe_setuid_drop();
<
< /* Append to the file */
< fff = my_fopen(buf, "a");
<
< /* Grab priv's */
< safe_setuid_grab();
<
< /* Failure */
< if (!fff) continue;
<
< /* Start dumping */
< fprintf(fff, "\n\n");
< fprintf(fff, "# Monster attr/char definitions\n\n");
<
< /* Dump monsters */
< for (i = 0; i < MAX_R_IDX; i++)
< {
< monster_race *r_ptr = &r_info[i];
<
< /* Skip non-entries */
< if (!r_ptr->name) continue;
<
< /* Dump a comment */
< fprintf(fff, "# %s\n", (r_name + r_ptr->name));
<
< /* Dump the monster attr/char info */
< fprintf(fff, "R:%d:0x%02X:0x%02X\n\n", i,
< (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
< }
<
< /* All done */
< fprintf(fff, "\n\n\n\n");
<
< /* Close */
< my_fclose(fff);
<
< /* Message */
< msg_print("Dumped monster attr/chars.");
< }
<
< /* Dump object attr/chars */
< else if (i == '3')
< {
< /* Prompt */
< prt("Command: Dump object attr/chars", 15, 0);
<
< /* Prompt */
< prt("File: ", 17, 0);
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Get a filename */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, tmp);
<
< /* Drop priv's */
< safe_setuid_drop();
<
< /* Append to the file */
< fff = my_fopen(buf, "a");
<
< /* Grab priv's */
< safe_setuid_grab();
<
< /* Failure */
< if (!fff) continue;
<
< /* Start dumping */
< fprintf(fff, "\n\n");
< fprintf(fff, "# Object attr/char definitions\n\n");
<
< /* Dump objects */
< for (i = 0; i < MAX_K_IDX; i++)
< {
< object_kind *k_ptr = &k_info[i];
<
< /* Skip non-entries */
< if (!k_ptr->name) continue;
<
< /* Dump a comment */
< fprintf(fff, "# %s\n", (k_name + k_ptr->name));
<
< /* Dump the object attr/char info */
< fprintf(fff, "K:%d:0x%02X:0x%02X\n\n", i,
< (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
< }
<
< /* All done */
< fprintf(fff, "\n\n\n\n");
<
< /* Close */
< my_fclose(fff);
<
< /* Message */
< msg_print("Dumped object attr/chars.");
< }
<
< /* Dump feature attr/chars */
< else if (i == '4')
< {
< /* Prompt */
< prt("Command: Dump feature attr/chars", 15, 0);
<
< /* Prompt */
< prt("File: ", 17, 0);
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Get a filename */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, tmp);
<
< /* Drop priv's */
< safe_setuid_drop();
<
< /* Append to the file */
< fff = my_fopen(buf, "a");
<
< /* Grab priv's */
< safe_setuid_grab();
<
< /* Failure */
< if (!fff) continue;
<
< /* Start dumping */
< fprintf(fff, "\n\n");
< fprintf(fff, "# Feature attr/char definitions\n\n");
<
< /* Dump features */
< for (i = 0; i < MAX_F_IDX; i++)
< {
< feature_type *f_ptr = &f_info[i];
<
< /* Skip non-entries */
< if (!f_ptr->name) continue;
<
< /* Dump a comment */
< fprintf(fff, "# %s\n", (f_name + f_ptr->name));
<
< /* Dump the feature attr/char info */
< fprintf(fff, "F:%d:0x%02X:0x%02X\n\n", i,
< (byte)(f_ptr->z_attr), (byte)(f_ptr->z_char));
< }
<
< /* All done */
< fprintf(fff, "\n\n\n\n");
<
< /* Close */
< my_fclose(fff);
<
< /* Message */
< msg_print("Dumped feature attr/chars.");
< }
<
< /* Modify monster attr/chars */
< else if (i == '6')
< {
< static int r = 0;
<
< /* Prompt */
< prt("Command: Change monster attr/chars", 15, 0);
<
< /* Hack -- query until done */
< while (1)
< {
< monster_race *r_ptr = &r_info[r];
<
< int da = (byte)(r_ptr->d_attr);
< int dc = (byte)(r_ptr->d_char);
< int ca = (byte)(r_ptr->x_attr);
< int cc = (byte)(r_ptr->x_char);
<
< /* Label the object */
< Term_putstr(5, 17, -1, TERM_WHITE,
< format("Monster = %d, Name = %-40.40s",
< r, (r_name + r_ptr->name)));
<
< /* Label the Default values */
< Term_putstr(10, 19, -1, TERM_WHITE,
< format("Default attr/char = %3u / %3u", da, dc));
< Term_putstr(40, 19, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 19, da, dc);
<
< /* Label the Current values */
< Term_putstr(10, 20, -1, TERM_WHITE,
< format("Current attr/char = %3u / %3u", ca, cc));
< Term_putstr(40, 20, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 20, ca, cc);
<
< /* Prompt */
< Term_putstr(0, 22, -1, TERM_WHITE,
< "Command (n/N/a/A/c/C): ");
<
< /* Get a command */
< i = inkey();
<
< /* All done */
< if (i == ESCAPE) break;
<
< /* Analyze */
< if (i == 'n') r = (r + MAX_R_IDX + 1) % MAX_R_IDX;
< if (i == 'N') r = (r + MAX_R_IDX - 1) % MAX_R_IDX;
< if (i == 'a') r_ptr->x_attr = (byte)(ca + 1);
< if (i == 'A') r_ptr->x_attr = (byte)(ca - 1);
< if (i == 'c') r_ptr->x_char = (byte)(cc + 1);
< if (i == 'C') r_ptr->x_char = (byte)(cc - 1);
< }
< }
<
< /* Modify object attr/chars */
< else if (i == '7')
< {
< static int k = 0;
<
< /* Prompt */
< prt("Command: Change object attr/chars", 15, 0);
<
< /* Hack -- query until done */
< while (1)
< {
< object_kind *k_ptr = &k_info[k];
<
< int da = (byte)k_ptr->k_attr;
< int dc = (byte)k_ptr->k_char;
< int ca = (byte)k_ptr->x_attr;
< int cc = (byte)k_ptr->x_char;
<
< /* Label the object */
< Term_putstr(5, 17, -1, TERM_WHITE,
< format("Object = %d, Name = %-40.40s",
< k, (k_name + k_ptr->name)));
<
< /* Label the Default values */
< Term_putstr(10, 19, -1, TERM_WHITE,
< format("Default attr/char = %3d / %3d", da, dc));
< Term_putstr(40, 19, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 19, da, dc);
<
< /* Label the Current values */
< Term_putstr(10, 20, -1, TERM_WHITE,
< format("Current attr/char = %3d / %3d", ca, cc));
< Term_putstr(40, 20, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 20, ca, cc);
<
< /* Prompt */
< Term_putstr(0, 22, -1, TERM_WHITE,
< "Command (n/N/a/A/c/C): ");
<
< /* Get a command */
< i = inkey();
<
< /* All done */
< if (i == ESCAPE) break;
<
< /* Analyze */
< if (i == 'n') k = (k + MAX_K_IDX + 1) % MAX_K_IDX;
< if (i == 'N') k = (k + MAX_K_IDX - 1) % MAX_K_IDX;
< if (i == 'a') k_info[k].x_attr = (byte)(ca + 1);
< if (i == 'A') k_info[k].x_attr = (byte)(ca - 1);
< if (i == 'c') k_info[k].x_char = (byte)(cc + 1);
< if (i == 'C') k_info[k].x_char = (byte)(cc - 1);
< }
< }
<
< /* Modify feature attr/chars */
< else if (i == '8')
< {
< static int f = 0;
<
< /* Prompt */
< prt("Command: Change feature attr/chars", 15, 0);
<
< /* Hack -- query until done */
< while (1)
< {
< feature_type *f_ptr = &f_info[f];
<
< int da = (byte)f_ptr->f_attr;
< int dc = (byte)f_ptr->f_char;
< int ca = (byte)f_ptr->z_attr;
< int cc = (byte)f_ptr->z_char;
<
< /* Label the object */
< Term_putstr(5, 17, -1, TERM_WHITE,
< format("Terrain = %d, Name = %-40.40s",
< f, (f_name + f_ptr->name)));
<
< /* Label the Default values */
< Term_putstr(10, 19, -1, TERM_WHITE,
< format("Default attr/char = %3d / %3d", da, dc));
< Term_putstr(40, 19, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 19, da, dc);
<
< /* Label the Current values */
< Term_putstr(10, 20, -1, TERM_WHITE,
< format("Current attr/char = %3d / %3d", ca, cc));
< Term_putstr(40, 20, -1, TERM_WHITE, "<< ? >>");
< Term_putch(43, 20, ca, cc);
<
< /* Prompt */
< Term_putstr(0, 22, -1, TERM_WHITE,
< "Command (n/N/a/A/c/C): ");
<
< /* Get a command */
< i = inkey();
<
< /* All done */
< if (i == ESCAPE) break;
<
< /* Analyze */
< if (i == 'n') f = (f + MAX_F_IDX + 1) % MAX_F_IDX;
< if (i == 'N') f = (f + MAX_F_IDX - 1) % MAX_F_IDX;
< if (i == 'a') f_info[f].z_attr = (byte)(ca + 1);
< if (i == 'A') f_info[f].z_attr = (byte)(ca - 1);
< if (i == 'c') f_info[f].z_char = (byte)(cc + 1);
< if (i == 'C') f_info[f].z_char = (byte)(cc - 1);
< }
< }
<
< #endif
<
< /* Reset visuals */
< else if (i == '0')
< {
< /* Reset */
< reset_visuals();
<
< /* Message */
< msg_print("Visual attr/char tables reset.");
< }
<
< /* Unknown option */
< else
< {
< bell();
< }
<
< /* Flush messages */
< msg_print(NULL);
< }
<
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
1838a128,133
> *
> * This is kind of client-side, but maybe we should allow players to select
> * the color and character of objects, like is done in single-player Angband.
> * Right now, the colors and characters of objects are fixed, but the user
> * will be able to change the overall colors (if his visual modules supports
> * that.) --KLJ--
1842,2068d136
< int i;
<
< FILE *fff;
<
< char tmp[160];
<
< char buf[1024];
<
<
< /* File type is "TEXT" */
< FILE_TYPE(FILE_TYPE_TEXT);
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
<
< /* Interact until done */
< while (1)
< {
< /* Clear screen */
< Term_clear();
<
< /* Ask for a choice */
< prt("Interact with Colors", 2, 0);
<
< /* Give some choices */
< prt("(1) Load a user pref file", 4, 5);
< #ifdef ALLOW_COLORS
< prt("(2) Dump colors", 5, 5);
< prt("(3) Modify colors", 6, 5);
< #endif
<
< /* Prompt */
< prt("Command: ", 8, 0);
<
< /* Prompt */
< i = inkey();
<
< /* Done */
< if (i == ESCAPE) break;
<
< /* Load a 'pref' file */
< if (i == '1')
< {
< /* Prompt */
< prt("Command: Load a user pref file", 8, 0);
<
< /* Prompt */
< prt("File: ", 10, 0);
<
< /* Default file */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Query */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Process the given filename */
< (void)process_pref_file(tmp);
<
< /* Mega-Hack -- react to changes */
< Term_xtra(TERM_XTRA_REACT, 0);
<
< /* Mega-Hack -- redraw */
< Term_redraw();
< }
<
< #ifdef ALLOW_COLORS
<
< /* Dump colors */
< else if (i == '2')
< {
< /* Prompt */
< prt("Command: Dump colors", 8, 0);
<
< /* Prompt */
< prt("File: ", 10, 0);
<
< /* Default filename */
< sprintf(tmp, "user-%s.prf", ANGBAND_SYS);
<
< /* Get a filename */
< if (!askfor_aux(tmp, 70)) continue;
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, tmp);
<
< /* Drop priv's */
< safe_setuid_drop();
<
< /* Append to the file */
< fff = my_fopen(buf, "a");
<
< /* Grab priv's */
< safe_setuid_grab();
<
< /* Failure */
< if (!fff) continue;
<
< /* Start dumping */
< fprintf(fff, "\n\n");
< fprintf(fff, "# Color redefinitions\n\n");
<
< /* Dump colors */
< for (i = 0; i < 256; i++)
< {
< int kv = color_table[i][0];
< int rv = color_table[i][1];
< int gv = color_table[i][2];
< int bv = color_table[i][3];
<
< cptr name = "unknown";
<
< /* Skip non-entries */
< if (!kv && !rv && !gv && !bv) continue;
<
< /* Extract the color name */
< if (i < 16) name = color_names[i];
<
< /* Dump a comment */
< fprintf(fff, "# Color '%s'\n", name);
<
< /* Dump the monster attr/char info */
< fprintf(fff, "V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
< i, kv, rv, gv, bv);
< }
<
< /* All done */
< fprintf(fff, "\n\n\n\n");
<
< /* Close */
< my_fclose(fff);
<
< /* Message */
< msg_print("Dumped color redefinitions.");
< }
<
< /* Edit colors */
< else if (i == '3')
< {
< static int a = 0;
<
< /* Prompt */
< prt("Command: Modify colors", 8, 0);
<
< /* Hack -- query until done */
< while (1)
< {
< cptr name;
<
< /* Clear */
< clear_from(10);
<
< /* Exhibit the normal colors */
< for (i = 0; i < 16; i++)
< {
< /* Exhibit this color */
< Term_putstr(i*4, 20, -1, a, "###");
<
< /* Exhibit all colors */
< Term_putstr(i*4, 22, -1, i, format("%3d", i));
< }
<
< /* Describe the color */
< name = ((a < 16) ? color_names[a] : "undefined");
<
< /* Describe the color */
< Term_putstr(5, 10, -1, TERM_WHITE,
< format("Color = %d, Name = %s", a, name));
<
< /* Label the Current values */
< Term_putstr(5, 12, -1, TERM_WHITE,
< format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
< color_table[a][0], color_table[a][1],
< color_table[a][2], color_table[a][3]));
<
< /* Prompt */
< Term_putstr(0, 14, -1, TERM_WHITE,
< "Command (n/N/k/K/r/R/g/G/b/B): ");
<
< /* Get a command */
< i = inkey();
<
< /* All done */
< if (i == ESCAPE) break;
<
< /* Analyze */
< if (i == 'n') a = (byte)(a + 1);
< if (i == 'N') a = (byte)(a - 1);
< if (i == 'k') color_table[a][0] = (byte)(color_table[a][0] + 1);
< if (i == 'K') color_table[a][0] = (byte)(color_table[a][0] - 1);
< if (i == 'r') color_table[a][1] = (byte)(color_table[a][1] + 1);
< if (i == 'R') color_table[a][1] = (byte)(color_table[a][1] - 1);
< if (i == 'g') color_table[a][2] = (byte)(color_table[a][2] + 1);
< if (i == 'G') color_table[a][2] = (byte)(color_table[a][2] - 1);
< if (i == 'b') color_table[a][3] = (byte)(color_table[a][3] + 1);
< if (i == 'B') color_table[a][3] = (byte)(color_table[a][3] - 1);
<
< /* Hack -- react to changes */
< Term_xtra(TERM_XTRA_REACT, 0);
<
< /* Hack -- redraw */
< Term_redraw();
< }
< }
<
< #endif
<
< /* Unknown option */
< else
< {
< bell();
< }
<
< /* Flush messages */
< msg_print(NULL);
< }
<
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
2073a142,144
> *
> * This is a (I think) useless command. It will later be used to "talk" to
> * other players on the same level as the "talker". --KLJ--
2077,2089d147
< char buf[80];
<
< /* Default */
< strcpy(buf, "");
<
< /* Input */
< if (!get_string("Note: ", buf, 60)) return;
<
< /* Ignore empty notes */
< if (!buf[0] || (buf[0] == ' ')) return;
<
< /* Add the note to the message recall */
< msg_format("Note: %s", buf);
2094a153,155
> *
> * The client handles this, and it also knows the server version, and prints
> * that out as well. --KLJ--
2098,2100d158
< /* Silly message */
< msg_format("You are playing Angband %d.%d.%d. Type '?' for more info.",
< VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
2107a166
> #if 0
2121a181
> #endif
2126a187,194
> *
> * Level feelings are tricky. Say level 1 (50') has been around for a long
> * time, because there's always been at least one player on it. Say that
> * it was "special" when it was generated, because the Phial was on it. But
> * it has long since been picked up, but any players who come later onto this
> * level will still get a "special" feeling. So, should the level feeling
> * be recomputed whenever it is asked for? Right now, level feelings are
> * disabled. --KLJ--
2130,2142d197
< /* Verify the feeling */
< if (feeling < 0) feeling = 0;
< if (feeling > 10) feeling = 10;
<
< /* No useful feeling in town */
< if (!dun_level)
< {
< msg_print("Looks like a typical town.");
< return;
< }
<
< /* Display the feeling */
< msg_print(do_cmd_feeling_text[feeling]);
2152c207
< static char hack[17] = "dwsorgbuDWvyRGBU";
---
> /*static char hack[17] = "dwsorgbuDWvyRGBU";*/
2156a212,213
> *
> * This can be client side --KLJ--
2160,2258d216
< int i, y, x;
<
< byte a = 0;
< char c = ' ';
<
< bool okay = TRUE;
<
< FILE *fff;
<
< char buf[1024];
<
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, "dump.txt");
<
< /* Append to the file */
< fff = my_fopen(buf, "r");
<
< /* Oops */
< if (!fff) return;
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
< /* Clear the screen */
< Term_clear();
<
<
< /* Load the screen */
< for (y = 0; okay && (y < 24); y++)
< {
< /* Get a line of data */
< if (my_fgets(fff, buf, 1024)) okay = FALSE;
<
< /* Show each row */
< for (x = 0; x < 79; x++)
< {
< /* Put the attr/char */
< Term_draw(x, y, TERM_WHITE, buf[x]);
< }
< }
<
< /* Get the blank line */
< if (my_fgets(fff, buf, 1024)) okay = FALSE;
<
<
< /* Dump the screen */
< for (y = 0; okay && (y < 24); y++)
< {
< /* Get a line of data */
< if (my_fgets(fff, buf, 1024)) okay = FALSE;
<
< /* Dump each row */
< for (x = 0; x < 79; x++)
< {
< /* Get the attr/char */
< (void)(Term_what(x, y, &a, &c));
<
< /* Look up the attr */
< for (i = 0; i < 16; i++)
< {
< /* Use attr matches */
< if (hack[i] == buf[x]) a = i;
< }
<
< /* Hack -- fake monochrome */
< if (!use_color) a = TERM_WHITE;
<
< /* Put the attr/char */
< Term_draw(x, y, a, c);
< }
<
< /* End the row */
< fprintf(fff, "\n");
< }
<
<
< /* Get the blank line */
< if (my_fgets(fff, buf, 1024)) okay = FALSE;
<
<
< /* Close it */
< my_fclose(fff);
<
<
< /* Message */
< msg_print("Screen dump loaded.");
< msg_print(NULL);
<
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
2263a222,223
> *
> * This can also be client side --KLJ--
2267,2364d226
< int y, x;
<
< byte a = 0;
< char c = ' ';
<
< FILE *fff;
<
< char buf[1024];
<
<
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_USER, "dump.txt");
<
< /* File type is "TEXT" */
< FILE_TYPE(FILE_TYPE_TEXT);
<
< /* Hack -- drop permissions */
< safe_setuid_drop();
<
< /* Append to the file */
< fff = my_fopen(buf, "w");
<
< /* Hack -- grab permissions */
< safe_setuid_grab();
<
< /* Oops */
< if (!fff) return;
<
<
< /* Enter "icky" mode */
< character_icky = TRUE;
<
< /* Save the screen */
< Term_save();
<
<
< /* Dump the screen */
< for (y = 0; y < 24; y++)
< {
< /* Dump each row */
< for (x = 0; x < 79; x++)
< {
< /* Get the attr/char */
< (void)(Term_what(x, y, &a, &c));
<
< /* Dump it */
< buf[x] = c;
< }
<
< /* Terminate */
< buf[x] = '\0';
<
< /* End the row */
< fprintf(fff, "%s\n", buf);
< }
<
< /* Skip a line */
< fprintf(fff, "\n");
<
<
< /* Dump the screen */
< for (y = 0; y < 24; y++)
< {
< /* Dump each row */
< for (x = 0; x < 79; x++)
< {
< /* Get the attr/char */
< (void)(Term_what(x, y, &a, &c));
<
< /* Dump it */
< buf[x] = hack[a&0x0F];
< }
<
< /* Terminate */
< buf[x] = '\0';
<
< /* End the row */
< fprintf(fff, "%s\n", buf);
< }
<
< /* Skip a line */
< fprintf(fff, "\n");
<
<
< /* Close it */
< my_fclose(fff);
<
<
< /* Message */
< msg_print("Screen dump saved.");
< msg_print(NULL);
<
<
< /* Restore the screen */
< Term_load();
<
< /* Leave "icky" mode */
< character_icky = FALSE;
2371a234,244
> *
> * Should every artifact that is held by anyone be listed? If so, should this
> * list the holder? Doing so might induce wars to take hold of relatively
> * worthless artifacts (like the Phial), simply because there are very few
> * (three) artifact lites. Right now, the holder isn't listed.
> *
> * Also, (for simplicity), artifacts lying in the dungeon, or artifacts that
> * are in a player's inventory but not identified are put in the list.
> *
> * Why does Ben save the list to a file and then display it? Seems like a
> * strange way of doing things to me. --KLJ--
2373c246
< void do_cmd_check_artifacts(void)
---
> void do_cmd_check_artifacts(int Ind)
2375c248
< int i, k, z, x, y;
---
> int k, z;
2410,2451d282
< /* Check the dungeon */
< for (y = 0; y < cur_hgt; y++)
< {
< for (x = 0; x < cur_wid; x++)
< {
< cave_type *c_ptr = &cave[y][x];
<
< /* Process objects */
< if (c_ptr->o_idx)
< {
< object_type *o_ptr = &o_list[c_ptr->o_idx];
<
< /* Ignore non-artifacts */
< if (!artifact_p(o_ptr)) continue;
<
< /* Ignore known items */
< if (object_known_p(o_ptr)) continue;
<
< /* Note the artifact */
< okay[o_ptr->name1] = FALSE;
< }
< }
< }
<
< /* Check the inventory */
< for (i = 0; i < INVEN_PACK; i++)
< {
< object_type *o_ptr = &inventory[i];
<
< /* Ignore non-objects */
< if (!o_ptr->k_idx) continue;
<
< /* Ignore non-artifacts */
< if (!artifact_p(o_ptr)) continue;
<
< /* Ignore known items */
< if (object_known_p(o_ptr)) continue;
<
< /* Note the artifact */
< okay[o_ptr->name1] = FALSE;
< }
<
2489c320
< show_file(file_name, "Artifacts Seen");
---
> /*show_file(file_name, "Artifacts Seen");*/
2499a331,334
> *
> * Any unique seen by any player will be shown. Also, I plan to add the name
> * of the slayer (if any) to the list, so the others will know just how
> * powerful any certain player is. --KLJ--
2501c336
< void do_cmd_check_uniques(void)
---
> void do_cmd_check_uniques(int Ind)
2541c376
< show_file(file_name, "Known Uniques");
---
> /*show_file(file_name, "Known Uniques");*/
diff -r src-280/cmd5.c mangband-000/src/server/cmd5.c
12a13,14
> #define SERVER
>
27a30,34
> *
> * I dunno about this -- I've never found it very useful, so it'll be
> * gone from MAngband (for a while, at least). I'll eventually just transmit
> * all of this information to client and let it handle it if the user wants
> * to have this in a window --KLJ--
31,130d37
< int i, j;
< int y, x;
<
< int m[9];
<
< magic_type *s_ptr;
<
< char name[80];
<
< char out_val[160];
<
<
< /* Erase window */
< clear_from(0);
<
< /* Warriors are illiterate */
< if (!mp_ptr->spell_book) return;
<
< /* Scan books */
< for (j = 0; j < 9; j++)
< {
< int n = 0;
<
< /* Reset vertical */
< m[j] = 0;
<
< /* Vertical location */
< y = (j < 3) ? 0 : (m[j - 3] + 2);
<
< /* Horizontal location */
< x = 27 * (j % 3);
<
< /* Scan spells */
< for (i = 0; i < 64; i++)
< {
< /* Check for spell */
< if ((i < 32) ?
< (spell_flags[mp_ptr->spell_type][j][0] & (1L << i)) :
< (spell_flags[mp_ptr->spell_type][j][1] & (1L << (i - 32))))
< {
< byte a = TERM_WHITE;
<
< /* Access the spell */
< s_ptr = &mp_ptr->info[i];
<
< /* Default name */
< strcpy(name, spell_names[mp_ptr->spell_type][i]);
<
< /* Illegible */
< if (s_ptr->slevel >= 99)
< {
< /* Illegible */
< strcpy(name, "(illegible)");
<
< /* Unusable */
< a = TERM_L_DARK;
< }
<
< /* Forgotten */
< else if ((i < 32) ?
< ((spell_forgotten1 & (1L << i))) :
< ((spell_forgotten2 & (1L << (i - 32)))))
< {
< /* Forgotten */
< a = TERM_ORANGE;
< }
<
< /* Unknown */
< else if (!((i < 32) ?
< (spell_learned1 & (1L << i)) :
< (spell_learned2 & (1L << (i - 32)))))
< {
< /* Unknown */
< a = TERM_RED;
< }
<
< /* Untried */
< else if (!((i < 32) ?
< (spell_worked1 & (1L << i)) :
< (spell_worked2 & (1L << (i - 32)))))
< {
< /* Untried */
< a = TERM_YELLOW;
< }
<
< /* Dump the spell --(-- */
< sprintf(out_val, "%c/%c) %-20.20s",
< I2A(j), I2A(n), name);
<
< /* Track maximum */
< m[j] = y + n;
<
< /* Dump onto the window */
< Term_putstr(x, m[j], -1, a, out_val);
<
< /* Next */
< n++;
< }
< }
< }
138c45
< static s16b spell_chance(int spell)
---
> static s16b spell_chance(int int spell)
139a47,48
> player_type *p_ptr = Players[Ind];
>
199c108
< static bool spell_okay(int j, bool known)
---
> static bool spell_okay(int int j, bool known)
200a110,111
> player_type *p_ptr = Players[Ind];
>
211,212c122,123
< (spell_forgotten1 & (1L << j)) :
< (spell_forgotten2 & (1L << (j - 32))))
---
> (p_ptr->spell_forgotten1 & (1L << j)) :
> (p_ptr->spell_forgotten2 & (1L << (j - 32))))
220,221c131,132
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32))))
241c152
< static void spell_info(char *p, int j)
---
> static void spell_info(int char *p, int j)
242a154,155
> player_type *p_ptr = Players[Ind];
>
333c246
< static void print_spells(byte *spell, int num)
---
> static void print_spells(int int book, byte *spell, int num)
335c248
< int i, j, col;
---
> player_type *p_ptr = Players[Ind];
336a250,251
> int i, j;
>
346,353d260
< /* Print column */
< col = 20;
<
< /* Title the list */
< prt("", 1, col);
< put_str("Name", 1, col + 5);
< put_str("Lv Mana Fail", 1, col + 35);
<
367c274
< prt(out_val, 2 + i, col);
---
> Send_spell_info(book, i, out_val);
381,382c288,289
< ((spell_forgotten1 & (1L << j))) :
< ((spell_forgotten2 & (1L << (j - 32)))))
---
> ((p_ptr->spell_forgotten1 & (1L << j))) :
> ((p_ptr->spell_forgotten2 & (1L << (j - 32)))))
387,388c294,295
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32)))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32)))))
393,394c300,301
< (spell_worked1 & (1L << j)) :
< (spell_worked2 & (1L << (j - 32)))))
---
> (p_ptr->spell_worked1 & (1L << j)) :
> (p_ptr->spell_worked2 & (1L << (j - 32)))))
403c310
< prt(out_val, 2 + i, col);
---
> Send_spell_info(book, i, out_val);
405,407d311
<
< /* Clear the bottom line */
< prt("", 2 + i, col);
422c326,327
< static int get_spell(int *sn, cptr prompt, int sval, bool known)
---
> #if 0
> static int get_spell(int int *sn, cptr prompt, int sval, bool known)
424,599d328
< int i, j = -1;
<
< byte spell[64], num = 0;
<
< bool flag, redraw, okay, ask;
< char choice;
<
< magic_type *s_ptr;
<
< char out_val[160];
<
< cptr p = ((mp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer");
<
<
< /* Extract spells */
< for (i = 0; i < 64; i++)
< {
< /* Check for this spell */
< if ((i < 32) ?
< (spell_flags[mp_ptr->spell_type][sval][0] & (1L << i)) :
< (spell_flags[mp_ptr->spell_type][sval][1] & (1L << (i - 32))))
< {
< /* Collect this spell */
< spell[num++] = i;
< }
< }
<
<
< /* Assume no usable spells */
< okay = FALSE;
<
< /* Assume no spells available */
< (*sn) = -2;
<
< /* Check for "okay" spells */
< for (i = 0; i < num; i++)
< {
< /* Look for "okay" spells */
< if (spell_okay(spell[i], known)) okay = TRUE;
< }
<
< /* No "okay" spells */
< if (!okay) return (FALSE);
<
<
< /* Assume cancelled */
< *sn = (-1);
<
< /* Nothing chosen yet */
< flag = FALSE;
<
< /* No redraw yet */
< redraw = FALSE;
<
<
< /* Show choices */
< if (show_choices)
< {
< /* Update */
< p_ptr->window |= (PW_SPELL);
<
< /* Window stuff */
< window_stuff();
< }
<
<
< /* Build a prompt (accept all spells) */
< strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) %^s which %s? ",
< p, I2A(0), I2A(num - 1), prompt, p);
<
< /* Get a spell from the user */
< while (!flag && get_com(out_val, &choice))
< {
< /* Request redraw */
< if ((choice == ' ') || (choice == '*') || (choice == '?'))
< {
< /* Show the list */
< if (!redraw)
< {
< /* Show list */
< redraw = TRUE;
<
< /* Save the screen */
< Term_save();
<
< /* Display a list of spells */
< print_spells(spell, num);
< }
<
< /* Hide the list */
< else
< {
< /* Hide list */
< redraw = FALSE;
<
< /* Restore the screen */
< Term_load();
< }
<
< /* Ask again */
< continue;
< }
<
<
< /* Note verify */
< ask = (isupper(choice));
<
< /* Lowercase */
< if (ask) choice = tolower(choice);
<
< /* Extract request */
< i = (islower(choice) ? A2I(choice) : -1);
<
< /* Totally Illegal */
< if ((i < 0) || (i >= num))
< {
< bell();
< continue;
< }
<
< /* Save the spell index */
< j = spell[i];
<
< /* Require "okay" spells */
< if (!spell_okay(j, known))
< {
< bell();
< msg_format("You may not %s that %s.", prompt, p);
< continue;
< }
<
< /* Verify it */
< if (ask)
< {
< char tmp_val[160];
<
< /* Access the spell */
< s_ptr = &mp_ptr->info[j];
<
< /* Prompt */
< strnfmt(tmp_val, 78, "%^s %s (%d mana, %d%% fail)? ",
< prompt, spell_names[mp_ptr->spell_type][j],
< s_ptr->smana, spell_chance(j));
<
< /* Belay that order */
< if (!get_check(tmp_val)) continue;
< }
<
< /* Stop the loop */
< flag = TRUE;
< }
<
<
< /* Restore the screen */
< if (redraw) Term_load();
<
<
< /* Show choices */
< if (show_choices)
< {
< /* Update */
< p_ptr->window |= (PW_SPELL);
<
< /* Window stuff */
< window_stuff();
< }
<
<
< /* Abort if needed */
< if (!flag) return (FALSE);
<
< /* Save the choice */
< (*sn) = j;
<
< /* Success */
< return (TRUE);
600a330
> #endif
610c340
< void do_cmd_browse(void)
---
> void do_cmd_browse(int int book)
611a342,343
> player_type *p_ptr = Players[Ind];
>
627c359
< if (p_ptr->blind || no_lite())
---
> if (p_ptr->blind || no_lite(Ind))
644,649c376
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Browse which book? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no books that you can read.");
< return;
< }
---
> item = book;
654c381
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
662a390,395
> if (o_ptr->tval != mp_ptr->spell_book)
> {
> msg_print("SERVER ERROR: Tried browsing a bad book!");
> return;
> }
>
681,683d413
< /* Save the screen */
< Term_save();
<
685,697c415
< print_spells(spell, num);
<
< /* Clear the top line */
< prt("", 0, 0);
<
< /* Prompt user */
< put_str("[Press any key to continue]", 0, 23);
<
< /* Wait for key */
< (void)inkey();
<
< /* Restore the screen */
< Term_load();
---
> print_spells(book, spell, num);
706c424
< void do_cmd_study(void)
---
> void do_cmd_study(int int book, int spell)
708c426
< int i, item, sval;
---
> player_type *p_ptr = Players[Ind];
709a428,429
> int i, sval;
>
715a436
> byte spells[64], num = 0;
716a438
>
723c445
< if (p_ptr->blind || no_lite())
---
> if (p_ptr->blind || no_lite(Ind))
745,751d466
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Study which book? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no books that you can read.");
< return;
< }
<
753c468
< if (item >= 0)
---
> if (book >= 0)
755c470
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[book];
761c476
< o_ptr = &o_list[0 - item];
---
> o_ptr = &o_list[0 - book];
763a479,484
> if (o_ptr->tval != mp_ptr->spell_book)
> {
> msg_print("SERVER ERROR: Trying to gain a spell from a bad book!");
> return;
> }
>
771,772c492,511
< /* Ask for a spell, allow cancel */
< if (!get_spell(&j, "study", sval, FALSE) && (j == -1)) return;
---
> for (i = 0; i < 64; i++)
> {
> /* Check for this spell */
> if ((i < 32) ?
> (spell_flags[mp_ptr->spell_type][sval][0] & (1L << i)) :
> (spell_flags[mp_ptr->spell_type][sval][1] & (1L << (i - 32))))
> {
> /* Collect this spell */
> spells[num++] = i;
> }
> }
>
> /* Set the spell number */
> j = spells[spell];
>
> if (!spell_okay(j, FALSE))
> {
> msg_print("You cannot gain that spell!");
> return;
> }
812c551
< energy_use = 100;
---
> p_ptr->energy_use = 100;
817c556
< spell_learned1 |= (1L << j);
---
> p_ptr->spell_learned1 |= (1L << j);
821c560
< spell_learned2 |= (1L << (j - 32));
---
> p_ptr->spell_learned2 |= (1L << (j - 32));
828c567
< if (spell_order[i] == 99) break;
---
> if (p_ptr->spell_order[i] == 99) break;
832c571
< spell_order[i++] = j;
---
> p_ptr->spell_order[i++] = j;
851a591,593
>
> /* Update the spell info */
> p_ptr->window |= (PW_SPELL);
857a600,607
> *
> * Many of the spells have a strange get_aim_dir(), and then they return.
> * What this does is it sends a PKT_GET_DIRECTION to the client, which then
> * (when the player hits a direction key), send a response to the server. The
> * server then calls do_cmd_cast_aux() with the direction. This is a crappy
> * way of doing things, but it should work. Without this, the server is hung
> * until the player hits a direction key, and we try very hard not to have
> * any undue slowness in the server. --KLJ--
859c609
< void do_cmd_cast(void)
---
> void do_cmd_cast(int int book, int spell)
861c611,613
< int item, sval, j, dir;
---
> player_type *p_ptr = Players[Ind];
>
> int i, j, sval;
868a621
> byte spells[64], num = 0;
878c631
< if (p_ptr->blind || no_lite())
---
> if (p_ptr->blind || no_lite(Ind))
895,901d647
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Use which book? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no spell books!");
< return;
< }
<
903c649
< if (item >= 0)
---
> if (book >= 0)
905c651
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[book];
911c657
< o_ptr = &o_list[0 - item];
---
> o_ptr = &o_list[0 - book];
913a660,665
> if (o_ptr->tval != mp_ptr->spell_book)
> {
> msg_print("SERVER ERROR: Tried to cast spell from bad book!");
> return;
> }
>
916a669,679
> for (i = 0; i < 64; i++)
> {
> /* Check for this spell */
> if ((i < 32) ?
> (spell_flags[mp_ptr->spell_type][sval][0] & (1L << i)) :
> (spell_flags[mp_ptr->spell_type][sval][1] & (1L << (i - 32))))
> {
> /* Collect this spell */
> spells[num++] = i;
> }
> }
918,919c681,684
< /* Ask for a spell */
< if (!get_spell(&j, "cast", sval, TRUE))
---
> /* Set the spell number */
> j = spells[spell];
>
> if (!spell_okay(j, 1))
921c686
< if (j == -2) msg_print("You don't know any spells in that book.");
---
> msg_print("You cannot cast that spell.");
925d689
<
930,940d693
< /* Verify "dangerous" spells */
< if (s_ptr->smana > p_ptr->csp)
< {
< /* Warning */
< msg_print("You do not have enough mana to cast this spell.");
<
< /* Verify */
< if (!get_check("Attempt it anyway? ")) return;
< }
<
<
962,965c715,717
< if (!get_aim_dir(&dir)) return;
< fire_bolt_or_beam(beam-10, GF_MISSILE, dir,
< damroll(3 + ((plev - 1) / 5), 4));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 0;
> return;
970c722
< (void)detect_monsters();
---
> (void)detect_monsters(Ind);
988c740
< (void)detect_treasure();
---
> (void)detect_treasure(Ind);
1001c753
< (void)detect_object();
---
> (void)detect_object(Ind);
1007,1008c759,760
< (void)detect_sdoor();
< (void)detect_trap();
---
> (void)detect_sdoor(Ind);
> (void)detect_trap(Ind);
1014,1017c766,768
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_POIS, dir,
< 10 + (plev / 2), 2);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 8;
> return;
1022,1024c773,775
< if (!get_aim_dir(&dir)) return;
< (void)confuse_monster(dir, plev);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 9;
> return;
1029,1032c780,782
< if (!get_aim_dir(&dir)) return;
< fire_bolt_or_beam(beam-10, GF_ELEC, dir,
< damroll(3+((plev-5)/4), 8));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 10;
> return;
1037c787
< (void)destroy_doors_touch();
---
> (void)destroy_doors_touch(Ind);
1043,1045c793,795
< if (!get_aim_dir(&dir)) return;
< (void)sleep_monster(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 12;
> return;
1062,1065c812,814
< if (!get_aim_dir(&dir)) return;
< msg_print("A line of blue shimmering light appears.");
< lite_line(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 15;
> return;
1070,1073c819,821
< if (!get_aim_dir(&dir)) return;
< fire_bolt_or_beam(beam-10, GF_COLD, dir,
< damroll(5+((plev-5)/4), 8));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 16;
> return;
1078,1080c826,828
< if (!get_aim_dir(&dir)) return;
< (void)wall_to_mud(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 17;
> return;
1097c845
< (void)sleep_monsters_touch();
---
> (void)sleep_monsters_touch(Ind);
1103,1105c851,853
< if (!get_aim_dir(&dir)) return;
< (void)poly_monster(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 21;
> return;
1110c858
< (void)ident_spell();
---
> (void)ident_spell(Ind);
1116c864
< (void)sleep_monsters();
---
> (void)sleep_monsters(Ind);
1122,1125c870,872
< if (!get_aim_dir(&dir)) return;
< fire_bolt_or_beam(beam, GF_FIRE, dir,
< damroll(8+((plev-5)/4), 8));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 24;
> return;
1130,1132c877,879
< if (!get_aim_dir(&dir)) return;
< (void)slow_monster(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 25;
> return;
1137,1140c884,886
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_COLD, dir,
< 30 + (plev), 2);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 26;
> return;
1151,1153c897,899
< if (!get_aim_dir(&dir)) return;
< (void)teleport_monster(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 28;
> return;
1171,1174c917,919
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_FIRE, dir,
< 55 + (plev), 2);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 30;
> return;
1179c924
< destroy_area(py, px, 15, TRUE);
---
> destroy_area(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 15, TRUE);
1185c930
< (void)genocide();
---
> (void)genocide(Ind);
1191c936
< (void)door_creation();
---
> (void)door_creation(Ind);
1197c942
< (void)stair_creation();
---
> (void)stair_creation(Ind);
1203c948
< (void)teleport_player_level();
---
> (void)teleport_player_level(Ind);
1209c954
< earthquake(py, px, 10);
---
> earthquake(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 10);
1230,1233c975,977
< if (!get_aim_dir(&dir)) return;
< fire_bolt_or_beam(beam, GF_ACID, dir,
< damroll(6+((plev-5)/4), 8));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 38;
> return;
1238,1241c982,984
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_POIS, dir,
< 20 + (plev / 2), 3);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 39;
> return;
1246,1249c989,991
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_ACID, dir,
< 40 + (plev), 2);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 40;
> return;
1254,1257c996,998
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_COLD, dir,
< 70 + (plev), 3);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 41;
> return;
1262,1265c1003,1005
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_METEOR, dir,
< 65 + (plev), 3);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 42;
> return;
1270,1273c1010,1012
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_MANA, dir,
< 300 + (plev * 2), 3);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 43;
> return;
1278c1017
< (void)detect_evil();
---
> (void)detect_evil(Ind);
1284c1023
< (void)detect_magic();
---
> (void)detect_magic(Ind);
1296c1035
< (void)genocide();
---
> (void)genocide(Ind);
1302c1041
< (void)mass_genocide();
---
> (void)mass_genocide(Ind);
1384,1385c1123,1124
< (spell_worked1 & (1L << j)) :
< (spell_worked2 & (1L << (j - 32)))))
---
> (p_ptr->spell_worked1 & (1L << j)) :
> (p_ptr->spell_worked2 & (1L << (j - 32)))))
1392c1131
< spell_worked1 |= (1L << j);
---
> p_ptr->spell_worked1 |= (1L << j);
1396c1135
< spell_worked2 |= (1L << (j - 32));
---
> p_ptr->spell_worked2 |= (1L << (j - 32));
1405c1144
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1450a1190,1405
> * Finish casting a spell that required a direction --KLJ--
> */
> void do_cmd_cast_aux(int int dir)
> {
> player_type *p_ptr = Players[Ind];
>
> int plev = p_ptr->lev;
> int beam = ((p_ptr->pclass == 1) ? plev : (plev / 2));
>
> magic_type *s_ptr = &mp_ptr->info[p_ptr->current_spell];
>
> /* We assume that the spell can be cast, and so forth */
> switch(p_ptr->current_spell)
> {
> case 0:
> {
> fire_bolt_or_beam(beam-10, GF_MISSILE, dir,
> damroll(3 + ((plev - 1) / 5), 4));
> break;
> }
>
> case 8:
> {
> fire_ball(GF_POIS, dir,
> 10 + (plev / 2), 2);
> break;
> }
>
> case 9:
> {
> confuse_monster(dir, plev);
> break;
> }
>
> case 10:
> {
> fire_bolt_or_beam(beam-10, GF_ELEC, dir,
> damroll(3+((plev-5)/4), 8));
> break;
> }
>
> case 12:
> {
> sleep_monster(dir);
> break;
> }
>
> case 15:
> {
> msg_print("A line of blue shimmering light appears.");
> lite_line(dir);
> }
>
> case 16:
> {
> fire_bolt_or_beam(beam-10, GF_COLD, dir,
> damroll(5+((plev-5)/4), 8));
> break;
> }
>
> case 17:
> {
> (void)wall_to_mud(dir);
> break;
> }
>
> case 21:
> {
> (void)poly_monster(dir);
> break;
> }
>
> case 24:
> {
> fire_bolt_or_beam(beam, GF_FIRE, dir,
> damroll(8+((plev-5)/4), 8));
> break;
> }
>
> case 25:
> {
> (void)slow_monster(dir);
> break;
> }
>
> case 26:
> {
> fire_ball(GF_COLD, dir, 30 + (plev), 2);
> break;
> }
>
> case 28:
> {
> (void)teleport_monster(dir);
> break;
> }
>
> case 30:
> {
> fire_ball(GF_FIRE, dir, 55 + (plev), 2);
> break;
> }
>
> case 38:
> {
> fire_bolt_or_beam(beam, GF_ACID, dir,
> damroll(6+((plev-5)/4), 8));
> break;
> }
>
> case 39:
> {
> fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
> break;
> }
>
> case 40:
> {
> fire_ball(GF_ACID, dir, 40 + (plev), 2);
> break;
> }
>
> case 41:
> {
> fire_ball(GF_COLD, dir, 70 + (plev), 3);
> break;
> }
>
> case 42:
> {
> fire_ball(GF_METEOR, dir, 65 + (plev), 3);
> break;
> }
>
> case 43:
> {
> fire_ball(GF_MANA, dir, 300 + (plev * 2), 3);
> break;
> }
>
> default: /* For some reason we got called for a spell that */
> { /* doesn't require a direction */
> msg_print("SERVER ERROR: do_cmd_cast_aux() called for non-directional spell!");
> p_ptr->current_spell = -1;
> return;
> }
> }
>
> if (!((p_ptr->current_spell < 32) ?
> (p_ptr->spell_worked1 & (1L << p_ptr->current_spell)) :
> (p_ptr->spell_worked2 & (1L << (p_ptr->current_spell - 32)))))
> {
> int e = s_ptr->sexp;
>
> if (p_ptr->current_spell < 32)
> {
> p_ptr->spell_worked1 |= (1L << p_ptr->current_spell);
> }
> else
> {
> p_ptr->spell_worked2 |= (1L << (p_ptr->current_spell - 32));
> }
>
> gain_exp(e * s_ptr->slevel);
> }
>
> p_ptr->energy_use = 100;
>
> if (s_ptr->smana <= p_ptr->csp)
> {
> /* Use some mana */
> p_ptr->csp -= s_ptr->smana;
> }
>
> /* Over-exert the player */
> else
> {
> int oops = s_ptr->smana - p_ptr->csp;
>
> /* No mana left */
> p_ptr->csp = 0;
> p_ptr->csp_frac = 0;
>
> /* Message */
> msg_print("You faint from the effort!");
>
> /* Hack -- bypass free action */
> (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
>
> /* Damage CON (possibly permanently) */
> if (rand_int(100) < 50)
> {
> bool perm = (rand_int(100) < 25);
>
> /* Message */
> msg_print("You have damaged your health!");
>
> /* Reduce constitution */
> (void)dec_stat(A_CON, 15 + randint(10), perm);
> }
> }
>
> /* Reset current spell */
> p_ptr->current_spell = -1;
>
> /* Resend mana */
> p_ptr->redraw |= (PR_MANA);
>
> /* Window stuff */
> p_ptr->window |= (PW_PLAYER);
> }
>
>
>
>
> /*
1453c1408
< static void brand_weapon(void)
---
> static void brand_weapon(int Ind)
1454a1410,1411
> player_type *p_ptr = Players[Ind];
>
1457c1414
< o_ptr = &inventory[INVEN_WIELD];
---
> o_ptr = &p_ptr->inventory[INVEN_WIELD];
1497a1455,1456
> *
> * See above for an explanation of the weirdness in this function --KLJ--
1499c1458
< void do_cmd_pray(void)
---
> void do_cmd_pray(int int book, int spell)
1501c1460,1462
< int item, sval, j, dir, chance;
---
> player_type *p_ptr = Players[Ind];
>
> int item, sval, j, chance, i;
1507a1469
> byte spells[64], num = 0;
1517c1479
< if (p_ptr->blind || no_lite())
---
> if (p_ptr->blind || no_lite(Ind))
1534,1539c1496
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Use which book? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no prayer books!");
< return;
< }
---
> item = book;
1544c1501
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1552a1510,1515
> if (o_ptr->tval != mp_ptr->spell_book)
> {
> msg_print("SERVER ERROR: Tried to pray prayer from bad book!");
> return;
> }
>
1555a1519,1529
> for (i = 0; i < 64; i++)
> {
> /* Check for this spell */
> if ((i < 32) ?
> (spell_flags[mp_ptr->spell_type][sval][0] & (1L << i)) :
> (spell_flags[mp_ptr->spell_type][sval][1] & (1L << (i - 32))))
> {
> /* Collect this spell */
> spells[num++] = i;
> }
> }
1557,1558c1531,1533
< /* Choose a spell */
< if (!get_spell(&j, "recite", sval, TRUE))
---
> j = spells[spell];
>
> if (!spell_okay(j, 1))
1560c1535
< if (j == -2) msg_print("You don't know any prayers in that book.");
---
> msg_print("You cannot pray that prayer.");
1569,1579d1543
< /* Verify "dangerous" prayers */
< if (s_ptr->smana > p_ptr->csp)
< {
< /* Warning */
< msg_print("You do not have enough mana to recite this prayer.");
<
< /* Verify */
< if (!get_check("Attempt it anyway? ")) return;
< }
<
<
1597c1561
< (void)detect_evil();
---
> (void)detect_evil(Ind);
1628c1592
< (void)detect_trap();
---
> (void)detect_trap(Ind);
1634c1598
< (void)detect_sdoor();
---
> (void)detect_sdoor(Ind);
1646,1648c1610,1612
< if (!get_aim_dir(&dir)) return;
< (void)fear_monster(dir, plev);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 8;
> return;
1672c1636
< (void)sleep_monsters_touch();
---
> (void)sleep_monsters_touch(Ind);
1684c1648
< remove_curse();
---
> remove_curse(Ind);
1703,1708c1667,1669
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_HOLY_ORB, dir,
< (damroll(3, 6) + plev +
< (plev / ((p_ptr->pclass == 2) ? 2 : 4))),
< ((plev < 30) ? 2 : 3));
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 17;
> return;
1732c1693
< earthquake(py, px, 10);
---
> earthquake(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 10);
1738c1699
< map_area();
---
> map_area(Ind);
1752c1713
< (void)turn_undead();
---
> (void)turn_undead(Ind);
1784c1745
< warding_glyph();
---
> warding_glyph(Ind);
1801c1762
< (void)detect_monsters();
---
> (void)detect_monsters(Ind);
1807c1768
< (void)detection();
---
> (void)detection(Ind);
1813c1774
< (void)ident_spell();
---
> (void)ident_spell(Ind);
1819c1780
< (void)probing();
---
> (void)probing(Ind);
1825c1786
< wiz_lite();
---
> wiz_lite(Ind);
1865c1826
< (void)restore_level();
---
> (void)restore_level(Ind);
1892c1853
< destroy_area(py, px, 15, TRUE);
---
> destroy_area(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 15, TRUE);
1898,1900c1859,1861
< if (!get_aim_dir(&dir)) return;
< drain_life(dir, 200);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 45;
> return;
1905c1866
< (void)destroy_doors_touch();
---
> (void)destroy_doors_touch(Ind);
1917c1878
< (void)remove_all_curse();
---
> (void)remove_all_curse(Ind);
1935c1896
< brand_weapon();
---
> brand_weapon(Ind);
1953,1955c1914,1916
< if (!get_aim_dir(&dir)) return;
< (void)teleport_monster(dir);
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_spell = 54;
> return;
1960c1921
< (void)teleport_player_level();
---
> (void)teleport_player_level(Ind);
1982c1943
< new_level_flag = TRUE;
---
> p_ptr->new_level_flag = TRUE;
1989,1990c1950,1951
< (spell_worked1 & (1L << j)) :
< (spell_worked2 & (1L << (j - 32)))))
---
> (p_ptr->spell_worked1 & (1L << j)) :
> (p_ptr->spell_worked2 & (1L << (j - 32)))))
1997c1958
< spell_worked1 |= (1L << j);
---
> p_ptr->spell_worked1 |= (1L << j);
2001c1962
< spell_worked2 |= (1L << (j - 32));
---
> p_ptr->spell_worked2 |= (1L << (j - 32));
2010c1971
< energy_use = 100;
---
> p_ptr->energy_use = 100;
2053a2015,2122
> void do_cmd_pray_aux(int int dir)
> {
> player_type *p_ptr = Players[Ind];
>
> int plev = p_ptr->lev;
>
> magic_type *s_ptr = &mp_ptr->info[p_ptr->current_spell];
>
> /* We assume that the spell can be cast, and so forth */
> switch(p_ptr->current_spell)
> {
> case 8:
> {
> (void)fear_monster(dir, plev);
> break;
> }
>
> case 17:
> {
> fire_ball(GF_HOLY_ORB, dir,
> (damroll(3, 6) + plev +
> (plev / ((p_ptr->pclass == 2) ? 2 : 4))),
> ((plev < 30) ? 2 : 3));
> break;
> }
>
> case 45:
> {
> drain_life(dir, 200);
> break;
> }
>
> case 54:
> {
> (void)teleport_monster(dir);
> break;
> }
>
> default: /* Something went wrong */
> {
> msg_print("SERVER ERROR: do_cmd_prayer_aux() called for non-directional prayer!");
> p_ptr->current_spell = -1;
> }
> }
>
> if (!((p_ptr->current_spell < 32) ?
> (p_ptr->spell_worked1 & (1L << p_ptr->current_spell)) :
> (p_ptr->spell_worked2 & (1L << (p_ptr->current_spell - 32)))))
> {
> int e = s_ptr->sexp;
>
> if (p_ptr->current_spell < 32)
> {
> p_ptr->spell_worked1 |= (1L << p_ptr->current_spell);
> }
> else
> {
> p_ptr->spell_worked2 |= (1L << (p_ptr->current_spell - 32));
> }
>
> gain_exp(e * s_ptr->slevel);
> }
>
> p_ptr->energy_use = 100;
>
> if (s_ptr->smana <= p_ptr->csp)
> {
> /* Use some mana */
> p_ptr->csp -= s_ptr->smana;
> }
>
> /* Over-exert the player */
> else
> {
> int oops = s_ptr->smana - p_ptr->csp;
>
> /* No mana left */
> p_ptr->csp = 0;
> p_ptr->csp_frac = 0;
>
> /* Message */
> msg_print("You faint from the effort!");
>
> /* Hack -- bypass free action */
> (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops - 1));
>
> /* Damage CON (possibly permanently) */
> if (rand_int(100) < 50)
> {
> bool perm = (rand_int(100) < 25);
>
> /* Message */
> msg_print("You have damaged your health!");
>
> /* Reduce constitution */
> (void)dec_stat(A_CON, 15 + randint(10), perm);
> }
> }
>
> /* Reset current spell */
> p_ptr->current_spell = -1;
>
> /* Resend mana */
> p_ptr->redraw |= (PR_MANA);
>
> /* Window stuff */
> p_ptr->window |= (PW_PLAYER);
> }
diff -r src-280/cmd6.c mangband-000/src/server/cmd6.c
12a13,14
> #define SERVER
>
65c67
< void do_cmd_eat_food(void)
---
> void do_cmd_eat_food(int int item)
67c69
< int item, ident, lev;
---
> player_type *p_ptr = Players[Ind];
68a71,72
> int ident, lev;
>
75,81d78
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Eat which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to eat.");
< return;
< }
<
85c82
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
93a91,95
> if (o_ptr->tval != TV_FOOD)
> {
> msg_print("SERVER ERROR: Tried to eat non-food!");
> return;
> }
94a97
>
96c99
< energy_use = 100;
---
> p_ptr->energy_use = 100;
354c357
< void do_cmd_quaff_potion(void)
---
> void do_cmd_quaff_potion(int int item)
356c359
< int item, ident, lev;
---
> player_type *p_ptr = Players[Ind];
357a361,362
> int ident, lev;
>
364,370d368
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Quaff which potion? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no potions to quaff.");
< return;
< }
<
374c372
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
383a382,387
> if (o_ptr->tval != TV_POTION)
> {
> msg_print("SERVER ERROR: Tried to quaff non-potion!");
> return;
> }
>
385c389
< energy_use = 100;
---
> p_ptr->energy_use = 100;
684c688
< restore_level();
---
> restore_level(Ind);
718c722
< if (restore_level()) ident = TRUE;
---
> if (restore_level(Ind)) ident = TRUE;
808c812
< wiz_lite();
---
> wiz_lite(Ind);
817c821
< wiz_lite();
---
> wiz_lite(Ind);
820,825c824,829
< (void)detect_treasure();
< (void)detect_object();
< (void)detect_sdoor();
< (void)detect_trap();
< identify_pack();
< self_knowledge();
---
> (void)detect_treasure(Ind);
> (void)detect_object(Ind);
> (void)detect_sdoor(Ind);
> (void)detect_trap(Ind);
> identify_pack(Ind);
> self_knowledge(Ind);
834c838
< self_knowledge();
---
> self_knowledge(Ind);
896c900
< static bool curse_armor(void)
---
> static bool curse_armor(int Ind)
897a902,903
> player_type *p_ptr = Players[Ind];
>
904c910
< o_ptr = &inventory[INVEN_BODY];
---
> o_ptr = &p_ptr->inventory[INVEN_BODY];
960c966
< static bool curse_weapon(void)
---
> static bool curse_weapon(int Ind)
961a968,969
> player_type *p_ptr = Players[Ind];
>
968c976
< o_ptr = &inventory[INVEN_WIELD];
---
> o_ptr = &p_ptr->inventory[INVEN_WIELD];
1029c1037
< void do_cmd_read_scroll(void)
---
> void do_cmd_read_scroll(int int item)
1031c1039
< int item, k, used_up, ident, lev;
---
> player_type *p_ptr = Players[Ind];
1032a1041,1042
> int k, used_up, ident, lev;
>
1042c1052
< if (no_lite())
---
> if (no_lite(Ind))
1057,1063d1066
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Read which scroll? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no scrolls to read.");
< return;
< }
<
1067c1070
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1076a1080,1085
> if (o_ptr->tval != TV_SCROLL)
> {
> msg_print("SERVER ERROR: Tried to read non-scroll!");
> return;
> }
>
1078c1087
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1112c1121
< if (curse_armor()) ident = TRUE;
---
> if (curse_armor(Ind)) ident = TRUE;
1118c1127
< if (curse_weapon()) ident = TRUE;
---
> if (curse_weapon(Ind)) ident = TRUE;
1126c1135
< if (summon_specific(py, px, dun_level, 0))
---
> if (summon_specific(p_ptr->dun_depth, p_ptr->py, p_ptr->px, p_ptr->dun_depth, 0))
1138c1147
< if (summon_specific(py, px, dun_level, SUMMON_UNDEAD))
---
> if (summon_specific(p_ptr->dun_depth, p_ptr->py, p_ptr->px, p_ptr->dun_depth, SUMMON_UNDEAD))
1148c1157
< if (trap_creation()) ident = TRUE;
---
> if (trap_creation(Ind)) ident = TRUE;
1168c1177
< (void)teleport_player_level();
---
> (void)teleport_player_level(Ind);
1193c1202
< if (!ident_spell()) used_up = FALSE;
---
> if (!ident_spell(Ind)) used_up = FALSE;
1201c1210
< if (!identify_fully()) used_up = FALSE;
---
> if (!identify_fully(Ind)) used_up = FALSE;
1207c1216
< if (remove_curse())
---
> if (remove_curse(Ind))
1217c1226
< remove_all_curse();
---
> remove_all_curse(Ind);
1278c1287
< map_area();
---
> map_area(Ind);
1285c1294
< if (detect_treasure()) ident = TRUE;
---
> if (detect_treasure(Ind)) ident = TRUE;
1291c1300
< if (detect_object()) ident = TRUE;
---
> if (detect_object(Ind)) ident = TRUE;
1297c1306
< if (detect_trap()) ident = TRUE;
---
> if (detect_trap(Ind)) ident = TRUE;
1303c1312
< if (detect_sdoor()) ident = TRUE;
---
> if (detect_sdoor(Ind)) ident = TRUE;
1309c1318
< if (detect_invisible()) ident = TRUE;
---
> if (detect_invisible(Ind)) ident = TRUE;
1357c1366
< warding_glyph();
---
> warding_glyph(Ind);
1364c1373
< if (destroy_doors_touch()) ident = TRUE;
---
> if (destroy_doors_touch(Ind)) ident = TRUE;
1370c1379
< destroy_area(py, px, 15, TRUE);
---
> destroy_area(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 15, TRUE);
1384c1393
< (void)genocide();
---
> (void)genocide(Ind);
1392c1401
< (void)mass_genocide();
---
> (void)mass_genocide(Ind);
1399c1408
< acquirement(py, px, 1, TRUE);
---
> acquirement(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 1, TRUE);
1406c1415
< acquirement(py, px, randint(2) + 1, TRUE);
---
> acquirement(p_ptr->dun_depth, p_ptr->py, p_ptr->px, randint(2) + 1, TRUE);
1464c1473
< void do_cmd_use_staff(void)
---
> void do_cmd_use_staff(int int item)
1466c1475
< int item, ident, chance, k, lev;
---
> player_type *p_ptr = Players[Ind];
1467a1477,1478
> int ident, chance, k, lev;
>
1477,1483d1487
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Use which staff? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no staff to use.");
< return;
< }
<
1487c1491
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1495a1500,1504
> if (o_ptr->tval != TV_STAFF)
> {
> msg_print("SERVER ERROR: Tried to use non-staff!");
> return;
> }
1505c1514
< if ((inven_cnt >= INVEN_PACK) &&
---
> /*if ((inven_cnt >= INVEN_PACK) &&
1507c1516
< {
---
> {*/
1509c1518
< if (other_query_flag &&
---
> /*if (other_query_flag &&
1511c1520
< }
---
> }*/
1515c1524
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1577c1586
< if (speed_monsters()) ident = TRUE;
---
> if (speed_monsters(Ind)) ident = TRUE;
1585c1594
< if (summon_specific(py, px, dun_level, 0))
---
> if (summon_specific(p_ptr->dun_depth, p_ptr->py, p_ptr->px, p_ptr->dun_depth, 0))
1602c1611
< if (!ident_spell()) use_charge = FALSE;
---
> if (!ident_spell(Ind)) use_charge = FALSE;
1609c1618
< if (remove_curse())
---
> if (remove_curse(Ind))
1639c1648
< map_area();
---
> map_area(Ind);
1646c1655
< if (detect_treasure()) ident = TRUE;
---
> if (detect_treasure(Ind)) ident = TRUE;
1652c1661
< if (detect_object()) ident = TRUE;
---
> if (detect_object(Ind)) ident = TRUE;
1658c1667
< if (detect_trap()) ident = TRUE;
---
> if (detect_trap(Ind)) ident = TRUE;
1664c1673
< if (detect_sdoor()) ident = TRUE;
---
> if (detect_sdoor(Ind)) ident = TRUE;
1670c1679
< if (detect_invisible()) ident = TRUE;
---
> if (detect_invisible(Ind)) ident = TRUE;
1676c1685
< if (detect_evil()) ident = TRUE;
---
> if (detect_evil(Ind)) ident = TRUE;
1721c1730
< if (sleep_monsters()) ident = TRUE;
---
> if (sleep_monsters(Ind)) ident = TRUE;
1727c1736
< if (slow_monsters()) ident = TRUE;
---
> if (slow_monsters(Ind)) ident = TRUE;
1746c1755
< probing();
---
> probing(Ind);
1778c1787
< (void)genocide();
---
> (void)genocide(Ind);
1785c1794
< earthquake(py, px, 10);
---
> earthquake(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 10);
1792c1801
< destroy_area(py, px, 15, TRUE);
---
> destroy_area(p_ptr->dun_depth, p_ptr->py, p_ptr->px, 15, TRUE);
1836c1845
< total_weight -= tmp_obj.weight;
---
> p_ptr->total_weight -= tmp_obj.weight;
1877c1886
< void do_cmd_aim_wand(void)
---
> void do_cmd_aim_wand(int int item, int dir)
1879c1888
< int item, lev, ident, chance, dir, sval;
---
> player_type *p_ptr = Players[Ind];
1880a1890,1891
> int lev, ident, chance, sval;
>
1887,1893d1897
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Aim which wand? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no wand to aim.");
< return;
< }
<
1897c1901
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1915c1919
< if ((inven_cnt >= INVEN_PACK) &&
---
> /*if ((inven_cnt >= INVEN_PACK) &&
1917c1921
< {
---
> {*/
1919c1923
< if (other_query_flag &&
---
> /* if (other_query_flag &&
1921c1925
< }
---
> }*/
1925c1929
< if (!get_aim_dir(&dir)) return;
---
> /*if (!get_aim_dir(&dir)) return;*/
1929c1933
< energy_use = 100;
---
> p_ptr->energy_use = 100;
2138c2142
< msg_print("Oops. Wand of wonder activated.");
---
> msg_print("SERVER ERROR: Oops. Wand of wonder activated.");
2236c2240
< total_weight -= tmp_obj.weight;
---
> p_ptr->total_weight -= tmp_obj.weight;
2268c2272
< void do_cmd_zap_rod(void)
---
> void do_cmd_zap_rod(int int item)
2270c2274
< int item, ident, chance, dir, lev;
---
> player_type *p_ptr = Players[Ind];
2271a2276,2277
> int ident, chance, lev;
>
2281,2287d2286
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Zap which rod? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have no rod to zap.");
< return;
< }
<
2291c2290
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
2300a2300,2305
> if (o_ptr->tval != TV_ROD)
> {
> msg_print("SERVER ERROR: Tried to zap non-rod!");
> return;
> }
>
2309c2314
< if ((inven_cnt >= INVEN_PACK) &&
---
> /*if ((inven_cnt >= INVEN_PACK) &&
2311c2316
< {
---
> {*/
2313c2318
< if (other_query_flag &&
---
> /*if (other_query_flag &&
2315c2320
< }
---
> }*/
2320,2321c2325,2328
< /* Get a direction, allow cancel */
< if (!get_aim_dir(&dir)) return;
---
> /* Get a direction, then return */
> get_aim_dir(Ind);
> p_ptr->current_rod = item;
> return;
2326c2333
< energy_use = 100;
---
> p_ptr->energy_use = 100;
2371c2378
< if (detect_trap()) ident = TRUE;
---
> if (detect_trap(Ind)) ident = TRUE;
2378c2385
< if (detect_sdoor()) ident = TRUE;
---
> if (detect_sdoor(Ind)) ident = TRUE;
2386c2393
< if (!ident_spell()) use_charge = FALSE;
---
> if (!ident_spell(Ind)) use_charge = FALSE;
2417c2424
< map_area();
---
> map_area(Ind);
2425c2432
< detection();
---
> detection(Ind);
2433c2440
< probing();
---
> probing(Ind);
2461c2468
< if (restore_level()) ident = TRUE;
---
> if (restore_level(Ind)) ident = TRUE;
2485a2493,2647
> default:
> {
> msg_print("SERVER ERROR: Directional rod zapped in non-directional function!");
> return;
> }
> }
>
>
> /* Combine / Reorder the pack (later) */
> p_ptr->notice |= (PN_COMBINE | PN_REORDER);
>
> /* Tried the object */
> object_tried(o_ptr);
>
> /* Successfully determined the object function */
> if (ident && !object_aware_p(o_ptr))
> {
> object_aware(o_ptr);
> gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
> }
>
> /* Window stuff */
> p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
>
> /* Hack -- deal with cancelled zap */
> if (!use_charge)
> {
> o_ptr->pval = 0;
> return;
> }
>
>
> /* XXX Hack -- unstack if necessary */
> if ((item >= 0) && (o_ptr->number > 1))
> {
> /* Make a fake item */
> object_type tmp_obj;
> tmp_obj = *o_ptr;
> tmp_obj.number = 1;
>
> /* Restore "charge" */
> o_ptr->pval = 0;
>
> /* Unstack the used item */
> o_ptr->number--;
> p_ptr->total_weight -= tmp_obj.weight;
> item = inven_carry(&tmp_obj);
>
> /* Message */
> msg_print("You unstack your rod.");
> }
> }
>
>
>
> /*
> * Activate (zap) a Rod
> *
> * Unstack fully charged rods as needed.
> *
> * Hack -- rods of perception/genocide can be "cancelled"
> * All rods can be cancelled at the "Direction?" prompt
> */
> void do_cmd_zap_rod_dir(int int dir)
> {
> player_type *p_ptr = Players[Ind];
>
> int item, ident, chance, lev;
>
> object_type *o_ptr;
>
> /* Hack -- let perception get aborted */
> bool use_charge = TRUE;
>
>
> item = p_ptr->current_rod;
>
> /* Get the item (in the pack) */
> if (item >= 0)
> {
> o_ptr = &p_ptr->inventory[item];
> }
>
> /* Get the item (on the floor) */
> else
> {
> o_ptr = &o_list[0 - item];
> }
>
> if (o_ptr->tval != TV_ROD)
> {
> msg_print("SERVER ERROR: Tried to zap non-rod!");
> return;
> }
>
> /* Mega-Hack -- refuse to zap a pile from the ground */
> if ((item < 0) && (o_ptr->number > 1))
> {
> msg_print("You must first pick up the rods.");
> return;
> }
>
> /* Hack -- verify potential overflow */
> /*if ((inven_cnt >= INVEN_PACK) &&
> (o_ptr->number > 1))
> {*/
> /* Verify with the player */
> /*if (other_query_flag &&
> !get_check("Your pack might overflow. Continue? ")) return;
> }*/
>
> /* Take a turn */
> p_ptr->energy_use = 100;
>
> /* Not identified yet */
> ident = FALSE;
>
> /* Extract the item level */
> lev = k_info[o_ptr->k_idx].level;
>
> /* Base chance of success */
> chance = p_ptr->skill_dev;
>
> /* Confusion hurts skill */
> if (p_ptr->confused) chance = chance / 2;
>
> /* Hight level objects are harder */
> chance = chance - ((lev > 50) ? 50 : lev);
>
> /* Give everyone a (slight) chance */
> if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0))
> {
> chance = USE_DEVICE;
> }
>
> /* Roll for usage */
> if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE))
> {
> if (flush_failure) flush();
> msg_print("You failed to use the rod properly.");
> return;
> }
>
> /* Still charging */
> if (o_ptr->pval)
> {
> if (flush_failure) flush();
> msg_print("The rod is still charging.");
> return;
> }
>
>
> /* Analyze the rod */
> switch (o_ptr->sval)
> {
2599a2762,2767
>
> default:
> {
> msg_print("SERVER ERROR: Tried to zap non-directional rod in directional function!");
> return;
> }
2602a2771,2773
> /* Clear the current rod */
> p_ptr->current_rod = -1;
>
2640c2811
< total_weight -= tmp_obj.weight;
---
> p_ptr->total_weight -= tmp_obj.weight;
2650d2820
<
2659c2829
< if (!object_known_p(o_ptr)) return (FALSE);
---
> /*if (!object_known_p(o_ptr)) return (FALSE);*/
2676c2846
< static void ring_of_power(int dir)
---
> static void ring_of_power(int int dir)
2677a2848,2849
> player_type *p_ptr = Players[Ind];
>
2698c2870
< check_experience();
---
> check_experience(Ind);
2743c2915
< static bool brand_bolts(void)
---
> static bool brand_bolts(int Ind)
2744a2917
> player_type *p_ptr = Players[Ind];
2750c2923
< object_type *o_ptr = &inventory[i];
---
> object_type *o_ptr = &p_ptr->inventory[i];
2798c2971
< void do_cmd_activate(void)
---
> void do_cmd_activate(int int item)
2800c2973
< int item, i, k, dir, lev, chance;
---
> player_type *p_ptr = Players[Ind];
2801a2975,2976
> int i, k, lev, chance;
>
2808,2814d2982
< /* Get an item (from equip) */
< if (!get_item(&item, "Activate which item? ", TRUE, FALSE, FALSE))
< {
< if (item == -2) msg_print("You have nothing to activate.");
< return;
< }
<
2818c2986
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
2829c2997
< energy_use = 100;
---
> p_ptr->energy_use = 100;
2881,2884c3049,3051
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_FIRE, dir, damroll(9, 8));
< o_ptr->timeout = rand_int(8) + 8;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2890,2893c3057,3059
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_COLD, dir, damroll(6, 8));
< o_ptr->timeout = rand_int(7) + 7;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2899,2902c3065,3067
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_ELEC, dir, damroll(4, 8));
< o_ptr->timeout = rand_int(6) + 6;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2908,2911c3073,3075
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_POIS, dir, 12, 3);
< o_ptr->timeout = rand_int(4) + 4;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2917,2920c3081,3083
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_COLD, dir, 48, 2);
< o_ptr->timeout = rand_int(5) + 5;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2935,2938c3098,3100
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_COLD, dir, 100, 2);
< o_ptr->timeout = 300;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2944,2947c3106,3108
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_FIRE, dir, 72, 2);
< o_ptr->timeout = 400;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2953,2956c3114,3116
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_FIRE, dir, 72, 3);
< o_ptr->timeout = 100;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2976,2979c3136,3138
< if (!get_aim_dir(&dir)) return;
< drain_life(dir, 120);
< o_ptr->timeout = 400;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2985,2988c3144,3146
< if (!get_aim_dir(&dir)) return;
< drain_life(dir, 90);
< o_ptr->timeout = 70;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
2994c3152
< destroy_doors_touch();
---
> destroy_doors_touch(Ind);
3032c3190
< (void)ident_spell();
---
> (void)ident_spell(Ind);
3040c3198
< probing();
---
> probing(Ind);
3048c3206
< (void)mass_genocide();
---
> (void)mass_genocide(Ind);
3064c3222
< (void)brand_bolts();
---
> (void)brand_bolts(Ind);
3072,3075c3230,3232
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_COLD, dir, damroll(12, 8));
< o_ptr->timeout = 500;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3081,3084c3238,3240
< if (!get_aim_dir(&dir)) return;
< fire_ball(GF_COLD, dir, 100, 2);
< o_ptr->timeout = 500;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3090,3093c3246,3248
< if (!get_aim_dir(&dir)) return;
< wall_to_mud(dir);
< o_ptr->timeout = 5;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3115c3270
< (void)genocide();
---
> (void)genocide(Ind);
3122c3277
< restore_level();
---
> restore_level(Ind);
3130,3133c3285,3287
< if (!get_aim_dir(&dir)) return;
< teleport_monster(dir);
< o_ptr->timeout = 150;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3151c3305
< sleep_monsters_touch();
---
> sleep_monsters_touch(Ind);
3174,3177c3328,3330
< if (!get_aim_dir(&dir)) return;
< confuse_monster(dir, 20);
< o_ptr->timeout = 15;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3183,3186c3336,3338
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_MISSILE, dir, damroll(2, 6));
< o_ptr->timeout = 2;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3192,3195c3344,3346
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_FIRE, dir, damroll(9, 8));
< o_ptr->timeout = rand_int(8) + 8;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3201,3204c3352,3354
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_COLD, dir, damroll(6, 8));
< o_ptr->timeout = rand_int(7) + 7;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3210,3213c3360,3362
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_ELEC, dir, damroll(4, 8));
< o_ptr->timeout = rand_int(6) + 6;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3219,3222c3368,3370
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_ACID, dir, damroll(5, 8));
< o_ptr->timeout = rand_int(5) + 5;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3228,3231c3376,3378
< if (!get_aim_dir(&dir)) return;
< fire_bolt(GF_ARROW, dir, 150);
< o_ptr->timeout = rand_int(90) + 90;
< break;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
3237c3384
< detection();
---
> detection(Ind);
3287c3434
< map_area();
---
> map_area(Ind);
3295,3297c3442,3444
< wiz_lite();
< (void)detect_sdoor();
< (void)detect_trap();
---
> wiz_lite(Ind);
> (void)detect_sdoor(Ind);
> (void)detect_trap(Ind);
3339c3486,3714
< if (!get_aim_dir(&dir)) return;
---
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
> }
>
> case ART_NENYA:
> {
> msg_print("The ring glows bright white...");
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
> }
>
> case ART_VILYA:
> {
> msg_print("The ring glows deep blue...");
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
> }
>
> case ART_POWER:
> {
> msg_print("The ring glows intensely black...");
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
> }
> }
>
> /* Window stuff */
> p_ptr->window |= (PW_INVEN | PW_EQUIP);
>
> /* Done */
> return;
> }
>
>
> /* Hack -- Dragon Scale Mail can be activated as well */
> if (o_ptr->tval == TV_DRAG_ARMOR)
> {
> /* Get a direction for breathing (or abort) */
> get_aim_dir(Ind);
> p_ptr->current_activation = item;
> return;
> }
>
>
> /* Mistake */
> msg_print("SERVER ERROR: Oops. That object cannot be activated.");
> }
>
>
> void do_cmd_activate_dir(int int dir)
> {
> player_type *p_ptr = Players[Ind];
> object_type *o_ptr;
>
> int item, chance;
>
> item = p_ptr->current_activation;
>
> /* Get the item (in the pack) */
> if (item >= 0)
> {
> o_ptr = &p_ptr->inventory[item];
> }
>
> /* Get the item (on the floor) */
> else
> {
> o_ptr = &o_list[0 - item];
> }
>
> /* Artifacts activate by name */
> if (o_ptr->name1)
> {
> /* This needs to be changed */
> switch (o_ptr->name1)
> {
> case ART_NARTHANC:
> {
> fire_bolt(GF_FIRE, dir, damroll(9, 8));
> o_ptr->timeout = rand_int(8) + 8;
> break;
> }
>
> case ART_NIMTHANC:
> {
> fire_bolt(GF_COLD, dir, damroll(6, 8));
> o_ptr->timeout = rand_int(7) + 7;
> break;
> }
>
> case ART_DETHANC:
> {
> fire_bolt(GF_ELEC, dir, damroll(4, 8));
> o_ptr->timeout = rand_int(6) + 6;
> break;
> }
>
> case ART_RILIA:
> {
> fire_ball(GF_POIS, dir, 12, 3);
> o_ptr->timeout = rand_int(4) + 4;
> break;
> }
>
> case ART_BELANGIL:
> {
> fire_ball(GF_COLD, dir, 48, 2);
> o_ptr->timeout = rand_int(5) + 5;
> break;
> }
>
> case ART_RINGIL:
> {
> fire_ball(GF_COLD, dir, 100, 2);
> o_ptr->timeout = 300;
> break;
> }
>
> case ART_ANDURIL:
> {
> fire_ball(GF_FIRE, dir, 72, 2);
> o_ptr->timeout = 400;
> break;
> }
>
> case ART_FIRESTAR:
> {
> fire_ball(GF_FIRE, dir, 72, 3);
> o_ptr->timeout = 100;
> break;
> }
>
> case ART_THEODEN:
> {
> drain_life(dir, 120);
> o_ptr->timeout = 400;
> break;
> }
>
> case ART_TURMIL:
> {
> drain_life(dir, 90);
> o_ptr->timeout = 70;
> break;
> }
>
> case ART_ARUNRUTH:
> {
> fire_bolt(GF_COLD, dir, damroll(12, 8));
> o_ptr->timeout = 500;
> break;
> }
>
> case ART_AEGLOS:
> {
> fire_ball(GF_COLD, dir, 100, 2);
> o_ptr->timeout = 500;
> break;
> }
>
> case ART_OROME:
> {
> wall_to_mud(dir);
> o_ptr->timeout = 5;
> break;
> }
>
> case ART_ULMO:
> {
> teleport_monster(dir);
> o_ptr->timeout = 150;
> break;
> }
>
> case ART_TOTILA:
> {
> confuse_monster(dir, 20);
> o_ptr->timeout = 15;
> break;
> }
>
> case ART_CAMMITHRIM:
> {
> fire_bolt(GF_MISSILE, dir, damroll(2, 6));
> o_ptr->timeout = 2;
> break;
> }
>
> case ART_PAURHACH:
> {
> fire_bolt(GF_FIRE, dir, damroll(9, 8));
> o_ptr->timeout = rand_int(8) + 8;
> break;
> }
>
> case ART_PAURNIMMEN:
> {
> fire_bolt(GF_COLD, dir, damroll(6, 8));
> o_ptr->timeout = rand_int(7) + 7;
> break;
> }
>
> case ART_PAURAEGEN:
> {
> fire_bolt(GF_ELEC, dir, damroll(4, 8));
> o_ptr->timeout = rand_int(6) + 6;
> break;
> }
>
> case ART_PAURNEN:
> {
> fire_bolt(GF_ACID, dir, damroll(5, 8));
> o_ptr->timeout = rand_int(5) + 5;
> break;
> }
>
> case ART_FINGOLFIN:
> {
> fire_bolt(GF_ARROW, dir, 150);
> o_ptr->timeout = rand_int(90) + 90;
> break;
> }
>
> case ART_NARYA:
> {
3347,3348d3721
< msg_print("The ring glows bright white...");
< if (!get_aim_dir(&dir)) return;
3356,3357d3728
< msg_print("The ring glows deep blue...");
< if (!get_aim_dir(&dir)) return;
3365,3366d3735
< msg_print("The ring glows intensely black...");
< if (!get_aim_dir(&dir)) return;
3372a3742,3744
> /* Clear activation */
> p_ptr->current_activation = -1;
>
3380d3751
<
3384,3387d3754
< /* Get a direction for breathing (or abort) */
< if (!get_aim_dir(&dir)) return;
<
< /* Branch on the sub-type */
3408c3775
< msg_print("You breathe acid.");
---
> msg_print("You breathe lightning.");
3434,3437c3801,3805
< ((chance == 1) ? "lightning" :
< ((chance == 2) ? "frost" :
< ((chance == 3) ? "acid" :
< ((chance == 4) ? "poison gas" : "fire")))));
---
> ((chance == 1) ? "lightning" :
> ((chance == 2) ? "frost" :
> ((chance == 3) ? "acid" :
> ((chance == 4) ? "poison gas" : "fire")))));
>
3439,3442c3807,3810
< ((chance == 2) ? GF_COLD :
< ((chance == 3) ? GF_ACID :
< ((chance == 4) ? GF_POIS : GF_FIRE)))),
< dir, 250, 2);
---
> ((chance == 2) ? GF_COLD :
> ((chance == 3) ? GF_ACID :
> ((chance == 4) ? GF_POIS : GF_FIRE)))),
> dir, 250, 2);
3467c3835,3836
< ((chance == 1 ? "chaos" : "disenchantment")));
---
> ((chance == 1 ? "chaos" : "disenchantment")));
>
3469c3838
< dir, 220, 2);
---
> dir, 220, 2);
3478c3847,3848
< ((chance == 1 ? "sound" : "shards")));
---
> ((chance == 1 ? "sound" : "shards")));
>
3480c3850
< dir, 230, 2);
---
> dir, 230, 2);
3489,3491c3859,3862
< ((chance == 1) ? "chaos" :
< ((chance == 2) ? "disenchantment" :
< ((chance == 3) ? "sound" : "shards"))));
---
> ((chance == 1) ? "chaos" :
> ((chance == 2) ? "disenchantment" :
> ((chance == 3) ? "sound" : "shards"))));
>
3493,3495c3864,3866
< ((chance == 2) ? GF_DISENCHANT :
< ((chance == 3) ? GF_SOUND : GF_SHARDS))),
< dir, 250, 2);
---
> ((chance == 2) ? GF_DISENCHANT :
> ((chance == 3) ? GF_SOUND : GF_SHARDS))),
> dir, 250, 2);
3504,3505c3875,3878
< ((chance == 0 ? "light" : "darkness")));
< fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, 2);
---
> ((chance == 1 ? "light" : "darkness")));
>
> fire_ball((chance == 1 ? GF_LITE : GF_DARK),
> dir, 200, 2);
3517d3889
< }
3519,3523c3891,3897
< /* Window stuff */
< p_ptr->window |= (PW_INVEN | PW_EQUIP);
<
< /* Success */
< return;
---
> default:
> {
> msg_print("SERVER ERROR: Directional activation called for non-directional activatee!");
> p_ptr->current_activation = -1;
> return;
> }
> }
3525a3900,3901
> /* Clear current activation */
> p_ptr->current_activation = -1;
3527,3529c3903,3904
< /* Mistake */
< msg_print("Oops. That object cannot be activated.");
< }
---
> /* Window stuff */
> p_ptr->window |= (PW_INVEN | PW_EQUIP);
3531c3906,3908
<
---
> /* Success */
> return;
> }
Only in src-280: config.h
Only in src-280: defines.h
diff -r src-280/dungeon.c mangband-000/src/server/dungeon.c
12a13,14
> #define SERVER
>
100c102
< static void sense_inventory(void)
---
> static void sense_inventory(int Ind)
101a104,105
> player_type *p_ptr = Players[Ind];
>
195c199
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
285c289
< static void regenhp(int percent)
---
> static void regenhp(int int percent)
286a291,292
> player_type *p_ptr = Players[Ind];
>
332c338
< static void regenmana(int percent)
---
> static void regenmana(int int percent)
333a340,341
> player_type *p_ptr = Players[Ind];
>
417c425
< if (health_who == i) p_ptr->redraw |= (PR_HEALTH);
---
> /*if (health_who == i) p_ptr->redraw |= (PR_HEALTH);*/
427c435
< static void process_world(void)
---
> static void process_world(int Ind)
428a437,438
> player_type *p_ptr = Players[Ind];
>
433a444
> byte *w_ptr;
443a455
> /* The server will never quit --KLJ-- */
445,476d456
< if (!(turn % 1000))
< {
< /* Check time and load */
< if ((0 != check_time()) || (0 != check_load()))
< {
< /* Warning */
< if (closing_flag <= 2)
< {
< /* Disturb */
< disturb(0, 0);
<
< /* Count warnings */
< closing_flag++;
<
< /* Message */
< msg_print("The gates to ANGBAND are closing...");
< msg_print("Please finish up and/or save your game.");
< }
<
< /* Slam the gate */
< else
< {
< /* Message */
< msg_print("The gates to ANGBAND are now closed.");
<
< /* Stop playing */
< alive = FALSE;
< }
< }
< }
<
<
480c460
< if (!dun_level)
---
> if (!p_ptr->dun_depth)
484a465
> int Depth = p_ptr->dun_depth;
497c478
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < SCREEN_HGT; y++)
499c480
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < SCREEN_WID; x++)
502c483,484
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
508c490
< if (view_perma_grids) c_ptr->info |= CAVE_MARK;
---
> if (view_perma_grids) *w_ptr |= CAVE_MARK;
523c505
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < SCREEN_HGT; y++)
525c507
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < SCREEN_WID; x++)
528c510
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
559,587c541,542
<
< /* Update the stores once a day (while in dungeon) */
< if (!(turn % (10L * STORE_TURNS)))
< {
< int n;
<
< /* Message */
< if (cheat_xtra) msg_print("Updating Shops...");
<
< /* Maintain each shop (except home) */
< for (n = 0; n < MAX_STORES - 1; n++)
< {
< /* Maintain */
< store_maint(n);
< }
<
< /* Sometimes, shuffle the shop-keepers */
< if (rand_int(STORE_SHUFFLE) == 0)
< {
< /* Message */
< if (cheat_xtra) msg_print("Shuffling a Shopkeeper...");
<
< /* Shuffle a random shop (except home) */
< store_shuffle(rand_int(MAX_STORES - 1));
< }
<
< /* Message */
< if (cheat_xtra) msg_print("Done.");
< }
---
> /* Don't do this for each player. In fact, this might be */
> /* taken out entirely for now --KLJ-- */
593,603d547
< /* Check for creature generation */
< if (rand_int(MAX_M_ALLOC_CHANCE) == 0)
< {
< /* Make a new monster */
< (void)alloc_monster(MAX_SIGHT + 5, FALSE);
< }
<
< /* Hack -- Check for creature regeneration */
< if (!(turn % 100)) regen_monsters();
<
<
903c847
< o_ptr = &inventory[INVEN_LITE];
---
> o_ptr = &p_ptr->inventory[INVEN_LITE];
957c901
< check_experience();
---
> check_experience(Ind);
968c912
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
987c931
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
1011c955
< sense_inventory();
---
> sense_inventory(Ind);
1029c973
< if (dun_level)
---
> if (p_ptr->dun_depth)
1032,1033c976,995
< dun_level = 0;
< new_level_flag = TRUE;
---
>
> /* One less person here */
> players_on_depth[p_ptr->dun_depth]--;
>
> /* Remove the player */
> cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show everyone that he's left */
> everyone_lite_spot(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and view */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth = 0;
>
> /* One more person here */
> players_on_depth[p_ptr->dun_depth]++;
>
> p_ptr->new_level_flag = TRUE;
1038,1040c1000,1021
< dun_level = p_ptr->max_dlv;
< if (!dun_level) dun_level = 1;
< new_level_flag = TRUE;
---
>
> /* One less person here */
> players_on_depth[p_ptr->dun_depth]--;
>
> /* Remove the player */
> cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show everyone that he's left */
> everyone_lite_spot(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and view */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth = p_ptr->max_dlv;
>
> if (!p_ptr->dun_depth) p_ptr->dun_depth = 1;
>
> /* And one more here */
> players_on_depth[p_ptr->dun_depth]++;
>
> p_ptr->new_level_flag = TRUE;
1050a1032
> #if 0
1052a1035
> #ifdef ALLOW_WIZARD
1075a1059,1062
> #endif /* ALLOW_WIZARD */
>
> /* XXX XXX XXX Return FALSE if wizard mode is compiled out --KLJ-- */
> return (FALSE);
1076a1064
> #endif
1164a1153,1154
> *
> * This all happens "automagically" by the Input() function in netserver.c
1165a1156
> #if 0
1168,1224c1159
< /* Parse the command */
< switch (command_cmd)
< {
< /* Ignore */
< case ESCAPE:
< case ' ':
< {
< break;
< }
<
< /* Ignore return */
< case '\r':
< {
< break;
< }
<
<
<
< /*** Wizard Commands ***/
<
< /* Toggle Wizard Mode */
< case KTRL('W'):
< {
< if (wizard)
< {
< wizard = FALSE;
< msg_print("Wizard mode off.");
< }
< else if (enter_wizard_mode())
< {
< wizard = TRUE;
< msg_print("Wizard mode on.");
< }
<
< /* Update monsters */
< p_ptr->update |= (PU_MONSTERS);
<
< /* Redraw "title" */
< p_ptr->redraw |= (PR_TITLE);
<
< break;
< }
<
<
< #ifdef ALLOW_WIZARD
<
< /* Special "debug" commands */
< case KTRL('A'):
< {
< /* Enter debug mode */
< if (enter_debug_mode())
< {
< do_cmd_wizard();
< }
< break;
< }
<
---
> }
1228d1162
< #ifdef ALLOW_BORG
1230,1237d1163
< /* Special "borg" commands */
< case KTRL('Z'):
< {
< /* Enter borg mode */
< if (enter_borg_mode())
< {
< do_cmd_borg();
< }
1239,1763d1164
< break;
< }
<
< #endif
<
<
<
< /*** Inventory Commands ***/
<
< /* Wear/wield equipment */
< case 'w':
< {
< do_cmd_wield();
< break;
< }
<
< /* Take off equipment */
< case 't':
< {
< do_cmd_takeoff();
< break;
< }
<
< /* Drop an item */
< case 'd':
< {
< do_cmd_drop();
< break;
< }
<
< /* Destroy an item */
< case 'k':
< {
< do_cmd_destroy();
< break;
< }
<
< /* Equipment list */
< case 'e':
< {
< do_cmd_equip();
< break;
< }
<
< /* Inventory list */
< case 'i':
< {
< do_cmd_inven();
< break;
< }
<
<
< /*** Various commands ***/
<
< /* Identify an object */
< case 'I':
< {
< do_cmd_observe();
< break;
< }
<
< /* Hack -- toggle windows */
< case KTRL('I'):
< {
< toggle_inven_equip();
< break;
< }
<
<
< /*** Standard "Movement" Commands ***/
<
< /* Dig a tunnel */
< case '+':
< {
< do_cmd_tunnel();
< break;
< }
<
< /* Move (usually pick up things) */
< case ';':
< {
< do_cmd_walk(always_pickup);
< break;
< }
<
< /* Move (usually do not pick up) */
< case '-':
< {
< do_cmd_walk(!always_pickup);
< break;
< }
<
<
< /*** Running, Resting, Searching, Staying */
<
< /* Begin Running -- Arg is Max Distance */
< case '.':
< {
< do_cmd_run();
< break;
< }
<
< /* Stay still (usually pick things up) */
< case ',':
< {
< do_cmd_stay(always_pickup);
< break;
< }
<
< /* Stay still (usually do not pick up) */
< case 'g':
< {
< do_cmd_stay(!always_pickup);
< break;
< }
<
< /* Rest -- Arg is time */
< case 'R':
< {
< do_cmd_rest();
< break;
< }
<
< /* Search for traps/doors */
< case 's':
< {
< do_cmd_search();
< break;
< }
<
< /* Toggle search mode */
< case 'S':
< {
< do_cmd_toggle_search();
< break;
< }
<
<
< /*** Stairs and Doors and Chests and Traps ***/
<
< /* Enter store */
< case '_':
< {
< do_cmd_store();
< break;
< }
<
< /* Go up staircase */
< case '<':
< {
< do_cmd_go_up();
< break;
< }
<
< /* Go down staircase */
< case '>':
< {
< do_cmd_go_down();
< break;
< }
<
< /* Open a door or chest */
< case 'o':
< {
< do_cmd_open();
< break;
< }
<
< /* Close a door */
< case 'c':
< {
< do_cmd_close();
< break;
< }
<
< /* Jam a door with spikes */
< case 'j':
< {
< do_cmd_spike();
< break;
< }
<
< /* Bash a door */
< case 'B':
< {
< do_cmd_bash();
< break;
< }
<
< /* Disarm a trap or chest */
< case 'D':
< {
< do_cmd_disarm();
< break;
< }
<
<
< /*** Magic and Prayers ***/
<
< /* Gain new spells/prayers */
< case 'G':
< {
< do_cmd_study();
< break;
< }
<
< /* Browse a book */
< case 'b':
< {
< do_cmd_browse();
< break;
< }
<
< /* Cast a spell */
< case 'm':
< {
< do_cmd_cast();
< break;
< }
<
< /* Pray a prayer */
< case 'p':
< {
< do_cmd_pray();
< break;
< }
<
<
< /*** Use various objects ***/
<
< /* Inscribe an object */
< case '{':
< {
< do_cmd_inscribe();
< break;
< }
<
< /* Uninscribe an object */
< case '}':
< {
< do_cmd_uninscribe();
< break;
< }
<
< /* Activate an artifact */
< case 'A':
< {
< do_cmd_activate();
< break;
< }
<
< /* Eat some food */
< case 'E':
< {
< do_cmd_eat_food();
< break;
< }
<
< /* Fuel your lantern/torch */
< case 'F':
< {
< do_cmd_refill();
< break;
< }
<
< /* Fire an item */
< case 'f':
< {
< do_cmd_fire();
< break;
< }
<
< /* Throw an item */
< case 'v':
< {
< do_cmd_throw();
< break;
< }
<
< /* Aim a wand */
< case 'a':
< {
< do_cmd_aim_wand();
< break;
< }
<
< /* Zap a rod */
< case 'z':
< {
< do_cmd_zap_rod();
< break;
< }
<
< /* Quaff a potion */
< case 'q':
< {
< do_cmd_quaff_potion();
< break;
< }
<
< /* Read a scroll */
< case 'r':
< {
< do_cmd_read_scroll();
< break;
< }
<
< /* Use a staff */
< case 'u':
< {
< do_cmd_use_staff();
< break;
< }
<
<
< /*** Looking at Things (nearby or on map) ***/
<
< /* Full dungeon map */
< case 'M':
< {
< do_cmd_view_map();
< break;
< }
<
< /* Locate player on map */
< case 'L':
< {
< do_cmd_locate();
< break;
< }
<
< /* Look around */
< case 'l':
< {
< do_cmd_look();
< break;
< }
<
< /* Target monster or location */
< case '*':
< {
< do_cmd_target();
< break;
< }
<
<
<
< /*** Help and Such ***/
<
< /* Help */
< case '?':
< {
< do_cmd_help("help.hlp");
< break;
< }
<
< /* Identify symbol */
< case '/':
< {
< do_cmd_query_symbol();
< break;
< }
<
< /* Character description */
< case 'C':
< {
< do_cmd_change_name();
< break;
< }
<
<
< /*** System Commands ***/
<
< /* Hack -- User interface */
< case '!':
< {
< (void)Term_user(0);
< break;
< }
<
< /* Single line from a pref file */
< case '"':
< {
< do_cmd_pref();
< break;
< }
<
< /* Interact with macros */
< case '@':
< {
< do_cmd_macros();
< break;
< }
<
< /* Interact with visuals */
< case '%':
< {
< do_cmd_visuals();
< break;
< }
<
< /* Interact with colors */
< case '&':
< {
< do_cmd_colors();
< break;
< }
<
< /* Interact with options */
< case '=':
< {
< do_cmd_options();
< break;
< }
<
<
< /*** Misc Commands ***/
<
< /* Take notes */
< case ':':
< {
< do_cmd_note();
< break;
< }
<
< /* Version info */
< case 'V':
< {
< do_cmd_version();
< break;
< }
<
< /* Repeat level feeling */
< case KTRL('F'):
< {
< do_cmd_feeling();
< break;
< }
<
< /* Show previous message */
< case KTRL('O'):
< {
< do_cmd_message_one();
< break;
< }
<
< /* Show previous messages */
< case KTRL('P'):
< {
< do_cmd_messages();
< break;
< }
<
< /* Redraw the screen */
< case KTRL('R'):
< {
< do_cmd_redraw();
< break;
< }
<
< #ifndef VERIFY_SAVEFILE
<
< /* Hack -- Save and don't quit */
< case KTRL('S'):
< {
< do_cmd_save_game();
< break;
< }
<
< #endif
<
< /* Save and quit */
< case KTRL('X'):
< {
< alive = FALSE;
< break;
< }
<
< /* Quit (commit suicide) */
< case 'Q':
< {
< do_cmd_suicide();
< break;
< }
<
< /* Check artifacts */
< case '~':
< {
< do_cmd_check_artifacts();
< break;
< }
<
< /* Check uniques */
< case '|':
< {
< do_cmd_check_uniques();
< break;
< }
<
< /* Load "screen dump" */
< case '(':
< {
< do_cmd_load_screen();
< break;
< }
<
< /* Save "screen dump" */
< case ')':
< {
< do_cmd_save_screen();
< break;
< }
<
< /* Hack -- Unknown command */
< default:
< {
< prt("Type '?' for help.", 0, 0);
< break;
< }
< }
< }
<
<
<
<
1765c1166
< * Process the player
---
> * Process a player
1767c1168
< static void process_player(void)
---
> static void process_player(int Ind)
1768a1170,1171
> player_type *p_ptr = Players[Ind];
>
1773a1177,1180
> /* XXX XXX XXX Redraw player "BEAST" every turn so he shimmers */
> if (!strcmp(p_ptr->name, "BEAST"))
> everyone_lite_spot(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
>
1776a1184,1200
> /* Make sure they don't have too much */
> /* But let them store up some extra */
> if (p_ptr->energy > 199)
> p_ptr->energy = 199;
>
> /* Handle paralysis here */
> if (p_ptr->paralyzed || p_ptr->stun >= 100)
> p_ptr->energy = 0;
>
> /* Check to see if he's alive */
> if (p_ptr->death)
> {
> /* Kill him */
> Destroy_connection(p_ptr->conn, format("Killed by %s", p_ptr->died_from));
> return;
> }
>
1778c1202
< if (p_ptr->energy < 100) return;
---
> if (p_ptr->energy < 20) return;
1781a1206
> /* Resting is disabled, because there's no need for it */
1784,1785c1209,1210
< if (resting)
< {
---
> /*if (resting)
> {*/
1787,1788c1212,1213
< if (resting > 0)
< {
---
> /*if (resting > 0)
> {*/
1790c1215
< resting--;
---
> /*resting--;*/
1793,1794c1218,1219
< p_ptr->redraw |= (PR_STATE);
< }
---
> /*p_ptr->redraw |= (PR_STATE);
> }*/
1797,1798c1222,1223
< else if (resting == -1)
< {
---
> /*else if (resting == -1)
> {*/
1800c1225
< if ((p_ptr->chp == p_ptr->mhp) &&
---
> /*if ((p_ptr->chp == p_ptr->mhp) &&
1805c1230
< }
---
> }*/
1809,1810c1234,1235
< else if (resting == -2)
< {
---
> /*else if (resting == -2)
> {*/
1812c1237
< if ((p_ptr->chp == p_ptr->mhp) &&
---
> /*if ((p_ptr->chp == p_ptr->mhp) &&
1823c1248
< }
---
> }*/
1830,1831c1255,1256
< if (!avoid_abort)
< {
---
> /*if (!avoid_abort)
> {*/
1833,1834c1258,1259
< if (running || command_rep || (resting && !(resting & 0x0F)))
< {
---
> /*if (running || command_rep || (resting && !(resting & 0x0F)))
> {*/
1836c1261
< inkey_scan = TRUE;
---
> /*inkey_scan = TRUE;*/
1839,1840c1264,1265
< if (inkey())
< {
---
> /*if (inkey())
> {*/
1842c1267
< flush();
---
> /*flush();*/
1845c1270
< disturb(0, 0);
---
> /*disturb(0, 0);*/
1848c1273
< msg_print("Cancelled.");
---
> /*msg_print("Cancelled.");
1851c1276
< }
---
> }*/
1865a1291,1298
> /* Hack -- Since running is twice as fast, this needs to be out here */
> while (p_ptr->running && p_ptr->energy >= 20)
> {
> /*printf("Player %d is running (%d)!?!\n", p_ptr->running);*/
> run_step(0);
> p_ptr->energy = 0;
> }
>
1867c1300
< while (p_ptr->energy >= 100)
---
> if (p_ptr->energy >= 100)
1870c1303
< if (p_ptr->notice) notice_stuff();
---
> if (p_ptr->notice) notice_stuff(Ind);
1873c1306
< if (p_ptr->update) update_stuff();
---
> if (p_ptr->update) update_stuff(Ind);
1876c1309
< if (p_ptr->redraw) redraw_stuff();
---
> if (p_ptr->redraw) redraw_stuff(Ind);
1879c1312
< if (p_ptr->window) window_stuff();
---
> if (p_ptr->window) window_stuff(Ind);
1883c1316
< move_cursor_relative(py, px);
---
> /*move_cursor_relative(py, px);*/
1886c1319
< if (fresh_before) Term_fresh();
---
> /*if (fresh_before) Term_fresh();*/
1890c1323
< if (!command_new) command_see = FALSE;
---
> /*if (!command_new) command_see = FALSE;*/
1894c1327
< energy_use = 0;
---
> /*p_ptr->energy_use = 0;*/
1896a1330
> #if 0
1898,1899c1332
< if ((resting) ||
< (p_ptr->paralyzed) ||
---
> if ((p_ptr->paralyzed) ||
1903c1336
< energy_use = 100;
---
> p_ptr->energy_use = 100;
1904a1338
> #endif
1906,1912d1339
< /* Hack -- Running */
< else if (running)
< {
< /* Take a step */
< run_step(0);
< }
<
1914c1341
< else if (command_rep)
---
> else if (p_ptr->command_rep)
1917c1344
< command_rep--;
---
> p_ptr->command_rep--;
1923c1350
< redraw_stuff();
---
> redraw_stuff(Ind);
1929c1356
< prt("", 0, 0);
---
> /*prt("", 0, 0);*/
1932c1359
< process_command();
---
> /*process_command();*/
1939c1366
< move_cursor_relative(py, px);
---
> /*move_cursor_relative(py, px);*/
1942c1369
< request_command(FALSE);
---
> /*request_command(FALSE);*/
1945c1372
< process_command();
---
> /*process_command();*/
1950c1377
< if (p_ptr->notice) notice_stuff();
---
> if (p_ptr->notice) notice_stuff(Ind);
1953c1380
< if (inventory[INVEN_PACK].k_idx)
---
> if (p_ptr->inventory[INVEN_PACK].k_idx)
1964c1391
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
1982c1409
< drop_near(o_ptr, 0, py, px);
---
> drop_near(o_ptr, 0, p_ptr->dun_depth, p_ptr->py, p_ptr->px);
1991c1418,1422
< if (energy_use) p_ptr->energy -= energy_use;
---
> if (p_ptr->energy_use)
> {
> p_ptr->energy -= p_ptr->energy_use;
> p_ptr->energy_use = 0;
> }
1995c1426
< if (!alive || death || new_level_flag) break;
---
> /*if (!p_ptr->alive || p_ptr->death || new_level_flag) break;*/
2002c1433
< * Interact with the current dungeon level.
---
> * Main loop --KLJ--
2004,2005c1435,1439
< * This function will not exit until the level is completed,
< * the user dies, or the game is terminated.
---
> * This is main loop; it is called every 1/FPS seconds. Usually FPS is about
> * 10, so that a normal unhasted unburdened character gets 1 player turn per
> * second. Note that we process every player and the monsters, then quit.
> * The "scheduling" code (see sched.c) is the REAL main loop, which handles
> * various inputs and timings.
2006a1441
>
2009,2010c1444,1445
< /* Reset various flags */
< new_level_flag = FALSE;
---
> int i, d;
> byte *w_ptr;
2011a1447,1452
> /* Check player's depth info */
> for (i = 1; i < NumPlayers + 1; i++)
> {
> player_type *p_ptr = Players[i];
> int Depth = p_ptr->dun_depth;
> int j, x, y;
2013,2018c1454,1455
< /* Reset the "command" vars */
< command_cmd = 0;
< command_new = 0;
< command_rep = 0;
< command_arg = 0;
< command_dir = 0;
---
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
2019a1457,1458
> if (!p_ptr->new_level_flag)
> continue;
2021,2022c1460,1462
< /* Cancel the target */
< target_who = 0;
---
> /* Check "maximum depth" to make sure it's still correct */
> if (Depth > p_ptr->max_dlv)
> p_ptr->max_dlv = Depth;
2024,2025c1464,1465
< /* Cancel the health bar */
< health_track(0);
---
> /* Check to see which if the level needs generation or destruction */
> /* Note that "town" is excluded */
2026a1467,1472
> for (j = 1; j < MAX_DEPTH; j++)
> {
> /* Everybody has left a level that is still generated */
> if (players_on_depth[j] == 0 && cave[j])
> {
> int k;
2028,2029c1474,1475
< /* Disturb */
< disturb(1, 0);
---
> /* Delete any monsters on that level */
> wipe_m_list(j);
2030a1477,1478
> /* Delete any objects on that level */
> wipe_o_list(j);
2032,2036c1480,1485
< /* Remember deepest dungeon level visited */
< if (dun_level > (unsigned)(p_ptr->max_dlv))
< {
< p_ptr->max_dlv = dun_level;
< }
---
> /* Free up the space taken up by that level */
> for (k = 0; k < MAX_HGT; k++)
> {
> /* Deallocate that row */
> C_FREE(cave[j][k], MAX_WID, cave_type);
> }
2037a1487,1488
> /* Deallocate the base level */
> C_FREE(cave[j], MAX_HGT, cave_type *);
2039,2040c1490,1493
< /* Paranoia -- No stairs down from Quest */
< if (is_quest(dun_level)) create_down_stair = FALSE;
---
> /* Set that level to "ungenerated" */
> cave[j] = NULL;
> }
> }
2042,2043d1494
< /* Paranoia -- no stairs from town */
< if (!dun_level) create_down_stair = create_up_stair = FALSE;
2045,2052c1496,1497
< /* Option -- no connected stairs */
< if (!dungeon_stair) create_down_stair = create_up_stair = FALSE;
<
< /* Make a stairway. */
< if (create_up_stair || create_down_stair)
< {
< /* Place a stairway */
< if (cave_valid_bold(py, px))
---
> /* Somebody has entered an ungenerated level */
> if (players_on_depth[Depth] && !cave[Depth])
2054c1499,1500
< cave_type *c_ptr;
---
> /* Allocate the base level */
> C_MAKE(cave[Depth], MAX_HGT, cave_type *);
2056,2057c1502,1506
< /* Delete the old object */
< delete_object(py, px);
---
> for (j = 0; j < MAX_HGT; j++)
> {
> /* Allocate one row of that level */
> C_MAKE(cave[Depth][j], MAX_WID, cave_type);
> }
2059,2060c1508,1510
< /* Access the cave grid */
< c_ptr = &cave[py][px];
---
> /* Generate a dungeon level there */
> generate_cave(Depth);
> }
2062,2063c1512,1515
< /* Make stairs */
< if (create_down_stair)
---
> /* Clear the "marked" and "lit" flags for each cave grid */
> for (y = 0; y < MAX_HGT; y++)
> {
> for (x = 0; x < MAX_WID; x++)
2065c1517,1519
< c_ptr->feat = FEAT_MORE;
---
> w_ptr = &p_ptr->cave_flag[y][x];
>
> *w_ptr = 0;
2067,2070d1520
< else
< {
< c_ptr->feat = FEAT_LESS;
< }
2073,2075c1523,1526
< /* Cancel the stair request */
< create_down_stair = create_up_stair = FALSE;
< }
---
> if (!Depth)
> {
> p_ptr->max_panel_rows = 0;
> p_ptr->max_panel_cols = 0;
2076a1528,1529
> p_ptr->cur_hgt = SCREEN_HGT;
> p_ptr->cur_wid = SCREEN_WID;
2078,2081c1531,1536
< /* Choose a panel row */
< panel_row = ((py - SCREEN_HGT / 4) / (SCREEN_HGT / 2));
< if (panel_row > max_panel_rows) panel_row = max_panel_rows;
< else if (panel_row < 0) panel_row = 0;
---
> /* Memorize the town for this player */
> for (y = 0; y < SCREEN_HGT; y++)
> {
> for (x = 0; x < SCREEN_WID; x++)
> {
> w_ptr = &p_ptr->cave_flag[y][x];
2083,2086c1538,1545
< /* Choose a panel col */
< panel_col = ((px - SCREEN_WID / 4) / (SCREEN_WID / 2));
< if (panel_col > max_panel_cols) panel_col = max_panel_cols;
< else if (panel_col < 0) panel_col = 0;
---
> *w_ptr |= CAVE_MARK;
> }
> }
> }
> else
> {
> p_ptr->max_panel_rows = (MAX_HGT / SCREEN_HGT) * 2 - 2;
> p_ptr->max_panel_cols = (MAX_WID / SCREEN_WID) * 2 - 2;
2088,2089c1547,1549
< /* Recalculate the boundaries */
< panel_bounds();
---
> p_ptr->cur_hgt = MAX_HGT;
> p_ptr->cur_wid = MAX_WID;
> }
2090a1551,1555
> /* Place the player in an empty space */
> for (j = 0; j < 35; ++j)
> {
> /* Increasing distance */
> d = (j + 4) / 5;
2092,2093c1557,1558
< /* Flush messages */
< msg_print(NULL);
---
> /* Pick a location */
> scatter(Depth, &y, &x, level_start_y[Depth], level_start_x[Depth], d, 0);
2094a1560,1561
> /* Must have a "naked" grid */
> if (!cave_naked_bold(Depth, y, x)) continue;
2096,2097c1563,1564
< /* Enter "xtra" mode */
< character_xtra = TRUE;
---
> break;
> }
2099,2100c1566,1570
< /* Window stuff */
< p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
---
> #if 0
> while (TRUE)
> {
> y = rand_range(1, ((Depth) ? (MAX_HGT - 2) : (SCREEN_HGT - 2)));
> x = rand_range(1, ((Depth) ? (MAX_WID - 2) : (SCREEN_WID - 2)));
2102,2103c1572,1573
< /* Window stuff */
< p_ptr->window |= (PW_MONSTER);
---
> /* Must be a "naked" floor grid */
> if (!cave_naked_bold(Depth, y, x)) continue;
2105,2106c1575,1576
< /* Redraw dungeon */
< p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA);
---
> /* Refuse to start on anti-teleport grids */
> if (cave[Depth][y][x].info & CAVE_ICKY) continue;
2108,2109c1578,1580
< /* Redraw map */
< p_ptr->redraw |= (PR_MAP);
---
> break;
> }
> #endif
2111,2112c1582,1583
< /* Window stuff */
< p_ptr->window |= (PW_OVERHEAD);
---
> p_ptr->py = y;
> p_ptr->px = x;
2114,2115c1585,1586
< /* Update stuff */
< p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
---
> /* Update the player location */
> cave[Depth][y][x].p_idx = i;
2117,2118c1588,1591
< /* Calculate torch radius */
< p_ptr->update |= (PU_TORCH);
---
> /* Recalculate panel */
> p_ptr->panel_row = ((p_ptr->py - SCREEN_HGT / 4) / (SCREEN_HGT / 2));
> if (p_ptr->panel_row > p_ptr->max_panel_rows) p_ptr->panel_row = p_ptr->max_panel_rows;
> else if (p_ptr->panel_row < 0) p_ptr->panel_row = 0;
2120,2121c1593,1598
< /* Update stuff */
< update_stuff();
---
> p_ptr->panel_col = ((p_ptr->px - SCREEN_WID / 4) / (SCREEN_WID / 2));
> if (p_ptr->panel_col > p_ptr->max_panel_cols) p_ptr->panel_col = p_ptr->max_panel_cols;
> else if (p_ptr->panel_col < 0) p_ptr->panel_col = 0;
>
> p_ptr->redraw |= (PR_MAP);
> p_ptr->redraw |= (PR_DEPTH);
2123,2124c1600,1603
< /* Redraw stuff */
< redraw_stuff();
---
> panel_bounds(i);
> forget_view(i);
> forget_lite(i);
> update_view(i);
2126,2127c1605,1607
< /* Redraw stuff */
< window_stuff();
---
> /* Clear the flag */
> p_ptr->new_level_flag = FALSE;
> }
2129,2130c1609,1610
< /* Update stuff */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_DISTANCE);
---
> /* Handle any network stuff */
> Net_input();
2132,2133c1612,1613
< /* Update stuff */
< update_stuff();
---
> /* Hack -- Compact the object list occasionally */
> if (o_top + 16 > MAX_O_IDX) compact_objects(32);
2135,2136c1615,1616
< /* Redraw stuff */
< redraw_stuff();
---
> /* Hack -- Compact the monster list occasionally */
> if (m_top + 32 > MAX_M_IDX) compact_monsters(64);
2138,2139c1618,1622
< /* Leave "xtra" mode */
< character_xtra = FALSE;
---
> /* Process each player */
> for (i = 1; i < NumPlayers + 1; i++)
> {
> if (Players[i]->conn == NOT_CONNECTED)
> continue;
2141,2142c1624,1626
< /* Update stuff */
< p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
---
> /* Actually process that player */
> process_player(i);
> }
2144,2145c1628,1629
< /* Combine / Reorder the pack */
< p_ptr->notice |= (PN_COMBINE | PN_REORDER);
---
> /* Process all of the monsters */
> process_monsters();
2147,2148c1631,1632
< /* Notice stuff */
< notice_stuff();
---
> /* Process all of the objects */
> process_objects();
2150,2151c1634,1638
< /* Update stuff */
< update_stuff();
---
> /* Process the world */
> for (i = 1; i < NumPlayers + 1; i++)
> {
> if (Players[i]->conn == NOT_CONNECTED)
> continue;
2153,2154c1640,1642
< /* Redraw stuff */
< redraw_stuff();
---
> /* Process the world of that player */
> process_world(i);
> }
2156,2157c1644,1645
< /* Window stuff */
< window_stuff();
---
> /* Hack -- Regenerate the monsters every hundred game turns */
> if (!(turn % 100)) regen_monsters();
2159,2180c1647,1648
< /* Refresh */
< Term_fresh();
<
<
< /* Announce (or repeat) the feeling */
< if (dun_level) do_cmd_feeling();
<
<
< /* Hack -- notice death or departure */
< if (!alive || death || new_level_flag) return;
<
<
< /*** Process this dungeon level ***/
<
< /* Reset the monster generation level */
< monster_level = dun_level;
<
< /* Reset the object generation level */
< object_level = dun_level;
<
< /* Main loop */
< while (TRUE)
---
> /* Refresh everybody's displays */
> for (i = 1; i < NumPlayers + 1; i++)
2182,2183c1650
< /* Hack -- Compact the object list occasionally */
< if (o_top + 16 > MAX_O_IDX) compact_objects(32);
---
> player_type *p_ptr = Players[i];
2185,2186c1652,1653
< /* Hack -- Compact the monster list occasionally */
< if (m_top + 32 > MAX_M_IDX) compact_monsters(64);
---
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
2188,2191d1654
<
< /* Process the player */
< process_player();
<
2193c1656
< if (p_ptr->notice) notice_stuff();
---
> if (p_ptr->notice) notice_stuff(i);
2196c1659
< if (p_ptr->update) update_stuff();
---
> if (p_ptr->update) update_stuff(i);
2199c1662
< if (p_ptr->redraw) redraw_stuff();
---
> if (p_ptr->redraw) redraw_stuff(i);
2201,2250d1663
< /* Redraw stuff */
< if (p_ptr->window) window_stuff();
<
< /* Hack -- Hilite the player */
< move_cursor_relative(py, px);
<
< /* Optional fresh */
< if (fresh_after) Term_fresh();
<
< /* Hack -- Notice death or departure */
< if (!alive || death || new_level_flag) break;
<
<
< /* Process all of the monsters */
< process_monsters();
<
< /* Notice stuff */
< if (p_ptr->notice) notice_stuff();
<
< /* Update stuff */
< if (p_ptr->update) update_stuff();
<
< /* Redraw stuff */
< if (p_ptr->redraw) redraw_stuff();
<
< /* Redraw stuff */
< if (p_ptr->window) window_stuff();
<
< /* Hack -- Hilite the player */
< move_cursor_relative(py, px);
<
< /* Optional fresh */
< if (fresh_after) Term_fresh();
<
< /* Hack -- Notice death or departure */
< if (!alive || death || new_level_flag) break;
<
<
< /* Process all of the objects */
< process_objects();
<
< /* Notice stuff */
< if (p_ptr->notice) notice_stuff();
<
< /* Update stuff */
< if (p_ptr->update) update_stuff();
<
< /* Redraw stuff */
< if (p_ptr->redraw) redraw_stuff();
<
2252,2290c1665
< if (p_ptr->window) window_stuff();
<
< /* Hack -- Hilite the player */
< move_cursor_relative(py, px);
<
< /* Optional fresh */
< if (fresh_after) Term_fresh();
<
< /* Hack -- Notice death or departure */
< if (!alive || death || new_level_flag) break;
<
<
< /* Process the world */
< process_world();
<
< /* Notice stuff */
< if (p_ptr->notice) notice_stuff();
<
< /* Update stuff */
< if (p_ptr->update) update_stuff();
<
< /* Redraw stuff */
< if (p_ptr->redraw) redraw_stuff();
<
< /* Window stuff */
< if (p_ptr->window) window_stuff();
<
< /* Hack -- Hilite the player */
< move_cursor_relative(py, px);
<
< /* Optional fresh */
< if (fresh_after) Term_fresh();
<
< /* Hack -- Notice death or departure */
< if (!alive || death || new_level_flag) break;
<
<
< /* Count game turns */
< turn++;
---
> if (p_ptr->window) window_stuff(i);
2292a1668,1669
> /* Send any information over the network */
> Net_output();
2294,2316c1671,1672
<
< /* Notice stuff */
< if (p_ptr->notice) notice_stuff();
<
< /* Update stuff */
< if (p_ptr->update) update_stuff();
<
< /* Redraw stuff */
< if (p_ptr->redraw) redraw_stuff();
<
<
< /* Cancel the target */
< target_who = 0;
<
< /* Cancel the health bar */
< health_track(0);
<
<
< /* Forget the old lite */
< forget_lite();
<
< /* Forget the old view */
< forget_view();
---
> /* Count game turns */
> turn++;
2319,2321c1675
<
<
<
---
>
2344,2379d1697
< /* Access the "basic" system pref file */
< sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
<
< /* Process that file */
< process_pref_file(buf);
<
< /* Access the "visual" system pref file (if any) */
< sprintf(buf, "%s-%s.prf", (use_graphics ? "graf" : "font"), ANGBAND_SYS);
<
< /* Process that file */
< process_pref_file(buf);
<
< /* Access the "user" system pref file */
< sprintf(buf, "user-%s.prf", ANGBAND_SYS);
<
< /* Process that file */
< process_pref_file(buf);
<
<
< /* Access the "race" pref file */
< sprintf(buf, "%s.prf", rp_ptr->title);
<
< /* Process that file */
< process_pref_file(buf);
<
< /* Access the "class" pref file */
< sprintf(buf, "%s.prf", cp_ptr->title);
<
< /* Process that file */
< process_pref_file(buf);
<
< /* Access the "character" pref file */
< sprintf(buf, "%s.prf", player_base);
<
< /* Process that file */
< process_pref_file(buf);
2387,2388c1705
< * savefile, we will commit suicide, if necessary, to allow the
< * player to start a new game.
---
> * server-specific savefiles, we will start anew.
2396c1713
< character_icky = TRUE;
---
> /*character_icky = TRUE;*/
2400c1717
< (void)Term_set_cursor(0);
---
> /*(void)Term_set_cursor(0);*/
2403,2404c1720,1721
< /* Attempt to load */
< if (!load_player())
---
> /* Attempt to load the server state information */
> if (!load_server_info())
2407c1724
< quit("broken savefile");
---
> quit("broken savefile(s)");
2411c1728
< if (!character_loaded)
---
> if (!server_state_loaded)
2413c1730
< /* Make new player */
---
> /* Make server state info */
2417c1734
< character_dungeon = FALSE;
---
> server_dungeon = FALSE;
2424c1741
< process_player_name(FALSE);
---
> /*process_player_name(FALSE);*/
2474c1791
< /* Roll new character */
---
> /* Roll new town */
2478c1795
< character_dungeon = FALSE;
---
> server_dungeon = FALSE;
2481c1798
< dun_level = 0;
---
> /*dun_level = 0;*/
2489,2490c1806,1808
< /* Roll up a new character */
< player_birth();
---
> /* Initialize server state information */
> /*player_birth();*/
> /*server_birth();*/
2498c1816
< prt("Please wait...", 0, 0);
---
> printf("Please wait...\n");
2501c1819
< Term_fresh();
---
> /*Term_fresh();*/
2505c1823
< if (arg_wizard && enter_wizard_mode()) wizard = TRUE;
---
> /*if (arg_wizard && enter_wizard_mode()) wizard = TRUE;*/
2510a1829,1830
> printf("Object flavors initialized...\n");
>
2516c1836
< p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
---
> /*p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);*/
2519c1839
< p_ptr->window |= (PW_MONSTER);
---
> /*p_ptr->window |= (PW_MONSTER);*/
2522c1842
< window_stuff();
---
> /*window_stuff();*/
2529,2530c1849,1850
< if (arg_force_original) rogue_like_commands = FALSE;
< if (arg_force_roguelike) rogue_like_commands = TRUE;
---
> /*if (arg_force_original) rogue_like_commands = FALSE;
> if (arg_force_roguelike) rogue_like_commands = TRUE;*/
2533c1853
< keymap_init();
---
> /*keymap_init();*/
2536c1856
< Term_xtra(TERM_XTRA_REACT, 0);
---
> /*Term_xtra(TERM_XTRA_REACT, 0);*/
2539,2540c1859,1863
< /* Make a level if necessary */
< if (!character_dungeon) generate_cave();
---
> /* Make a town if necessary */
> if (!server_dungeon)
> {
> /* But first we need some memory for it */
> C_MAKE(cave[0], MAX_HGT, cave_type *);
2541a1865,1869
> for (i = 0; i < MAX_HGT; i++)
> {
> /* Allocate one row of the town level */
> C_MAKE(cave[0][i], MAX_WID, cave_type);
> }
2543,2544c1871,1873
< /* Character is now "complete" */
< character_generated = TRUE;
---
> /* Actually generate the town */
> generate_cave(0);
> }
2545a1875,1876
> /* Server initialization is now "complete" */
> server_generated = TRUE;
2546a1878
>
2548c1880
< character_icky = FALSE;
---
> /*character_icky = FALSE;*/
2552c1884
< alive = TRUE;
---
> /*alive = TRUE;*/
2555c1887
< if (p_ptr->chp < 0) death = TRUE;
---
> /*if (p_ptr->chp < 0) death = TRUE;*/
2557,2561c1889,1890
< /* Loop till dead */
< while (TRUE)
< {
< /* Process the level */
< dungeon();
---
> /* Set up the contact socket, so we can allow players to connect */
> setup_contact_socket();
2563,2564c1892,1894
< /* Handle "quit and save" */
< if (!alive && !death) break;
---
> /* Set up the network server */
> if (Setup_net_server() == -1)
> quit("Couldn't set up net server");
2566,2568c1896,1897
< /* Erase the old cave */
< wipe_o_list();
< wipe_m_list();
---
> /* Set up the main loop */
> install_timer_tick(dungeon, FPS);
2570,2571c1899,1900
< /* XXX XXX XXX */
< msg_print(NULL);
---
> /* Loop forever */
> sched();
2573,2580c1902,1903
< /* Accidental Death */
< if (alive && death)
< {
< /* Mega-Hack -- Allow player to cheat death */
< if ((wizard || cheat_live) && !get_check("Die? "))
< {
< /* Mark social class, reset age, if needed */
< if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
---
> /* This should never, ever happen */
> printf("sched returned!!!\n");
2582,2644d1904
< /* Increase age */
< p_ptr->age++;
<
< /* Mark savefile */
< noscore |= 0x0001;
<
< /* Message */
< msg_print("You invoke wizard mode and cheat death.");
< msg_print(NULL);
<
< /* Restore hit points */
< p_ptr->chp = p_ptr->mhp;
< p_ptr->chp_frac = 0;
<
< /* Restore spell points */
< p_ptr->csp = p_ptr->msp;
< p_ptr->csp_frac = 0;
<
< /* Hack -- Healing */
< (void)set_blind(0);
< (void)set_confused(0);
< (void)set_poisoned(0);
< (void)set_afraid(0);
< (void)set_paralyzed(0);
< (void)set_image(0);
< (void)set_stun(0);
< (void)set_cut(0);
<
< /* Hack -- Prevent starvation */
< (void)set_food(PY_FOOD_MAX - 1);
<
< /* Hack -- cancel recall */
< if (p_ptr->word_recall)
< {
< /* Message */
< msg_print("A tension leaves the air around you...");
< msg_print(NULL);
<
< /* Hack -- Prevent recall */
< p_ptr->word_recall = 0;
< }
<
< /* Note cause of death XXX XXX XXX */
< (void)strcpy(died_from, "Cheating death");
<
< /* Teleport to town */
< new_level_flag = TRUE;
<
< /* Go to town */
< dun_level = 0;
<
< /* Do not die */
< death = FALSE;
< }
< }
<
< /* Handle "death" */
< if (death) break;
<
< /* Make a new level */
< generate_cave();
< }
<
diff -r src-280/externs.h mangband-000/src/server/externs.h
14a15,18
> /* netserver.c */
> extern long Id;
> extern int NumPlayers;
>
65c69
< extern cptr copyright[5];
---
> extern cptr copyright[6];
82,83c86,89
< extern bool character_generated;
< extern bool character_dungeon;
---
> extern bool server_generated;
> extern bool server_dungeon;
> extern bool server_state_loaded;
> extern bool server_saved;
85d90
< extern bool character_saved;
92c97
< extern s16b command_rep;
---
> /*extern s16b command_rep;*/
98c103
< extern s16b energy_use;
---
> /*extern s16b energy_use;*/
103,105c108,110
< extern bool alive;
< extern bool death;
< extern s16b running;
---
> /*extern bool alive;
> extern bool death;*/
> /*extern s16b running;*/
107,109c112,115
< extern s16b cur_hgt;
< extern s16b cur_wid;
< extern s16b dun_level;
---
> /*extern s16b cur_hgt;
> extern s16b cur_wid;*/
> /*extern s16b dun_level;*/
> extern s16b players_on_depth[MAX_DEPTH];
112a119,120
> extern byte level_start_x[MAX_DEPTH];
> extern byte level_start_y[MAX_DEPTH];
118c126
< extern u16b total_winner;
---
> /*extern u16b total_winner;*/
120c128
< extern u16b noscore;
---
> /*extern u16b noscore;*/
132c140
< extern s16b total_weight;
---
> /*extern s16b total_weight;*/
134,135c142,143
< extern s16b inven_cnt;
< extern s16b equip_cnt;
---
> /*extern s16b inven_cnt;
> extern s16b equip_cnt;*/
223c231
< extern bool new_level_flag;
---
> /*extern bool new_level_flag;*/
225,227c233,235
< extern s16b max_panel_rows, max_panel_cols;
< extern s16b panel_row, panel_col;
< extern s16b panel_row_min, panel_row_max;
---
> /*extern s16b max_panel_rows, max_panel_cols;
> extern s16b panel_row, panel_col;*/
> /*extern s16b panel_row_min, panel_row_max;
231,232c239,240
< extern s16b px;
< extern s16b target_who;
---
> extern s16b px;*/
> /*extern s16b target_who;
234c242
< extern s16b target_row;
---
> extern s16b target_row;*/
240c248,250
< extern char player_name[32];
---
> extern player_type **Players;
> extern long GetInd[];
> /*extern char player_name[32];
244,245c254,255
< extern char savefile[1024];
< extern s16b lite_n;
---
> extern char savefile[1024];*/
> /*extern s16b lite_n;
253c263
< extern byte temp_x[TEMP_MAX];
---
> extern byte temp_x[TEMP_MAX];*/
271c281
< extern term *ang_term[8];
---
> /*extern term *ang_term[8];*/
274c284
< extern cave_type *cave[MAX_HGT];
---
> extern cave_type **cave[MAX_DEPTH];
279c289
< extern object_type *inventory;
---
> /*extern object_type *inventory;*/
289,290c299,300
< extern player_type *p_ptr;
< extern player_race *rp_ptr;
---
> /*extern player_type *p_ptr;*/
> /*extern player_race *rp_ptr;
292,293c302,303
< extern player_magic *mp_ptr;
< extern u32b spell_learned1;
---
> extern player_magic *mp_ptr;*/
> /*extern u32b spell_learned1;
300c310
< extern s16b player_hp[PY_MAX_LEVEL];
---
> extern s16b player_hp[PY_MAX_LEVEL];*/
340,341c350,351
< extern bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
< extern void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
---
> extern bool (*ang_sort_comp)(int vptr u, vptr v, int a, int b);
> extern void (*ang_sort_swap)(int vptr u, vptr v, int a, int b);
353c363
< extern void player_birth(void);
---
> extern bool player_birth(int cptr name, cptr pass, int conn, int race, int class, int sex);
357,360c367,370
< extern bool los(int y1, int x1, int y2, int x2);
< extern bool player_can_see_bold(int y, int x);
< extern bool no_lite(void);
< extern void map_info(int y, int x, byte *ap, char *cp);
---
> extern bool los(int Depth, int y1, int x1, int y2, int x2);
> extern bool player_can_see_bold(int int y, int x);
> extern bool no_lite(int Ind);
> extern void map_info(int int y, int x, byte *ap, char *cp);
363,371c373,384
< extern void note_spot(int y, int x);
< extern void lite_spot(int y, int x);
< extern void prt_map(void);
< extern void display_map(int *cy, int *cx);
< extern void do_cmd_view_map(void);
< extern void forget_lite(void);
< extern void update_lite(void);
< extern void forget_view(void);
< extern void update_view(void);
---
> extern void note_spot(int int y, int x);
> extern void note_spot_depth(int Depth, int y, int x);
> extern void everyone_lite_spot(int Depth, int y, int x);
> extern void everyone_forget_spot(int Depth, int y, int x);
> extern void lite_spot(int int y, int x);
> extern void prt_map(int Ind);
> extern void display_map(int int *cy, int *cx);
> extern void do_cmd_view_map(int Ind);
> extern void forget_lite(int Ind);
> extern void update_lite(int Ind);
> extern void forget_view(int Ind);
> extern void update_view(int Ind);
374,376c387,389
< extern void map_area(void);
< extern void wiz_lite(void);
< extern void wiz_dark(void);
---
> extern void map_area(int Ind);
> extern void wiz_lite(int Ind);
> extern void wiz_dark(int Ind);
378,379c391,392
< extern bool projectable(int y1, int x1, int y2, int x2);
< extern void scatter(int *yp, int *xp, int y, int x, int d, int m);
---
> extern bool projectable(int Depth, int y1, int x1, int y2, int x2);
> extern void scatter(int Depth, int *yp, int *xp, int y, int x, int d, int m);
382c395
< extern void disturb(int stop_search, int flush_output);
---
> extern void disturb(int int stop_search, int flush_output);
388,389c401,402
< extern s16b critical_shot(int weight, int plus, int dam);
< extern s16b critical_norm(int weight, int plus, int dam);
---
> extern s16b critical_shot(int int weight, int plus, int dam);
> extern s16b critical_norm(int int weight, int plus, int dam);
391,395c404,408
< extern void search(void);
< extern void carry(int pickup);
< extern void py_attack(int y, int x);
< extern void move_player(int dir, int do_pickup);
< extern void run_step(int dir);
---
> extern void search(int Ind);
> extern void carry(int int pickup);
> extern void py_attack(int int y, int x);
> extern void move_player(int int dir, int do_pickup);
> extern void run_step(int int dir);
398,413c411,426
< extern void do_cmd_go_up(void);
< extern void do_cmd_go_down(void);
< extern void do_cmd_search(void);
< extern void do_cmd_toggle_search(void);
< extern void do_cmd_open(void);
< extern void do_cmd_close(void);
< extern void do_cmd_tunnel(void);
< extern void do_cmd_disarm(void);
< extern void do_cmd_bash(void);
< extern void do_cmd_spike(void);
< extern void do_cmd_walk(int pickup);
< extern void do_cmd_stay(int pickup);
< extern void do_cmd_run(void);
< extern void do_cmd_rest(void);
< extern void do_cmd_fire(void);
< extern void do_cmd_throw(void);
---
> extern void do_cmd_go_up(int Ind);
> extern void do_cmd_go_down(int Ind);
> extern void do_cmd_search(int Ind);
> extern void do_cmd_toggle_search(int Ind);
> extern void do_cmd_open(int int dir);
> extern void do_cmd_close(int int dir);
> extern void do_cmd_tunnel(int int dir);
> extern void do_cmd_disarm(int int dir);
> extern void do_cmd_bash(int int dir);
> extern void do_cmd_spike(int int dir);
> extern void do_cmd_walk(int int dir, int pickup);
> extern void do_cmd_stay(int int pickup);
> extern void do_cmd_run(int int dir);
> /*extern void do_cmd_rest(void);*/
> extern void do_cmd_fire(int int dir, int item);
> extern void do_cmd_throw(int int dir, int item);
418,429c431,442
< extern void do_cmd_wield(void);
< extern void do_cmd_takeoff(void);
< extern void do_cmd_drop(void);
< extern void do_cmd_destroy(void);
< extern void do_cmd_observe(void);
< extern void do_cmd_uninscribe(void);
< extern void do_cmd_inscribe(void);
< extern void do_cmd_refill(void);
< extern void do_cmd_target(void);
< extern void do_cmd_look(void);
< extern void do_cmd_locate(void);
< extern void do_cmd_query_symbol(void);
---
> extern void do_cmd_wield(int int item);
> extern void do_cmd_takeoff(int int item);
> extern void do_cmd_drop(int int item, int quantity);
> extern void do_cmd_destroy(int int item, int quantity);
> extern void do_cmd_observe(int int item);
> extern void do_cmd_uninscribe(int int item);
> extern void do_cmd_inscribe(int int item, cptr inscription);
> extern void do_cmd_refill(int int item);
> extern void do_cmd_target(int int dir);
> extern void do_cmd_look(int int dir);
> extern void do_cmd_locate(int int dir);
> extern void do_cmd_query_symbol(int char sym);
446,447c459,460
< extern void do_cmd_check_artifacts(void);
< extern void do_cmd_check_uniques(void);
---
> extern void do_cmd_check_artifacts(int Ind);
> extern void do_cmd_check_uniques(int Ind);
450,453c463,468
< extern void do_cmd_browse(void);
< extern void do_cmd_study(void);
< extern void do_cmd_cast(void);
< extern void do_cmd_pray(void);
---
> extern void do_cmd_browse(int int book);
> extern void do_cmd_study(int int book, int spell);
> extern void do_cmd_cast(int int book, int spell);
> extern void do_cmd_cast_aux(int int dir);
> extern void do_cmd_pray(int int book, int spell);
> extern void do_cmd_pray_aux(int int dir);
456,462c471,479
< extern void do_cmd_eat_food(void);
< extern void do_cmd_quaff_potion(void);
< extern void do_cmd_read_scroll(void);
< extern void do_cmd_aim_wand(void);
< extern void do_cmd_use_staff(void);
< extern void do_cmd_zap_rod(void);
< extern void do_cmd_activate(void);
---
> extern void do_cmd_eat_food(int int item);
> extern void do_cmd_quaff_potion(int int item);
> extern void do_cmd_read_scroll(int int item);
> extern void do_cmd_aim_wand(int int item, int dir);
> extern void do_cmd_use_staff(int int item);
> extern void do_cmd_zap_rod(int int item);
> extern void do_cmd_zap_rod_dir(int int dir);
> extern void do_cmd_activate(int int item);
> extern void do_cmd_activate_dir(int int dir);
471c488
< extern void display_player(bool do_hist);
---
> extern void display_player(int bool do_hist);
481c498
< extern errr show_file(cptr name, cptr what);
---
> extern errr show_file(int cptr name, cptr what);
483,487c500,504
< extern void process_player_name(bool sf);
< extern void get_name(void);
< extern void do_cmd_suicide(void);
< extern void do_cmd_save_game(void);
< extern long total_points(void);
---
> extern void process_player_name(int bool sf);
> extern void get_name(int Ind);
> extern void do_cmd_suicide(int Ind);
> extern void do_cmd_save_game(int Ind);
> extern long total_points(int Ind);
496c513
< extern void generate_cave(void);
---
> extern void generate_cave(int Depth);
511c528
< extern errr rd_savefile_old(void);
---
> /*extern errr rd_savefile_old(void);*/
514c531
< extern errr rd_savefile_new(void);
---
> extern errr rd_savefile_new(int Ind);
518,519c535,536
< extern bool make_attack_normal(int m_idx);
< extern bool make_attack_spell(int m_idx);
---
> extern bool make_attack_normal(int int m_idx);
> extern bool make_attack_spell(int int m_idx);
528c545
< extern void delete_monster(int y, int x);
---
> extern void delete_monster(int Depth, int y, int x);
530c547
< extern void wipe_m_list(void);
---
> extern void wipe_m_list(int Depth);
539,542c556,559
< extern bool place_monster_aux(int y, int x, int r_idx, bool slp, bool grp);
< extern bool place_monster(int y, int x, bool slp, bool grp);
< extern bool alloc_monster(int dis, int slp);
< extern bool summon_specific(int y1, int x1, int lev, int type);
---
> extern bool place_monster_aux(int Depth, int y, int x, int r_idx, bool slp, bool grp);
> extern bool place_monster(int Depth, int y, int x, bool slp, bool grp);
> extern bool alloc_monster(int Depth, int dis, int slp);
> extern bool summon_specific(int Depth, int y1, int x1, int lev, int type);
545a563,610
> /* netserver.c */
> /*extern void Contact(int fd, void *arg);*/
> extern int Net_input(void);
> extern int Net_output(void);
> extern void setup_contact_socket(void);
> extern bool Report_to_meta(int flag);
> extern int Setup_net_server(void);
> extern void Destroy_connection(int char *reason);
> extern int Send_plusses(int int tohit, int todam);
> extern int Send_ac(int int base, int plus);
> extern int Send_experience(int int lev, int max_exp, int cur_exp, s32b adv_exp);
> extern int Send_gold(int s32b gold);
> extern int Send_hp(int int mhp, int chp);
> extern int Send_sp(int int msp, int csp);
> extern int Send_char_info(int int race, int class, int sex);
> extern int Send_various(int int height, int weight, int age, int sc);
> extern int Send_stat(int int stat, int max, int cur);
> extern int Send_history(int int line, cptr hist);
> extern int Send_inven(int char pos, byte attr, int wgt, int amt, byte tval, cptr name);
> extern int Send_equip(int char pos, byte attr, int wgt, byte tval, cptr name);
> extern int Send_title(int cptr title);
> /*extern int Send_level(int int max, int cur);*/
> /*extern void Send_exp(int s32b max, s32b cur);*/
> extern int Send_depth(int int depth);
> extern int Send_food(int int food);
> extern int Send_blind(int bool blind);
> extern int Send_confused(int bool confused);
> extern int Send_fear(int bool afraid);
> extern int Send_poison(int bool poisoned);
> extern int Send_paralyzed(int bool paralyzed);
> extern int Send_searching(int bool searching);
> extern int Send_speed(int int speed);
> extern int Send_study(int bool study);
> extern int Send_cut(int int cut);
> extern int Send_stun(int int stun);
> extern int Send_direction(int Ind);
> extern int Send_message(int cptr msg);
> extern int Send_char(int int x, int y, byte a, char c);
> extern int Send_spell_info(int int book, int i, cptr out_val);
> extern int Send_item_request(int Ind);
> extern int Send_state(int bool paralyzed, bool searching);
> extern int Send_flush(int Ind);
>
> extern void Handle_direction(int int dir);
>
>
>
>
551c616
< extern void object_desc(char *buf, object_type *o_ptr, int pref, int mode);
---
> extern void object_desc(int char *buf, object_type *o_ptr, int pref, int mode);
555,563c620,628
< extern s16b label_to_inven(int c);
< extern s16b label_to_equip(int c);
< extern s16b wield_slot(object_type *o_ptr);
< extern cptr mention_use(int i);
< extern cptr describe_use(int i);
< extern void inven_item_charges(int item);
< extern void inven_item_describe(int item);
< extern void inven_item_increase(int item, int num);
< extern void inven_item_optimize(int item);
---
> extern s16b label_to_inven(int int c);
> extern s16b label_to_equip(int int c);
> extern s16b wield_slot(int object_type *o_ptr);
> extern cptr mention_use(int int i);
> extern cptr describe_use(int int i);
> extern void inven_item_charges(int int item);
> extern void inven_item_describe(int int item);
> extern void inven_item_increase(int int item, int num);
> extern void inven_item_optimize(int int item);
568,569c633,634
< extern bool inven_carry_okay(object_type *o_ptr);
< extern s16b inven_carry(object_type *o_ptr);
---
> extern bool inven_carry_okay(int object_type *o_ptr);
> extern s16b inven_carry(int object_type *o_ptr);
571,573c636,638
< extern void display_inven(void);
< extern void display_equip(void);
< extern void show_inven(void);
---
> extern void display_inven(int Ind);
> extern void display_equip(int Ind);
> /*extern void show_inven(void);
576c641
< extern bool get_item(int *cp, cptr pmt, bool equip, bool inven, bool floor);
---
> extern bool get_item(int int *cp, cptr pmt, bool equip, bool inven, bool floor);*/
578c643
< extern void delete_object(int y, int x);
---
> extern void delete_object(int Depth, int y, int x);
580c645
< extern void wipe_o_list(void);
---
> extern void wipe_o_list(int Depth);
585,589c650,654
< extern void object_aware(object_type *o_ptr);
< extern void object_tried(object_type *o_ptr);
< extern s32b object_value(object_type *o_ptr);
< extern bool object_similar(object_type *o_ptr, object_type *j_ptr);
< extern void object_absorb(object_type *o_ptr, object_type *j_ptr);
---
> extern void object_aware(int object_type *o_ptr);
> extern void object_tried(int object_type *o_ptr);
> extern s32b object_value(int object_type *o_ptr);
> extern bool object_similar(int object_type *o_ptr, object_type *j_ptr);
> extern void object_absorb(int object_type *o_ptr, object_type *j_ptr);
593,597c658,662
< extern void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great);
< extern void place_object(int y, int x, bool good, bool great);
< extern void acquirement(int y1, int x1, int num, bool great);
< extern void place_trap(int y, int x);
< extern void place_gold(int y, int x);
---
> extern void apply_magic(int Depth, object_type *o_ptr, int lev, bool okay, bool good, bool great);
> extern void place_object(int Depth, int y, int x, bool good, bool great);
> extern void acquirement(int Depth, int y1, int x1, int num, bool great);
> extern void place_trap(int Depth, int y, int x);
> extern void place_gold(int Depth, int y, int x);
599,600c664,665
< extern void drop_near(object_type *o_ptr, int chance, int y, int x);
< extern void pick_trap(int y, int x);
---
> extern void drop_near(object_type *o_ptr, int chance, int Depth, int y, int x);
> extern void pick_trap(int Depth, int y, int x);
602,603c667,668
< extern void combine_pack(void);
< extern void reorder_pack(void);
---
> extern void combine_pack(int Ind);
> extern void reorder_pack(int Ind);
606,607c671,674
< extern bool save_player(void);
< extern bool load_player(void);
---
> extern bool save_player(int Ind);
> extern bool load_player(int Ind);
> extern bool load_server_info(void);
> extern bool save_server_info(void);
608a676,682
>
> /* sched.c */
> extern void install_timer_tick(void (*func)(void), int freq);
> extern void install_input(void (*func)(int, void *), int fd, void *arg);
> extern void remove_input(int fd);
> extern void sched(void);
>
612,624c686,698
< extern void teleport_player(int dis);
< extern void teleport_player_to(int ny, int nx);
< extern void teleport_player_level(void);
< extern void take_hit(int damage, cptr kb_str);
< extern void acid_dam(int dam, cptr kb_str);
< extern void elec_dam(int dam, cptr kb_str);
< extern void fire_dam(int dam, cptr kb_str);
< extern void cold_dam(int dam, cptr kb_str);
< extern bool inc_stat(int stat);
< extern bool dec_stat(int stat, int amount, int permanent);
< extern bool res_stat(int stat);
< extern bool apply_disenchant(int mode);
< extern bool project(int who, int rad, int y, int x, int dam, int typ, int flg);
---
> extern void teleport_player(int int dis);
> extern void teleport_player_to(int int ny, int nx);
> extern void teleport_player_level(int Ind);
> extern void take_hit(int int damage, cptr kb_str);
> extern void acid_dam(int int dam, cptr kb_str);
> extern void elec_dam(int int dam, cptr kb_str);
> extern void fire_dam(int int dam, cptr kb_str);
> extern void cold_dam(int int dam, cptr kb_str);
> extern bool inc_stat(int int stat);
> extern bool dec_stat(int int stat, int amount, int permanent);
> extern bool res_stat(int int stat);
> extern bool apply_disenchant(int int mode);
> extern bool project(int who, int rad, int Depth, int y, int x, int dam, int typ, int flg);
627,693c701,771
< extern bool hp_player(int num);
< extern void warding_glyph(void);
< extern bool do_dec_stat(int stat);
< extern bool do_res_stat(int stat);
< extern bool do_inc_stat(int stat);
< extern void identify_pack(void);
< extern void message_pain(int m_idx, int dam);
< extern bool remove_curse(void);
< extern bool remove_all_curse(void);
< extern bool restore_level(void);
< extern void self_knowledge(void);
< extern bool lose_all_info(void);
< extern bool detect_treasure(void);
< extern bool detect_magic(void);
< extern bool detect_invisible(void);
< extern bool detect_evil(void);
< extern bool detect_monsters(void);
< extern bool detection(void);
< extern bool detect_object(void);
< extern bool detect_trap(void);
< extern bool detect_sdoor(void);
< extern void stair_creation(void);
< extern bool enchant(object_type *o_ptr, int n, int eflag);
< extern bool enchant_spell(int num_hit, int num_dam, int num_ac);
< extern bool ident_spell(void);
< extern bool identify_fully(void);
< extern bool recharge(int num);
< extern bool speed_monsters(void);
< extern bool slow_monsters(void);
< extern bool sleep_monsters(void);
< extern void aggravate_monsters(int who);
< extern bool genocide(void);
< extern bool mass_genocide(void);
< extern bool probing(void);
< extern bool banish_evil(int dist);
< extern bool dispel_evil(int dam);
< extern bool dispel_undead(int dam);
< extern bool dispel_monsters(int dam);
< extern bool turn_undead(void);
< extern void destroy_area(int y1, int x1, int r, bool full);
< extern void earthquake(int cy, int cx, int r);
< extern void lite_room(int y1, int x1);
< extern void unlite_room(int y1, int x1);
< extern bool lite_area(int dam, int rad);
< extern bool unlite_area(int dam, int rad);
< extern bool fire_ball(int typ, int dir, int dam, int rad);
< extern bool fire_bolt(int typ, int dir, int dam);
< extern bool fire_beam(int typ, int dir, int dam);
< extern bool fire_bolt_or_beam(int prob, int typ, int dir, int dam);
< extern bool lite_line(int dir);
< extern bool drain_life(int dir, int dam);
< extern bool wall_to_mud(int dir);
< extern bool destroy_door(int dir);
< extern bool disarm_trap(int dir);
< extern bool heal_monster(int dir);
< extern bool speed_monster(int dir);
< extern bool slow_monster(int dir);
< extern bool sleep_monster(int dir);
< extern bool confuse_monster(int dir, int plev);
< extern bool fear_monster(int dir, int plev);
< extern bool poly_monster(int dir);
< extern bool clone_monster(int dir);
< extern bool teleport_monster(int dir);
< extern bool door_creation(void);
< extern bool trap_creation(void);
< extern bool destroy_doors_touch(void);
< extern bool sleep_monsters_touch(void);
---
> extern bool hp_player(int int num);
> extern void warding_glyph(int Ind);
> extern bool do_dec_stat(int int stat);
> extern bool do_res_stat(int int stat);
> extern bool do_inc_stat(int int stat);
> extern void identify_pack(int Ind);
> extern void message_pain(int int m_idx, int dam);
> extern bool remove_curse(int Ind);
> extern bool remove_all_curse(int Ind);
> extern bool restore_level(int Ind);
> extern void self_knowledge(int Ind);
> extern bool lose_all_info(int Ind);
> extern bool detect_treasure(int Ind);
> extern bool detect_magic(int Ind);
> extern bool detect_invisible(int Ind);
> extern bool detect_evil(int Ind);
> extern bool detect_monsters(int Ind);
> extern bool detection(int Ind);
> extern bool detect_object(int Ind);
> extern bool detect_trap(int Ind);
> extern bool detect_sdoor(int Ind);
> extern void stair_creation(int Ind);
> extern bool enchant(int object_type *o_ptr, int n, int eflag);
> extern bool enchant_spell(int int num_hit, int num_dam, int num_ac);
> extern bool enchant_spell_aux(int int item, int num_hit, int num_dam, int num_ac);
> extern bool ident_spell(int Ind);
> extern bool ident_spell_aux(int int item);
> extern bool identify_fully(int Ind);
> extern bool identify_fully_item(int int item);
> extern bool recharge(int int num);
> extern bool recharge_aux(int int item, int num);
> extern bool speed_monsters(int Ind);
> extern bool slow_monsters(int Ind);
> extern bool sleep_monsters(int Ind);
> extern void aggravate_monsters(int int who);
> extern bool genocide(int Ind);
> extern bool mass_genocide(int Ind);
> extern bool probing(int Ind);
> extern bool banish_evil(int int dist);
> extern bool dispel_evil(int int dam);
> extern bool dispel_undead(int int dam);
> extern bool dispel_monsters(int int dam);
> extern bool turn_undead(int Ind);
> extern void destroy_area(int Depth, int y1, int x1, int r, bool full);
> extern void earthquake(int Depth, int cy, int cx, int r);
> extern void lite_room(int int Depth, int y1, int x1);
> extern void unlite_room(int int Depth, int y1, int x1);
> extern bool lite_area(int int dam, int rad);
> extern bool unlite_area(int int dam, int rad);
> extern bool fire_ball(int int typ, int dir, int dam, int rad);
> extern bool fire_bolt(int int typ, int dir, int dam);
> extern bool fire_beam(int int typ, int dir, int dam);
> extern bool fire_bolt_or_beam(int int prob, int typ, int dir, int dam);
> extern bool lite_line(int int dir);
> extern bool drain_life(int int dir, int dam);
> extern bool wall_to_mud(int int dir);
> extern bool destroy_door(int int dir);
> extern bool disarm_trap(int int dir);
> extern bool heal_monster(int int dir);
> extern bool speed_monster(int int dir);
> extern bool slow_monster(int int dir);
> extern bool sleep_monster(int int dir);
> extern bool confuse_monster(int int dir, int plev);
> extern bool fear_monster(int int dir, int plev);
> extern bool poly_monster(int int dir);
> extern bool clone_monster(int int dir);
> extern bool teleport_monster(int int dir);
> extern bool door_creation(int Ind);
> extern bool trap_creation(int Ind);
> extern bool destroy_doors_touch(int Ind);
> extern bool sleep_monsters_touch(int Ind);
696c774
< extern void do_cmd_store(void);
---
> extern void do_cmd_store(int Ind);
723c801
< extern void move_cursor(int row, int col);
---
> /* extern void move_cursor(int row, int col); */
734,735c812,813
< extern void msg_print(cptr msg);
< extern void msg_format(cptr fmt, ...);
---
> extern void msg_print(int cptr msg);
> extern void msg_format(int cptr fmt, ...);
756,760c834,838
< extern void notice_stuff(void);
< extern void update_stuff(void);
< extern void redraw_stuff(void);
< extern void window_stuff(void);
< extern void handle_stuff(void);
---
> extern void notice_stuff(int Ind);
> extern void update_stuff(int Ind);
> extern void redraw_stuff(int Ind);
> extern void window_stuff(int Ind);
> extern void handle_stuff(int Ind);
763,793c841,871
< extern bool set_blind(int v);
< extern bool set_confused(int v);
< extern bool set_poisoned(int v);
< extern bool set_afraid(int v);
< extern bool set_paralyzed(int v);
< extern bool set_image(int v);
< extern bool set_fast(int v);
< extern bool set_slow(int v);
< extern bool set_shield(int v);
< extern bool set_blessed(int v);
< extern bool set_hero(int v);
< extern bool set_shero(int v);
< extern bool set_protevil(int v);
< extern bool set_invuln(int v);
< extern bool set_tim_invis(int v);
< extern bool set_tim_infra(int v);
< extern bool set_oppose_acid(int v);
< extern bool set_oppose_elec(int v);
< extern bool set_oppose_fire(int v);
< extern bool set_oppose_cold(int v);
< extern bool set_oppose_pois(int v);
< extern bool set_stun(int v);
< extern bool set_cut(int v);
< extern bool set_food(int v);
< extern void check_experience(void);
< extern void gain_exp(s32b amount);
< extern void lose_exp(s32b amount);
< extern void monster_death(int m_idx);
< extern bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note);
< extern void panel_bounds(void);
< extern void verify_panel(void);
---
> extern bool set_blind(int int v);
> extern bool set_confused(int int v);
> extern bool set_poisoned(int int v);
> extern bool set_afraid(int int v);
> extern bool set_paralyzed(int int v);
> extern bool set_image(int int v);
> extern bool set_fast(int int v);
> extern bool set_slow(int int v);
> extern bool set_shield(int int v);
> extern bool set_blessed(int int v);
> extern bool set_hero(int int v);
> extern bool set_shero(int int v);
> extern bool set_protevil(int int v);
> extern bool set_invuln(int int v);
> extern bool set_tim_invis(int int v);
> extern bool set_tim_infra(int int v);
> extern bool set_oppose_acid(int int v);
> extern bool set_oppose_elec(int int v);
> extern bool set_oppose_fire(int int v);
> extern bool set_oppose_cold(int int v);
> extern bool set_oppose_pois(int int v);
> extern bool set_stun(int int v);
> extern bool set_cut(int int v);
> extern bool set_food(int int v);
> extern void check_experience(int Ind);
> extern void gain_exp(int s32b amount);
> extern void lose_exp(int s32b amount);
> extern void monster_death(int int m_idx);
> extern bool mon_take_hit(int int m_idx, int dam, bool *fear, cptr note);
> extern void panel_bounds(int Ind);
> extern void verify_panel(int Ind);
795,804c873,883
< extern void ang_sort_aux(vptr u, vptr v, int p, int q);
< extern void ang_sort(vptr u, vptr v, int n);
< extern void ang_sort_swap_distance(vptr u, vptr v, int a, int b);
< extern bool ang_sort_comp_distance(vptr u, vptr v, int a, int b);
< extern bool target_able(int m_idx);
< extern bool target_okay(void);
< extern s16b target_pick(int y1, int x1, int dy, int dx);
< extern bool target_set(void);
< extern bool get_aim_dir(int *dp);
< extern bool get_rep_dir(int *dp);
---
> extern void ang_sort_aux(int vptr u, vptr v, int p, int q);
> extern void ang_sort(int vptr u, vptr v, int n);
> extern void ang_sort_swap_distance(int vptr u, vptr v, int a, int b);
> extern bool ang_sort_comp_distance(int vptr u, vptr v, int a, int b);
> extern bool target_able(int int m_idx);
> extern bool target_okay(int Ind);
> extern s16b target_pick(int int y1, int x1, int dy, int dx);
> extern bool target_set(int int dir);
> extern bool get_aim_dir(int Ind/*, int *dp*/);
> extern bool get_item(int Ind);
> /*extern bool get_rep_dir(int *dp);*/
805a885
> extern bool c_get_item(int *cp, cptr pmt, bool equip, bool inven, bool floor);
diff -r src-280/files.c mangband-000/src/server/files.c
12a13,14
> #define SERVER
>
485c487
< msg_format("Error in '%s' parsing '%s'.", buf, name);
---
> printf("Error in '%s' parsing '%s'.", buf, name);
745c747
< static void prt_lnum(cptr header, s32b num, int row, int col, byte color)
---
> /*static void prt_lnum(cptr header, s32b num, int row, int col, byte color)
752c754
< }
---
> }*/
757c759
< static void prt_num(cptr header, int num, int row, int col, byte color)
---
> /*static void prt_num(cptr header, int num, int row, int col, byte color)
765c767
< }
---
> }*/
773a776,777
> *
> * This will send the info to the client now --KLJ--
775c779
< static void display_player_middle(void)
---
> static void display_player_middle(int Ind)
776a781,782
> player_type *p_ptr = Players[Ind];
>
780c786
< object_type *o_ptr = &inventory[INVEN_WIELD];
---
> s32b adv_exp;
781a788,789
> object_type *o_ptr = &p_ptr->inventory[INVEN_WIELD];
>
787,788c795,796
< prt_num("+ To Hit ", show_tohit, 9, 1, TERM_L_BLUE);
< prt_num("+ To Damage ", show_todam, 10, 1, TERM_L_BLUE);
---
> /*prt_num("+ To Hit ", show_tohit, 9, 1, TERM_L_BLUE);
> prt_num("+ To Damage ", show_todam, 10, 1, TERM_L_BLUE);*/
789a798,799
> Send_plusses(show_tohit, show_todam);
>
791c801
< prt_num("+ To AC ", p_ptr->dis_to_a, 11, 1, TERM_L_BLUE);
---
> /*prt_num("+ To AC ", p_ptr->dis_to_a, 11, 1, TERM_L_BLUE);*/
794c804
< prt_num(" Base AC ", p_ptr->dis_ac, 12, 1, TERM_L_BLUE);
---
> /*prt_num(" Base AC ", p_ptr->dis_ac, 12, 1, TERM_L_BLUE);*/
796c806
< prt_num("Level ", (int)p_ptr->lev, 9, 28, TERM_L_GREEN);
---
> Send_ac(p_ptr->dis_ac, p_ptr->dis_to_a);
797a808,809
> /*prt_num("Level ", (int)p_ptr->lev, 9, 28, TERM_L_GREEN);
>
819c831
< }
---
> }*/
821c833,835
< prt_lnum("Gold ", p_ptr->au, 13, 28, TERM_L_GREEN);
---
> if (p_ptr->lev >= PY_MAX_LEVEL)
> adv_exp = 0;
> else adv_exp = (s32b)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L);
823c837
< prt_num("Max Hit Points ", p_ptr->mhp, 9, 52, TERM_L_GREEN);
---
> Send_experience(p_ptr->lev, p_ptr->max_exp, p_ptr->exp, adv_exp);
824a839,843
> /*prt_lnum("Gold ", p_ptr->au, 13, 28, TERM_L_GREEN);*/
> Send_gold(p_ptr->au);
>
> /*prt_num("Max Hit Points ", p_ptr->mhp, 9, 52, TERM_L_GREEN);
>
836c855
< }
---
> }*/
838c857
< prt_num("Max SP (Mana) ", p_ptr->msp, 11, 52, TERM_L_GREEN);
---
> Send_hp(p_ptr->mhp, p_ptr->chp);
839a859,860
> /*prt_num("Max SP (Mana) ", p_ptr->msp, 11, 52, TERM_L_GREEN);
>
851c872,874
< }
---
> }*/
>
> Send_sp(p_ptr->msp, p_ptr->csp);
860c883
< static byte likert_color = TERM_WHITE;
---
> /*static byte likert_color = TERM_WHITE;*/
865a889
> #if 0
937a962
> #endif
943a969,970
> *
> * FIXME -- This has been taken out for now --KLJ--
945c972
< static void display_player_various(void)
---
> static void display_player_various(int Ind)
946a974,975
> player_type *p_ptr = Players[Ind];
>
950d978
< cptr desc;
956c984
< o_ptr = &inventory[INVEN_WIELD];
---
> o_ptr = &p_ptr->inventory[INVEN_WIELD];
961c989
< o_ptr = &inventory[INVEN_BOW];
---
> o_ptr = &p_ptr->inventory[INVEN_BOW];
974c1002
< put_str("Fighting :", 16, 1);
---
> /*put_str("Fighting :", 16, 1);
1015c1043
< put_str(format("%d feet", p_ptr->see_infra * 10), 19, 69);
---
> put_str(format("%d feet", p_ptr->see_infra * 10), 19, 69);*/
1025c1053
< void display_player(bool do_hist)
---
> void display_player(int bool do_hist)
1026a1055,1056
> player_type *p_ptr = Players[Ind];
>
1029d1058
< char buf[80];
1031d1059
<
1033c1061
< clear_from(0);
---
> /*clear_from(0);*/
1036c1064
< put_str("Name :", 2, 1);
---
> /*put_str("Name :", 2, 1);
1044c1072
< c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15);
---
> c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15);*/
1045a1074,1075
> Send_char_info(p_ptr->prace, p_ptr->pclass, p_ptr->male);
>
1047c1077
< prt_num("Age ", (int)p_ptr->age, 2, 32, TERM_L_BLUE);
---
> /*prt_num("Age ", (int)p_ptr->age, 2, 32, TERM_L_BLUE);
1050c1080
< prt_num("Social Class ", (int)p_ptr->sc, 5, 32, TERM_L_BLUE);
---
> prt_num("Social Class ", (int)p_ptr->sc, 5, 32, TERM_L_BLUE);*/
1051a1082,1083
> Send_various(p_ptr->ht, p_ptr->wt, p_ptr->age, p_ptr->sc);
>
1053,1054c1085,1086
< for (i = 0; i < 6; i++)
< {
---
> /*for (i = 0; i < 6; i++)
> {*/
1056c1088
< if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
---
> /*if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
1058c1090
< int value;
---
> int value;*/
1061c1093
< put_str(stat_names_reduced[i], 2 + i, 61);
---
> /*put_str(stat_names_reduced[i], 2 + i, 61);*/
1064c1096
< value = p_ptr->stat_use[i];
---
> /*value = p_ptr->stat_use[i];*/
1067c1099
< cnv_stat(value, buf);
---
> /*cnv_stat(value, buf);*/
1070c1102
< c_put_str(TERM_YELLOW, buf, 2 + i, 66);
---
> /*c_put_str(TERM_YELLOW, buf, 2 + i, 66);*/
1073c1105
< value = p_ptr->stat_top[i];
---
> /*value = p_ptr->stat_top[i];*/
1076c1108
< cnv_stat(value, buf);
---
> /*cnv_stat(value, buf);*/
1079,1080c1111,1112
< c_put_str(TERM_L_GREEN, buf, 2 + i, 73);
< }
---
> /*c_put_str(TERM_L_GREEN, buf, 2 + i, 73);
> }*/
1083,1084c1115,1116
< else
< {
---
> /*else
> {*/
1086c1118
< put_str(stat_names[i], 2 + i, 61);
---
> /*put_str(stat_names[i], 2 + i, 61);*/
1089c1121
< cnv_stat(p_ptr->stat_use[i], buf);
---
> /*cnv_stat(p_ptr->stat_use[i], buf);*/
1092c1124
< c_put_str(TERM_L_GREEN, buf, 2 + i, 66);
---
> /*c_put_str(TERM_L_GREEN, buf, 2 + i, 66);
1093a1126,1132
> }*/
>
>
> /* Send all the stats */
> for (i = 0; i < 6; i++)
> {
> Send_stat(i, p_ptr->stat_max[i], p_ptr->stat_cur[i]);
1097c1136
< display_player_middle();
---
> display_player_middle(Ind);
1102c1141
< put_str("(Character Background)", 15, 25);
---
> /*put_str("(Character Background)", 15, 25);*/
1106c1145,1146
< put_str(history[i], i + 16, 10);
---
> /*put_str(history[i], i + 16, 10);*/
> Send_history(i, p_ptr->history[i]);
1115c1155
< display_player_various();
---
> display_player_various(Ind);
1126a1167,1170
> *
> * FIXME -- This is currently disabled, because either the character dump
> * will just end up on the server, or a lot more network interface will have
> * to be defined to transfer this back to the client machine. Ugh.
1127a1172
> #if 0
1312a1358
> #endif
1319a1366,1368
> *
> * FIXME -- This is disabled, because it is difficult to send to the client
> * without defining some more network packet types, etc.
1320a1370
> #if 0
1656a1707
> #endif
1660a1712,1713
> *
> * Disabled --KLJ--
1663a1717
> #if 0
1680a1735
> #endif
1689a1745,1746
> *
> * Disabled --KLJ--
1691c1748,1749
< errr show_file(cptr name, cptr what)
---
> #if 0
> errr show_file(int cptr name, cptr what)
1710a1769
> #endif
1720c1779
< void process_player_name(bool sf)
---
> void process_player_name(int bool sf)
1721a1781,1782
> player_type *p_ptr = Players[Ind];
>
1726c1787
< if (strlen(player_name) > 15)
---
> if (strlen(p_ptr->name) > 15)
1729c1790
< quit_fmt("The name '%s' is too long!", player_name);
---
> Destroy_connection(p_ptr->conn, "Your name is too long!");
1733c1794
< for (i = 0; player_name[i]; i++)
---
> for (i = 0; p_ptr->name[i]; i++)
1736c1797
< if (iscntrl(player_name[i]))
---
> if (iscntrl(p_ptr->name[i]))
1739c1800
< quit_fmt("The name '%s' contains control chars!", player_name);
---
> Destroy_connection(p_ptr->conn, "Your name contains control chars!");
1747c1808
< for (i = 0; player_name[i]; i++)
---
> for (i = 0; p_ptr->name[i]; i++)
1749c1810
< char c = player_name[i];
---
> char c = p_ptr->name[i];
1755c1816
< player_base[k++] = c;
---
> p_ptr->basename[k++] = c;
1761c1822
< for (i = 0; player_name[i]; i++)
---
> for (i = 0; p_ptr->name[i]; i++)
1763c1824
< char c = player_name[i];
---
> char c = p_ptr->name[i];
1766c1827
< if (isalpha(c) || isdigit(c)) player_base[k++] = c;
---
> if (isalpha(c) || isdigit(c)) p_ptr->basename[k++] = c;
1769c1830
< else if (strchr(". _", c)) player_base[k++] = '_';
---
> else if (strchr(". _", c)) p_ptr->basename[k++] = '_';
1783c1844
< player_base[k] = '\0';
---
> p_ptr->basename[k] = '\0';
1786c1847
< if (!player_base[0]) strcpy(player_base, "PLAYER");
---
> if (!p_ptr->basename[0]) strcpy(p_ptr->basename, "PLAYER");
1801,1804d1861
< #ifdef SAVEFILE_USE_UID
< /* Rename the savefile, using the player_uid and player_base */
< (void)sprintf(temp, "%d.%s", player_uid, player_base);
< #else
1806,1807c1863
< (void)sprintf(temp, "%s", player_base);
< #endif
---
> (void)sprintf(temp, "%s", p_ptr->basename);
1815c1871
< path_build(savefile, 1024, ANGBAND_DIR_SAVE, temp);
---
> path_build(p_ptr->savefile, 1024, ANGBAND_DIR_SAVE, temp);
1824a1881,1882
> *
> * The name should be sent to us from the client, so this is unnecessary --KLJ--
1826c1884
< void get_name(void)
---
> void get_name(int Ind)
1827a1886
> #if 0
1859a1919
> #endif
1867c1927
< void do_cmd_suicide(void)
---
> void do_cmd_suicide(int Ind)
1869c1929
< int i;
---
> player_type *p_ptr = Players[Ind];
1872c1932
< flush();
---
> /*flush();*/
1874,1894d1933
< /* Verify Retirement */
< if (total_winner)
< {
< /* Verify */
< if (!get_check("Do you want to retire? ")) return;
< }
<
< /* Verify Suicide */
< else
< {
< /* Verify */
< if (!get_check("Do you really want to quit? ")) return;
<
< /* Special Verification for suicide */
< prt("Please verify QUITTING by typing the '@' sign: ", 0, 0);
< flush();
< i = inkey();
< prt("", 0, 0);
< if (i != '@') return;
< }
<
1896c1935
< alive = FALSE;
---
> p_ptr->alive = FALSE;
1899c1938
< death = TRUE;
---
> p_ptr->death = TRUE;
1902c1941
< (void)strcpy(died_from, "Quitting");
---
> (void)strcpy(p_ptr->died_from, "Quitting");
1908c1947
< * Save the game
---
> * Save a character
1910c1949
< void do_cmd_save_game(void)
---
> void do_cmd_save_game(int Ind)
1911a1951,1952
> player_type *p_ptr = Players[Ind];
>
1919c1960
< handle_stuff();
---
> handle_stuff(Ind);
1922c1963
< prt("Saving game...", 0, 0);
---
> msg_print("Saving game...");
1925c1966
< Term_fresh();
---
> /*Term_fresh();*/
1928c1969
< (void)strcpy(died_from, "(saved)");
---
> (void)strcpy(p_ptr->died_from, "(saved)");
1934c1975
< if (save_player())
---
> if (save_player(Ind))
1936c1977
< prt("Saving game... done.", 0, 0);
---
> msg_print("Saving game... done.");
1942c1983
< prt("Saving game... failed!", 0, 0);
---
> msg_print("Saving game... failed!");
1949c1990
< Term_fresh();
---
> /*Term_fresh();*/
1952c1993
< (void)strcpy(died_from, "(alive and well)");
---
> (void)strcpy(p_ptr->died_from, "(alive and well)");
1960c2001
< long total_points(void)
---
> long total_points(int Ind)
1961a2003,2004
> player_type *p_ptr = Players[Ind];
>
1969a2013
> #if 0
1982a2027
> #endif
1993c2038
< static void make_bones(void)
---
> static void make_bones(int Ind)
1994a2040,2041
> player_type *p_ptr = Players[Ind];
>
2001c2048
< if (!(noscore & 0x00FF))
---
> if (!(p_ptr->noscore & 0x00FF))
2004c2051
< if (dun_level)
---
> if (p_ptr->dun_depth)
2009c2056
< sprintf(tmp, "bone.%03d", dun_level);
---
> sprintf(tmp, "bone.%03d", p_ptr->dun_depth);
2033c2080
< fprintf(fp, "%s\n", player_name);
---
> fprintf(fp, "%s\n", p_ptr->name);
2046a2094,2096
> *
> * Since the client knows all of this information, it will be handled by the
> * client --KLJ--
2048c2098
< static void print_tomb(void)
---
> static void print_tomb(int Ind)
2049a2100
> #if 0
2135a2187
> #endif
2140a2193,2196
> *
> * FIXME -- This is very broken. There is no home. There is no way to get
> * most of this information transferred to the client. This isn't used all
> * that often. I'll worry about it later. --KLJ--
2142c2198
< static void show_info(void)
---
> static void show_info(int Ind)
2143a2200
> #if 0
2279a2337
> #endif
2332c2390
< static int highscore_fd = -1;
---
> /* static int highscore_fd = -1; */
2337a2396
> #if 0
2342a2402
> #endif
2347a2408
> #if 0
2352a2414
> #endif
2357a2420
> #if 0
2362a2426
> #endif
2370a2435
> #if 0
2392a2458
> #endif
2398a2465
> #if 0
2436a2504
> #endif
2445a2514,2520
> *
> * FIXME -- Unfortunately, this suffers from the same problem that many of
> * the functions in this file do. There is no way to send random info
> * to the client to be displayed on screen. To fix just about everything
> * here, some method of "dumping" a screen is needed. Perhaps putting the
> * into a "raw keyboard" mode would be nice to, in order to interact with
> * the functions correctly. So, for now, this is disabled. --KLJ--
2446a2522
> #if 0
2590a2667
> #endif
2597a2675,2676
> *
> * FIXME -- Disabled. --KLJ--
2600a2680
> #if 0
2625a2706
> #endif
2634a2716,2717
> *
> * FIXME -- Disabled. --KLJ--
2636c2719,2720
< static errr top_twenty(void)
---
> #if 0
> static errr top_twenty(int Ind)
2780a2865
> #endif
2784a2870,2871
> *
> * FIXME -- Disabled. --KLJ--
2785a2873
> #if 0
2857a2946
> #endif
2867c2956
< * Change the player into a King! -RAK-
---
> * Change a player into a King! -RAK-
2869c2958
< static void kingly(void)
---
> static void kingly(int Ind)
2870a2960,2961
> player_type *p_ptr = Players[Ind];
>
2872c2963
< dun_level = 0;
---
> p_ptr->dun_depth = 0;
2875c2966
< (void)strcpy(died_from, "Ripe Old Age");
---
> (void)strcpy(p_ptr->died_from, "Ripe Old Age");
2887c2978
< Term_clear();
---
> /*Term_clear();*/
2889a2981
> #if 0
2919a3012
> #endif
2926a3020,3021
> *
> * In here we try to save everybody's game, as well as save the server state.
2930c3025
< char buf[1024];
---
> int i;
2931a3027,3028
> /* No suspending now */
> signals_ignore_tstp();
2933,2934c3030,3032
< /* Handle stuff */
< handle_stuff();
---
> for (i = 0; i < NumPlayers; i++)
> {
> player_type *p_ptr = Players[i];
2936,2937c3034,3036
< /* Flush the messages */
< msg_print(NULL);
---
> /* Make sure the player is connected */
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
2939,2940c3038,3039
< /* Flush the input */
< flush();
---
> /* Handle stuff */
> handle_stuff(i);
2941a3041,3042
> /* Flush the messages */
> msg_print(i, NULL);
2943,2944c3044,3045
< /* No suspending now */
< signals_ignore_tstp();
---
> /* Flush the input */
> /*flush();*/
2947,2948c3048,3049
< /* Hack -- Character is now "icky" */
< character_icky = TRUE;
---
> /* Hack -- Character is now "icky" */
> /*character_icky = TRUE;*/
2951,2952c3052,3053
< /* Build the filename */
< path_build(buf, 1024, ANGBAND_DIR_APEX, "scores.raw");
---
> /* Build the filename */
> /*path_build(buf, 1024, ANGBAND_DIR_APEX, "scores.raw");*/
2954,2955c3055,3056
< /* Open the high score file, for reading/writing */
< highscore_fd = fd_open(buf, O_RDWR);
---
> /* Open the high score file, for reading/writing */
> /*highscore_fd = fd_open(buf, O_RDWR);*/
2958,2962c3059,3063
< /* Handle death */
< if (death)
< {
< /* Handle retirement */
< if (total_winner) kingly();
---
> /* Handle death */
> if (p_ptr->death)
> {
> /* Handle retirement */
> if (p_ptr->total_winner) kingly(i);
2964,2965c3065,3066
< /* Save memories */
< if (!save_player()) msg_print("death save failed!");
---
> /* Save memories */
> if (!save_player(i)) msg_print(i, "death save failed!");
2967,2968c3068,3069
< /* Dump bones file */
< make_bones();
---
> /* Dump bones file */
> make_bones(i);
2970,2971c3071,3079
< /* You are dead */
< print_tomb();
---
> /* You are dead */
> print_tomb(i);
>
> /* Show more info */
> show_info(i);
>
> /* Handle score, show Top scores */
> /*top_twenty(i);*/
> }
2973,2974c3081,3085
< /* Show more info */
< show_info();
---
> /* Still alive */
> else
> {
> /* Save the game */
> do_cmd_save_game(i);
2976,2978c3087,3092
< /* Handle score, show Top scores */
< top_twenty();
< }
---
> /* Prompt for scores XXX XXX XXX */
> /*prt("Press Return (or Escape).", 0, 40);*/
>
> /* Predict score (or ESCAPE) */
> /*if (inkey() != ESCAPE) predict_score();*/
> }
2980,2984d3093
< /* Still alive */
< else
< {
< /* Save the game */
< do_cmd_save_game();
2986,2987c3095,3096
< /* Prompt for scores XXX XXX XXX */
< prt("Press Return (or Escape).", 0, 40);
---
> /* Shut the high score file */
> /*(void)fd_close(highscore_fd);*/
2989,2990c3098,3099
< /* Predict score (or ESCAPE) */
< if (inkey() != ESCAPE) predict_score();
---
> /* Forget the high score fd */
> /*highscore_fd = -1;*/
2992a3102,3103
> /* Try to save the server information */
> save_server_info();
2994,3000d3104
< /* Shut the high score file */
< (void)fd_close(highscore_fd);
<
< /* Forget the high score fd */
< highscore_fd = -1;
<
<
3016a3121,3122
> int i;
>
3018c3124
< if (!character_generated || character_saved) quit("panic");
---
> if (!server_generated || server_saved) quit("panic");
3024c3130
< prt("", 0, 0);
---
> /*prt("", 0, 0);*/
3026,3027c3132,3134
< /* Hack -- turn off some things */
< disturb(1, 0);
---
> for (i = 0; i < NumPlayers; i++)
> {
> player_type *p_ptr = Players[i];
3029,3030c3136,3137
< /* Mega-Hack -- Delay death */
< if (p_ptr->chp < 0) death = FALSE;
---
> /* Hack -- turn off some things */
> disturb(i, 1, 0);
3032,3033c3139,3140
< /* Hardcode panic save */
< panic_save = 1;
---
> /* Mega-Hack -- Delay death */
> if (p_ptr->chp < 0) p_ptr->death = FALSE;
3035,3036c3142,3143
< /* Forbid suspend */
< signals_ignore_tstp();
---
> /* Hardcode panic save */
> panic_save = 1;
3038,3039c3145,3146
< /* Indicate panic save */
< (void)strcpy(died_from, "(panic save)");
---
> /* Forbid suspend */
> signals_ignore_tstp();
3041,3042c3148,3149
< /* Panic save, or get worried */
< if (!save_player()) quit("panic save failed!");
---
> /* Indicate panic save */
> (void)strcpy(p_ptr->died_from, "(panic save)");
3044,3045c3151,3161
< /* Successful panic save */
< quit("panic save succeeded!");
---
> /* Panic save, or get worried */
> if (!save_player(i)) Destroy_connection(p_ptr->conn, "panic save failed!");
>
> /* Successful panic save */
> Destroy_connection(p_ptr->conn, "panic save succeeded!");
> }
>
> if (!save_server_info()) quit("server panic info save failed!");
>
> /* Successful panic save of server info */
> quit("server panic info save succeeded!");
3059a3176,3178
> *
> * This will probably inflict much anger upon the suspender, but it is still
> * allowed (for now) --KLJ--
3069c3188
< Term_fresh();
---
> /*Term_fresh();*/
3072c3191
< Term_xtra(TERM_XTRA_ALIVE, 0);
---
> /*Term_xtra(TERM_XTRA_ALIVE, 0);*/
3078c3197
< Term_xtra(TERM_XTRA_ALIVE, 1);
---
> /*Term_xtra(TERM_XTRA_ALIVE, 1);*/
3081c3200
< Term_redraw();
---
> /*Term_redraw();*/
3084c3203
< Term_fresh();
---
> /*Term_fresh();*/
3105a3225,3228
> *
> * This simply calls "exit_game_panic()", which should try to save
> * everyone's character and the server info, which is probably nicer
> * than killing everybody. --KLJ--
3114c3237
< if (!character_generated || character_saved) quit(NULL);
---
> if (!server_generated || server_saved) quit(NULL);
3121,3133d3243
< /* Terminate dead characters */
< if (death)
< {
< /* Mark the savefile */
< (void)strcpy(died_from, "Abortion");
<
< /* Close stuff */
< close_game();
<
< /* Quit */
< quit("interrupt");
< }
<
3135c3245
< else if (signal_count >= 5)
---
> if (signal_count >= 5)
3137,3138c3247,3248
< /* Cause of "death" */
< (void)strcpy(died_from, "Interrupting");
---
> /* Tell the metaserver that we've quit */
> Report_to_meta(META_DIE);
3140,3150c3250,3251
< /* Stop playing */
< alive = FALSE;
<
< /* Suicide */
< death = TRUE;
<
< /* Close stuff */
< close_game();
<
< /* Quit */
< quit("interrupt");
---
> /* Save everything and quit the game */
> exit_game_panic();
3155a3257,3258
> printf("Warning: Next signal kills server!\n");
>
3157c3260
< Term_xtra(TERM_XTRA_NOISE, 0);
---
> /*Term_xtra(TERM_XTRA_NOISE, 0);*/
3160c3263
< Term_erase(0, 0, 255);
---
> /*Term_erase(0, 0, 255);*/
3163c3266
< Term_putstr(0, 0, -1, TERM_WHITE, "Contemplating suicide!");
---
> /*Term_putstr(0, 0, -1, TERM_WHITE, "Contemplating suicide!");*/
3166c3269
< Term_fresh();
---
> /*Term_fresh();*/
3173c3276
< Term_xtra(TERM_XTRA_NOISE, 0);
---
> /*Term_xtra(TERM_XTRA_NOISE, 0);*/
3182a3286,3287
> *
> * This one also calls exit_game_panic() --KLJ--
3191c3296
< if (!character_generated || character_saved) quit(NULL);
---
> if (!server_generated || server_saved) quit(NULL);
3193,3232c3298,3299
<
< /* Clear the bottom line */
< Term_erase(0, 23, 255);
<
< /* Give a warning */
< Term_putstr(0, 23, -1, TERM_RED,
< "A gruesome software bug LEAPS out at you!");
<
< /* Message */
< Term_putstr(45, 23, -1, TERM_RED, "Panic save...");
<
< /* Flush output */
< Term_fresh();
<
< /* Panic Save */
< panic_save = 1;
<
< /* Panic save */
< (void)strcpy(died_from, "(panic save)");
<
< /* Forbid suspend */
< signals_ignore_tstp();
<
< /* Attempt to save */
< if (save_player())
< {
< Term_putstr(45, 23, -1, TERM_RED, "Panic save succeeded!");
< }
<
< /* Save failed */
< else
< {
< Term_putstr(45, 23, -1, TERM_RED, "Panic save failed!");
< }
<
< /* Flush output */
< Term_fresh();
<
< /* Quit */
< quit("software bug");
---
> /* Save everybody and quit */
> exit_game_panic();
diff -r src-280/generate.c mangband-000/src/server/generate.c
12a13,14
> #define SERVER
>
315c317,318
< static void new_player_spot(void)
---
> #if 0
> static void new_player_spot(int Ind)
316a320,321
> player_type *p_ptr = Players[Ind];
>
327c332
< if (!cave_naked_bold(y, x)) continue;
---
> if (!cave_naked_bold(p_ptr->dun_depth, y, x)) continue;
330c335
< if (cave[y][x].info & CAVE_ICKY) continue;
---
> if (cave[p_ptr->dun_depth][y][x].info & CAVE_ICKY) continue;
337,338c342,343
< py = y;
< px = x;
---
> p_ptr->py = y;
> p_ptr->px = x;
339a345
> #endif
350c356
< static int next_to_walls(int y, int x)
---
> static int next_to_walls(int Depth, int y, int x)
354,357c360,363
< if (cave[y+1][x].feat >= FEAT_WALL_EXTRA) k++;
< if (cave[y-1][x].feat >= FEAT_WALL_EXTRA) k++;
< if (cave[y][x+1].feat >= FEAT_WALL_EXTRA) k++;
< if (cave[y][x-1].feat >= FEAT_WALL_EXTRA) k++;
---
> if (cave[Depth][y+1][x].feat >= FEAT_WALL_EXTRA) k++;
> if (cave[Depth][y-1][x].feat >= FEAT_WALL_EXTRA) k++;
> if (cave[Depth][y][x+1].feat >= FEAT_WALL_EXTRA) k++;
> if (cave[Depth][y][x-1].feat >= FEAT_WALL_EXTRA) k++;
367c373
< static void place_rubble(int y, int x)
---
> static void place_rubble(int Depth, int y, int x)
369c375
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
380c386
< static void place_up_stairs(int y, int x)
---
> static void place_up_stairs(int Depth, int y, int x)
382c388
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
392c398
< static void place_down_stairs(int y, int x)
---
> static void place_down_stairs(int Depth, int y, int x)
394c400
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
407c413
< static void place_random_stairs(int y, int x)
---
> static void place_random_stairs(int Depth, int y, int x)
410c416
< if (!cave_clean_bold(y, x)) return;
---
> if (!cave_clean_bold(Depth, y, x)) return;
413c419
< if (!dun_level)
---
> if (!Depth)
415c421
< place_down_stairs(y, x);
---
> place_down_stairs(Depth, y, x);
417c423
< else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1))
---
> else if (is_quest(Depth) || (Depth >= MAX_DEPTH-1))
419c425
< place_up_stairs(y, x);
---
> place_up_stairs(Depth, y, x);
423c429
< place_down_stairs(y, x);
---
> place_down_stairs(Depth, y, x);
427c433
< place_up_stairs(y, x);
---
> place_up_stairs(Depth, y, x);
435c441
< static void place_locked_door(int y, int x)
---
> static void place_locked_door(int Depth, int y, int x)
437c443
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
447c453
< static void place_secret_door(int y, int x)
---
> static void place_secret_door(int Depth, int y, int x)
449c455
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
459c465
< static void place_random_door(int y, int x)
---
> static void place_random_door(int Depth, int y, int x)
463c469
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
516c522
< static void alloc_stairs(int feat, int num, int walls)
---
> static void alloc_stairs(int Depth, int feat, int num, int walls)
533,534c539,540
< y = rand_int(cur_hgt);
< x = rand_int(cur_wid);
---
> y = rand_int(Depth ? MAX_HGT : SCREEN_HGT);
> x = rand_int(Depth ? MAX_WID : SCREEN_WID);
537c543
< if (!cave_naked_bold(y, x)) continue;
---
> if (!cave_naked_bold(Depth, y, x)) continue;
540c546
< if (next_to_walls(y, x) < walls) continue;
---
> if (next_to_walls(Depth, y, x) < walls) continue;
543c549
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
546c552
< if (!dun_level)
---
> if (!Depth)
553c559
< else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1))
---
> else if (is_quest(Depth) || (Depth >= MAX_DEPTH-1))
563a570,576
>
> if (feat == FEAT_LESS)
> {
> /* Set this to be the preferred starting location */
> level_start_y[Depth] = y;
> level_start_x[Depth] = x;
> }
582c595
< static void alloc_object(int set, int typ, int num)
---
> static void alloc_object(int Depth, int set, int typ, int num)
595,596c608,609
< y = rand_int(cur_hgt);
< x = rand_int(cur_wid);
---
> y = rand_int(Depth ? MAX_HGT : SCREEN_HGT);
> x = rand_int(Depth ? MAX_WID : SCREEN_WID);
599c612
< if (!cave_naked_bold(y, x)) continue;
---
> if (!cave_naked_bold(Depth, y, x)) continue;
602c615
< room = (cave[y][x].info & CAVE_ROOM) ? TRUE : FALSE;
---
> room = (cave[Depth][y][x].info & CAVE_ROOM) ? TRUE : FALSE;
619c632
< place_rubble(y, x);
---
> place_rubble(Depth, y, x);
625c638
< place_trap(y, x);
---
> place_trap(Depth, y, x);
631c644
< place_gold(y, x);
---
> place_gold(Depth, y, x);
637c650
< place_object(y, x, FALSE, FALSE);
---
> place_object(Depth, y, x, FALSE, FALSE);
654c667
< static void build_streamer(int feat, int chance)
---
> static void build_streamer(int Depth, int feat, int chance)
662,663c675,676
< y = rand_spread(cur_hgt / 2, 10);
< x = rand_spread(cur_wid / 2, 15);
---
> y = rand_spread((Depth ? MAX_HGT : SCREEN_HGT) / 2, 10);
> x = rand_spread((Depth ? MAX_WID : SCREEN_WID) / 2, 15);
681c694
< if (!in_bounds2(ty, tx)) continue;
---
> if (!in_bounds2(Depth, ty, tx)) continue;
686c699
< c_ptr = &cave[ty][tx];
---
> c_ptr = &cave[Depth][ty][tx];
704c717
< if (!in_bounds(y, x)) break;
---
> if (!in_bounds(Depth, y, x)) break;
712c725
< static void destroy_level(void)
---
> static void destroy_level(int Depth)
719c732
< if (cheat_room) msg_print("Destroyed Level");
---
> /*if (cheat_room) msg_print("Destroyed Level");*/
725,726c738,739
< x1 = rand_range(5, cur_wid-1 - 5);
< y1 = rand_range(5, cur_hgt-1 - 5);
---
> y1 = rand_range(5, (Depth ? MAX_HGT : SCREEN_HGT) - 6);
> x1 = rand_range(5, (Depth ? MAX_WID : SCREEN_WID) - 6);
734c747
< if (!in_bounds(y, x)) continue;
---
> if (!in_bounds(Depth, y, x)) continue;
743c756
< delete_monster(y, x);
---
> delete_monster(Depth, y, x);
746c759
< if (cave_valid_bold(y, x))
---
> if (cave_valid_bold(Depth, y, x))
749c762
< delete_object(y, x);
---
> delete_object(Depth, y, x);
752c765
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
789c802
< c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
---
> c_ptr->info &= ~CAVE_GLOW;
802c815
< static void vault_objects(int y, int x, int num)
---
> static void vault_objects(int Depth, int y, int x, int num)
817c830
< if (!in_bounds(j, k)) continue;
---
> if (!in_bounds(Depth, j, k)) continue;
822c835
< if (!cave_clean_bold(j, k)) continue;
---
> if (!cave_clean_bold(Depth, j, k)) continue;
827c840
< place_object(j, k, FALSE, FALSE);
---
> place_object(Depth, j, k, FALSE, FALSE);
833c846
< place_gold(j, k);
---
> place_gold(Depth, j, k);
846c859
< static void vault_trap_aux(int y, int x, int yd, int xd)
---
> static void vault_trap_aux(int Depth, int y, int x, int yd, int xd)
858c871
< if (!in_bounds(y1, x1)) continue;
---
> if (!in_bounds(Depth, y1, x1)) continue;
863c876
< if (!cave_naked_bold(y1, x1)) continue;
---
> if (!cave_naked_bold(Depth, y1, x1)) continue;
866c879
< place_trap(y1, x1);
---
> place_trap(Depth, y1, x1);
877c890
< static void vault_traps(int y, int x, int yd, int xd, int num)
---
> static void vault_traps(int Depth, int y, int x, int yd, int xd, int num)
883c896
< vault_trap_aux(y, x, yd, xd);
---
> vault_trap_aux(Depth, y, x, yd, xd);
891c904
< static void vault_monsters(int y1, int x1, int num)
---
> static void vault_monsters(int Depth, int y1, int x1, int num)
904c917
< scatter(&y, &x, y1, x1, d, 0);
---
> scatter(Depth, &y, &x, y1, x1, d, 0);
907c920
< if (!cave_empty_bold(y, x)) continue;
---
> if (!cave_empty_bold(Depth, y, x)) continue;
910,912c923,925
< monster_level = dun_level + 2;
< (void)place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
---
> monster_level = Depth + 2;
> (void)place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
938c951
< static void build_type1(int yval, int xval)
---
> static void build_type1(int Depth, int yval, int xval)
949c962
< light = (dun_level <= randint(25));
---
> light = (Depth <= randint(25));
964c977
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
974c987
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
976c989
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
981c994
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
983c996
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
995c1008
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1006c1019
< c_ptr = &cave[y][x1];
---
> c_ptr = &cave[Depth][y][x1];
1008c1021
< c_ptr = &cave[y][x2];
---
> c_ptr = &cave[Depth][y][x2];
1013c1026
< c_ptr = &cave[y1][x];
---
> c_ptr = &cave[Depth][y1][x];
1015c1028
< c_ptr = &cave[y2][x];
---
> c_ptr = &cave[Depth][y2][x];
1025c1038
< static void build_type2(int yval, int xval)
---
> static void build_type2(int Depth, int yval, int xval)
1038c1051
< light = (dun_level <= randint(25));
---
> light = (Depth <= randint(25));
1059c1072
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1071c1084
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1082c1095
< c_ptr = &cave[y][x1a-1];
---
> c_ptr = &cave[Depth][y][x1a-1];
1084c1097
< c_ptr = &cave[y][x2a+1];
---
> c_ptr = &cave[Depth][y][x2a+1];
1089c1102
< c_ptr = &cave[y1a-1][x];
---
> c_ptr = &cave[Depth][y1a-1][x];
1091c1104
< c_ptr = &cave[y2a+1][x];
---
> c_ptr = &cave[Depth][y2a+1][x];
1098c1111
< c_ptr = &cave[y][x1b-1];
---
> c_ptr = &cave[Depth][y][x1b-1];
1100c1113
< c_ptr = &cave[y][x2b+1];
---
> c_ptr = &cave[Depth][y][x2b+1];
1105c1118
< c_ptr = &cave[y1b-1][x];
---
> c_ptr = &cave[Depth][y1b-1][x];
1107c1120
< c_ptr = &cave[y2b+1][x];
---
> c_ptr = &cave[Depth][y2b+1][x];
1118c1131
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1128c1141
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1148c1161
< static void build_type3(int yval, int xval)
---
> static void build_type3(int Depth, int yval, int xval)
1161c1174
< light = (dun_level <= randint(25));
---
> light = (Depth <= randint(25));
1192c1205
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1204c1217
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1215c1228
< c_ptr = &cave[y][x1a-1];
---
> c_ptr = &cave[Depth][y][x1a-1];
1217c1230
< c_ptr = &cave[y][x2a+1];
---
> c_ptr = &cave[Depth][y][x2a+1];
1222c1235
< c_ptr = &cave[y1a-1][x];
---
> c_ptr = &cave[Depth][y1a-1][x];
1224c1237
< c_ptr = &cave[y2a+1][x];
---
> c_ptr = &cave[Depth][y2a+1][x];
1231c1244
< c_ptr = &cave[y][x1b-1];
---
> c_ptr = &cave[Depth][y][x1b-1];
1233c1246
< c_ptr = &cave[y][x2b+1];
---
> c_ptr = &cave[Depth][y][x2b+1];
1238c1251
< c_ptr = &cave[y1b-1][x];
---
> c_ptr = &cave[Depth][y1b-1][x];
1240c1253
< c_ptr = &cave[y2b+1][x];
---
> c_ptr = &cave[Depth][y2b+1][x];
1250c1263
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1260c1273
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1276c1289
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1288c1301
< c_ptr = &cave[y][x1a];
---
> c_ptr = &cave[Depth][y][x1a];
1290c1303
< c_ptr = &cave[y][x2a];
---
> c_ptr = &cave[Depth][y][x2a];
1295c1308
< c_ptr = &cave[y1b][x];
---
> c_ptr = &cave[Depth][y1b][x];
1297c1310
< c_ptr = &cave[y2b][x];
---
> c_ptr = &cave[Depth][y2b][x];
1304,1307c1317,1320
< case 0: place_secret_door(y1b, xval); break;
< case 1: place_secret_door(y2b, xval); break;
< case 2: place_secret_door(yval, x1a); break;
< case 3: place_secret_door(yval, x2a); break;
---
> case 0: place_secret_door(Depth, y1b, xval); break;
> case 1: place_secret_door(Depth, y2b, xval); break;
> case 2: place_secret_door(Depth, yval, x1a); break;
> case 3: place_secret_door(Depth, yval, x2a); break;
1311c1324
< place_object(yval, xval, FALSE, FALSE);
---
> place_object(Depth, yval, xval, FALSE, FALSE);
1314c1327
< vault_monsters(yval, xval, rand_int(2) + 3);
---
> vault_monsters(Depth, yval, xval, rand_int(2) + 3);
1317c1330
< vault_traps(yval, xval, 4, 4, rand_int(3) + 2);
---
> vault_traps(Depth, yval, xval, 4, 4, rand_int(3) + 2);
1332c1345
< c_ptr = &cave[y][x1a - 1];
---
> c_ptr = &cave[Depth][y][x1a - 1];
1334c1347
< c_ptr = &cave[y][x2a + 1];
---
> c_ptr = &cave[Depth][y][x2a + 1];
1342c1355
< c_ptr = &cave[y1b - 1][x];
---
> c_ptr = &cave[Depth][y1b - 1][x];
1344c1357
< c_ptr = &cave[y2b + 1][x];
---
> c_ptr = &cave[Depth][y2b + 1][x];
1351,1354c1364,1367
< place_secret_door(yval, x1a - 1);
< place_secret_door(yval, x2a + 1);
< place_secret_door(y1b - 1, xval);
< place_secret_door(y2b + 1, xval);
---
> place_secret_door(Depth, yval, x1a - 1);
> place_secret_door(Depth, yval, x2a + 1);
> place_secret_door(Depth, y1b - 1, xval);
> place_secret_door(Depth, y2b + 1, xval);
1361c1374
< c_ptr = &cave[yval][xval];
---
> c_ptr = &cave[Depth][yval][xval];
1363c1376
< c_ptr = &cave[y1b][xval];
---
> c_ptr = &cave[Depth][y1b][xval];
1365c1378
< c_ptr = &cave[y2b][xval];
---
> c_ptr = &cave[Depth][y2b][xval];
1367c1380
< c_ptr = &cave[yval][x1a];
---
> c_ptr = &cave[Depth][yval][x1a];
1369c1382
< c_ptr = &cave[yval][x2a];
---
> c_ptr = &cave[Depth][yval][x2a];
1376c1389
< c_ptr = &cave[yval][xval];
---
> c_ptr = &cave[Depth][yval][xval];
1395c1408
< static void build_type4(int yval, int xval)
---
> static void build_type4(int Depth, int yval, int xval)
1407c1420
< light = (dun_level <= randint(25));
---
> light = (Depth <= randint(25));
1422c1435
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1432c1445
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
1434c1447
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
1439c1452
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
1441c1454
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
1455c1468
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
1457c1470
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
1462c1475
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
1464c1477
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
1478,1481c1491,1494
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
1485c1498
< vault_monsters(yval, xval, 1);
---
> vault_monsters(Depth, yval, xval, 1);
1496,1499c1509,1512
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
1508c1521
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1516,1519c1529,1532
< case 1: place_locked_door(yval - 1, xval); break;
< case 2: place_locked_door(yval + 1, xval); break;
< case 3: place_locked_door(yval, xval - 1); break;
< case 4: place_locked_door(yval, xval + 1); break;
---
> case 1: place_locked_door(Depth, yval - 1, xval); break;
> case 2: place_locked_door(Depth, yval + 1, xval); break;
> case 3: place_locked_door(Depth, yval, xval - 1); break;
> case 4: place_locked_door(Depth, yval, xval + 1); break;
1523c1536
< vault_monsters(yval, xval, randint(3) + 2);
---
> vault_monsters(Depth, yval, xval, randint(3) + 2);
1528c1541
< place_object(yval, xval, FALSE, FALSE);
---
> place_object(Depth, yval, xval, FALSE, FALSE);
1534c1547
< place_random_stairs(yval, xval);
---
> place_random_stairs(Depth, yval, xval);
1538c1551
< vault_traps(yval, xval, 4, 10, 2 + randint(3));
---
> vault_traps(Depth, yval, xval, 4, 10, 2 + randint(3));
1549,1552c1562,1565
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
1560c1573
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1573c1586
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1578c1591
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1590c1603
< c_ptr = &cave[yval-1][x];
---
> c_ptr = &cave[Depth][yval-1][x];
1592c1605
< c_ptr = &cave[yval+1][x];
---
> c_ptr = &cave[Depth][yval+1][x];
1597c1610
< c_ptr = &cave[yval][xval-5];
---
> c_ptr = &cave[Depth][yval][xval-5];
1599c1612
< c_ptr = &cave[yval][xval+5];
---
> c_ptr = &cave[Depth][yval][xval+5];
1603,1604c1616,1617
< place_secret_door(yval - 3 + (randint(2) * 2), xval - 3);
< place_secret_door(yval - 3 + (randint(2) * 2), xval + 3);
---
> place_secret_door(Depth, yval - 3 + (randint(2) * 2), xval - 3);
> place_secret_door(Depth, yval - 3 + (randint(2) * 2), xval + 3);
1607,1608c1620,1621
< vault_monsters(yval, xval - 2, randint(2));
< vault_monsters(yval, xval + 2, randint(2));
---
> vault_monsters(Depth, yval, xval - 2, randint(2));
> vault_monsters(Depth, yval, xval + 2, randint(2));
1611,1612c1624,1625
< if (rand_int(3) == 0) place_object(yval, xval - 2, FALSE, FALSE);
< if (rand_int(3) == 0) place_object(yval, xval + 2, FALSE, FALSE);
---
> if (rand_int(3) == 0) place_object(Depth, yval, xval - 2, FALSE, FALSE);
> if (rand_int(3) == 0) place_object(Depth, yval, xval + 2, FALSE, FALSE);
1624,1627c1637,1640
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
1637c1650
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1644,1645c1657,1658
< vault_monsters(yval, xval - 5, randint(3));
< vault_monsters(yval, xval + 5, randint(3));
---
> vault_monsters(Depth, yval, xval - 5, randint(3));
> vault_monsters(Depth, yval, xval + 5, randint(3));
1648,1649c1661,1662
< vault_traps(yval, xval - 3, 2, 8, randint(3));
< vault_traps(yval, xval + 3, 2, 8, randint(3));
---
> vault_traps(Depth, yval, xval - 3, 2, 8, randint(3));
> vault_traps(Depth, yval, xval + 3, 2, 8, randint(3));
1652c1665
< vault_objects(yval, xval, 3);
---
> vault_objects(Depth, yval, xval, 3);
1663c1676
< c_ptr = &cave[y][xval];
---
> c_ptr = &cave[Depth][y][xval];
1668c1681
< c_ptr = &cave[yval][x];
---
> c_ptr = &cave[Depth][yval][x];
1676,1679c1689,1692
< place_secret_door(y1 - 1, xval - i);
< place_secret_door(y1 - 1, xval + i);
< place_secret_door(y2 + 1, xval - i);
< place_secret_door(y2 + 1, xval + i);
---
> place_secret_door(Depth, y1 - 1, xval - i);
> place_secret_door(Depth, y1 - 1, xval + i);
> place_secret_door(Depth, y2 + 1, xval - i);
> place_secret_door(Depth, y2 + 1, xval + i);
1684,1687c1697,1700
< place_secret_door(yval + i, x1 - 1);
< place_secret_door(yval - i, x1 - 1);
< place_secret_door(yval + i, x2 + 1);
< place_secret_door(yval - i, x2 + 1);
---
> place_secret_door(Depth, yval + i, x1 - 1);
> place_secret_door(Depth, yval - i, x1 - 1);
> place_secret_door(Depth, yval + i, x2 + 1);
> place_secret_door(Depth, yval - i, x2 + 1);
1691c1704
< vault_objects(yval, xval, 2 + randint(2));
---
> vault_objects(Depth, yval, xval, 2 + randint(2));
1694,1697c1707,1710
< vault_monsters(yval + 1, xval - 4, randint(4));
< vault_monsters(yval + 1, xval + 4, randint(4));
< vault_monsters(yval - 1, xval - 4, randint(4));
< vault_monsters(yval - 1, xval + 4, randint(4));
---
> vault_monsters(Depth, yval + 1, xval - 4, randint(4));
> vault_monsters(Depth, yval + 1, xval + 4, randint(4));
> vault_monsters(Depth, yval - 1, xval - 4, randint(4));
> vault_monsters(Depth, yval - 1, xval + 4, randint(4));
1899c1912
< static void build_type5(int yval, int xval)
---
> static void build_type5(int Depth, int yval, int xval)
1926c1939
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1935c1948
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
1937c1950
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
1942c1955
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
1944c1957
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
1958c1971
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
1960c1973
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
1965c1978
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
1967c1980
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
1975,1978c1988,1991
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
1983c1996
< tmp = randint(dun_level);
---
> tmp = randint(Depth);
2023c2036
< what[i] = get_mon_num(dun_level + 10);
---
> what[i] = get_mon_num(Depth + 10);
2045c2058
< msg_format("Monster nest (%s)", name);
---
> /*msg_format("Monster nest (%s)", name);*/
2053c2066
< if ((dun_level <= 40) && (randint(dun_level*dun_level + 1) < 300))
---
> if ((Depth <= 40) && (randint(Depth*Depth + 1) < 300))
2067c2080
< (void)place_monster_aux(y, x, r_idx, FALSE, FALSE);
---
> (void)place_monster_aux(Depth, y, x, r_idx, FALSE, FALSE);
2117c2130
< static void build_type6(int yval, int xval)
---
> static void build_type6(int Depth, int yval, int xval)
2142c2155
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2151c2164
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
2153c2166
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
2158c2171
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
2160c2173
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
2174c2187
< c_ptr = &cave[y][x1-1];
---
> c_ptr = &cave[Depth][y][x1-1];
2176c2189
< c_ptr = &cave[y][x2+1];
---
> c_ptr = &cave[Depth][y][x2+1];
2181c2194
< c_ptr = &cave[y1-1][x];
---
> c_ptr = &cave[Depth][y1-1][x];
2183c2196
< c_ptr = &cave[y2+1][x];
---
> c_ptr = &cave[Depth][y2+1][x];
2191,2194c2204,2207
< case 1: place_secret_door(y1 - 1, xval); break;
< case 2: place_secret_door(y2 + 1, xval); break;
< case 3: place_secret_door(yval, x1 - 1); break;
< case 4: place_secret_door(yval, x2 + 1); break;
---
> case 1: place_secret_door(Depth, y1 - 1, xval); break;
> case 2: place_secret_door(Depth, y2 + 1, xval); break;
> case 3: place_secret_door(Depth, yval, x1 - 1); break;
> case 4: place_secret_door(Depth, yval, x2 + 1); break;
2199c2212
< tmp = randint(dun_level);
---
> tmp = randint(Depth);
2341c2354
< what[i] = get_mon_num(dun_level + 10);
---
> what[i] = get_mon_num(Depth + 10);
2389a2403
> #if 0
2402a2417
> #endif
2409c2424
< if ((dun_level <= 40) && (randint(dun_level*dun_level + 1) < 300))
---
> if ((Depth <= 40) && (randint(Depth*Depth + 1) < 300))
2418,2419c2433,2434
< place_monster_aux(yval - 2, x, what[0], FALSE, FALSE);
< place_monster_aux(yval + 2, x, what[0], FALSE, FALSE);
---
> place_monster_aux(Depth, yval - 2, x, what[0], FALSE, FALSE);
> place_monster_aux(Depth, yval + 2, x, what[0], FALSE, FALSE);
2425,2426c2440,2441
< place_monster_aux(y, xval - 9, what[0], FALSE, FALSE);
< place_monster_aux(y, xval + 9, what[0], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 9, what[0], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 9, what[0], FALSE, FALSE);
2428,2429c2443,2444
< place_monster_aux(y, xval - 8, what[1], FALSE, FALSE);
< place_monster_aux(y, xval + 8, what[1], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 8, what[1], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 8, what[1], FALSE, FALSE);
2431,2432c2446,2447
< place_monster_aux(y, xval - 7, what[1], FALSE, FALSE);
< place_monster_aux(y, xval + 7, what[1], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 7, what[1], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 7, what[1], FALSE, FALSE);
2434,2435c2449,2450
< place_monster_aux(y, xval - 6, what[2], FALSE, FALSE);
< place_monster_aux(y, xval + 6, what[2], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 6, what[2], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 6, what[2], FALSE, FALSE);
2437,2438c2452,2453
< place_monster_aux(y, xval - 5, what[2], FALSE, FALSE);
< place_monster_aux(y, xval + 5, what[2], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 5, what[2], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 5, what[2], FALSE, FALSE);
2440,2441c2455,2456
< place_monster_aux(y, xval - 4, what[3], FALSE, FALSE);
< place_monster_aux(y, xval + 4, what[3], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 4, what[3], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 4, what[3], FALSE, FALSE);
2443,2444c2458,2459
< place_monster_aux(y, xval - 3, what[3], FALSE, FALSE);
< place_monster_aux(y, xval + 3, what[3], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 3, what[3], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 3, what[3], FALSE, FALSE);
2446,2447c2461,2462
< place_monster_aux(y, xval - 2, what[4], FALSE, FALSE);
< place_monster_aux(y, xval + 2, what[4], FALSE, FALSE);
---
> place_monster_aux(Depth, y, xval - 2, what[4], FALSE, FALSE);
> place_monster_aux(Depth, y, xval + 2, what[4], FALSE, FALSE);
2453,2454c2468,2469
< place_monster_aux(yval + 1, x, what[5], FALSE, FALSE);
< place_monster_aux(yval - 1, x, what[5], FALSE, FALSE);
---
> place_monster_aux(Depth, yval + 1, x, what[5], FALSE, FALSE);
> place_monster_aux(Depth, yval - 1, x, what[5], FALSE, FALSE);
2458,2459c2473,2474
< place_monster_aux(yval, xval + 1, what[6], FALSE, FALSE);
< place_monster_aux(yval, xval - 1, what[6], FALSE, FALSE);
---
> place_monster_aux(Depth, yval, xval + 1, what[6], FALSE, FALSE);
> place_monster_aux(Depth, yval, xval - 1, what[6], FALSE, FALSE);
2462c2477
< place_monster_aux(yval, xval, what[7], FALSE, FALSE);
---
> place_monster_aux(Depth, yval, xval, what[7], FALSE, FALSE);
2470c2485
< static void build_vault(int yval, int xval, int ymax, int xmax, cptr data)
---
> static void build_vault(int Depth, int yval, int xval, int ymax, int xmax, cptr data)
2492c2507
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2522c2537
< place_object(y, x, FALSE, FALSE);
---
> place_object(Depth, y, x, FALSE, FALSE);
2526c2541
< place_trap(y, x);
---
> place_trap(Depth, y, x);
2532c2547
< place_secret_door(y, x);
---
> place_secret_door(Depth, y, x);
2537c2552
< place_trap(y, x);
---
> place_trap(Depth, y, x);
2561,2563c2576,2578
< monster_level = dun_level + 5;
< place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
---
> monster_level = Depth + 5;
> place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
2568,2570c2583,2585
< monster_level = dun_level + 11;
< place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
---
> monster_level = Depth + 11;
> place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
2575,2580c2590,2595
< monster_level = dun_level + 9;
< place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
< object_level = dun_level + 7;
< place_object(y, x, TRUE, FALSE);
< object_level = dun_level;
---
> monster_level = Depth + 9;
> place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
> object_level = Depth + 7;
> place_object(Depth, y, x, TRUE, FALSE);
> object_level = Depth;
2585,2590c2600,2605
< monster_level = dun_level + 40;
< place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
< object_level = dun_level + 20;
< place_object(y, x, TRUE, TRUE);
< object_level = dun_level;
---
> monster_level = Depth + 40;
> place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
> object_level = Depth + 20;
> place_object(Depth, y, x, TRUE, TRUE);
> object_level = Depth;
2597,2599c2612,2614
< monster_level = dun_level + 3;
< place_monster(y, x, TRUE, TRUE);
< monster_level = dun_level;
---
> monster_level = Depth + 3;
> place_monster(Depth, y, x, TRUE, TRUE);
> monster_level = Depth;
2603,2605c2618,2620
< object_level = dun_level + 7;
< place_object(y, x, FALSE, FALSE);
< object_level = dun_level;
---
> object_level = Depth + 7;
> place_object(Depth, y, x, FALSE, FALSE);
> object_level = Depth;
2618c2633
< static void build_type7(int yval, int xval)
---
> static void build_type7(int Depth, int yval, int xval)
2633c2648
< if (cheat_room) msg_print("Lesser Vault");
---
> /*if (cheat_room) msg_print("Lesser Vault");*/
2639,2640c2654,2655
< if ((dun_level <= 50) ||
< (randint((dun_level-40) * (dun_level-40) + 1) < 400))
---
> if ((Depth <= 50) ||
> (randint((Depth-40) * (Depth-40) + 1) < 400))
2646c2661
< build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
---
> build_vault(Depth, yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
2654c2669
< static void build_type8(int yval, int xval)
---
> static void build_type8(int Depth, int yval, int xval)
2669c2684
< if (cheat_room) msg_print("Greater Vault");
---
> /*if (cheat_room) msg_print("Greater Vault");*/
2675,2676c2690,2691
< if ((dun_level <= 50) ||
< (randint((dun_level-40) * (dun_level-40) + 1) < 400))
---
> if ((Depth <= 50) ||
> (randint((Depth-40) * (Depth-40) + 1) < 400))
2682c2697
< build_vault(yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
---
> build_vault(Depth, yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text);
2721c2736
< static void build_tunnel(int row1, int col1, int row2, int col2)
---
> static void build_tunnel(int Depth, int row1, int col1, int row2, int col2)
2770c2785
< while (!in_bounds(tmp_row, tmp_col))
---
> while (!in_bounds(Depth, tmp_row, tmp_col))
2788c2803
< c_ptr = &cave[tmp_row][tmp_col];
---
> c_ptr = &cave[Depth][tmp_row][tmp_col];
2808,2809c2823,2824
< if (cave[y][x].feat == FEAT_PERM_SOLID) continue;
< if (cave[y][x].feat == FEAT_PERM_OUTER) continue;
---
> if (cave[Depth][y][x].feat == FEAT_PERM_SOLID) continue;
> if (cave[Depth][y][x].feat == FEAT_PERM_OUTER) continue;
2812,2813c2827,2828
< if (cave[y][x].feat == FEAT_WALL_OUTER) continue;
< if (cave[y][x].feat == FEAT_WALL_SOLID) continue;
---
> if (cave[Depth][y][x].feat == FEAT_WALL_OUTER) continue;
> if (cave[Depth][y][x].feat == FEAT_WALL_SOLID) continue;
2833c2848
< if (cave[y][x].feat == FEAT_WALL_OUTER)
---
> if (cave[Depth][y][x].feat == FEAT_WALL_OUTER)
2836c2851
< cave[y][x].feat = FEAT_WALL_SOLID;
---
> cave[Depth][y][x].feat = FEAT_WALL_SOLID;
2917c2932
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2932c2947
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2941c2956
< place_random_door(y, x);
---
> place_random_door(Depth, y, x);
2958c2973
< static int next_to_corr(int y1, int x1)
---
> static int next_to_corr(int Depth, int y1, int x1)
2972c2987
< if (!cave_floor_bold(y, x)) continue;
---
> if (!cave_floor_bold(Depth, y, x)) continue;
2975c2990
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2998c3013
< static bool possible_doorway(int y, int x)
---
> static bool possible_doorway(int Depth, int y, int x)
3001c3016
< if (next_to_corr(y, x) >= 2)
---
> if (next_to_corr(Depth, y, x) >= 2)
3004,3005c3019,3020
< if ((cave[y-1][x].feat >= FEAT_MAGMA) &&
< (cave[y+1][x].feat >= FEAT_MAGMA))
---
> if ((cave[Depth][y-1][x].feat >= FEAT_MAGMA) &&
> (cave[Depth][y+1][x].feat >= FEAT_MAGMA))
3011,3012c3026,3027
< if ((cave[y][x-1].feat >= FEAT_MAGMA) &&
< (cave[y][x+1].feat >= FEAT_MAGMA))
---
> if ((cave[Depth][y][x-1].feat >= FEAT_MAGMA) &&
> (cave[Depth][y][x+1].feat >= FEAT_MAGMA))
3026c3041
< static void try_door(int y, int x)
---
> static void try_door(int Depth, int y, int x)
3029c3044
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
3032c3047
< if (cave[y][x].feat >= FEAT_MAGMA) return;
---
> if (cave[Depth][y][x].feat >= FEAT_MAGMA) return;
3035c3050
< if (cave[y][x].info & CAVE_ROOM) return;
---
> if (cave[Depth][y][x].info & CAVE_ROOM) return;
3038c3053
< if ((rand_int(100) < DUN_TUN_JCT) && possible_doorway(y, x))
---
> if ((rand_int(100) < DUN_TUN_JCT) && possible_doorway(Depth, y, x))
3041c3056
< place_random_door(y, x);
---
> place_random_door(Depth, y, x);
3054c3069
< static bool room_build(int y0, int x0, int typ)
---
> static bool room_build(int Depth, int y0, int x0, int typ)
3060c3075
< if (dun_level < room[typ].level) return (FALSE);
---
> if (Depth < room[typ].level) return (FALSE);
3095,3102c3110,3117
< case 8: build_type8(y, x); break;
< case 7: build_type7(y, x); break;
< case 6: build_type6(y, x); break;
< case 5: build_type5(y, x); break;
< case 4: build_type4(y, x); break;
< case 3: build_type3(y, x); break;
< case 2: build_type2(y, x); break;
< case 1: build_type1(y, x); break;
---
> case 8: build_type8(Depth, y, x); break;
> case 7: build_type7(Depth, y, x); break;
> case 6: build_type6(Depth, y, x); break;
> case 5: build_type5(Depth, y, x); break;
> case 4: build_type4(Depth, y, x); break;
> case 3: build_type3(Depth, y, x); break;
> case 2: build_type2(Depth, y, x); break;
> case 1: build_type1(Depth, y, x); break;
3138c3153
< static void cave_gen(void)
---
> static void cave_gen(int Depth)
3152c3167
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < MAX_HGT; y++)
3154c3169
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < MAX_WID; x++)
3156c3171
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
3165c3180
< if ((dun_level > 10) && (rand_int(DUN_DEST) == 0)) destroyed = TRUE;
---
> if ((Depth > 10) && (rand_int(DUN_DEST) == 0)) destroyed = TRUE;
3168c3183
< if (is_quest(dun_level)) destroyed = FALSE;
---
> if (is_quest(Depth)) destroyed = FALSE;
3172,3173c3187,3188
< dun->row_rooms = cur_hgt / BLOCK_HGT;
< dun->col_rooms = cur_wid / BLOCK_WID;
---
> dun->row_rooms = MAX_HGT / BLOCK_HGT;
> dun->col_rooms = MAX_WID / BLOCK_WID;
3213c3228
< if (room_build(y, x, 1)) continue;
---
> if (room_build(Depth, y, x, 1)) continue;
3220c3235
< if (rand_int(DUN_UNUSUAL) < dun_level)
---
> if (rand_int(DUN_UNUSUAL) < Depth)
3226c3241
< if (rand_int(DUN_UNUSUAL) < dun_level)
---
> if (rand_int(DUN_UNUSUAL) < Depth)
3229c3244
< if ((k < 10) && room_build(y, x, 8)) continue;
---
> if ((k < 10) && room_build(Depth, y, x, 8)) continue;
3232c3247
< if ((k < 25) && room_build(y, x, 7)) continue;
---
> if ((k < 25) && room_build(Depth, y, x, 7)) continue;
3235c3250
< if ((k < 40) && room_build(y, x, 6)) continue;
---
> if ((k < 40) && room_build(Depth, y, x, 6)) continue;
3238c3253
< if ((k < 50) && room_build(y, x, 5)) continue;
---
> if ((k < 50) && room_build(Depth, y, x, 5)) continue;
3242c3257
< if ((k < 25) && room_build(y, x, 4)) continue;
---
> if ((k < 25) && room_build(Depth, y, x, 4)) continue;
3245c3260
< if ((k < 50) && room_build(y, x, 3)) continue;
---
> if ((k < 50) && room_build(Depth, y, x, 3)) continue;
3248c3263
< if ((k < 100) && room_build(y, x, 2)) continue;
---
> if ((k < 100) && room_build(Depth, y, x, 2)) continue;
3252c3267
< if (room_build(y, x, 1)) continue;
---
> if (room_build(Depth, y, x, 1)) continue;
3257c3272
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < MAX_WID; x++)
3259c3274
< cave_type *c_ptr = &cave[0][x];
---
> cave_type *c_ptr = &cave[Depth][0][x];
3266c3281
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < MAX_WID; x++)
3268c3283
< cave_type *c_ptr = &cave[cur_hgt-1][x];
---
> cave_type *c_ptr = &cave[Depth][MAX_HGT-1][x];
3275c3290
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < MAX_HGT; y++)
3277c3292
< cave_type *c_ptr = &cave[y][0];
---
> cave_type *c_ptr = &cave[Depth][y][0];
3284c3299
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < MAX_HGT; y++)
3286c3301
< cave_type *c_ptr = &cave[y][cur_wid-1];
---
> cave_type *c_ptr = &cave[Depth][y][MAX_WID-1];
3317c3332
< build_tunnel(dun->cent[i].y, dun->cent[i].x, y, x);
---
> build_tunnel(Depth, dun->cent[i].y, dun->cent[i].x, y, x);
3332,3335c3347,3350
< try_door(y, x - 1);
< try_door(y, x + 1);
< try_door(y - 1, x);
< try_door(y + 1, x);
---
> try_door(Depth, y, x - 1);
> try_door(Depth, y, x + 1);
> try_door(Depth, y - 1, x);
> try_door(Depth, y + 1, x);
3342c3357
< build_streamer(FEAT_MAGMA, DUN_STR_MC);
---
> build_streamer(Depth, FEAT_MAGMA, DUN_STR_MC);
3348c3363
< build_streamer(FEAT_QUARTZ, DUN_STR_QC);
---
> build_streamer(Depth, FEAT_QUARTZ, DUN_STR_QC);
3353c3368
< if (destroyed) destroy_level();
---
> if (destroyed) destroy_level(Depth);
3357c3372
< alloc_stairs(FEAT_MORE, rand_range(3, 4), 3);
---
> alloc_stairs(Depth, FEAT_MORE, rand_range(3, 4), 3);
3360c3375
< alloc_stairs(FEAT_LESS, rand_range(1, 2), 3);
---
> alloc_stairs(Depth, FEAT_LESS, rand_range(1, 2), 3);
3364c3379
< new_player_spot();
---
> /*new_player_spot(Depth);*/
3368c3383
< k = (dun_level / 3);
---
> k = (Depth / 3);
3379c3394
< (void)alloc_monster(0, TRUE);
---
> (void)alloc_monster(Depth, 0, TRUE);
3384c3399
< alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint(k));
---
> alloc_object(Depth, ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint(k));
3387c3402
< alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint(k));
---
> alloc_object(Depth, ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint(k));
3390c3405
< alloc_object(ALLOC_SET_ROOM, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ROOM, 3));
---
> alloc_object(Depth, ALLOC_SET_ROOM, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ROOM, 3));
3393,3394c3408,3409
< alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ITEM, 3));
< alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
---
> alloc_object(Depth, ALLOC_SET_BOTH, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ITEM, 3));
> alloc_object(Depth, ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
3435c3450
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[0][y][x];
3441c3456
< c_ptr->info |= (CAVE_GLOW | CAVE_MARK);
---
> c_ptr->info |= (CAVE_GLOW);
3487c3502
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[0][y][x];
3544,3545c3559,3560
< y = rand_range(3, cur_hgt - 4);
< x = rand_range(3, cur_wid - 4);
---
> y = rand_range(3, SCREEN_HGT - 4);
> x = rand_range(3, SCREEN_WID - 4);
3548c3563
< if (cave_naked_bold(y, x)) break;
---
> if (cave_naked_bold(0, y, x)) break;
3552c3567
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[0][y][x];
3558c3573
< c_ptr->info |= CAVE_MARK;
---
> /*c_ptr->info |= CAVE_MARK;*/
3560,3562c3575,3577
< /* Hack -- the player starts on the stairs */
< py = y;
< px = x;
---
> /* Hack -- the players start on the stairs */
> level_start_y[0] = y;
> level_start_x[0] = x;
3595c3610
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < SCREEN_HGT; y++)
3597c3612
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < SCREEN_WID; x++)
3599c3614
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[0][y][x];
3608c3623
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < SCREEN_WID; x++)
3611c3626
< c_ptr = &cave[0][x];
---
> c_ptr = &cave[0][0][x];
3620c3635
< c_ptr = &cave[cur_hgt-1][x];
---
> c_ptr = &cave[0][SCREEN_HGT-1][x];
3626c3641
< c_ptr->info |= (CAVE_GLOW | CAVE_MARK);
---
> c_ptr->info |= (CAVE_GLOW);
3630c3645
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < SCREEN_HGT; y++)
3633c3648
< c_ptr = &cave[y][0];
---
> c_ptr = &cave[0][y][0];
3639c3654
< c_ptr->info |= (CAVE_GLOW | CAVE_MARK);
---
> c_ptr->info |= (CAVE_GLOW);
3642c3657
< c_ptr = &cave[y][cur_wid-1];
---
> c_ptr = &cave[0][y][SCREEN_WID-1];
3648c3663
< c_ptr->info |= (CAVE_GLOW | CAVE_MARK);
---
> c_ptr->info |= (CAVE_GLOW);
3660c3675
< for (y = 0; y < cur_hgt; y++)
---
> for (y = 0; y < SCREEN_HGT; y++)
3662c3677
< for (x = 0; x < cur_wid; x++)
---
> for (x = 0; x < SCREEN_WID; x++)
3664c3679
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[0][y][x];
3670c3685
< if (view_perma_grids) c_ptr->info |= CAVE_MARK;
---
> /*if (view_perma_grids) c_ptr->info |= CAVE_MARK;*/
3675c3690
< for (i = 0; i < MIN_M_ALLOC_TD; i++) (void)alloc_monster(3, TRUE);
---
> for (i = 0; i < MIN_M_ALLOC_TD; i++) (void)alloc_monster(0, 3, TRUE);
3682c3697
< for (i = 0; i < MIN_M_ALLOC_TN; i++) (void)alloc_monster(3, TRUE);
---
> for (i = 0; i < MIN_M_ALLOC_TN; i++) (void)alloc_monster(0, 3, TRUE);
3686a3702
>
3694c3710
< void generate_cave(void)
---
> void generate_cave(int Depth)
3700c3716
< character_dungeon = FALSE;
---
> server_dungeon = FALSE;
3711,3712c3727,3728
< o_max = 1;
< m_max = 1;
---
> /*o_max = 1;
> m_max = 1;*/
3718c3734
< C_WIPE(cave[i], MAX_WID, cave_type);
---
> C_WIPE(cave[Depth][i], MAX_WID, cave_type);
3723c3739
< px = py = 0;
---
> /*px = py = 0;*/
3727c3743
< panel_row_min = 0;
---
> /*panel_row_min = 0;
3730c3746
< panel_col_max = 0;
---
> panel_col_max = 0;*/
3734c3750
< monster_level = dun_level;
---
> monster_level = Depth;
3737c3753
< object_level = dun_level;
---
> object_level = Depth;
3747c3763
< if (!dun_level)
---
> if (!Depth)
3750,3751c3766,3767
< cur_hgt = SCREEN_HGT;
< cur_wid = SCREEN_WID;
---
> /*cur_hgt = SCREEN_HGT;
> cur_wid = SCREEN_WID;*/
3754,3755c3770,3771
< max_panel_rows = (cur_hgt / SCREEN_HGT) * 2 - 2;
< max_panel_cols = (cur_wid / SCREEN_WID) * 2 - 2;
---
> /*max_panel_rows = (cur_hgt / SCREEN_HGT) * 2 - 2;
> max_panel_cols = (cur_wid / SCREEN_WID) * 2 - 2;*/
3758,3759c3774,3775
< panel_row = max_panel_rows;
< panel_col = max_panel_cols;
---
> /*panel_row = max_panel_rows;
> panel_col = max_panel_cols;*/
3769,3770c3785,3786
< cur_hgt = MAX_HGT;
< cur_wid = MAX_WID;
---
> /*cur_hgt = MAX_HGT;
> cur_wid = MAX_WID;*/
3773,3774c3789,3790
< max_panel_rows = (cur_hgt / SCREEN_HGT) * 2 - 2;
< max_panel_cols = (cur_wid / SCREEN_WID) * 2 - 2;
---
> /*max_panel_rows = (cur_hgt / SCREEN_HGT) * 2 - 2;
> max_panel_cols = (cur_wid / SCREEN_WID) * 2 - 2;*/
3777,3778c3793,3794
< panel_row = max_panel_rows;
< panel_col = max_panel_cols;
---
> /*panel_row = max_panel_rows;
> panel_col = max_panel_cols;*/
3781c3797
< cave_gen();
---
> cave_gen(Depth);
3797c3813
< if (good_item_flag && !p_ptr->preserve) feeling = 1;
---
> if (good_item_flag) feeling = 1;
3803c3819
< if (!dun_level) feeling = 0;
---
> if (!Depth) feeling = 0;
3831,3834c3847,3850
< ((dun_level >= 5) && (feeling > 8)) ||
< ((dun_level >= 10) && (feeling > 7)) ||
< ((dun_level >= 20) && (feeling > 6)) ||
< ((dun_level >= 40) && (feeling > 5)))
---
> ((Depth >= 5) && (feeling > 8)) ||
> ((Depth >= 10) && (feeling > 7)) ||
> ((Depth >= 20) && (feeling > 6)) ||
> ((Depth >= 40) && (feeling > 5)))
3854c3870
< if (why) msg_format("Generation restarted (%s)", why);
---
> if (why) printf("Generation restarted (%s)\n", why);
3857c3873
< wipe_o_list();
---
> wipe_o_list(Depth);
3860c3876
< wipe_m_list();
---
> wipe_m_list(Depth);
3865c3881
< character_dungeon = TRUE;
---
> server_dungeon = TRUE;
Only in src-280: h-basic.h
Only in src-280: h-config.h
Only in src-280: h-define.h
Only in src-280: h-system.h
Only in src-280: h-type.h
diff -r src-280/init1.c mangband-000/src/server/init1.c
4a5,6
> #define SERVER
>
939c941
< msg_format("Unknown object flag '%s'.", what);
---
> printf("Unknown object flag '%s'.", what);
1292c1294
< msg_format("Unknown artifact flag '%s'.", what);
---
> printf("Unknown artifact flag '%s'.", what);
1587c1589
< msg_format("Unknown ego-item flag '%s'.", what);
---
> printf("Unknown ego-item flag '%s'.", what);
1872c1874
< msg_format("Unknown monster flag '%s'.", what);
---
> printf("Unknown monster flag '%s'.", what);
1917c1919
< msg_format("Unknown monster flag '%s'.", what);
---
> printf("Unknown monster flag '%s'.", what);
diff -r src-280/init2.c mangband-000/src/server/init2.c
4a5,6
> #define SERVER
>
289c291
< Term_clear();
---
> /*Term_clear();*/
300,301d301
< int i = 0;
<
306c306,307
< Term_putstr(0, i++, -1, TERM_WHITE, buf);
---
> printf(buf);
> printf("\n");
314c315
< Term_fresh();
---
> /*Term_fresh();*/
355a357
> #if 0
361a364
> #endif
529,530c532,533
< msg_print("Ignoring obsolete/defective 'f_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'f_info.raw' file.");
> /*print(NULL);*/
574,577c577,580
< msg_format("Error %d at line %d of 'f_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'f_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
782,783c785,786
< msg_print("Ignoring obsolete/defective 'k_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'k_info.raw' file.");
> /*msg_print(NULL);*/
827,830c830,833
< msg_format("Error %d at line %d of 'k_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'k_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
1035,1036c1038,1039
< msg_print("Ignoring obsolete/defective 'a_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'a_info.raw' file.");
> /*msg_print(NULL);*/
1080,1083c1083,1086
< msg_format("Error %d at line %d of 'a_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'a_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
1288,1289c1291,1292
< msg_print("Ignoring obsolete/defective 'e_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'e_info.raw' file.");
> /*msg_print(NULL);*/
1333,1336c1336,1339
< msg_format("Error %d at line %d of 'e_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'e_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
1541,1542c1544,1545
< msg_print("Ignoring obsolete/defective 'r_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'r_info.raw' file.");
> /*msg_print(NULL);*/
1586,1589c1589,1592
< msg_format("Error %d at line %d of 'r_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'r_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
1793,1794c1796,1797
< msg_print("Ignoring obsolete/defective 'v_info.raw' file.");
< msg_print(NULL);
---
> printf("Ignoring obsolete/defective 'v_info.raw' file.");
> /*msg_print(NULL);*/
1838,1841c1841,1844
< msg_format("Error %d at line %d of 'v_info.txt'.", err, error_line);
< msg_format("Record %d contains a '%s' error.", error_idx, oops);
< msg_format("Parsing '%s'.", buf);
< msg_print(NULL);
---
> printf("Error %d at line %d of 'v_info.txt'.", err, error_line);
> printf("Record %d contains a '%s' error.", error_idx, oops);
> printf("Parsing '%s'.", buf);
> /*msg_print(NULL);*/
2195c2198,2201
< /* Allocate and wipe each line of the cave */
---
> /* Allocate "permament" space for the town */
> C_MAKE(cave[0], MAX_HGT, cave_type *);
>
> /* Allocate and wipe each line of the town level */
2199c2205
< C_MAKE(cave[i], MAX_WID, cave_type);
---
> C_MAKE(cave[0][i], MAX_WID, cave_type);
2227c2233,2234
< C_MAKE(inventory, INVEN_TOTAL, object_type);
---
> /* This is done on player initialization --KLJ-- */
> /*C_MAKE(inventory, INVEN_TOTAL, object_type);*/
2331a2339,2345
> /* Turn on color */
> use_color = TRUE;
> view_bright_lite = TRUE;
> view_granite_lite = TRUE;
> view_special_lite = TRUE;
> view_perma_grids = TRUE;
>
2569c2583
< note("[Initializing arrays... (features)]");
---
> printf("[Initializing arrays... (features)]\n");
2573c2587
< note("[Initializing arrays... (objects)]");
---
> printf("[Initializing arrays... (objects)]\n");
2577c2591
< note("[Initializing arrays... (artifacts)]");
---
> printf("[Initializing arrays... (artifacts)]\n");
2581c2595
< note("[Initializing arrays... (ego-items)]");
---
> printf("[Initializing arrays... (ego-items)]\n");
2585c2599
< note("[Initializing arrays... (monsters)]");
---
> printf("[Initializing arrays... (monsters)]\n");
2589c2603
< note("[Initializing arrays... (vaults)]");
---
> printf("[Initializing arrays... (vaults)]\n");
2593c2607
< note("[Initializing arrays... (other)]");
---
> printf("[Initializing arrays... (other)]\n");
2597c2611
< note("[Initializing arrays... (alloc)]");
---
> printf("[Initializing arrays... (alloc)]\n");
2601c2615
< note("[Initializing arrays... done]");
---
> printf("[Initializing arrays... done]\n");
diff -r src-280/load2.c mangband-000/src/server/load2.c
4a5,6
> #define SERVER
>
78a81,82
> return (FALSE);
>
101a106
> #if 0
111a117
> #endif
248a255
> #if 0
254a262
> #endif
488a497
> rd_byte(&o_ptr->dun_depth);
545c554,555
< rd_byte(&o_ptr->marked);
---
> strip_bytes(1);
> /*rd_byte(&o_ptr->marked);*/
840a851
> #if 0
863a875
> #endif
871a884
> #if 0
976a990
> #endif
983a998
> #if 0
1021a1037
> #endif
1027a1044
> #if 0
1051a1069
> #endif
1066a1085
> #if 0
1189a1209
> #endif
1199a1220
> #if 0
1220a1242
> #endif
1229c1251
< static void rd_extra(void)
---
> static bool rd_extra(int Ind)
1230a1253,1255
> player_type *p_ptr = Players[Ind];
> char pass[80];
>
1235c1260
< rd_string(player_name, 32);
---
> rd_string(p_ptr->name, 32);
1237c1262
< rd_string(died_from, 80);
---
> rd_string(pass, 80);
1238a1264,1268
> if (strcmp(pass, p_ptr->pass))
> return TRUE;
>
> rd_string(p_ptr->died_from, 80);
>
1241c1271
< rd_string(history[i], 60);
---
> rd_string(p_ptr->history[i], 60);
1343,1344c1373,1374
< rd_u32b(&seed_flavor);
< rd_u32b(&seed_town);
---
> /*rd_u32b(&seed_flavor);
> rd_u32b(&seed_town);*/
1349,1350c1379,1380
< rd_u16b(&total_winner);
< rd_u16b(&noscore);
---
> rd_u16b(&p_ptr->total_winner);
> rd_u16b(&p_ptr->noscore);
1355c1385
< death = tmp8u;
---
> p_ptr->death = tmp8u;
1358,1359c1388,1389
< rd_byte(&tmp8u);
< feeling = tmp8u;
---
> /*rd_byte(&tmp8u);
> feeling = tmp8u;*/
1362c1392
< rd_s32b(&old_turn);
---
> /*rd_s32b(&old_turn);*/
1365c1395,1398
< rd_s32b(&turn);
---
> /*rd_s32b(&turn);*/
>
> /* Success */
> return FALSE;
1382c1415
< static errr rd_inventory(void)
---
> static errr rd_inventory(int Ind)
1383a1417,1418
> player_type *p_ptr = Players[Ind];
>
1389c1424
< total_weight = 0;
---
> p_ptr->total_weight = 0;
1392,1393c1427,1428
< inven_cnt = 0;
< equip_cnt = 0;
---
> p_ptr->inven_cnt = 0;
> p_ptr->equip_cnt = 0;
1419c1454
< inventory[n] = forge;
---
> p_ptr->inventory[n] = forge;
1422c1457
< total_weight += (forge.number * forge.weight);
---
> p_ptr->total_weight += (forge.number * forge.weight);
1425c1460
< equip_cnt++;
---
> p_ptr->equip_cnt++;
1429c1464
< else if (inven_cnt == INVEN_PACK)
---
> else if (p_ptr->inven_cnt == INVEN_PACK)
1432c1467
< note("Too many items in the inventory!");
---
> /*note("Too many items in the inventory!");*/
1445c1480
< inventory[n] = forge;
---
> p_ptr->inventory[n] = forge;
1448c1483
< total_weight += (forge.number * forge.weight);
---
> p_ptr->total_weight += (forge.number * forge.weight);
1451c1486
< inven_cnt++;
---
> p_ptr->inven_cnt++;
1459a1495
> #if 0
2379a2416
> #endif
2381d2417
<
2388c2424
< static errr rd_savefile_new_aux(void)
---
> static errr rd_savefile_new_aux(int Ind)
2389a2426,2427
> player_type *p_ptr = Players[Ind];
>
2392d2429
< byte tmp8u;
2404,2405c2441,2442
< note(format("Loading a %d.%d.%d savefile...",
< sf_major, sf_minor, sf_patch));
---
> /*note(format("Loading a %d.%d.%d savefile...",
> sf_major, sf_minor, sf_patch));*/
2409c2446
< if (older_than(2, 7, 4))
---
> /*if (older_than(2, 7, 4))
2412c2449
< }
---
> }*/
2445a2483
> #if 0
2507a2546
> #endif
2525,2526d2563
< object_kind *k_ptr = &k_info[i];
<
2529,2530c2566,2567
< k_ptr->aware = (tmp8u & 0x01) ? TRUE: FALSE;
< k_ptr->tried = (tmp8u & 0x02) ? TRUE: FALSE;
---
> Players[Ind]->obj_aware[i] = (tmp8u & 0x01) ? TRUE : FALSE;
> Players[Ind]->obj_tried[i] = (tmp8u & 0x02) ? TRUE : FALSE;
2532c2569
< if (arg_fiddle) note("Loaded Object Memory");
---
> /*if (arg_fiddle) note("Loaded Object Memory");*/
2533a2571
> #if 0
2576a2615
> #endif
2580,2581c2619,2621
< rd_extra();
< if (arg_fiddle) note("Loaded extra information");
---
> if (rd_extra(Ind))
> return 35;
> /*if (arg_fiddle) note("Loaded extra information");*/
2586a2627
> #if 0
2592a2634
> #endif
2597c2639
< rd_s16b(&player_hp[i]);
---
> rd_s16b(&p_ptr->player_hp[i]);
2610,2615c2652,2657
< rd_u32b(&spell_learned1);
< rd_u32b(&spell_learned2);
< rd_u32b(&spell_worked1);
< rd_u32b(&spell_worked2);
< rd_u32b(&spell_forgotten1);
< rd_u32b(&spell_forgotten2);
---
> rd_u32b(&p_ptr->spell_learned1);
> rd_u32b(&p_ptr->spell_learned2);
> rd_u32b(&p_ptr->spell_worked1);
> rd_u32b(&p_ptr->spell_worked2);
> rd_u32b(&p_ptr->spell_forgotten1);
> rd_u32b(&p_ptr->spell_forgotten2);
2619c2661
< rd_byte(&spell_order[i]);
---
> rd_byte(&p_ptr->spell_order[i]);
2624c2666
< if (rd_inventory())
---
> if (rd_inventory(Ind))
2626c2668
< note("Unable to read inventory");
---
> /*note("Unable to read inventory");*/
2630a2673
> #if 0
2653a2697
> #endif
2703c2747
< errr rd_savefile_new(void)
---
> errr rd_savefile_new(int Ind)
2704a2749,2750
> player_type *p_ptr = Players[Ind];
>
2708c2754
< fff = my_fopen(savefile, "rb");
---
> fff = my_fopen(p_ptr->savefile, "rb");
2714c2760
< err = rd_savefile_new_aux();
---
> err = rd_savefile_new_aux(Ind);
Only in src-280: main-acn.c
Only in src-280: main-ami.c
Only in src-280: main-cap.c
Only in src-280: main-emx.c
Only in src-280: main-gcu.c
Only in src-280: main-ibm.c
Only in src-280: main-lsl.c
Only in src-280: main-mac.c
Only in src-280: main-sla.c
Only in src-280: main-vme.c
Only in src-280: main-win.c
Only in src-280: main-x11.c
Only in src-280: main-xaw.c
Only in src-280: main-xxx.c
diff -r src-280/main.c mangband-000/src/server/main.c
12a13,14
> #define SERVER
>
79a82,83
> *
> * Unnecessary, as the server doesn't open any "terms". --KLJ--
80a85
> #if 0
94a100
> #endif
175,176d180
< bool done = FALSE;
<
273a278
> #if 0
275a281
> #endif
342a349
> #if 0
351a359
> #endif
357a366
> #if 0
362a372
> #endif
387a398
> #if 0
390a402
> #endif
391a404,405
> /* This is all removed, as there is no need for the server to open a term */
> #if 0
393d406
<
508a522,524
> #endif
>
> #if 0
514a531
> #endif
531c548
< pause_line(23);
---
> /*pause_line(23);*/
diff -r src-280/melee1.c mangband-000/src/server/melee1.c
12a13,14
> #define SERVER
>
60c62
< static int check_hit(int power, int level)
---
> static int check_hit(int int power, int level)
61a64,65
> player_type *p_ptr = Players[Ind];
>
115c119
< * Attack the player via physical attacks.
---
> * Attack a player via physical attacks.
117c121
< bool make_attack_normal(int m_idx)
---
> bool make_attack_normal(int int m_idx)
118a123,124
> player_type *p_ptr = Players[Ind];
>
141d146
<
145d149
<
184d187
<
186c189
< if (!alive || death || new_level_flag) break;
---
> if (!p_ptr->alive || p_ptr->death || p_ptr->new_level_flag) break;
190c193
< if (m_ptr->ml) visible = TRUE;
---
> if (p_ptr->mon_vis[m_idx]) visible = TRUE;
242c245
< if (m_ptr->ml) r_ptr->r_flags3 |= RF3_EVIL;
---
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags3 |= RF3_EVIL;
498c501
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
622c625
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
667c670
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
703c706
< o_ptr = &inventory[INVEN_LITE];
---
> o_ptr = &p_ptr->inventory[INVEN_LITE];
988c991
< if (damage > 23) earthquake(m_ptr->fy, m_ptr->fx, 8);
---
> if (damage > 23) earthquake(p_ptr->dun_depth, m_ptr->fy, m_ptr->fx, 8);
1198c1201
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
1237c1240
< if (death && (r_ptr->r_deaths < MAX_SHORT)) r_ptr->r_deaths++;
---
> if (p_ptr->death && (r_ptr->r_deaths < MAX_SHORT)) r_ptr->r_deaths++;
diff -r src-280/melee2.c mangband-000/src/server/melee2.c
12a13,14
> #define SERVER
>
333c335
< static void bolt(int m_idx, int typ, int dam_hp)
---
> static void bolt(int int m_idx, int typ, int dam_hp)
334a337,338
> player_type *p_ptr = Players[Ind];
>
338c342
< (void)project(m_idx, 0, py, px, dam_hp, typ, flg);
---
> (void)project(m_idx, 0, p_ptr->dun_depth, p_ptr->py, p_ptr->px, dam_hp, typ, flg);
347c351
< static void breath(int m_idx, int typ, int dam_hp)
---
> static void breath(int int m_idx, int typ, int dam_hp)
348a353,354
> player_type *p_ptr = Players[Ind];
>
360c366
< (void)project(m_idx, rad, py, px, dam_hp, typ, flg);
---
> (void)project(m_idx, rad, p_ptr->dun_depth, p_ptr->py, p_ptr->px, dam_hp, typ, flg);
416c422
< bool make_attack_spell(int m_idx)
---
> bool make_attack_spell(int int m_idx)
417a424,427
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
434,435c444,445
< int x = px;
< int y = py;
---
> int x = p_ptr->px;
> int y = p_ptr->py;
445c455
< bool seen = (!blind && m_ptr->ml);
---
> bool seen = (!blind && p_ptr->mon_vis[m_idx]);
478c488
< if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) return (FALSE);
---
> if (!projectable(p_ptr->dun_depth, m_ptr->fy, m_ptr->fx, p_ptr->py, p_ptr->px)) return (FALSE);
541c551
< if (!alive || death || new_level_flag) return (FALSE);
---
> if (!p_ptr->alive || p_ptr->death || p_ptr->new_level_flag) return (FALSE);
1604c1614
< teleport_player_level();
---
> teleport_player_level(Ind);
1634c1644
< (void)trap_creation();
---
> (void)trap_creation(Ind);
1649c1659
< else if (lose_all_info())
---
> else if (lose_all_info(Ind))
1682c1692
< count += summon_specific(y, x, rlev, 0);
---
> count += summon_specific(Depth, y, x, rlev, 0);
1696c1706
< count += summon_specific(y, x, rlev, 0);
---
> count += summon_specific(Depth, y, x, rlev, 0);
1710c1720
< count += summon_specific(y, x, rlev, SUMMON_ANT);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_ANT);
1724c1734
< count += summon_specific(y, x, rlev, SUMMON_SPIDER);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_SPIDER);
1738c1748
< count += summon_specific(y, x, rlev, SUMMON_HOUND);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HOUND);
1752c1762
< count += summon_specific(y, x, rlev, SUMMON_HYDRA);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HYDRA);
1766c1776
< count += summon_specific(y, x, rlev, SUMMON_ANGEL);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_ANGEL);
1780c1790
< count += summon_specific(y, x, rlev, SUMMON_DEMON);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_DEMON);
1794c1804
< count += summon_specific(y, x, rlev, SUMMON_UNDEAD);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_UNDEAD);
1808c1818
< count += summon_specific(y, x, rlev, SUMMON_DRAGON);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_DRAGON);
1822c1832
< count += summon_specific(y, x, rlev, SUMMON_HI_UNDEAD);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HI_UNDEAD);
1839c1849
< count += summon_specific(y, x, rlev, SUMMON_HI_DRAGON);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HI_DRAGON);
1856c1866
< count += summon_specific(y, x, rlev, SUMMON_WRAITH);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_WRAITH);
1860c1870
< count += summon_specific(y, x, rlev, SUMMON_HI_UNDEAD);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HI_UNDEAD);
1877c1887
< count += summon_specific(y, x, rlev, SUMMON_UNIQUE);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_UNIQUE);
1881c1891
< count += summon_specific(y, x, rlev, SUMMON_HI_UNDEAD);
---
> count += summon_specific(Depth, y, x, rlev, SUMMON_HI_UNDEAD);
1919c1929
< if (death && (r_ptr->r_deaths < MAX_SHORT)) r_ptr->r_deaths++;
---
> if (p_ptr->death && (r_ptr->r_deaths < MAX_SHORT)) r_ptr->r_deaths++;
1940c1950
< static int mon_will_run(int m_idx)
---
> static int mon_will_run(int int m_idx)
1941a1952,1953
> player_type *p_ptr = Players[Ind];
>
2102c2114
< static void get_moves(int m_idx, int *mm)
---
> static void get_moves(int int m_idx, int *mm)
2103a2116,2117
> player_type *p_ptr = Players[Ind];
>
2110,2111c2124,2125
< int y2 = py;
< int x2 = px;
---
> int y2 = p_ptr->py;
> int x2 = p_ptr->px;
2333a2348,2349
> *
> * Note that the "Ind" specifies the player that the monster will go after.
2335c2351
< static void process_monster(int m_idx)
---
> static void process_monster(int int m_idx)
2336a2353,2356
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
2375a2396,2398
> /* Hack -- make sure the distance isn't zero */
> if (m_ptr->cdis == 0) m_ptr->cdis = 1;
>
2389c2412
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
2403c2426
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
2450c2473
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
2487c2510
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
2521c2544
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
2552c2575
< if (cave[y][x].m_idx) k++;
---
> if (cave[Depth][y][x].m_idx) k++;
2563c2586
< if (m_ptr->ml) r_ptr->r_flags2 |= RF2_MULTIPLY;
---
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags2 |= RF2_MULTIPLY;
2594,2595c2617,2618
< if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_50;
< if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_25;
---
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags1 |= RF1_RAND_50;
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags1 |= RF1_RAND_25;
2606c2629
< if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_50;
---
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags1 |= RF1_RAND_50;
2617c2640
< if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_25;
---
> if (p_ptr->mon_vis[m_idx]) r_ptr->r_flags1 |= RF1_RAND_25;
2661c2684
< c_ptr = &cave[ny][nx];
---
> c_ptr = &cave[Depth][ny][nx];
2671c2694
< if (cave_floor_bold(ny, nx))
---
> if (cave_floor_bold(Depth, ny, nx))
2706c2729
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, ny, nx);
2712c2735
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
2819c2842
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
2837c2860
< if (c_ptr->info & CAVE_MARK)
---
> if (Players[Ind]->cave_flag[ny][nx] & CAVE_MARK)
2851c2874
< if (do_move && (ny == py) && (nx == px) &&
---
> if (do_move && (ny == p_ptr->py) && (nx == p_ptr->px) &&
2863c2886
< if (do_move && (ny == py) && (nx == px))
---
> if (do_move && c_ptr->p_idx /*(ny == p_ptr->py) && (nx == p_ptr->px)*/)
2866c2889
< (void)make_attack_normal(m_idx);
---
> (void)make_attack_normal(c_ptr->p_idx, m_idx);
2908c2931
< delete_monster(ny, nx);
---
> delete_monster(Depth, ny, nx);
2917c2940
< (cave_floor_bold(m_ptr->fy, m_ptr->fx)))
---
> (cave_floor_bold(Depth, m_ptr->fy, m_ptr->fx)))
2937c2960
< cave[oy][ox].m_idx = c_ptr->m_idx;
---
> cave[Depth][oy][ox].m_idx = c_ptr->m_idx;
2961c2984
< lite_spot(oy, ox);
---
> everyone_lite_spot(Depth, oy, ox);
2964c2987
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
2967c2990
< if (m_ptr->ml &&
---
> if (p_ptr->mon_vis[m_idx] &&
2969c2992
< (m_ptr->los &&
---
> (p_ptr->mon_los[m_idx] &&
3024c3047
< if (m_ptr->ml && player_has_los_bold(ny, nx))
---
> if (p_ptr->mon_vis[m_idx] && player_has_los_bold(ny, nx))
3047c3070
< delete_object(ny, nx);
---
> delete_object(Depth, ny, nx);
3064c3087
< delete_object(ny, nx);
---
> delete_object(Depth, ny, nx);
3083c3106
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
3118c3141
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[m_idx])
3167c3190
< int k, i, e;
---
> int k, i, e, pl;
3176,3177d3198
< /* Hack -- calculate the "player noise" */
< noise = (1L << (30 - p_ptr->skill_stl));
3179d3199
<
3182a3203,3205
> player_type *p_ptr;
> int closest = -1, dis_to_closest = 9999;
>
3213a3237,3240
> /* Find the closest player */
> for (pl = 1; pl < NumPlayers + 1; pl++)
> {
> int j;
3214a3242,3270
> p_ptr = Players[pl];
>
> /* Only check him if he is playing */
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
>
> /* Make sure he's on the same dungeon level */
> if (p_ptr->dun_depth != m_ptr->dun_depth)
> continue;
>
> if ((j = distance(p_ptr->px, p_ptr->py, m_ptr->fx, m_ptr->fy)) < dis_to_closest)
> {
> dis_to_closest = j;
> closest = pl;
> }
> }
>
> /* Paranoia -- Make sure we found a closest player */
> if (closest == -1)
> continue;
>
> p_ptr = Players[closest];
>
> /* Hack -- calculate the "player noise" */
> noise = (1L << (30 - p_ptr->skill_stl));
>
> m_ptr->cdis = dis_to_closest;
> m_ptr->closest_player = closest;
>
3239c3295
< (player_has_los_bold(fy, fx) ||
---
> (player_has_los_bold(closest, fy, fx) ||
3265c3321
< process_monster(i);
---
> process_monster(closest, i);
3268c3324
< if (!alive || death || new_level_flag) break;
---
> if (!p_ptr->alive || p_ptr->death || p_ptr->new_level_flag) break;
3271a3328,3329
> /* This should be done automagically due to the real time nature */
>
3272a3331
> #if 0
3302a3362
> #endif
diff -r src-280/monster1.c mangband-000/src/server/monster1.c
12a13,14
> #define SERVER
>
18a21
> #if 0
22a26
> #endif
39a44
> #if 0
59a65
> #endif
66a73
> #if 0
91a99
> #endif
105a114
> #if 0
1357a1367
> #endif
1365a1376
> #if 0
1411a1423
> #endif
1419a1432
> #if 0
1430a1444
> #endif
1440a1455
> #if 0
1457a1473
> #endif
diff -r src-280/monster2.c mangband-000/src/server/monster2.c
12a13,14
> #define SERVER
>
33c35
< int x, y;
---
> int x, y, Depth, Ind;
39d40
<
42a44
> Depth = m_ptr->dun_depth;
53c55
< if (i == target_who) target_who = 0;
---
> /*if (i == target_who) target_who = 0;*/
57a60,64
> /* Remove him from everybody's view */
> for (Ind = 1; Ind < NumPlayers + 1; Ind++)
> {
> /* Skip this player if he isn't playing */
> if (Players[Ind]->conn == NOT_CONNECTED) continue;
59,60c66,68
< /* Monster is gone */
< cave[y][x].m_idx = 0;
---
> Players[Ind]->mon_vis[i] = FALSE;
> Players[Ind]->mon_los[i] = FALSE;
> }
62a71,73
> /* Monster is gone */
> cave[Depth][y][x].m_idx = 0;
>
64c75
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
66d76
<
75c85
< void delete_monster(int y, int x)
---
> void delete_monster(int Depth, int y, int x)
80c90
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
81a92,94
> /* Paranoia */
> if (!cave[Depth]) return;
>
83c96
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
104c117
< int i, num, cnt;
---
> int i, num, cnt, Ind;
110c123
< if (size) msg_print("Compacting monsters...");
---
> if (size) printf("Compacting monsters...");
175a189
> int Depth = m_list[m_max].dun_depth;
178c192
< cave[ny][nx].m_idx = i;
---
> cave[Depth][ny][nx].m_idx = i;
181c195
< if (target_who == (int)(m_max)) target_who = i;
---
> /*if (target_who == (int)(m_max)) target_who = i;*/
188a203,211
> /* Copy the visibility and los flags for the players */
> for (Ind = 1; Ind < NumPlayers + 1; Ind++)
> {
> if (Players[Ind]->conn == NOT_CONNECTED) continue;
>
> Players[Ind]->mon_vis[i] = Players[Ind]->mon_vis[m_max];
> Players[Ind]->mon_los[i] = Players[Ind]->mon_los[m_max];
> }
>
214a238,239
> *
> * Note that this only deletes monsters that on the specified depth
216c241
< void wipe_m_list(void)
---
> void wipe_m_list(int Depth)
219a245
> #if 0
255a282,291
> #endif
>
> /* Delete all the monsters */
> for (i = m_max - 1; i >= 1; i--)
> {
> monster_type *m_ptr = &m_list[i];
>
> if (m_ptr->dun_depth == Depth)
> delete_monster_idx(i);
> }
323c359
< if (character_dungeon) msg_print("Too many monsters!");
---
> if (server_dungeon) printf("Too many monsters!");
455c491,492
< if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (r_ptr->level > dun_level))
---
> /* FIXME: This might cause FORCE_DEPTH monsters to appear out of depth */
> if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (r_ptr->level > level))
600c637
< seen = (m_ptr && ((mode & 0x80) || (!(mode & 0x40) && m_ptr->ml)));
---
> seen = (m_ptr && ((mode & 0x80) || (!(mode & 0x40)/* && m_ptr->ml*/)));
729c766
< p_ptr->window |= (PW_MONSTER);
---
> /*p_ptr->window |= (PW_MONSTER);*/
817a855,856
> player_type *p_ptr;
>
821a861,864
> int Depth = m_ptr->dun_depth;
>
> int Ind = m_ptr->closest_player;
>
837,839c880,881
<
< /* Calculate distance */
< if (dist)
---
> /* Check for each player */
> for (Ind = 1; Ind < NumPlayers + 1; Ind++)
841c883
< int d, dy, dx;
---
> p_ptr = Players[Ind];
843,845c885,886
< /* Distance components */
< dy = (py > fy) ? (py - fy) : (fy - py);
< dx = (px > fx) ? (px - fx) : (fx - px);
---
> /* Reset the flags */
> flag = easy = hard = FALSE;
847,848c888,890
< /* Approximate distance */
< d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1));
---
> /* If he's not playing, skip him */
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
850,852c892,894
< /* Save the distance (in a byte) */
< m_ptr->cdis = (d < 255) ? d : 255;
< }
---
> /* If he's not on this depth, skip him */
> if (p_ptr->dun_depth != Depth)
> continue;
853a896,899
> /* Calculate distance */
> if (dist)
> {
> int d, dy, dx;
855,860c901,903
< /* Process "distant" monsters */
< if (m_ptr->cdis > MAX_SIGHT)
< {
< /* Ignore unseen monsters */
< if (!m_ptr->ml) return;
< }
---
> /* Distance components */
> dy = (p_ptr->py > fy) ? (p_ptr->py - fy) : (fy - p_ptr->py);
> dx = (p_ptr->px > fx) ? (p_ptr->px - fx) : (fx - p_ptr->px);
862,865c905,906
< /* Process "nearby" monsters on the current "panel" */
< else if (panel_contains(fy, fx))
< {
< cave_type *c_ptr = &cave[fy][fx];
---
> /* Approximate distance */
> d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1));
867,875c908,910
< /* Normal line of sight, and player is not blind */
< if ((c_ptr->info & CAVE_VIEW) && (!p_ptr->blind))
< {
< /* Use "infravision" */
< if (m_ptr->cdis <= (byte)(p_ptr->see_infra))
< {
< /* Infravision only works on "warm" creatures */
< /* Below, we will need to know that infravision failed */
< if (r_ptr->flags2 & RF2_COLD_BLOOD) do_cold_blood = TRUE;
---
> /* Save the distance (in a byte) */
> m_ptr->cdis = (d < 255) ? d : 255;
> }
877,879d911
< /* Infravision works */
< if (!do_cold_blood) easy = flag = TRUE;
< }
881,889c913,918
< /* Use "illumination" */
< if (c_ptr->info & (CAVE_LITE | CAVE_GLOW))
< {
< /* Take note of invisibility */
< if (r_ptr->flags2 & RF2_INVISIBLE) do_invisible = TRUE;
<
< /* Visible, or detectable, monsters get seen */
< if (!do_invisible || p_ptr->see_inv) easy = flag = TRUE;
< }
---
> /* Process "distant" monsters */
> #if 0
> if (m_ptr->cdis > MAX_SIGHT)
> {
> /* Ignore unseen monsters */
> if (!p_ptr->mon_vis[m_idx]) return;
890a920
> #endif
892,893c922,923
< /* Telepathy can see all "nearby" monsters with "minds" */
< if (p_ptr->telepathy)
---
> /* Process "nearby" monsters on the current "panel" */
> if (panel_contains(fy, fx))
895,899c925,926
< /* Empty mind, no telepathy */
< if (r_ptr->flags2 & RF2_EMPTY_MIND)
< {
< do_empty_mind = TRUE;
< }
---
> cave_type *c_ptr = &cave[Depth][fy][fx];
> byte *w_ptr = &p_ptr->cave_flag[fy][fx];
901,902c928,929
< /* Weird mind, occasional telepathy */
< else if (r_ptr->flags2 & RF2_WEIRD_MIND)
---
> /* Normal line of sight, and player is not blind */
> if ((*w_ptr & CAVE_VIEW) && (!p_ptr->blind))
904,906c931,936
< do_weird_mind = TRUE;
< if (rand_int(100) < 10) hard = flag = TRUE;
< }
---
> /* Use "infravision" */
> if (m_ptr->cdis <= (byte)(p_ptr->see_infra))
> {
> /* Infravision only works on "warm" creatures */
> /* Below, we will need to know that infravision failed */
> if (r_ptr->flags2 & RF2_COLD_BLOOD) do_cold_blood = TRUE;
908,911c938,950
< /* Normal mind, allow telepathy */
< else
< {
< hard = flag = TRUE;
---
> /* Infravision works */
> if (!do_cold_blood) easy = flag = TRUE;
> }
>
> /* Use "illumination" */
> if ((*w_ptr & CAVE_LITE) || (c_ptr->info & CAVE_GLOW))
> {
> /* Take note of invisibility */
> if (r_ptr->flags2 & RF2_INVISIBLE) do_invisible = TRUE;
>
> /* Visible, or detectable, monsters get seen */
> if (!do_invisible || p_ptr->see_inv) easy = flag = TRUE;
> }
914,915c953,954
< /* Apply telepathy */
< if (hard)
---
> /* Telepathy can see all "nearby" monsters with "minds" */
> if (p_ptr->telepathy)
917,919c956,981
< /* Hack -- Memorize mental flags */
< if (r_ptr->flags2 & RF2_SMART) r_ptr->r_flags2 |= RF2_SMART;
< if (r_ptr->flags2 & RF2_STUPID) r_ptr->r_flags2 |= RF2_STUPID;
---
> /* Empty mind, no telepathy */
> if (r_ptr->flags2 & RF2_EMPTY_MIND)
> {
> do_empty_mind = TRUE;
> }
>
> /* Weird mind, occasional telepathy */
> else if (r_ptr->flags2 & RF2_WEIRD_MIND)
> {
> do_weird_mind = TRUE;
> if (rand_int(100) < 10) hard = flag = TRUE;
> }
>
> /* Normal mind, allow telepathy */
> else
> {
> hard = flag = TRUE;
> }
>
> /* Apply telepathy */
> if (hard)
> {
> /* Hack -- Memorize mental flags */
> if (r_ptr->flags2 & RF2_SMART) r_ptr->r_flags2 |= RF2_SMART;
> if (r_ptr->flags2 & RF2_STUPID) r_ptr->r_flags2 |= RF2_STUPID;
> }
920a983,985
>
> /* Hack -- Wizards have "perfect telepathy" */
> /*if (wizard) flag = TRUE;*/
923,925d987
< /* Hack -- Wizards have "perfect telepathy" */
< if (wizard) flag = TRUE;
< }
927,932c989,990
<
< /* The monster is now visible */
< if (flag)
< {
< /* It was previously unseen */
< if (!m_ptr->ml)
---
> /* The monster is now visible */
> if (flag)
934,935c992,996
< /* Mark as visible */
< m_ptr->ml = TRUE;
---
> /* It was previously unseen */
> if (!p_ptr->mon_vis[m_idx])
> {
> /* Mark as visible */
> p_ptr->mon_vis[m_idx] = TRUE;
937,938c998,999
< /* Draw the monster */
< lite_spot(fy, fx);
---
> /* Draw the monster */
> lite_spot(fy, fx);
940,941c1001,1002
< /* Update health bar as needed */
< if (health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
---
> /* Update health bar as needed */
> if (health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
943,944c1004,1005
< /* Hack -- Count "fresh" sightings */
< if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
---
> /* Hack -- Count "fresh" sightings */
> if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
946,948c1007,1009
< /* Disturb on appearance */
< if (disturb_move) disturb(1, 0);
< }
---
> /* Disturb on appearance */
> if (disturb_move) disturb(1, 0);
> }
950,954c1011,1015
< /* Memorize various observable flags */
< if (do_empty_mind) r_ptr->r_flags2 |= RF2_EMPTY_MIND;
< if (do_weird_mind) r_ptr->r_flags2 |= RF2_WEIRD_MIND;
< if (do_cold_blood) r_ptr->r_flags2 |= RF2_COLD_BLOOD;
< if (do_invisible) r_ptr->r_flags2 |= RF2_INVISIBLE;
---
> /* Memorize various observable flags */
> if (do_empty_mind) r_ptr->r_flags2 |= RF2_EMPTY_MIND;
> if (do_weird_mind) r_ptr->r_flags2 |= RF2_WEIRD_MIND;
> if (do_cold_blood) r_ptr->r_flags2 |= RF2_COLD_BLOOD;
> if (do_invisible) r_ptr->r_flags2 |= RF2_INVISIBLE;
956,958c1017,1019
< /* Efficiency -- Notice multi-hued monsters */
< if (r_ptr->flags1 & RF1_ATTR_MULTI) scan_monsters = TRUE;
< }
---
> /* Efficiency -- Notice multi-hued monsters */
> if (r_ptr->flags1 & RF1_ATTR_MULTI) scan_monsters = TRUE;
> }
960,964c1021,1022
< /* The monster is not visible */
< else
< {
< /* It was previously seen */
< if (m_ptr->ml)
---
> /* The monster is not visible */
> else
966,967c1024,1028
< /* Mark as not visible */
< m_ptr->ml = FALSE;
---
> /* It was previously seen */
> if (p_ptr->mon_vis[m_idx])
> {
> /* Mark as not visible */
> p_ptr->mon_vis[m_idx] = FALSE;
969,970c1030,1031
< /* Erase the monster */
< lite_spot(fy, fx);
---
> /* Erase the monster */
> lite_spot(fy, fx);
972,973c1033,1034
< /* Update health bar as needed */
< if (health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
---
> /* Update health bar as needed */
> if (health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
975,976c1036,1038
< /* Disturb on disappearance*/
< if (disturb_move) disturb(1, 0);
---
> /* Disturb on disappearance*/
> if (disturb_move) disturb(1, 0);
> }
978d1039
< }
981,985c1042,1043
< /* The monster is now easily visible */
< if (easy)
< {
< /* Change */
< if (!m_ptr->los)
---
> /* The monster is now easily visible */
> if (easy)
987,988c1045,1049
< /* Mark as easily visible */
< m_ptr->los = TRUE;
---
> /* Change */
> if (!p_ptr->mon_los[m_idx])
> {
> /* Mark as easily visible */
> p_ptr->mon_los[m_idx] = TRUE;
990,991c1051,1053
< /* Disturb on appearance */
< if (disturb_near) disturb(1, 0);
---
> /* Disturb on appearance */
> if (disturb_near) disturb(1, 0);
> }
993d1054
< }
995,999c1056,1057
< /* The monster is not easily visible */
< else
< {
< /* Change */
< if (m_ptr->los)
---
> /* The monster is not easily visible */
> else
1001,1002c1059,1063
< /* Mark as not easily visible */
< m_ptr->los = FALSE;
---
> /* Change */
> if (p_ptr->mon_los[m_idx])
> {
> /* Mark as not easily visible */
> p_ptr->mon_los[m_idx] = FALSE;
1004,1005c1065,1067
< /* Disturb on disappearance */
< if (disturb_near) disturb(1, 0);
---
> /* Disturb on disappearance */
> if (disturb_near) disturb(1, 0);
> }
1052c1114
< static bool place_monster_one(int y, int x, int r_idx, bool slp)
---
> static bool place_monster_one(int Depth, int y, int x, int r_idx, bool slp)
1054c1116
< int i;
---
> int i, Ind;
1062c1124
< cptr name = (r_name + r_ptr->name);
---
> char buf[80];
1064d1125
<
1066c1127
< if (!in_bounds(y, x)) return (FALSE);
---
> if (!in_bounds(Depth, y, x)) return (FALSE);
1069c1130
< if (!cave_empty_bold(y, x)) return (FALSE);
---
> if (!cave_empty_bold(Depth, y, x)) return (FALSE);
1072c1133
< if (cave[y][x].feat == FEAT_GLYPH) return (FALSE);
---
> if (cave[Depth][y][x].feat == FEAT_GLYPH) return (FALSE);
1091c1152
< if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (dun_level < r_ptr->level))
---
> if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (Depth < r_ptr->level))
1099c1160
< if (r_ptr->level > dun_level)
---
> if (r_ptr->level > Depth)
1105c1166
< if (cheat_hear) msg_format("Deep Unique (%s).", name);
---
> /*if (cheat_hear) msg_format("Deep Unique (%s).", name);*/
1108c1169
< rating += (r_ptr->level - dun_level) * 2;
---
> rating += (r_ptr->level - Depth) * 2;
1115c1176
< if (cheat_hear) msg_format("Deep Monster (%s).", name);
---
> /*if (cheat_hear) msg_format("Deep Monster (%s).", name);*/
1118c1179
< rating += (r_ptr->level - dun_level);
---
> rating += (r_ptr->level - Depth);
1126c1187
< if (cheat_hear) msg_format("Unique (%s).", name);
---
> /*if (cheat_hear) msg_format("Unique (%s).", name);*/
1131c1192
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1148a1210
> m_ptr->dun_depth = Depth;
1203,1204d1264
< m_ptr->los = FALSE;
< m_ptr->ml = FALSE;
1205a1266,1276
> for (Ind = 1; Ind < NumPlayers + 1; Ind++)
> {
> if (Players[Ind]->conn == NOT_CONNECTED)
> continue;
>
> Players[Ind]->mon_los[c_ptr->m_idx] = FALSE;
> Players[Ind]->mon_vis[c_ptr->m_idx] = FALSE;
> }
>
> strcpy(buf, (r_name + r_ptr->name));
>
1235c1306
< static bool place_monster_group(int y, int x, int r_idx, bool slp)
---
> static bool place_monster_group(int Depth, int y, int x, int r_idx, bool slp)
1252c1323
< if (r_ptr->level > dun_level)
---
> if (r_ptr->level > Depth)
1254c1325
< extra = r_ptr->level - dun_level;
---
> extra = r_ptr->level - Depth;
1259c1330
< else if (r_ptr->level < dun_level)
---
> else if (r_ptr->level < Depth)
1261c1332
< extra = dun_level - r_ptr->level;
---
> extra = Depth - r_ptr->level;
1300c1371
< if (!cave_empty_bold(my, mx)) continue;
---
> if (!cave_empty_bold(Depth, my, mx)) continue;
1303c1374
< if (place_monster_one(my, mx, r_idx, slp))
---
> if (place_monster_one(Depth, my, mx, r_idx, slp))
1371c1442
< bool place_monster_aux(int y, int x, int r_idx, bool slp, bool grp)
---
> bool place_monster_aux(int Depth, int y, int x, int r_idx, bool slp, bool grp)
1379c1450
< if (!place_monster_one(y, x, r_idx, slp)) return (FALSE);
---
> if (!place_monster_one(Depth, y, x, r_idx, slp)) return (FALSE);
1390c1461
< (void)place_monster_group(y, x, r_idx, slp);
---
> (void)place_monster_group(Depth, y, x, r_idx, slp);
1403c1474
< scatter(&ny, &nx, y, x, d, 0);
---
> scatter(Depth, &ny, &nx, y, x, d, 0);
1406c1477
< if (!cave_empty_bold(ny, nx)) continue;
---
> if (!cave_empty_bold(Depth, ny, nx)) continue;
1435c1506
< (void)place_monster_one(ny, nx, z, slp);
---
> (void)place_monster_one(Depth, ny, nx, z, slp);
1442c1513
< (void)place_monster_group(ny, nx, z, slp);
---
> (void)place_monster_group(Depth, ny, nx, z, slp);
1458c1529
< bool place_monster(int y, int x, bool slp, bool grp)
---
> bool place_monster(int Depth, int y, int x, bool slp, bool grp)
1467a1539,1540
> /*printf("Trying to place a monster (%d) at %d, %d.\n", r_idx, y, x);*/
>
1469c1542
< if (place_monster_aux(y, x, r_idx, slp, grp)) return (TRUE);
---
> if (place_monster_aux(Depth, y, x, r_idx, slp, grp)) return (TRUE);
1541c1614
< bool alloc_monster(int dis, int slp)
---
> bool alloc_monster(int Depth, int dis, int slp)
1549,1550c1622,1623
< y = rand_int(cur_hgt);
< x = rand_int(cur_wid);
---
> y = rand_int(Depth ? MAX_HGT : SCREEN_HGT);
> x = rand_int(Depth ? MAX_WID : SCREEN_WID);
1553c1626,1627
< if (!cave_naked_bold(y, x)) continue;
---
> if (!cave_naked_bold(Depth, y, x)) continue;
> else break;
1554a1629
>
1556c1631,1633
< if (distance(y, x, py, px) > dis) break;
---
> /* FIXME: This needs to be fixed so that it is far away */
> /* from every player */
> /*if (distance(y, x, py, px) > dis) break;*/
1558a1636,1637
> /*printf("Trying to place a monster at %d, %d.\n", y, x);*/
>
1560c1639
< if (place_monster(y, x, slp, TRUE)) return (TRUE);
---
> if (place_monster(Depth, y, x, slp, TRUE)) return (TRUE);
1705c1784
< bool summon_specific(int y1, int x1, int lev, int type)
---
> bool summon_specific(int Depth, int y1, int x1, int lev, int type)
1717c1796
< scatter(&y, &x, y1, x1, d, 0);
---
> scatter(Depth, &y, &x, y1, x1, d, 0);
1720c1799
< if (!cave_empty_bold(y, x)) continue;
---
> if (!cave_empty_bold(Depth, y, x)) continue;
1723c1802
< if (cave[y][x].feat == FEAT_GLYPH) continue;
---
> if (cave[Depth][y][x].feat == FEAT_GLYPH) continue;
1745c1824
< r_idx = get_mon_num((dun_level + lev) / 2 + 5);
---
> r_idx = get_mon_num((Depth + lev) / 2 + 5);
1759c1838
< if (!place_monster_aux(y, x, r_idx, FALSE, TRUE)) return (FALSE);
---
> if (!place_monster_aux(Depth, y, x, r_idx, FALSE, TRUE)) return (FALSE);
1788c1867
< scatter(&y, &x, m_ptr->fy, m_ptr->fx, d, 0);
---
> scatter(m_ptr->dun_depth, &y, &x, m_ptr->fy, m_ptr->fx, d, 0);
1791c1870
< if (!cave_empty_bold(y, x)) continue;
---
> if (!cave_empty_bold(m_ptr->dun_depth, y, x)) continue;
1794c1873
< result = place_monster_aux(y, x, m_ptr->r_idx, FALSE, FALSE);
---
> result = place_monster_aux(m_ptr->dun_depth, y, x, m_ptr->r_idx, FALSE, FALSE);
1813c1892
< void message_pain(int m_idx, int dam)
---
> void message_pain(int int m_idx, int dam)
Only in mangband-000/src/server: net.c
Only in mangband-000/src/server: netserver.c
Only in mangband-000/src/server: netserver.h
diff -r src-280/object1.c mangband-000/src/server/object1.c
12a13,14
> #define SERVER
>
736c738
< if (!k_ptr->has_flavor) k_ptr->aware = TRUE;
---
> /*if (!k_ptr->has_flavor) k_ptr->aware = TRUE;*/
1122c1124
< void object_desc(char *buf, object_type *o_ptr, int pref, int mode)
---
> void object_desc(int char *buf, object_type *o_ptr, int pref, int mode)
1889a1892
> #if 0
1912a1916
> #endif
2221c2225
< int i = 0, j, k;
---
> int i = 0;
2575a2580
> #if 0
2606a2612
> #endif
2631c2637
< s16b label_to_inven(int c)
---
> s16b label_to_inven(int int c)
2632a2639,2640
> player_type *p_ptr = Players[Ind];
>
2642c2650
< if (!inventory[i].k_idx) return (-1);
---
> if (!p_ptr->inventory[i].k_idx) return (-1);
2653c2661
< s16b label_to_equip(int c)
---
> s16b label_to_equip(int int c)
2654a2663,2664
> player_type *p_ptr = Players[Ind];
>
2664c2674
< if (!inventory[i].k_idx) return (-1);
---
> if (!p_ptr->inventory[i].k_idx) return (-1);
2675c2685
< s16b wield_slot(object_type *o_ptr)
---
> s16b wield_slot(int object_type *o_ptr)
2676a2687,2688
> player_type *p_ptr = Players[Ind];
>
2696c2708
< if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
---
> if (!p_ptr->inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
2754c2766
< cptr mention_use(int i)
---
> cptr mention_use(int int i)
2755a2768,2769
> player_type *p_ptr = Players[Ind];
>
2780c2794
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2791c2805
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2807c2821
< cptr describe_use(int i)
---
> cptr describe_use(int int i)
2808a2823,2824
> player_type *p_ptr = Players[Ind];
>
2832c2848
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2843c2859
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2892a2909,2912
> *
> * Note that this function simply sends a text string describing the
> * inventory slot, along with the tval, weight, and position in the inventory
> * to the client --KLJ--
2894c2914
< void display_inven(void)
---
> void display_inven(int Ind)
2895a2916,2917
> player_type *p_ptr = Players[Ind];
>
2905a2928
> int wgt;
2906a2930
> #if 0
2910c2934
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2914a2939
> #endif
2915a2941,2943
> /* Have the final slot be the FINAL slot */
> z = INVEN_WIELD;
>
2920c2948
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2924a2953
> #if 0
2927a2957
> #endif
2932c2962,2963
< tmp_val[1] = ')';
---
> /*tmp_val[1] = ')';*/
> #if 0
2933a2965
> #endif
2936c2968
< Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
---
> /*Term_putstr(0, i, 3, TERM_WHITE, tmp_val);*/
2951c2983
< Term_putstr(3, i, n, attr, o_name);
---
> /*Term_putstr(3, i, n, attr, o_name);*/
2954c2986
< Term_erase(3+n, i, 255);
---
> /*Term_erase(3+n, i, 255);*/
2957,2962c2989,2992
< if (show_weights && o_ptr->weight)
< {
< int wgt = o_ptr->weight * o_ptr->number;
< sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
< Term_putstr(71, i, -1, TERM_WHITE, tmp_val);
< }
---
> wgt = o_ptr->weight * o_ptr->number;
>
> /* Send the info to the client */
> Send_inven(tmp_val[0], attr, wgt, o_ptr->number, o_ptr->tval, o_name);
2964a2995
> #if 0
2970a3002
> #endif
2978c3010
< void display_equip(void)
---
> void display_equip(int Ind)
2979a3012,3013
> player_type *p_ptr = Players[Ind];
>
2987a3022
> int wgt;
2993c3028
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2998a3034
> #if 0
3000a3037
> #endif
3005c3042,3043
< tmp_val[1] = ')';
---
> /*tmp_val[1] = ')';*/
> #if 0
3006a3045
> #endif
3009c3048
< Term_putstr(0, i - INVEN_WIELD, 3, TERM_WHITE, tmp_val);
---
> /*Term_putstr(0, i - INVEN_WIELD, 3, TERM_WHITE, tmp_val);*/
3024c3063
< Term_putstr(3, i - INVEN_WIELD, n, attr, o_name);
---
> /*Term_putstr(3, i - INVEN_WIELD, n, attr, o_name);*/
3027c3066
< Term_erase(3+n, i - INVEN_WIELD, 255);
---
> /*Term_erase(3+n, i - INVEN_WIELD, 255);*/
3030c3069
< if (show_labels)
---
> /*if (show_labels)
3034c3073
< }
---
> }*/
3037,3043c3076,3079
< if (show_weights && o_ptr->weight)
< {
< int wgt = o_ptr->weight * o_ptr->number;
< int col = (show_labels ? 52 : 71);
< sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
< Term_putstr(col, i - INVEN_WIELD, -1, TERM_WHITE, tmp_val);
< }
---
> wgt = o_ptr->weight * o_ptr->number;
>
> /* Send the info off */
> Send_equip(tmp_val[0], attr, wgt, o_ptr->tval, o_name);
3045a3082
> #if 0
3051a3089
> #endif
3056a3095
> #if 0
3965c4004
<
---
> #endif
diff -r src-280/object2.c mangband-000/src/server/object2.c
12a13,14
> #define SERVER
>
25a28
> int Depth = o_ptr->dun_depth;
27c30
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
38c41
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
45c48
< void delete_object(int y, int x)
---
> void delete_object(int Depth, int y, int x)
50c53
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
53c56
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
84c87
< msg_print("Compacting objects...");
---
> printf("Compacting objects...");
87c90
< p_ptr->redraw |= (PR_MAP);
---
> /*p_ptr->redraw |= (PR_MAP);*/
90c93
< p_ptr->window |= (PW_OVERHEAD);
---
> /*p_ptr->window |= (PW_OVERHEAD);*/
121c124
< if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue;
---
> /*if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue;*/
157a161
> int Depth = o_list[o_max].dun_depth;
160c164
< cave[ny][nx].o_idx = i;
---
> cave[Depth][ny][nx].o_idx = i;
193c197
< void wipe_o_list(void)
---
> void wipe_o_list(int Depth)
204a209,212
> /* Skip objects not on this depth */
> if (o_ptr->dun_depth != Depth)
> continue;
>
206c214,216
< if (!character_dungeon || p_ptr->preserve)
---
> /* Hack -- Preserve unknown artifacts */
> /* We not preserve ALL artifacts, known or not */
> if (artifact_p(o_ptr)/* && !object_known_p(o_ptr)*/)
208,213c218,219
< /* Hack -- Preserve unknown artifacts */
< if (artifact_p(o_ptr) && !object_known_p(o_ptr))
< {
< /* Mega-Hack -- Preserve the artifact */
< a_info[o_ptr->name1].cur_num = 0;
< }
---
> /* Mega-Hack -- Preserve the artifact */
> a_info[o_ptr->name1].cur_num = 0;
216,220c222,223
< /* Object is gone */
< cave[o_ptr->iy][o_ptr->ix].o_idx = 0;
<
< /* Wipe the object */
< WIPE(o_ptr, object_type);
---
> /* Delete it */
> delete_object_idx(i);
222,227d224
<
< /* Restart free/heap pointers */
< o_nxt = o_max = 1;
<
< /* No more objects */
< o_top = 0;
296c293
< if (character_dungeon) msg_print("Too many objects!");
---
> if (server_dungeon) printf("Too many objects!");
540c537
< void object_aware(object_type *o_ptr)
---
> void object_aware(int object_type *o_ptr)
543c540
< k_info[o_ptr->k_idx].aware = TRUE;
---
> Players[Ind]->obj_aware[o_ptr->k_idx] = TRUE;
551c548
< void object_tried(object_type *o_ptr)
---
> void object_tried(int object_type *o_ptr)
554c551
< k_info[o_ptr->k_idx].tried = TRUE;
---
> Players[Ind]->obj_tried[o_ptr->k_idx] = TRUE;
563c560
< static s32b object_value_base(object_type *o_ptr)
---
> static s32b object_value_base(int object_type *o_ptr)
839c836
< s32b object_value(object_type *o_ptr)
---
> s32b object_value(int object_type *o_ptr)
906c903
< bool object_similar(object_type *o_ptr, object_type *j_ptr)
---
> bool object_similar(int object_type *o_ptr, object_type *j_ptr)
1069c1066
< void object_absorb(object_type *o_ptr, object_type *j_ptr)
---
> void object_absorb(int object_type *o_ptr, object_type *j_ptr)
1112c1109
< msg_format("No object (%d,%d)", tval, sval);
---
> printf("No object (%d,%d)", tval, sval);
1258a1256
> #if 0
1291a1290
> #endif
1303c1302
< static bool make_artifact_special(object_type *o_ptr)
---
> static bool make_artifact_special(int Depth, object_type *o_ptr)
1311c1310
< if (!dun_level) return (FALSE);
---
> if (!Depth) return (FALSE);
1325c1324
< if (a_ptr->level > dun_level)
---
> if (a_ptr->level > Depth)
1328c1327
< int d = (a_ptr->level - dun_level) * 2;
---
> int d = (a_ptr->level - Depth) * 2;
1372c1371
< static bool make_artifact(object_type *o_ptr)
---
> static bool make_artifact(int Depth, object_type *o_ptr)
1378c1377
< if (!dun_level) return (FALSE);
---
> if (!Depth) return (FALSE);
1399c1398
< if (a_ptr->level > dun_level)
---
> if (a_ptr->level > Depth)
1402c1401
< int d = (a_ptr->level - dun_level) * 2;
---
> int d = (a_ptr->level - Depth) * 2;
1870c1869
< if (cheat_peek) object_mention(o_ptr);
---
> /*if (cheat_peek) object_mention(o_ptr);*/
2378c2377
< if (cheat_peek) object_mention(o_ptr);
---
> /*if (cheat_peek) object_mention(o_ptr);*/
2599c2598
< if (cheat_peek) object_mention(o_ptr);
---
> /*if (cheat_peek) object_mention(o_ptr);*/
2718c2717
< void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great)
---
> void apply_magic(int Depth, object_type *o_ptr, int lev, bool okay, bool good, bool great)
2780c2779
< if (make_artifact(o_ptr)) break;
---
> if (make_artifact(Depth, o_ptr)) break;
2818c2817
< if (cheat_peek) object_mention(o_ptr);
---
> /* if (cheat_peek) object_mention(o_ptr); */
2966c2965
< if (cheat_peek) object_mention(o_ptr);
---
> /*if (cheat_peek) object_mention(o_ptr);*/
3070c3069
< void place_object(int y, int x, bool good, bool great)
---
> void place_object(int Depth, int y, int x, bool good, bool great)
3080c3079
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
3083c3082
< if (!cave_clean_bold(y, x)) return;
---
> if (!cave_clean_bold(Depth, y, x)) return;
3097c3096
< if ((rand_int(prob) != 0) || !make_artifact_special(&forge))
---
> if ((rand_int(prob) != 0) || !make_artifact_special(Depth, &forge))
3132c3131
< apply_magic(&forge, object_level, TRUE, good, great);
---
> apply_magic(Depth, &forge, object_level, TRUE, good, great);
3159a3159
> o_ptr->dun_depth = Depth;
3161c3161
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
3166c3166
< (rating == old) && (k_info[o_ptr->k_idx].level > dun_level))
---
> (rating == old) && (k_info[o_ptr->k_idx].level > Depth))
3169c3169
< rating += (k_info[o_ptr->k_idx].level - dun_level);
---
> rating += (k_info[o_ptr->k_idx].level - Depth);
3172c3172
< if (cheat_peek) object_mention(o_ptr);
---
> /*if (cheat_peek) object_mention(o_ptr);*/
3182c3182
< void acquirement(int y1, int x1, int num, bool great)
---
> void acquirement(int Depth, int y1, int x1, int num, bool great)
3196c3196
< scatter(&y, &x, y1, x1, d, 0);
---
> scatter(Depth, &y, &x, y1, x1, d, 0);
3199c3199
< if (!cave_clean_bold(y, x)) continue;
---
> if (!cave_clean_bold(Depth, y, x)) continue;
3202c3202
< place_object(y, x, TRUE, great);
---
> place_object(Depth, y, x, TRUE, great);
3205c3205
< note_spot(y, x);
---
> note_spot_depth(Depth, y, x);
3208c3208
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
3211,3212c3211,3212
< if ((y == py) && (x == px))
< {
---
> /*if ((y == py) && (x == px))
> {*/
3214,3215c3214,3215
< msg_print ("You feel something roll beneath your feet.");
< }
---
> /*msg_print ("You feel something roll beneath your feet.");
> }*/
3236c3236
< void place_trap(int y, int x)
---
> void place_trap(int Depth, int y, int x)
3241c3241
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
3244c3244
< if (!cave_naked_bold(y, x)) return;
---
> if (!cave_naked_bold(Depth, y, x)) return;
3247c3247
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
3264c3264
< void place_gold(int y, int x)
---
> void place_gold(int Depth, int y, int x)
3275c3275
< if (!in_bounds(y, x)) return;
---
> if (!in_bounds(Depth, y, x)) return;
3278c3278
< if (!cave_clean_bold(y, x)) return;
---
> if (!cave_clean_bold(Depth, y, x)) return;
3308a3309
> o_ptr->dun_depth = Depth;
3310c3311
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
3339c3340
< void drop_near(object_type *o_ptr, int chance, int y, int x)
---
> void drop_near(object_type *o_ptr, int chance, int Depth, int y, int x)
3364c3365
< scatter(&ny, &nx, y1, x1, d, 0);
---
> scatter(Depth, &ny, &nx, y1, x1, d, 0);
3367c3368
< if (!cave_clean_bold(ny, nx)) continue;
---
> if (!cave_clean_bold(Depth, ny, nx)) continue;
3386c3387
< scatter(&ny, &nx, y1, x1, d, 0);
---
> scatter(Depth, &ny, &nx, y1, x1, d, 0);
3389c3390
< if (!cave_floor_bold(ny, nx)) continue;
---
> if (!cave_floor_bold(Depth, ny, nx)) continue;
3395c3396
< c_ptr = &cave[ny][nx];
---
> c_ptr = &cave[Depth][ny][nx];
3403c3404
< else if ((k>99) && cave_valid_bold(ny, nx)) flag = TRUE;
---
> else if ((k>99) && cave_valid_bold(Depth, ny, nx)) flag = TRUE;
3409,3410d3409
< char o_name[80];
<
3419c3418
< object_desc(o_name, o_ptr, FALSE, 0);
---
> /*object_desc(o_name, o_ptr, FALSE, 0);*/
3422c3421
< msg_format("The %s crashes to the floor.", o_name);
---
> /*msg_format("The %s crashes to the floor.", o_name);*/
3436c3435
< delete_object(ny, nx);
---
> delete_object(Depth, ny, nx);
3452a3452
> o_ptr->dun_depth = Depth;
3455c3455
< c_ptr = &cave[ny][nx];
---
> c_ptr = &cave[Depth][ny][nx];
3459c3459
< note_spot(ny, nx);
---
> note_spot_depth(Depth, ny, nx);
3462c3462
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
3465c3465
< sound(SOUND_DROP);
---
> /*sound(SOUND_DROP);*/
3469c3469
< if (chance && (ny == py) && (nx == px))
---
> /*if (chance && (ny == py) && (nx == px))
3472c3472
< }
---
> }*/
3483,3484d3482
< char o_name[80];
<
3486c3484
< object_desc(o_name, o_ptr, FALSE, 0);
---
> /*object_desc(o_name, o_ptr, FALSE, 0);*/
3489,3490c3487,3488
< msg_format("The %s disappear%s.",
< o_name, ((o_ptr->number == 1) ? "s" : ""));
---
> /*msg_format("The %s disappear%s.",
> o_name, ((o_ptr->number == 1) ? "s" : ""));*/
3505c3503
< void pick_trap(int y, int x)
---
> void pick_trap(int Depth, int y, int x)
3509c3507
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
3521c3519
< if ((feat == FEAT_TRAP_HEAD + 0x00) && is_quest(dun_level)) continue;
---
> if ((feat == FEAT_TRAP_HEAD + 0x00) && is_quest(Depth)) continue;
3524c3522
< if ((feat == FEAT_TRAP_HEAD + 0x00) && (dun_level >= MAX_DEPTH-1)) continue;
---
> if ((feat == FEAT_TRAP_HEAD + 0x00) && (Depth >= MAX_DEPTH-1)) continue;
3534c3532
< note_spot(y, x);
---
> note_spot_depth(Depth, y, x);
3537c3535
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
3546c3544
< void inven_item_charges(int item)
---
> void inven_item_charges(int int item)
3548c3546
< object_type *o_ptr = &inventory[item];
---
> player_type *p_ptr = Players[Ind];
3549a3548,3549
> object_type *o_ptr = &p_ptr->inventory[item];
>
3575c3575
< void inven_item_describe(int item)
---
> void inven_item_describe(int int item)
3577c3577
< object_type *o_ptr = &inventory[item];
---
> player_type *p_ptr = Players[Ind];
3578a3579,3580
> object_type *o_ptr = &p_ptr->inventory[item];
>
3592c3594
< void inven_item_increase(int item, int num)
---
> void inven_item_increase(int int item, int num)
3594c3596
< object_type *o_ptr = &inventory[item];
---
> player_type *p_ptr = Players[Ind];
3595a3598,3599
> object_type *o_ptr = &p_ptr->inventory[item];
>
3613c3617
< total_weight += (num * o_ptr->weight);
---
> p_ptr->total_weight += (num * o_ptr->weight);
3633c3637
< void inven_item_optimize(int item)
---
> void inven_item_optimize(int int item)
3635c3639
< object_type *o_ptr = &inventory[item];
---
> player_type *p_ptr = Players[Ind];
3636a3641,3642
> object_type *o_ptr = &p_ptr->inventory[item];
>
3649c3655
< inven_cnt--;
---
> p_ptr->inven_cnt--;
3655c3661
< inventory[i] = inventory[i+1];
---
> p_ptr->inventory[i] = p_ptr->inventory[i+1];
3659c3665
< invwipe(&inventory[i]);
---
> invwipe(&p_ptr->inventory[i]);
3666c3672
< equip_cnt--;
---
> p_ptr->equip_cnt--;
3669c3675
< invwipe(&inventory[item]);
---
> invwipe(&p_ptr->inventory[item]);
3697c3703
< if (!object_known_p(o_ptr)) return;
---
> /*if (!object_known_p(o_ptr)) return;*/
3703c3709
< msg_format("There are %d charges remaining.", o_ptr->pval);
---
> /*msg_format("There are %d charges remaining.", o_ptr->pval);*/
3710c3716
< msg_format("There is %d charge remaining.", o_ptr->pval);
---
> /*msg_format("There is %d charge remaining.", o_ptr->pval);*/
3721,3724d3726
< object_type *o_ptr = &o_list[item];
<
< char o_name[80];
<
3726c3728
< object_desc(o_name, o_ptr, TRUE, 3);
---
> /*object_desc(o_name, o_ptr, TRUE, 3);*/
3729c3731
< msg_format("You see %s.", o_name);
---
> /*msg_format("You see %s.", o_name);*/
3779c3781
< bool inven_carry_okay(object_type *o_ptr)
---
> bool inven_carry_okay(int object_type *o_ptr)
3780a3783,3784
> player_type *p_ptr = Players[Ind];
>
3784c3788
< if (inven_cnt < INVEN_PACK) return (TRUE);
---
> if (p_ptr->inven_cnt < INVEN_PACK) return (TRUE);
3790c3794
< object_type *j_ptr = &inventory[i];
---
> object_type *j_ptr = &p_ptr->inventory[i];
3815c3819
< s16b inven_carry(object_type *o_ptr)
---
> s16b inven_carry(int object_type *o_ptr)
3816a3821,3822
> player_type *p_ptr = Players[Ind];
>
3826c3832
< j_ptr = &inventory[j];
---
> j_ptr = &p_ptr->inventory[j];
3841c3847
< total_weight += (o_ptr->number * o_ptr->weight);
---
> p_ptr->total_weight += (o_ptr->number * o_ptr->weight);
3856c3862
< if (inven_cnt > INVEN_PACK) return (-1);
---
> if (p_ptr->inven_cnt > INVEN_PACK) return (-1);
3862c3868
< j_ptr = &inventory[j];
---
> j_ptr = &p_ptr->inventory[j];
3883c3889
< j_ptr = &inventory[j];
---
> j_ptr = &p_ptr->inventory[j];
3925c3931
< inventory[k+1] = inventory[k];
---
> p_ptr->inventory[k+1] = p_ptr->inventory[k];
3929c3935
< invwipe(&inventory[i]);
---
> invwipe(&p_ptr->inventory[i]);
3934c3940
< inventory[i] = (*o_ptr);
---
> p_ptr->inventory[i] = (*o_ptr);
3937c3943
< inventory[i].iy = inventory[i].ix = 0;
---
> p_ptr->inventory[i].iy = p_ptr->inventory[i].ix = p_ptr->inventory[i].dun_depth = 0;
3940c3946
< total_weight += (o_ptr->number * o_ptr->weight);
---
> p_ptr->total_weight += (o_ptr->number * o_ptr->weight);
3943c3949
< inven_cnt++;
---
> p_ptr->inven_cnt++;
3966c3972
< void combine_pack(void)
---
> void combine_pack(int Ind)
3967a3974,3975
> player_type *p_ptr = Players[Ind];
>
3980c3988
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
3989c3997
< j_ptr = &inventory[j];
---
> j_ptr = &p_ptr->inventory[j];
4004c4012
< inven_cnt--;
---
> p_ptr->inven_cnt--;
4010c4018
< inventory[k] = inventory[k+1];
---
> p_ptr->inventory[k] = p_ptr->inventory[k+1];
4014c4022
< invwipe(&inventory[k]);
---
> invwipe(&p_ptr->inventory[k]);
4037c4045
< void reorder_pack(void)
---
> void reorder_pack(int Ind)
4038a4047,4048
> player_type *p_ptr = Players[Ind];
>
4056c4066
< if ((i == INVEN_PACK) && (inven_cnt == INVEN_PACK)) break;
---
> if ((i == INVEN_PACK) && (p_ptr->inven_cnt == INVEN_PACK)) break;
4059c4069
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
4071c4081
< j_ptr = &inventory[j];
---
> j_ptr = &p_ptr->inventory[j];
4113c4123
< temp = inventory[i];
---
> temp = p_ptr->inventory[i];
4119c4129
< inventory[k] = inventory[k-1];
---
> p_ptr->inventory[k] = p_ptr->inventory[k-1];
4123c4133
< inventory[j] = temp;
---
> p_ptr->inventory[j] = temp;
diff -r src-280/save.c mangband-000/src/server/save.c
4a5,6
> #define SERVER
>
652a655
> #if 0
656a660
> #endif
682a687
> wr_byte(o_ptr->dun_depth);
705c710
< wr_byte(o_ptr->marked);
---
> wr_byte(0);
730a736
> #if 0
735a742
> wr_byte(m_ptr->dun_depth);
745a753
> #endif
750a759
> #if 0
799a809
> #endif
805c815
< static void wr_xtra(int k_idx)
---
> static void wr_xtra(int int k_idx)
806a817
> player_type *p_ptr = Players[Ind];
809c820,821
< object_kind *k_ptr = &k_info[k_idx];
---
> if (p_ptr->obj_aware[k_idx]) tmp8u |= 0x01;
> if (p_ptr->obj_tried[k_idx]) tmp8u |= 0x02;
811,813d822
< if (k_ptr->aware) tmp8u |= 0x01;
< if (k_ptr->tried) tmp8u |= 0x02;
<
820a830
> #if 0
847a858
> #endif
852a864
> #if 0
871a884
> #endif
876a890
> #if 0
959a974
> #endif
964a980
> #if 0
974a991
> #endif
980c997
< static void wr_extra(void)
---
> static void wr_extra(int Ind)
981a999,1000
> player_type *p_ptr = Players[Ind];
>
984c1003
< wr_string(player_name);
---
> wr_string(p_ptr->name);
986c1005
< wr_string(died_from);
---
> wr_string(p_ptr->pass);
987a1007,1008
> wr_string(p_ptr->died_from);
>
990c1011
< wr_string(history[i]);
---
> wr_string(p_ptr->history[i]);
1090,1091c1111,1112
< wr_u32b(seed_flavor);
< wr_u32b(seed_town);
---
> /*wr_u32b(seed_flavor);*/
> /*wr_u32b(seed_town);*/
1096,1097c1117,1118
< wr_u16b(total_winner);
< wr_u16b(noscore);
---
> wr_u16b(p_ptr->total_winner);
> wr_u16b(p_ptr->noscore);
1101c1122
< wr_byte(death);
---
> wr_byte(p_ptr->death);
1104c1125
< wr_byte(feeling);
---
> /*wr_byte(feeling);*/
1107c1128
< wr_s32b(old_turn);
---
> /*wr_s32b(old_turn);*/
1110c1131
< wr_s32b(turn);
---
> /*wr_s32b(turn);*/
1709a1731
> #if 0
1856a1879
> #endif
1859d1881
<
1863c1885
< static bool wr_savefile_new(void)
---
> static bool wr_savefile_new(int Ind)
1864a1887,1888
> player_type *p_ptr = Players[Ind];
>
1926c1950
< wr_randomizer();
---
> /*wr_randomizer();*/
1930c1954
< wr_options();
---
> /*wr_options();*/
1932a1957
> #if 0
1948a1974
> #endif
1955a1982
> #if 0
1979a2007
> #endif
1983c2011
< wr_extra();
---
> wr_extra(Ind);
1991c2019
< wr_s16b(player_hp[i]);
---
> wr_s16b(p_ptr->player_hp[i]);
1996,2001c2024,2029
< wr_u32b(spell_learned1);
< wr_u32b(spell_learned2);
< wr_u32b(spell_worked1);
< wr_u32b(spell_worked2);
< wr_u32b(spell_forgotten1);
< wr_u32b(spell_forgotten2);
---
> wr_u32b(p_ptr->spell_learned1);
> wr_u32b(p_ptr->spell_learned2);
> wr_u32b(p_ptr->spell_worked1);
> wr_u32b(p_ptr->spell_worked2);
> wr_u32b(p_ptr->spell_forgotten1);
> wr_u32b(p_ptr->spell_forgotten2);
2006c2034
< wr_byte(spell_order[i]);
---
> wr_byte(p_ptr->spell_order[i]);
2013c2041
< if (inventory[i].k_idx)
---
> if (p_ptr->inventory[i].k_idx)
2016c2044
< wr_item(&inventory[i]);
---
> wr_item(&p_ptr->inventory[i]);
2023a2052
> #if 0
2033c2062
< if (!death)
---
> if (!p_ptr->death)
2040a2070
> #endif
2043c2073
< /* Write the "value check-sum" */
---
> /*Write the "value check-sum" */
2063c2093
< static bool save_player_aux(char *name)
---
> static bool save_player_aux(int char *name)
2096c2126
< if (wr_savefile_new()) ok = TRUE;
---
> if (wr_savefile_new(Ind)) ok = TRUE;
2111c2141
< character_saved = TRUE;
---
> /*server_saved = TRUE;*/
2122c2152
< bool save_player(void)
---
> bool save_player(int Ind)
2123a2154,2155
> player_type *p_ptr = Players[Ind];
>
2142c2174
< strcpy(safe, savefile);
---
> strcpy(safe, p_ptr->savefile);
2147c2179
< strcpy(safe, savefile);
---
> strcpy(safe, p_ptr->savefile);
2160c2192
< strcpy(temp, savefile);
---
> strcpy(temp, p_ptr->savefile);
2165c2197
< strcpy(temp, savefile);
---
> strcpy(temp, p_ptr->savefile);
2173c2205
< fd_move(savefile, temp);
---
> fd_move(p_ptr->savefile, temp);
2176c2208
< fd_move(safe, savefile);
---
> fd_move(safe, p_ptr->savefile);
2182c2214
< character_loaded = TRUE;
---
> /*character_loaded = TRUE;*/
2241c2273
< bool load_player(void)
---
> bool load_player(int Ind)
2242a2275,2276
> player_type *p_ptr = Players[Ind];
>
2257c2291
< turn = 0;
---
> /*turn = 0;*/
2260c2294
< death = FALSE;
---
> p_ptr->death = FALSE;
2264c2298
< if (!savefile[0]) return (TRUE);
---
> if (!p_ptr->savefile[0]) return (TRUE);
2272c2306
< if (access(savefile, 0) < 0)
---
> if (access(p_ptr->savefile, 0) < 0)
2275,2276c2309
< msg_print("Savefile does not exist.");
< msg_print(NULL);
---
> printf("Savefile does not exist for player %s.\n", p_ptr->name);
2295c2328
< strcpy(temp, savefile);
---
> strcpy(temp, p_ptr->savefile);
2319c2352
< fprintf(fkk, "Lock file for savefile '%s'\n", savefile);
---
> fprintf(fkk, "Lock file for savefile '%s'\n", p_ptr->savefile);
2332c2365
< fd = fd_open(savefile, O_RDONLY);
---
> fd = fd_open(p_ptr->savefile, O_RDONLY);
2383c2416
< Term_clear();
---
> /*Term_clear();*/
2384a2418
> #if 0
2397a2432
> #endif
2400c2435,2436
< else if (sf_major == 2)
---
> /* Parse "MAngband" savefiles */
> if (sf_major == 0)
2403c2439
< err = rd_savefile_new();
---
> err = rd_savefile_new(Ind);
2414a2451
> if (err == 35) what = "Incorrect password";
2460c2497
< if (death)
---
> if (p_ptr->death)
2463c2500
< death = FALSE;
---
> p_ptr->death = FALSE;
2464a2502
> #if 0
2473a2512
> #endif
2479c2518
< turn = old_turn = 0;
---
> /*turn = old_turn = 0;*/
2492c2531
< (void)strcpy(died_from, "(alive and well)");
---
> (void)strcpy(p_ptr->died_from, "(alive and well)");
2508c2547
< strcpy(temp, savefile);
---
> strcpy(temp, p_ptr->savefile);
2519,2521c2558,2559
< msg_format("Error (%s) reading %d.%d.%d savefile.",
< what, sf_major, sf_minor, sf_patch);
< msg_print(NULL);
---
> Destroy_connection(p_ptr->conn, format("Error (%s) reading %d.%d.%d savefile.",
> what, sf_major, sf_minor, sf_patch));
2526a2565,2568
> bool load_server_info(void)
> {
> return (TRUE);
> }
2527a2570,2573
> bool save_server_info(void)
> {
> return (TRUE);
> }
Only in mangband-000/src/server: sched.c
Only in mangband-000/src/server: socklib.c
diff -r src-280/spells1.c mangband-000/src/server/spells1.c
12a13,14
> #define SERVER
>
40c42,44
< r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);
---
> /* Don't base this on "dun_level" */
> /*r = get_mon_num((dun_level + r_ptr->level) / 2 + 5);*/
> r = get_mon_num(r_ptr->level + 5);
75c79
< int ny, nx, oy, ox, d, i, min;
---
> int ny, nx, oy, ox, Depth, d, i, min;
88a93,94
> Depth = m_ptr->dun_depth;
>
111c117
< if (!in_bounds(ny, nx)) continue;
---
> if (!in_bounds(Depth, ny, nx)) continue;
114c120
< if (!cave_empty_bold(ny, nx)) continue;
---
> if (!cave_empty_bold(Depth, ny, nx)) continue;
117c123
< if (cave[ny][nx].feat == FEAT_GLYPH) continue;
---
> if (cave[Depth][ny][nx].feat == FEAT_GLYPH) continue;
120c126
< /* if (cave[ny][nx].info & CAVE_ICKY) continue; */
---
> /* if (cave[Depth][ny][nx].info & CAVE_ICKY) continue; */
137c143
< cave[ny][nx].m_idx = m_idx;
---
> cave[Depth][ny][nx].m_idx = m_idx;
140c146
< cave[oy][ox].m_idx = 0;
---
> cave[Depth][oy][ox].m_idx = 0;
150c156
< lite_spot(oy, ox);
---
> everyone_lite_spot(Depth, oy, ox);
153c159
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
163c169
< void teleport_player(int dis)
---
> void teleport_player(int int dis)
165c171
< int d, i, min, ox, oy, x = py, y = px;
---
> player_type *p_ptr = Players[Ind];
166a173,175
> int d, i, min, ox, oy, x = p_ptr->py, y = p_ptr->px;
> int Depth = p_ptr->dun_depth;
>
184,186c193,195
< y = rand_spread(py, dis);
< x = rand_spread(px, dis);
< d = distance(py, px, y, x);
---
> y = rand_spread(p_ptr->py, dis);
> x = rand_spread(p_ptr->px, dis);
> d = distance(p_ptr->py, p_ptr->px, y, x);
191c200
< if (!in_bounds(y, x)) continue;
---
> if (!in_bounds(Depth, y, x)) continue;
194c203
< if (!cave_naked_bold(y, x)) continue;
---
> if (!cave_naked_bold(Depth, y, x)) continue;
197c206
< if (cave[y][x].info & CAVE_ICKY) continue;
---
> if (cave[Depth][y][x].info & CAVE_ICKY) continue;
214,215c223,224
< oy = py;
< ox = px;
---
> oy = p_ptr->py;
> ox = p_ptr->px;
218,219c227,228
< py = y;
< px = x;
---
> p_ptr->py = y;
> p_ptr->px = x;
220a230,235
> /* The player isn't on his old spot anymore */
> cave[Depth][oy][ox].p_idx = 0;
>
> /* The player is on his new spot */
> cave[Depth][y][x].p_idx = Ind;
>
222c237
< lite_spot(oy, ox);
---
> everyone_lite_spot(Depth, oy, ox);
225c240
< lite_spot(py, px);
---
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
228c243
< verify_panel();
---
> verify_panel(Ind);
240c255
< handle_stuff();
---
> handle_stuff(Ind);
251c266
< void teleport_player_to(int ny, int nx)
---
> void teleport_player_to(int int ny, int nx)
252a268,269
> player_type *p_ptr = Players[Ind];
>
253a271
> int Depth = p_ptr->dun_depth;
264c282
< if (in_bounds(y, x)) break;
---
> if (in_bounds(Depth, y, x)) break;
268c286
< if (cave_naked_bold(y, x)) break;
---
> if (cave_naked_bold(Depth, y, x)) break;
279,280c297,298
< oy = py;
< ox = px;
---
> oy = p_ptr->py;
> ox = p_ptr->px;
283,284c301,302
< py = y;
< px = x;
---
> p_ptr->py = y;
> p_ptr->px = x;
287c305
< lite_spot(oy, ox);
---
> everyone_lite_spot(Depth, oy, ox);
290c308
< lite_spot(py, px);
---
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
293c311
< verify_panel();
---
> verify_panel(Ind);
305c323
< handle_stuff();
---
> handle_stuff(Ind);
311a330,333
> *
> * Note that keeping the "players_on_depth" array correct is VERY important,
> * otherwise levels with players still on them might be destroyed, or empty
> * levels could be kept around, wasting memory.
313c335
< void teleport_player_level(void)
---
> void teleport_player_level(int Ind)
315c337,340
< if (!dun_level)
---
> player_type *p_ptr = Players[Ind];
> int Depth = p_ptr->dun_depth;
>
> if (!Depth)
318,319c343,363
< dun_level++;
< new_level_flag = TRUE;
---
>
> /* One less player here */
> players_on_depth[Depth]--;
>
> /* Remove the player */
> cave[Depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show that he's left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth++;
> Depth++;
>
> /* One more player here */
> players_on_depth[Depth]++;
>
> p_ptr->new_level_flag = TRUE;
321c365
< else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1))
---
> else if (is_quest(Depth) || (Depth >= MAX_DEPTH-1))
324,325c368,388
< dun_level--;
< new_level_flag = TRUE;
---
>
> /* One less player here */
> players_on_depth[Depth]--;
>
> /* Remove the player */
> cave[Depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show that he's left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth--;
> Depth--;
>
> /* One more player here */
> players_on_depth[Depth]++;
>
> p_ptr->new_level_flag = TRUE;
330,331c393,413
< dun_level--;
< new_level_flag = TRUE;
---
>
> /* One less player here */
> players_on_depth[Depth]--;
>
> /* Remove the player */
> cave[Depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show that he's left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth--;
> Depth--;
>
> /* One more player here */
> players_on_depth[Depth]++;
>
> p_ptr->new_level_flag = TRUE;
336,337c418,438
< dun_level++;
< new_level_flag = TRUE;
---
>
> /* One less player here */
> players_on_depth[Depth]--;
>
> /* Remove the player */
> cave[Depth][p_ptr->py][p_ptr->px].p_idx = 0;
>
> /* Show that he's left */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Forget his lite and viewing area */
> forget_lite(Ind);
> forget_view(Ind);
>
> p_ptr->dun_depth++;
> Depth++;
>
> /* One more player here */
> players_on_depth[Depth]++;
>
> p_ptr->new_level_flag = TRUE;
427c528
< void take_hit(int damage, cptr hit_from)
---
> void take_hit(int int damage, cptr hit_from)
429c530
< int old_chp = p_ptr->chp;
---
> player_type *p_ptr = Players[Ind];
435c536
< if (death) return;
---
> if (p_ptr->death) return;
464c565
< (void)strcpy(died_from, hit_from);
---
> (void)strcpy(p_ptr->died_from, hit_from);
467c568
< total_winner = FALSE;
---
> p_ptr->total_winner = FALSE;
470c571
< death = TRUE;
---
> p_ptr->death = TRUE;
480c581
< if (alert_hitpoint && (old_chp > warning)) bell();
---
> /*if (alert_hitpoint && (old_chp > warning)) bell();*/
711c812
< static int inven_damage(inven_func typ, int perc)
---
> static int inven_damage(int inven_func typ, int perc)
712a814,815
> player_type *p_ptr = Players[Ind];
>
727c830
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
779c882
< static int minus_ac(void)
---
> static int minus_ac(int Ind)
780a884,885
> player_type *p_ptr = Players[Ind];
>
791,796c896,901
< case 1: o_ptr = &inventory[INVEN_BODY]; break;
< case 2: o_ptr = &inventory[INVEN_ARM]; break;
< case 3: o_ptr = &inventory[INVEN_OUTER]; break;
< case 4: o_ptr = &inventory[INVEN_HANDS]; break;
< case 5: o_ptr = &inventory[INVEN_HEAD]; break;
< case 6: o_ptr = &inventory[INVEN_FEET]; break;
---
> case 1: o_ptr = &p_ptr->inventory[INVEN_BODY]; break;
> case 2: o_ptr = &p_ptr->inventory[INVEN_ARM]; break;
> case 3: o_ptr = &p_ptr->inventory[INVEN_OUTER]; break;
> case 4: o_ptr = &p_ptr->inventory[INVEN_HANDS]; break;
> case 5: o_ptr = &p_ptr->inventory[INVEN_HEAD]; break;
> case 6: o_ptr = &p_ptr->inventory[INVEN_FEET]; break;
840c945
< void acid_dam(int dam, cptr kb_str)
---
> void acid_dam(int int dam, cptr kb_str)
841a947,948
> player_type *p_ptr = Players[Ind];
>
852c959
< if (minus_ac()) dam = (dam + 1) / 2;
---
> if (minus_ac(Ind)) dam = (dam + 1) / 2;
865c972
< void elec_dam(int dam, cptr kb_str)
---
> void elec_dam(int int dam, cptr kb_str)
866a974,975
> player_type *p_ptr = Players[Ind];
>
889c998
< void fire_dam(int dam, cptr kb_str)
---
> void fire_dam(int int dam, cptr kb_str)
890a1000,1001
> player_type *p_ptr = Players[Ind];
>
911c1022
< void cold_dam(int dam, cptr kb_str)
---
> void cold_dam(int int dam, cptr kb_str)
912a1024,1025
> player_type *p_ptr = Players[Ind];
>
939c1052
< bool inc_stat(int stat)
---
> bool inc_stat(int int stat)
940a1054,1055
> player_type *p_ptr = Players[Ind];
>
1012c1127
< bool dec_stat(int stat, int amount, int permanent)
---
> bool dec_stat(int int stat, int amount, int permanent)
1013a1129,1130
> player_type *p_ptr = Players[Ind];
>
1122c1239
< bool res_stat(int stat)
---
> bool res_stat(int int stat)
1123a1241,1242
> player_type *p_ptr = Players[Ind];
>
1153c1272
< bool apply_disenchant(int mode)
---
> bool apply_disenchant(int int mode)
1154a1274,1275
> player_type *p_ptr = Players[Ind];
>
1180c1301
< o_ptr = &inventory[t];
---
> o_ptr = &p_ptr->inventory[t];
1242c1363
< static void apply_nexus(monster_type *m_ptr)
---
> static void apply_nexus(int monster_type *m_ptr)
1243a1365,1366
> player_type *p_ptr = Players[Ind];
>
1269c1392
< teleport_player_level();
---
> teleport_player_level(Ind);
1333c1456
< static bool project_f(int who, int r, int y, int x, int dam, int typ)
---
> static bool project_f(int int who, int r, int Depth, int y, int x, int dam, int typ)
1335c1458
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
1338a1462
> bool quiet = ((Ind <= 0) ? TRUE : FALSE);
1340a1465
> player_type *p_ptr = (quiet ? NULL : Players[Ind]);
1341a1467,1468
> byte *w_ptr = (quiet ? NULL : &p_ptr->cave_flag[y][x]);
>
1380c1507
< if (player_can_see_bold(y, x))
---
> if (!quiet && player_can_see_bold(y, x))
1389,1390c1516,1519
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1392,1393c1521,1523
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1401c1531
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1410,1411c1540,1543
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1413,1414c1545,1547
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1423c1556
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1432,1433c1565,1568
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1435,1436c1570,1572
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1449c1585
< if (player_can_see_bold(y, x))
---
> if (!quiet && player_can_see_bold(y, x))
1459c1595
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, y, x);
1461,1462c1597,1600
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1464,1465c1602,1604
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1475c1614
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1485c1624
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, y, x);
1487,1488c1626,1629
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1490,1491c1631,1633
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1499c1641
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1509c1651
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, y, x);
1511,1512c1653,1656
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1514,1515c1658,1659
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
1517,1518c1661,1663
< /* Update some things */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
---
> /* Update some things */
> p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
> }
1528c1673
< if (cave_floor_bold(y, x)) break;
---
> if (cave_floor_bold(Depth, y, x)) break;
1537c1682
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1551c1696
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1562c1707
< place_gold(y, x);
---
> place_gold(Depth, y, x);
1569c1714
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1583c1728
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1596c1741
< if (player_can_see_bold(y, x))
---
> if (!quiet && player_can_see_bold(y, x))
1603c1748
< place_object(y, x, FALSE, FALSE);
---
> place_object(Depth, y, x, FALSE, FALSE);
1611c1756
< if (c_ptr->info & CAVE_MARK)
---
> if (!quiet && (*w_ptr & CAVE_MARK))
1622c1767,1772
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, y, x);
>
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1624,1625c1774,1775
< /* Notice */
< note_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
1627,1628c1777,1779
< /* Redraw */
< lite_spot(y, x);
---
> /* Update some things */
> p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS);
> }
1630,1632d1780
< /* Update some things */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS);
<
1640c1788
< if (!cave_naked_bold(y, x)) break;
---
> if (!cave_naked_bold(Depth, y, x)) break;
1645,1646c1793,1796
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1648,1649c1798,1799
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
1651,1652c1801,1802
< /* Observe */
< if (c_ptr->info & CAVE_MARK) obvious = TRUE;
---
> /* Observe */
> if (*w_ptr & CAVE_MARK) obvious = TRUE;
1654,1655c1804,1806
< /* Update some things */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
---
> /* Update some things */
> p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS);
> }
1664c1815
< if (!cave_naked_bold(y, x)) break;
---
> if (!cave_naked_bold(Depth, y, x)) break;
1667c1818
< place_trap(y, x);
---
> place_trap(Depth, y, x);
1669,1670c1820,1823
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1672,1673c1825,1827
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1685,1686c1839,1842
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
1688,1689c1844,1845
< /* Redraw */
< lite_spot(y, x);
---
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
1691,1692c1847,1849
< /* Observe */
< if (player_can_see_bold(y, x)) obvious = TRUE;
---
> /* Observe */
> if (player_can_see_bold(y, x)) obvious = TRUE;
> }
1706c1863
< if (player_can_see_bold(y, x)) obvious = TRUE;
---
> if (!quiet && player_can_see_bold(y, x)) obvious = TRUE;
1715c1872
< c_ptr->info &= ~CAVE_MARK;
---
> everyone_forget_spot(Depth, y, x);
1717,1718c1874,1878
< /* Notice */
< note_spot(y, x);
---
> if (!quiet)
> {
> /* Notice */
> note_spot(y, x);
> }
1721,1722c1881,1885
< /* Redraw */
< lite_spot(y, x);
---
> if (!quiet)
> {
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
1755c1918
< static bool project_i(int who, int r, int y, int x, int dam, int typ)
---
> static bool project_i(int int who, int r, int Depth, int y, int x, int dam, int typ)
1757c1920
< cave_type *c_ptr = &cave[y][x];
---
> player_type *p_ptr;
1758a1922,1923
> cave_type *c_ptr = &cave[Depth][y][x];
>
1767a1933,1934
> bool quiet = ((Ind <= 0) ? TRUE : FALSE);
>
1779a1947,1949
> /* Set the player pointer */
> if (!quiet)
> p_ptr = Players[Ind];
1939c2109
< if (o_ptr->marked)
---
> if (!quiet && p_ptr->obj_vis[c_ptr->o_idx])
1956c2126
< if (o_ptr->marked)
---
> if (p_ptr->obj_vis[c_ptr->o_idx])
1966c2136
< if (o_ptr->marked)
---
> if (!quiet && p_ptr->obj_vis[c_ptr->o_idx])
1977c2147
< if (o_ptr->marked && note_kill)
---
> if (!quiet && p_ptr->obj_vis[c_ptr->o_idx] && note_kill)
1983c2153
< delete_object(y, x);
---
> delete_object(Depth, y, x);
1985,1986c2155,2159
< /* Redraw */
< lite_spot(y, x);
---
> if (!quiet)
> {
> /* Redraw */
> everyone_lite_spot(Depth, y, x);
> }
2049c2222
< static bool project_m(int who, int r, int y, int x, int dam, int typ)
---
> static bool project_m(int int who, int r, int Depth, int y, int x, int dam, int typ)
2053c2226
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
2062c2235
< bool seen = m_ptr->ml;
---
> bool seen;
2066a2240
> bool quiet = ((Ind <= 0) ? TRUE : FALSE);
2067a2242,2243
> player_type *p_ptr = (quiet ? NULL : Players[Ind]);
>
2101c2277
< if (who && (c_ptr->m_idx == who)) return (FALSE);
---
> if ((who > 0) && (c_ptr->m_idx == who)) return (FALSE);
2103a2280,2284
> /* Set the "seen" flag */
> if (!quiet)
> seen = p_ptr->mon_vis[c_ptr->m_idx];
> else seen = FALSE;
>
2965c3146
< if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
---
> if ((who > 0) && (dam > m_ptr->hp)) dam = m_ptr->hp;
3001c3182
< (void)place_monster_aux(y, x, i, FALSE, FALSE);
---
> (void)place_monster_aux(Depth, y, x, i, FALSE, FALSE);
3030c3211
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
3097c3278
< if (who)
---
> if (who > 0)
3112c3293
< monster_death(c_ptr->m_idx);
---
> if (!quiet) monster_death(c_ptr->m_idx);
3118c3299
< if (note) msg_format("%^s%s", m_name, note);
---
> if (!quiet && note) msg_format("%^s%s", m_name, note);
3125c3306
< if (note && seen) msg_format("%^s%s", m_name, note);
---
> if (!quiet && note && seen) msg_format("%^s%s", m_name, note);
3128c3309
< else if (dam > 0) message_pain(c_ptr->m_idx, dam);
---
> else if (!quiet && dam > 0) message_pain(c_ptr->m_idx, dam);
3141c3322
< if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
---
> if (!quiet && mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
3150c3331
< if (note && seen) msg_format("%^s%s", m_name, note);
---
> if (!quiet && note && seen) msg_format("%^s%s", m_name, note);
3153c3334
< else if (dam > 0) message_pain(c_ptr->m_idx, dam);
---
> else if (!quiet && dam > 0) message_pain(c_ptr->m_idx, dam);
3156c3337
< if ((fear || do_fear) && (m_ptr->ml))
---
> if (!quiet && (fear || do_fear) && (p_ptr->mon_vis[c_ptr->m_idx]))
3174,3175c3355,3359
< /* Hack -- Redraw the monster grid anyway */
< lite_spot(y, x);
---
> if (!quiet)
> {
> /* Hack -- Redraw the monster grid anyway */
> everyone_lite_spot(Depth, y, x);
> }
3202c3386
< static bool project_p(int who, int r, int y, int x, int dam, int typ)
---
> static bool project_p(int int who, int r, int Depth, int y, int x, int dam, int typ)
3203a3388,3389
> player_type *p_ptr;
>
3212c3398
< bool blind = (p_ptr->blind ? TRUE : FALSE);
---
> bool blind;
3228a3415,3417
> /* Bad player number */
> if (Ind <= 0)
> return (FALSE);
3229a3419,3422
> p_ptr = Players[Ind];
>
> blind = (p_ptr->blind ? TRUE : FALSE);
>
3231c3424
< if ((x != px) || (y != py)) return (FALSE);
---
> if ((x != p_ptr->px) || (y != p_ptr->py) || (Depth != p_ptr->dun_depth)) return (FALSE);
3234c3427
< if (!who) return (FALSE);
---
> if (who == Ind) return (FALSE);
3255,3256c3448,3451
< /* Get the source monster */
< m_ptr = &m_list[who];
---
> if (who > 0)
> {
> /* Get the source monster */
> m_ptr = &m_list[who];
3258,3259c3453,3454
< /* Get the monster name */
< monster_desc(m_name, m_ptr, 0);
---
> /* Get the monster name */
> monster_desc(m_name, m_ptr, 0);
3261,3262c3456,3462
< /* Get the monster's real name */
< monster_desc(killer, m_ptr, 0x88);
---
> /* Get the monster's real name */
> monster_desc(killer, m_ptr, 0x88);
> }
> else if (who < 0)
> {
> strcpy(killer, Players[0 - who]->name);
> }
3658c3858
< * who: Index of "source" monster (or "zero" for "player")
---
> * who: Index of "source" monster (or "zero" if "player")
3788c3988
< bool project(int who, int rad, int y, int x, int dam, int typ, int flg)
---
> bool project(int who, int rad, int Depth, int y, int x, int dam, int typ, int flg)
3790c3990
< int i, t;
---
> int i, j, t;
3792c3992
< int y0, x0, y9, x9;
---
> int /*y0, x0,*/ y9, x9;
3793a3994
> int who_can_see[26], num_can_see = 0;
3795c3996
< int msec = delay_factor * delay_factor * delay_factor;
---
> /*int msec = delay_factor * delay_factor * delay_factor;*/
3804c4005
< bool visual = FALSE;
---
> /*bool visual = FALSE;*/
3810c4011,4012
< bool blind = (p_ptr->blind ? TRUE : FALSE);
---
> /* Blindness is currently ignored for this function */
> /*bool blind;*/
3823,3824c4025,4026
< y0 = py;
< x0 = px;
---
> /*y0 = py;
> x0 = px;*/
3834,3835c4036,4037
< /* Hack -- Start at player */
< else if (!who)
---
> /* Hack -- Start at a player */
> else if (who < 0)
3837,3838c4039,4040
< x1 = px;
< y1 = py;
---
> x1 = Players[0 - who]->px;
> y1 = Players[0 - who]->py;
3868c4070
< handle_stuff();
---
> /*handle_stuff();*/
3886a4089,4091
> /* Check the grid */
> c_ptr = &cave[Depth][y][x];
>
3888,3890c4093,4094
< if (!blind && !(flg & PROJECT_HIDE) &&
< dist && (flg & PROJECT_BEAM) &&
< panel_contains(y, x) && player_has_los_bold(y, x))
---
> if (!(flg & PROJECT_HIDE) &&
> dist && (flg & PROJECT_BEAM))
3893,3894c4097,4101
< print_rel('*', spell_color(typ), y, x);
< }
---
> for (j = 1; j < NumPlayers + 1; j++)
> {
> player_type *p_ptr = Players[j];
> int dispx, dispy;
> byte attr;
3896,3897c4103,4104
< /* Check the grid */
< c_ptr = &cave[y][x];
---
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
3898a4106,4132
> if (p_ptr->dun_depth != Depth)
> continue;
>
> if (p_ptr->blind)
> continue;
>
> if (!panel_contains(y, x))
> continue;
>
> if (!player_has_los_bold(j, y, x))
> continue;
>
> dispx = x - p_ptr->panel_col_prt;
> dispy = y - p_ptr->panel_row_prt;
>
> attr = spell_color(typ);
>
> p_ptr->scr_info[dispy][dispx].c = '*';
> p_ptr->scr_info[dispy][dispx].a = attr;
>
> Send_char(j, dispx, dispy, attr, '*');
>
> /* Hack -- Show bolt char */
> Send_flush(j);
> }
> }
>
3900c4134
< if (dist && !cave_floor_bold(y, x)) break;
---
> if (dist && !cave_floor_bold(Depth, y, x)) break;
3915c4149
< if (!cave_floor_bold(y9, x9) && (rad > 0)) break;
---
> if (!cave_floor_bold(Depth, y9, x9) && (rad > 0)) break;
3924c4158
< if (!blind && !(flg & PROJECT_HIDE))
---
> if (!(flg & PROJECT_HIDE))
3926,3927c4160
< /* Only do visuals if the player can "see" the bolt */
< if (player_has_los_bold(y9, x9) && panel_contains(y9, x9))
---
> for (j = 1; j < NumPlayers + 1; j++)
3929,3937c4162,4165
< /* Visual effects -- Display, Highlight, Flush, Pause, Erase */
< print_rel(bolt_char(y, x, y9, x9), spell_color(typ), y9, x9);
< move_cursor_relative(y9, x9);
< Term_fresh();
< visual = TRUE;
< Term_xtra(TERM_XTRA_DELAY, msec);
< lite_spot(y9, x9);
< Term_fresh();
< }
---
> player_type *p_ptr = Players[j];
> int dispy, dispx;
> char ch;
> byte attr;
3939,3943c4167,4194
< /* Hack -- make sure to delay anyway for consistency */
< else if (visual)
< {
< /* Delay for consistency */
< Term_xtra(TERM_XTRA_DELAY, msec);
---
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
>
> if (p_ptr->dun_depth != Depth)
> continue;
>
> if (p_ptr->blind)
> continue;
>
> if (!panel_contains(y9, x9))
> continue;
>
> if (!player_has_los_bold(j, y9, x9))
> continue;
>
> dispx = x9 - p_ptr->panel_col_prt;
> dispy = y9 - p_ptr->panel_row_prt;
>
> ch = bolt_char(y, x, y9, x9);
> attr = spell_color(typ);
>
> p_ptr->scr_info[dispy][dispx].c = ch;
> p_ptr->scr_info[dispy][dispx].a = attr;
>
> Send_char(j, dispx, dispy, attr, ch);
>
> /* Hack -- Show bolt char */
> Send_flush(j);
3946a4198,4200
> /* Clean up */
> everyone_lite_spot(Depth, y9, x9);
>
3978c4232
< if (!in_bounds2(y, x)) continue;
---
> if (!in_bounds2(Depth, y, x)) continue;
3984c4238
< if (!los(y2, x2, y, x)) continue;
---
> if (!los(Depth, y2, x2, y, x)) continue;
4002d4255
<
4004c4257
< if (!blind && !(flg & PROJECT_HIDE))
---
> if (!(flg & PROJECT_HIDE))
4008a4262,4264
> /* Reset who can see */
> num_can_see = 0;
>
4016,4018c4272
< /* The player can see it */
< if (player_has_los_bold(y, x) &&
< panel_contains(y, x))
---
> for (j = 1; j < NumPlayers + 1; j++)
4019a4274,4302
> player_type *p_ptr = Players[j];
> int dispy, dispx;
> byte attr;
>
> if (p_ptr->conn == NOT_CONNECTED)
> continue;
>
> if (p_ptr->dun_depth != Depth)
> continue;
>
> if (p_ptr->blind)
> continue;
>
> if (!panel_contains(y, x))
> continue;
>
> if (!player_has_los_bold(j, y, x))
> continue;
>
> attr = spell_color(typ);
>
> dispx = x - p_ptr->panel_col_prt;
> dispy = y - p_ptr->panel_row_prt;
>
> p_ptr->scr_info[dispy][dispx].c = '*';
> p_ptr->scr_info[dispy][dispx].a = attr;
>
> Send_char(j, dispx, dispy, attr, '*');
>
4021c4304,4305
< print_rel('*', spell_color(typ), y, x);
---
>
> who_can_see[num_can_see++] = j;
4029,4032c4313
< Term_fresh();
<
< /* Delay (efficiently) */
< if (visual || drawn)
---
> for (j = 0; j < num_can_see; j++)
4034c4315
< Term_xtra(TERM_XTRA_DELAY, msec);
---
> Send_flush(who_can_see[j]);
4049,4053c4330
< if (player_has_los_bold(y, x) &&
< panel_contains(y, x))
< {
< lite_spot(y, x);
< }
---
> everyone_lite_spot(Depth, y, x);
4057c4334
< move_cursor_relative(y2, x2);
---
> /*move_cursor_relative(y2, x2);*/
4060c4337,4340
< Term_fresh();
---
> for (j = 0; j < num_can_see; j++)
> {
> Send_flush(who_can_see[j]);
> }
4082c4362
< if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
---
> if (project_f(0 - who, who, dist, Depth, y, x, dam, typ)) notice = TRUE;
4104c4384
< if (project_i(who, dist, y, x, dam, typ)) notice = TRUE;
---
> if (project_i(0 - who, who, dist, Depth, y, x, dam, typ)) notice = TRUE;
4131c4411
< if (!cave_floor_bold(y, x)) continue;
---
> if (!cave_floor_bold(Depth, y, x)) continue;
4134c4414
< if (project_m(who, dist, y, x, dam, typ)) notice = TRUE;
---
> if (project_m(0 - who, who, dist, Depth, y, x, dam, typ)) notice = TRUE;
4138c4418
< if (!who && (project_m_n == 1))
---
> if ((who < 0) && (project_m_n == 1))
4143a4424
> #if 0
4145c4426
< if (cave[y][x].m_idx)
---
> if (cave[Depth][y][x].m_idx)
4147c4428
< monster_type *m_ptr = &m_list[cave[y][x].m_idx];
---
> monster_type *m_ptr = &m_list[cave[Depth][y][x].m_idx];
4153c4434
< if (m_ptr->ml) health_track(cave[y][x].m_idx);
---
> if (m_ptr->ml) health_track(cave[Depth][y][x].m_idx);
4154a4436
> #endif
4167a4450,4452
> /* Who is at the location */
> int player_idx;
>
4174a4460,4462
> /* Set the player index */
> player_idx = cave[Depth][y][x].p_idx;
>
4176c4464
< if (project_p(who, dist, y, x, dam, typ)) notice = TRUE;
---
> if (project_p(player_idx, who, dist, Depth, y, x, dam, typ)) notice = TRUE;
diff -r src-280/spells2.c mangband-000/src/server/spells2.c
12a13,14
> #define SERVER
>
22c24
< bool hp_player(int num)
---
> bool hp_player(int int num)
23a26,27
> player_type *p_ptr = Players[Ind];
>
75c79
< void warding_glyph(void)
---
> void warding_glyph(int Ind)
76a81,82
> player_type *p_ptr = Players[Ind];
>
80c86
< if (!cave_clean_bold(py, px)) return;
---
> if (!cave_clean_bold(p_ptr->dun_depth, p_ptr->py, p_ptr->px)) return;
83c89
< c_ptr = &cave[py][px];
---
> c_ptr = &cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px];
123c129
< bool do_dec_stat(int stat)
---
> bool do_dec_stat(int int stat)
124a131,132
> player_type *p_ptr = Players[Ind];
>
167c175
< bool do_res_stat(int stat)
---
> bool do_res_stat(int int stat)
187c195
< bool do_inc_stat(int stat)
---
> bool do_inc_stat(int int stat)
224c232
< void identify_pack(void)
---
> void identify_pack(int Ind)
225a234,235
> player_type *p_ptr = Players[Ind];
>
232c242
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
268c278
< static int remove_curse_aux(int all)
---
> static int remove_curse_aux(int int all)
269a280,281
> player_type *p_ptr = Players[Ind];
>
277c289
< object_type *o_ptr = &inventory[i];
---
> object_type *o_ptr = &p_ptr->inventory[i];
318c330
< bool remove_curse(void)
---
> bool remove_curse(int Ind)
326c338
< bool remove_all_curse(void)
---
> bool remove_all_curse(int Ind)
336c348
< bool restore_level(void)
---
> bool restore_level(int Ind)
337a350,351
> player_type *p_ptr = Players[Ind];
>
348c362
< check_experience();
---
> check_experience(Ind);
370a385,386
> *
> * It is now disabled. --KLJ--
372c388
< void self_knowledge(void)
---
> void self_knowledge(int Ind)
373a390
> #if 0
807a825
> #endif
818c836
< bool lose_all_info(void)
---
> bool lose_all_info(int Ind)
819a838,839
> player_type *p_ptr = Players[Ind];
>
825c845
< object_type *o_ptr = &inventory[i];
---
> object_type *o_ptr = &p_ptr->inventory[i];
874c894
< wiz_dark();
---
> wiz_dark(Ind);
886c906
< bool detect_treasure(void)
---
> bool detect_treasure(int Ind)
887a908,911
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
891a916
> byte *w_ptr;
897c922
< for (y = panel_row_min; y <= panel_row_max; y++)
---
> for (y = p_ptr->panel_row_min; y <= p_ptr->panel_row_max; y++)
899c924
< for (x = panel_col_min; x <= panel_col_max; x++)
---
> for (x = p_ptr->panel_col_min; x <= p_ptr->panel_col_max; x++)
901c926,927
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
> w_ptr = &p_ptr->cave_flag[y][x];
910c936
< if (!(c_ptr->info & CAVE_MARK))
---
> if (!(*w_ptr & CAVE_MARK))
916c942
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
919c945
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
934c960
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
937c963
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
944c970
< if (!(o_ptr->marked))
---
> if (!(p_ptr->obj_vis[c_ptr->o_idx]))
950c976
< o_ptr->marked = TRUE;
---
> p_ptr->obj_vis[c_ptr->o_idx] = TRUE;
953c979
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
973c999
< bool detect_magic(void)
---
> bool detect_magic(int Ind)
974a1001,1004
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
983c1013
< for (i = panel_row_min; i <= panel_row_max; i++)
---
> for (i = p_ptr->panel_row_min; i <= p_ptr->panel_row_max; i++)
985c1015
< for (j = panel_col_min; j <= panel_col_max; j++)
---
> for (j = p_ptr->panel_col_min; j <= p_ptr->panel_col_max; j++)
988c1018
< c_ptr = &cave[i][j];
---
> c_ptr = &cave[Depth][i][j];
1006c1036
< if (!(o_ptr->marked))
---
> if (!(p_ptr->obj_vis[c_ptr->o_idx]))
1012c1042
< o_ptr->marked = TRUE;
---
> p_ptr->obj_vis[c_ptr->o_idx] = TRUE;
1015c1045
< lite_spot(i, j);
---
> everyone_lite_spot(Depth, i, j);
1032c1062
< bool detect_invisible(void)
---
> bool detect_invisible(int Ind)
1033a1064,1065
> player_type *p_ptr = Players[Ind];
>
1051c1083
< if (m_ptr->ml) continue;
---
> if (p_ptr->mon_vis[i]) continue;
1052a1085,1087
> /* Skip monsters not on this depth */
> if (m_ptr->dun_depth != p_ptr->dun_depth) continue;
>
1060,1061c1095,1096
< m_ptr->ml = TRUE;
< lite_spot(fy, fx);
---
> p_ptr->mon_vis[i] = TRUE;
> everyone_lite_spot(p_ptr->dun_depth, fy, fx);
1086c1121
< bool detect_evil(void)
---
> bool detect_evil(int Ind)
1087a1123,1124
> player_type *p_ptr = Players[Ind];
>
1105c1142
< if (m_ptr->ml) continue;
---
> if (p_ptr->mon_vis[i]) continue;
1106a1144,1146
> /* Skip monsters not on this depth */
> if (m_ptr->dun_depth != p_ptr->dun_depth) continue;
>
1111,1112c1151,1152
< m_ptr->ml = TRUE;
< lite_spot(fy, fx);
---
> p_ptr->mon_vis[i] = TRUE;
> everyone_lite_spot(p_ptr->dun_depth, fy, fx);
1137c1177
< bool detect_monsters(void)
---
> bool detect_monsters(int Ind)
1138a1179,1180
> player_type *p_ptr = Players[Ind];
>
1156c1198
< if (m_ptr->ml) continue;
---
> if (p_ptr->mon_vis[i]) continue;
1157a1200,1202
> /* Skip monsters not on this depth */
> if (m_ptr->dun_depth != p_ptr->dun_depth) continue;
>
1162,1163c1207,1208
< m_ptr->ml = TRUE;
< lite_spot(fy, fx);
---
> p_ptr->mon_vis[i] = TRUE;
> everyone_lite_spot(p_ptr->dun_depth, fy, fx);
1187c1232
< bool detection(void)
---
> bool detection(int Ind)
1188a1234,1235
> player_type *p_ptr = Players[Ind];
>
1195,1198c1242,1245
< if (detect_treasure()) detect = TRUE;
< if (detect_object()) detect = TRUE;
< if (detect_trap()) detect = TRUE;
< if (detect_sdoor()) detect = TRUE;
---
> if (detect_treasure(Ind)) detect = TRUE;
> if (detect_object(Ind)) detect = TRUE;
> if (detect_trap(Ind)) detect = TRUE;
> if (detect_sdoor(Ind)) detect = TRUE;
1213c1260
< if (m_ptr->ml) continue;
---
> if (p_ptr->mon_vis[i]) continue;
1214a1262,1264
> /* Skip monsters not on this depth */
> if (m_ptr->dun_depth != p_ptr->dun_depth) continue;
>
1219,1220c1269,1270
< m_ptr->ml = TRUE;
< lite_spot(fy, fx);
---
> p_ptr->mon_vis[i] = TRUE;
> everyone_lite_spot(p_ptr->dun_depth, fy, fx);
1244c1294
< bool detect_object(void)
---
> bool detect_object(int Ind)
1245a1296,1299
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
1255c1309
< for (i = panel_row_min; i <= panel_row_max; i++)
---
> for (i = p_ptr->panel_row_min; i <= p_ptr->panel_row_max; i++)
1257c1311
< for (j = panel_col_min; j <= panel_col_max; j++)
---
> for (j = p_ptr->panel_col_min; j <= p_ptr->panel_col_max; j++)
1259c1313
< c_ptr = &cave[i][j];
---
> c_ptr = &cave[Depth][i][j];
1270c1324
< if (!(o_ptr->marked))
---
> if (!(p_ptr->obj_vis[c_ptr->o_idx]))
1276c1330
< o_ptr->marked = TRUE;
---
> p_ptr->obj_vis[c_ptr->o_idx] = TRUE;
1279c1333
< lite_spot(i, j);
---
> everyone_lite_spot(Depth, i, j);
1291c1345
< bool detect_trap(void)
---
> bool detect_trap(int Ind)
1292a1347,1350
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
1297a1356
> byte *w_ptr;
1301c1360
< for (i = panel_row_min; i <= panel_row_max; i++)
---
> for (i = p_ptr->panel_row_min; i <= p_ptr->panel_row_max; i++)
1303c1362
< for (j = panel_col_min; j <= panel_col_max; j++)
---
> for (j = p_ptr->panel_col_min; j <= p_ptr->panel_col_max; j++)
1306c1365,1366
< c_ptr = &cave[i][j];
---
> c_ptr = &cave[Depth][i][j];
> w_ptr = &p_ptr->cave_flag[i][j];
1312c1372
< pick_trap(i, j);
---
> pick_trap(Depth, i, j);
1315c1375
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
1318c1378
< lite_spot(i, j);
---
> everyone_lite_spot(Depth, i, j);
1334c1394
< bool detect_sdoor(void)
---
> bool detect_sdoor(int Ind)
1335a1396,1399
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
1339a1404
> byte *w_ptr;
1343c1408
< for (i = panel_row_min; i <= panel_row_max; i++)
---
> for (i = p_ptr->panel_row_min; i <= p_ptr->panel_row_max; i++)
1345c1410
< for (j = panel_col_min; j <= panel_col_max; j++)
---
> for (j = p_ptr->panel_col_min; j <= p_ptr->panel_col_max; j++)
1348c1413,1414
< c_ptr = &cave[i][j];
---
> c_ptr = &cave[Depth][i][j];
> w_ptr = &p_ptr->cave_flag[i][j];
1357c1423
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
1360c1426
< lite_spot(i, j);
---
> everyone_lite_spot(Depth, i, j);
1367c1433
< if (c_ptr->info & CAVE_MARK) continue;
---
> if (*w_ptr & CAVE_MARK) continue;
1374c1440
< c_ptr->info |= CAVE_MARK;
---
> *w_ptr |= CAVE_MARK;
1377c1443
< lite_spot(i, j);
---
> everyone_lite_spot(Depth, i, j);
1392c1458
< void stair_creation(void)
---
> void stair_creation(int Ind)
1393a1460,1463
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
1398c1468
< c_ptr = &cave[py][px];
---
> c_ptr = &cave[Depth][p_ptr->py][p_ptr->px];
1401c1471
< if (!cave_valid_bold(py, px))
---
> if (!cave_valid_bold(Depth, p_ptr->py, p_ptr->px))
1408c1478
< delete_object(py, px);
---
> delete_object(Depth, p_ptr->py, p_ptr->px);
1411c1481
< if (!dun_level)
---
> if (!Depth)
1415c1485
< else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1))
---
> else if (is_quest(Depth) || (Depth >= MAX_DEPTH-1))
1429c1499
< note_spot(py, px);
---
> note_spot(p_ptr->py, p_ptr->px);
1432c1502
< lite_spot(py, px);
---
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
1503c1573
< bool enchant(object_type *o_ptr, int n, int eflag)
---
> bool enchant(int object_type *o_ptr, int n, int eflag)
1504a1575,1576
> player_type *p_ptr = Players[Ind];
>
1627a1700,1712
> bool enchant_spell(int int num_hit, int num_dam, int num_ac)
> {
> player_type *p_ptr = Players[Ind];
>
> get_item(Ind);
>
> p_ptr->current_enchant_h = num_hit;
> p_ptr->current_enchant_d = num_dam;
> p_ptr->current_enchant_a = num_ac;
>
> return (TRUE);
> }
>
1633c1718
< bool enchant_spell(int num_hit, int num_dam, int num_ac)
---
> bool enchant_spell_aux(int int item, int num_hit, int num_dam, int num_ac)
1635c1720,1721
< int item;
---
> player_type *p_ptr = Players[Ind];
>
1649,1655d1734
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Enchant which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to enchant.");
< return (FALSE);
< }
<
1659c1738
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1668a1748,1754
> if (!item_tester_hook(o_ptr))
> {
> msg_print("Sorry, you cannot enchant that item.");
> get_item(Ind);
> return (FALSE);
> }
>
1686c1772
< if (flush_failure) flush();
---
> /*if (flush_failure) flush();*/
1691a1778,1781
> p_ptr->current_enchant_h = -1;
> p_ptr->current_enchant_d = -1;
> p_ptr->current_enchant_a = -1;
>
1696a1787,1797
> bool ident_spell(int Ind)
> {
> player_type *p_ptr = Players[Ind];
>
> get_item(Ind);
>
> p_ptr->current_identify = 1;
>
> return TRUE;
> }
>
1702c1803
< bool ident_spell(void)
---
> bool ident_spell_aux(int int item)
1704c1805
< int item;
---
> player_type *p_ptr = Players[Ind];
1711,1717d1811
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Identify which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to identify.");
< return (FALSE);
< }
<
1721c1815
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1763a1858,1859
> p_ptr->current_identify = 0;
>
1768a1865,1867
> bool identify_fully(int Ind)
> {
> player_type *p_ptr = Players[Ind];
1769a1869,1876
> get_item(Ind);
>
> p_ptr->current_star_identify = 1;
>
> return TRUE;
> }
>
>
1774c1881
< bool identify_fully(void)
---
> bool identify_fully_item(int int item)
1776c1883
< int item;
---
> player_type *p_ptr = Players[Ind];
1783,1789d1889
< /* Get an item (from equip or inven or floor) */
< if (!get_item(&item, "Identify which item? ", TRUE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to identify.");
< return (FALSE);
< }
<
1793c1893
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1820c1920
< handle_stuff();
---
> handle_stuff(Ind);
1843c1943
< identify_fully_aux(o_ptr);
---
> /*identify_fully_aux(o_ptr);*/
1844a1945,1947
> /* We no longer have a *identify* in progress */
> p_ptr->current_star_identify = 0;
>
1870a1974,1985
> bool recharge(int int num)
> {
> player_type *p_ptr = Players[Ind];
>
> get_item(Ind);
>
> p_ptr->current_recharge = num;
>
> return TRUE;
> }
>
>
1898c2013
< bool recharge(int num)
---
> bool recharge_aux(int int item, int num)
1900c2015
< int i, t, item, lev;
---
> player_type *p_ptr = Players[Ind];
1901a2017,2018
> int i, t, lev;
>
1908,1914d2024
< /* Get an item (from inven or floor) */
< if (!get_item(&item, "Recharge which item? ", FALSE, TRUE, TRUE))
< {
< if (item == -2) msg_print("You have nothing to recharge.");
< return (FALSE);
< }
<
1918c2028
< o_ptr = &inventory[item];
---
> o_ptr = &p_ptr->inventory[item];
1926a2037,2042
> if (!item_tester_hook(o_ptr))
> {
> msg_print("You cannot recharge that item.");
> get_item(Ind);
> return (FALSE);
> }
2024a2141,2143
> /* We no longer have a recharge in progress */
> p_ptr->current_recharge = 0;
>
2039c2158
< static bool project_hack(int typ, int dam)
---
> static bool project_hack(int int typ, int dam)
2040a2160,2163
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
2059a2183,2185
> /* Skip monsters not on this depth */
> if (Depth != m_ptr->dun_depth) continue;
>
2064c2190
< if (project(0, 0, y, x, dam, typ, flg)) obvious = TRUE;
---
> if (project(0 - 0, Depth, y, x, dam, typ, flg)) obvious = TRUE;
2075c2201
< bool speed_monsters(void)
---
> bool speed_monsters(int Ind)
2076a2203,2204
> player_type *p_ptr = Players[Ind];
>
2083c2211
< bool slow_monsters(void)
---
> bool slow_monsters(int Ind)
2084a2213,2214
> player_type *p_ptr = Players[Ind];
>
2091c2221
< bool sleep_monsters(void)
---
> bool sleep_monsters(int Ind)
2092a2223,2224
> player_type *p_ptr = Players[Ind];
>
2100c2232
< bool banish_evil(int dist)
---
> bool banish_evil(int int dist)
2109c2241
< bool turn_undead(void)
---
> bool turn_undead(int Ind)
2110a2243,2244
> player_type *p_ptr = Players[Ind];
>
2118c2252
< bool dispel_undead(int dam)
---
> bool dispel_undead(int int dam)
2126c2260
< bool dispel_evil(int dam)
---
> bool dispel_evil(int int dam)
2134c2268
< bool dispel_monsters(int dam)
---
> bool dispel_monsters(int int dam)
2146c2280
< void aggravate_monsters(int who)
---
> void aggravate_monsters(int int who)
2147a2282,2283
> player_type *p_ptr = Players[Ind];
>
2161a2298,2300
> /* Skip monsters not on this depth */
> if (p_ptr->dun_depth != m_ptr->dun_depth) continue;
>
2198a2338,2342
> *
> * This is such a nasty hack -- It can't really be done for MAngband without
> * adding a special packet type (PKT_GENOCIDE_RACE or something). So unless
> * I think of a better way to do this, genocide (but not mass genocide) will
> * be disabled. --KLJ--
2200c2344
< bool genocide(void)
---
> bool genocide(int Ind)
2201a2346
> #if 0
2256a2402,2405
> #endif
>
> /* Hack */
> return (FALSE);
2263c2412
< bool mass_genocide(void)
---
> bool mass_genocide(int Ind)
2264a2414,2415
> player_type *p_ptr = Players[Ind];
>
2269c2420
< int msec = delay_factor * delay_factor * delay_factor;
---
> /*int msec = delay_factor * delay_factor * delay_factor;*/
2280a2432,2434
> /* Skip monsters not on this depth */
> if (p_ptr->dun_depth != m_ptr->dun_depth) continue;
>
2292c2446
< move_cursor_relative(py, px);
---
> /*move_cursor_relative(p_ptr->py, p_ptr->px);*/
2301c2455
< handle_stuff();
---
> handle_stuff(Ind);
2304c2458
< Term_fresh();
---
> /*Term_fresh();*/
2307c2461
< Term_xtra(TERM_XTRA_DELAY, msec);
---
> /*Term_xtra(TERM_XTRA_DELAY, msec);*/
2321c2475
< bool probing(void)
---
> bool probing(int Ind)
2322a2477,2480
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
2335a2494,2496
> /* Skip monsters not on this depth */
> if (Depth != m_ptr->dun_depth) continue;
>
2340c2501
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[i])
2381c2542
< void destroy_area(int y1, int x1, int r, bool full)
---
> void destroy_area(int Depth, int y1, int x1, int r, bool full)
2383c2544
< int y, x, k, t;
---
> int y, x, k, t, Ind;
2384a2546,2547
> player_type *p_ptr;
>
2387c2550
< bool flag = FALSE;
---
> /*bool flag = FALSE;*/
2399c2562
< if (!in_bounds(y, x)) continue;
---
> if (!in_bounds(Depth, y, x)) continue;
2408c2571
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2414c2577,2578
< c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
---
> c_ptr->info &= ~(CAVE_GLOW);
> everyone_forget_spot(Depth, y, x);
2417c2581
< if ((x == px) && (y == py))
---
> if (c_ptr->p_idx)
2419,2420c2583,2584
< /* Hurt the player later */
< flag = TRUE;
---
> Ind = c_ptr->p_idx;
> p_ptr = Players[Ind];
2421a2586,2610
> /* Message */
> msg_print("There is a searing blast of light!");
>
> /* Blind the player */
> if (!p_ptr->resist_blind && !p_ptr->resist_lite)
> {
> /* Become blind */
> (void)set_blind(p_ptr->blind + 10 + randint(10));
> }
>
> /* Mega-Hack -- Forget the view and lite */
> p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
>
> /* Update stuff */
> p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
>
> /* Update the monsters */
> p_ptr->update |= (PU_MONSTERS);
>
> /* Redraw map */
> p_ptr->redraw |= (PR_MAP);
>
> /* Window stuff */
> p_ptr->window |= (PW_OVERHEAD);
>
2430c2619
< delete_monster(y, x);
---
> delete_monster(Depth, y, x);
2433c2622
< if (cave_valid_bold(y, x))
---
> if (cave_valid_bold(Depth, y, x))
2436c2625
< delete_object(y, x);
---
> delete_object(Depth, y, x);
2471,2501d2659
<
<
< /* Hack -- Affect player */
< if (flag)
< {
< /* Message */
< msg_print("There is a searing blast of light!");
<
< /* Blind the player */
< if (!p_ptr->resist_blind && !p_ptr->resist_lite)
< {
< /* Become blind */
< (void)set_blind(p_ptr->blind + 10 + randint(10));
< }
< }
<
<
< /* Mega-Hack -- Forget the view and lite */
< p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
<
< /* Update stuff */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
<
< /* Update the monsters */
< p_ptr->update |= (PU_MONSTERS);
<
< /* Redraw map */
< p_ptr->redraw |= (PR_MAP);
<
< /* Window stuff */
< p_ptr->window |= (PW_OVERHEAD);
2523c2681
< void earthquake(int cy, int cx, int r)
---
> void earthquake(int Depth, int cy, int cx, int r)
2531c2689
< bool hurt = FALSE;
---
> int Ind;
2532a2691,2694
> player_type *p_ptr;
>
> /*bool hurt = FALSE;*/
>
2560c2722
< if (!in_bounds(yy, xx)) continue;
---
> if (!in_bounds(Depth, yy, xx)) continue;
2566c2728
< c_ptr = &cave[yy][xx];
---
> c_ptr = &cave[Depth][yy][xx];
2572c2734,2735
< c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
---
> c_ptr->info &= ~(CAVE_GLOW);
> everyone_forget_spot(Depth, y, x);
2584,2586c2747,2750
< if ((yy == py) && (xx == px)) hurt = TRUE;
< }
< }
---
> if (c_ptr->p_idx)
> {
> Ind = c_ptr->p_idx;
> p_ptr = Players[Ind];
2588,2596c2752,2757
< /* First, affect the player (if necessary) */
< if (hurt)
< {
< /* Check around the player */
< for (i = 0; i < 8; i++)
< {
< /* Access the location */
< y = py + ddy[i];
< x = px + ddx[i];
---
> /* Check around the player */
> for (i = 0; i < 8; i++)
> {
> /* Access the location */
> y = p_ptr->py + ddy[i];
> x = p_ptr->px + ddx[i];
2598,2599c2759,2760
< /* Skip non-empty grids */
< if (!cave_empty_bold(y, x)) continue;
---
> /* Skip non-empty grids */
> if (!cave_empty_bold(Depth, y, x)) continue;
2601,2602c2762,2763
< /* Important -- Skip "quake" grids */
< if (map[16+y-cy][16+x-cx]) continue;
---
> /* Important -- Skip "quake" grids */
> if (map[16+y-cy][16+x-cx]) continue;
2604,2605c2765,2766
< /* Count "safe" grids */
< sn++;
---
> /* Count "safe" grids */
> sn++;
2607,2608c2768,2769
< /* Randomize choice */
< if (rand_int(sn) > 0) continue;
---
> /* Randomize choice */
> if (rand_int(sn) > 0) continue;
2610,2612c2771,2773
< /* Save the safe location */
< sy = y; sx = x;
< }
---
> /* Save the safe location */
> sy = y; sx = x;
> }
2614,2648c2775,2776
< /* Random message */
< switch (randint(3))
< {
< case 1:
< {
< msg_print("The cave ceiling collapses!");
< break;
< }
< case 2:
< {
< msg_print("The cave floor twists in an unnatural way!");
< break;
< }
< default:
< {
< msg_print("The cave quakes! You are pummeled with debris!");
< break;
< }
< }
<
< /* Hurt the player a lot */
< if (!sn)
< {
< /* Message and damage */
< msg_print("You are severely crushed!");
< damage = 300;
< }
<
< /* Destroy the grid, and push the player to safety */
< else
< {
< /* Calculate results */
< switch (randint(3))
< {
< case 1:
---
> /* Random message */
> switch (randint(3))
2650,2652c2778,2792
< msg_print("You nimbly dodge the blast!");
< damage = 0;
< break;
---
> case 1:
> {
> msg_print("The cave ceiling collapses!");
> break;
> }
> case 2:
> {
> msg_print("The cave floor twists in an unnatural way!");
> break;
> }
> default:
> {
> msg_print("The cave quakes! You are pummeled with debris!");
> break;
> }
2654c2794,2796
< case 2:
---
>
> /* Hurt the player a lot */
> if (!sn)
2656,2659c2798,2800
< msg_print("You are bashed by rubble!");
< damage = damroll(10, 4);
< (void)set_stun(p_ptr->stun + randint(50));
< break;
---
> /* Message and damage */
> msg_print("You are severely crushed!");
> damage = 300;
2661c2802,2804
< case 3:
---
>
> /* Destroy the grid, and push the player to safety */
> else
2663,2666c2806,2850
< msg_print("You are crushed between the floor and ceiling!");
< damage = damroll(10, 4);
< (void)set_stun(p_ptr->stun + randint(50));
< break;
---
> /* Calculate results */
> switch (randint(3))
> {
> case 1:
> {
> msg_print("You nimbly dodge the blast!");
> damage = 0;
> break;
> }
> case 2:
> {
> msg_print("You are bashed by rubble!");
> damage = damroll(10, 4);
> (void)set_stun(p_ptr->stun + randint(50));
> break;
> }
> case 3:
> {
> msg_print("You are crushed between the floor and ceiling!");
> damage = damroll(10, 4);
> (void)set_stun(p_ptr->stun + randint(50));
> break;
> }
> }
>
> /* Save the old location */
> oy = p_ptr->py;
> ox = p_ptr->px;
>
> /* Move the player to the safe location */
> p_ptr->py = sy;
> p_ptr->px = sx;
>
> /* Update the cave player indices */
> cave[Depth][oy][ox].p_idx = 0;
> cave[Depth][sy][sx].p_idx = Ind;
>
> /* Redraw the old spot */
> everyone_lite_spot(Depth, oy, ox);
>
> /* Redraw the new spot */
> everyone_lite_spot(Depth, p_ptr->py, p_ptr->px);
>
> /* Check for new panel */
> verify_panel(Ind);
2668d2851
< }
2670,2672c2853,2854
< /* Save the old location */
< oy = py;
< ox = px;
---
> /* Important -- no wall on player */
> map[16+p_ptr->py-cy][16+p_ptr->px-cx] = FALSE;
2674,2676c2856,2857
< /* Move the player to the safe location */
< py = sy;
< px = sx;
---
> /* Take some damage */
> if (damage) take_hit(damage, "an earthquake");
2678,2679c2859,2860
< /* Redraw the old spot */
< lite_spot(oy, ox);
---
> /* Mega-Hack -- Forget the view and lite */
> p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2681,2682c2862,2863
< /* Redraw the new spot */
< lite_spot(py, px);
---
> /* Update stuff */
> p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
2684,2686c2865,2866
< /* Check for new panel */
< verify_panel();
< }
---
> /* Update the monsters */
> p_ptr->update |= (PU_DISTANCE);
2688,2689c2868,2869
< /* Important -- no wall on player */
< map[16+py-cy][16+px-cx] = FALSE;
---
> /* Update the health bar */
> p_ptr->redraw |= (PR_HEALTH);
2691,2692c2871,2877
< /* Take some damage */
< if (damage) take_hit(damage, "an earthquake");
---
> /* Redraw map */
> p_ptr->redraw |= (PR_MAP);
>
> /* Window stuff */
> p_ptr->window |= (PW_OVERHEAD);
> }
> }
2709c2894
< c_ptr = &cave[yy][xx];
---
> c_ptr = &cave[Depth][yy][xx];
2737c2922
< if (!cave_empty_bold(y, x)) continue;
---
> if (!cave_empty_bold(Depth, y, x)) continue;
2740c2925
< if (cave[y][x].feat == FEAT_GLYPH) continue;
---
> if (cave[Depth][y][x].feat == FEAT_GLYPH) continue;
2760c2945
< msg_format("%^s wails out in pain!", m_name);
---
> /*msg_format("%^s wails out in pain!", m_name);*/
2775c2960
< msg_format("%^s is embedded in the rock!", m_name);
---
> /*msg_format("%^s is embedded in the rock!", m_name);*/
2778c2963
< delete_monster(yy, xx);
---
> delete_monster(Depth, yy, xx);
2787c2972
< int m_idx = cave[yy][xx].m_idx;
---
> int m_idx = cave[Depth][yy][xx].m_idx;
2790c2975
< cave[sy][sx].m_idx = m_idx;
---
> cave[Depth][sy][sx].m_idx = m_idx;
2793c2978
< cave[yy][xx].m_idx = 0;
---
> cave[Depth][yy][xx].m_idx = 0;
2803c2988
< lite_spot(yy, xx);
---
> everyone_lite_spot(Depth, yy, xx);
2806c2991
< lite_spot(sy, sx);
---
> everyone_lite_spot(Depth, sy, sx);
2827c3012
< c_ptr = &cave[yy][xx];
---
> c_ptr = &cave[Depth][yy][xx];
2830c3015
< if ((yy == py) && (xx == px)) continue;
---
> if (c_ptr->p_idx) continue;
2833c3018
< if (cave_valid_bold(yy, xx))
---
> if (cave_valid_bold(Depth, yy, xx))
2835c3020
< bool floor = cave_floor_bold(yy, xx);
---
> bool floor = cave_floor_bold(Depth, yy, xx);
2838c3023
< delete_object(yy, xx);
---
> delete_object(Depth, yy, xx);
2873,2891d3057
<
<
< /* Mega-Hack -- Forget the view and lite */
< p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
<
< /* Update stuff */
< p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
<
< /* Update the monsters */
< p_ptr->update |= (PU_DISTANCE);
<
< /* Update the health bar */
< p_ptr->redraw |= (PR_HEALTH);
<
< /* Redraw map */
< p_ptr->redraw |= (PR_MAP);
<
< /* Window stuff */
< p_ptr->window |= (PW_OVERHEAD);
2911c3077
< static void cave_temp_room_lite(void)
---
> static void cave_temp_room_lite(int Ind)
2912a3079,3082
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
2916c3086
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
2918,2919c3088,3089
< int y = temp_y[i];
< int x = temp_x[i];
---
> int y = p_ptr->temp_y[i];
> int x = p_ptr->temp_x[i];
2921c3091
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
2957c3127
< if (m_ptr->ml)
---
> if (p_ptr->mon_vis[c_ptr->m_idx])
2974c3144
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
2978c3148
< temp_n = 0;
---
> p_ptr->temp_n = 0;
2994c3164
< static void cave_temp_room_unlite(void)
---
> static void cave_temp_room_unlite(int Ind)
2995a3166,3169
> player_type *p_ptr = Players[Ind];
>
> int Depth = p_ptr->dun_depth;
>
2999c3173
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
3001,3002c3175,3176
< int y = temp_y[i];
< int x = temp_x[i];
---
> int y = p_ptr->temp_y[i];
> int x = p_ptr->temp_x[i];
3004c3178
< cave_type *c_ptr = &cave[y][x];
---
> cave_type *c_ptr = &cave[Depth][y][x];
3016c3190
< c_ptr->info &= ~CAVE_MARK;
---
> p_ptr->cave_flag[y][x] &= ~CAVE_MARK;
3030c3204
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
3034c3208
< temp_n = 0;
---
> p_ptr->temp_n = 0;
3043c3217
< static void cave_temp_room_aux(int y, int x)
---
> static void cave_temp_room_aux(int int Depth, int y, int x)
3045c3219
< cave_type *c_ptr = &cave[y][x];
---
> player_type *p_ptr = Players[Ind];
3046a3221,3222
> cave_type *c_ptr = &cave[Depth][y][x];
>
3054c3230
< if (temp_n == TEMP_MAX) return;
---
> if (p_ptr->temp_n == TEMP_MAX) return;
3060,3062c3236,3238
< temp_y[temp_n] = y;
< temp_x[temp_n] = x;
< temp_n++;
---
> p_ptr->temp_y[p_ptr->temp_n] = y;
> p_ptr->temp_x[p_ptr->temp_n] = x;
> p_ptr->temp_n++;
3071c3247
< void lite_room(int y1, int x1)
---
> void lite_room(int int Depth, int y1, int x1)
3072a3249,3250
> player_type *p_ptr = Players[Ind];
>
3076c3254
< cave_temp_room_aux(y1, x1);
---
> cave_temp_room_aux(Depth, y1, x1);
3079c3257
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
3081c3259
< x = temp_x[i], y = temp_y[i];
---
> x = p_ptr->temp_x[i], y = p_ptr->temp_y[i];
3084c3262
< if (!cave_floor_bold(y, x)) continue;
---
> if (!cave_floor_bold(Depth, y, x)) continue;
3087,3090c3265,3268
< cave_temp_room_aux(y + 1, x);
< cave_temp_room_aux(y - 1, x);
< cave_temp_room_aux(y, x + 1);
< cave_temp_room_aux(y, x - 1);
---
> cave_temp_room_aux(Depth, y + 1, x);
> cave_temp_room_aux(Depth, y - 1, x);
> cave_temp_room_aux(Depth, y, x + 1);
> cave_temp_room_aux(Depth, y, x - 1);
3093,3096c3271,3274
< cave_temp_room_aux(y + 1, x + 1);
< cave_temp_room_aux(y - 1, x - 1);
< cave_temp_room_aux(y - 1, x + 1);
< cave_temp_room_aux(y + 1, x - 1);
---
> cave_temp_room_aux(Depth, y + 1, x + 1);
> cave_temp_room_aux(Depth, y - 1, x - 1);
> cave_temp_room_aux(Depth, y - 1, x + 1);
> cave_temp_room_aux(Depth, y + 1, x - 1);
3100c3278
< cave_temp_room_lite();
---
> cave_temp_room_lite(Ind);
3107c3285
< void unlite_room(int y1, int x1)
---
> void unlite_room(int int Depth, int y1, int x1)
3108a3287,3288
> player_type *p_ptr = Players[Ind];
>
3112c3292
< cave_temp_room_aux(y1, x1);
---
> cave_temp_room_aux(Depth, y1, x1);
3115c3295
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
3117c3297
< x = temp_x[i], y = temp_y[i];
---
> x = p_ptr->temp_x[i], y = p_ptr->temp_y[i];
3120c3300
< if (!cave_floor_bold(y, x)) continue;
---
> if (!cave_floor_bold(Depth, y, x)) continue;
3123,3126c3303,3306
< cave_temp_room_aux(y + 1, x);
< cave_temp_room_aux(y - 1, x);
< cave_temp_room_aux(y, x + 1);
< cave_temp_room_aux(y, x - 1);
---
> cave_temp_room_aux(Depth, y + 1, x);
> cave_temp_room_aux(Depth, y - 1, x);
> cave_temp_room_aux(Depth, y, x + 1);
> cave_temp_room_aux(Depth, y, x - 1);
3129,3132c3309,3312
< cave_temp_room_aux(y + 1, x + 1);
< cave_temp_room_aux(y - 1, x - 1);
< cave_temp_room_aux(y - 1, x + 1);
< cave_temp_room_aux(y + 1, x - 1);
---
> cave_temp_room_aux(Depth, y + 1, x + 1);
> cave_temp_room_aux(Depth, y - 1, x - 1);
> cave_temp_room_aux(Depth, y - 1, x + 1);
> cave_temp_room_aux(Depth, y + 1, x - 1);
3136c3316
< cave_temp_room_unlite();
---
> cave_temp_room_unlite(Ind);
3145c3325
< bool lite_area(int dam, int rad)
---
> bool lite_area(int int dam, int rad)
3146a3327,3328
> player_type *p_ptr = Players[Ind];
>
3156c3338
< (void)project(0, rad, py, px, dam, GF_LITE_WEAK, flg);
---
> (void)project(0 - rad, p_ptr->dun_depth, p_ptr->py, p_ptr->px, dam, GF_LITE_WEAK, flg);
3159c3341
< lite_room(py, px);
---
> lite_room(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
3170c3352
< bool unlite_area(int dam, int rad)
---
> bool unlite_area(int int dam, int rad)
3171a3354,3355
> player_type *p_ptr = Players[Ind];
>
3181c3365
< (void)project(0, rad, py, px, dam, GF_DARK_WEAK, flg);
---
> (void)project(0 - rad, p_ptr->dun_depth, p_ptr->py, p_ptr->px, dam, GF_DARK_WEAK, flg);
3184c3368
< unlite_room(py, px);
---
> unlite_room(p_ptr->dun_depth, p_ptr->py, p_ptr->px);
3198c3382
< bool fire_ball(int typ, int dir, int dam, int rad)
---
> bool fire_ball(int int typ, int dir, int dam, int rad)
3199a3384,3385
> player_type *p_ptr = Players[Ind];
>
3205,3206c3391,3392
< tx = px + 99 * ddx[dir];
< ty = py + 99 * ddy[dir];
---
> tx = p_ptr->px + 99 * ddx[dir];
> ty = p_ptr->py + 99 * ddy[dir];
3209c3395
< if ((dir == 5) && target_okay())
---
> if ((dir == 5) && target_okay(Ind))
3212,3213c3398,3399
< tx = target_col;
< ty = target_row;
---
> tx = p_ptr->target_col;
> ty = p_ptr->target_row;
3217c3403
< return (project(0, rad, ty, tx, dam, typ, flg));
---
> return (project(0 - rad, p_ptr->dun_depth, ty, tx, dam, typ, flg));
3224c3410
< static bool project_hook(int typ, int dir, int dam, int flg)
---
> static bool project_hook(int int typ, int dir, int dam, int flg)
3225a3412,3413
> player_type *p_ptr = Players[Ind];
>
3232,3233c3420,3421
< tx = px + ddx[dir];
< ty = py + ddy[dir];
---
> tx = p_ptr->px + ddx[dir];
> ty = p_ptr->py + ddy[dir];
3236c3424
< if ((dir == 5) && target_okay())
---
> if ((dir == 5) && target_okay(Ind))
3238,3239c3426,3427
< tx = target_col;
< ty = target_row;
---
> tx = p_ptr->target_col;
> ty = p_ptr->target_row;
3243c3431
< return (project(0, 0, ty, tx, dam, typ, flg));
---
> return (project(0 - 0, p_ptr->dun_depth, ty, tx, dam, typ, flg));
3252c3440
< bool fire_bolt(int typ, int dir, int dam)
---
> bool fire_bolt(int int typ, int dir, int dam)
3263c3451
< bool fire_beam(int typ, int dir, int dam)
---
> bool fire_beam(int int typ, int dir, int dam)
3272c3460
< bool fire_bolt_or_beam(int prob, int typ, int dir, int dam)
---
> bool fire_bolt_or_beam(int int prob, int typ, int dir, int dam)
3289c3477
< bool lite_line(int dir)
---
> bool lite_line(int int dir)
3295c3483
< bool drain_life(int dir, int dam)
---
> bool drain_life(int int dir, int dam)
3301c3489
< bool wall_to_mud(int dir)
---
> bool wall_to_mud(int int dir)
3307c3495
< bool destroy_door(int dir)
---
> bool destroy_door(int int dir)
3313c3501
< bool disarm_trap(int dir)
---
> bool disarm_trap(int int dir)
3319c3507
< bool heal_monster(int dir)
---
> bool heal_monster(int int dir)
3325c3513
< bool speed_monster(int dir)
---
> bool speed_monster(int int dir)
3326a3515,3516
> player_type *p_ptr = Players[Ind];
>
3331c3521
< bool slow_monster(int dir)
---
> bool slow_monster(int int dir)
3332a3523,3524
> player_type *p_ptr = Players[Ind];
>
3337c3529
< bool sleep_monster(int dir)
---
> bool sleep_monster(int int dir)
3338a3531,3532
> player_type *p_ptr = Players[Ind];
>
3343c3537
< bool confuse_monster(int dir, int plev)
---
> bool confuse_monster(int int dir, int plev)
3349c3543
< bool poly_monster(int dir)
---
> bool poly_monster(int int dir)
3350a3545,3546
> player_type *p_ptr = Players[Ind];
>
3355c3551
< bool clone_monster(int dir)
---
> bool clone_monster(int int dir)
3361c3557
< bool fear_monster(int dir, int plev)
---
> bool fear_monster(int int dir, int plev)
3367c3563
< bool teleport_monster(int dir)
---
> bool teleport_monster(int int dir)
3379c3575
< bool door_creation(void)
---
> bool door_creation(int Ind)
3380a3577,3578
> player_type *p_ptr = Players[Ind];
>
3382c3580
< return (project(0, 1, py, px, 0, GF_MAKE_DOOR, flg));
---
> return (project(0 - 1, p_ptr->dun_depth, p_ptr->py, p_ptr->px, 0, GF_MAKE_DOOR, flg));
3385c3583
< bool trap_creation(void)
---
> bool trap_creation(int Ind)
3386a3585,3586
> player_type *p_ptr = Players[Ind];
>
3388c3588
< return (project(0, 1, py, px, 0, GF_MAKE_TRAP, flg));
---
> return (project(0 - 1, p_ptr->dun_depth, p_ptr->py, p_ptr->px, 0, GF_MAKE_TRAP, flg));
3391c3591
< bool destroy_doors_touch(void)
---
> bool destroy_doors_touch(int Ind)
3392a3593,3594
> player_type *p_ptr = Players[Ind];
>
3394c3596
< return (project(0, 1, py, px, 0, GF_KILL_DOOR, flg));
---
> return (project(0 - 1, p_ptr->dun_depth, p_ptr->py, p_ptr->px, 0, GF_KILL_DOOR, flg));
3397c3599
< bool sleep_monsters_touch(void)
---
> bool sleep_monsters_touch(int Ind)
3398a3601,3602
> player_type *p_ptr = Players[Ind];
>
3400c3604
< return (project(0, 1, py, px, p_ptr->lev, GF_OLD_SLEEP, flg));
---
> return (project(0 - 1, p_ptr->dun_depth, p_ptr->py, p_ptr->px, p_ptr->lev, GF_OLD_SLEEP, flg));
diff -r src-280/store.c mangband-000/src/server/store.c
12a13,14
> #define SERVER
>
18a21
> #if 0
293a297
> #endif
297d300
<
302a306
>
306c310
< static int store_top = 0;
---
> /*static int store_top = 0;*/
320a325
> #if 0
440a446
> #endif
459a466
> #if 0
555a563
> #endif
630a639
> #if 0
905a915
> #endif
921a932
> #if 0
993a1005
> #endif
1089a1102
>
1124a1138
> #if 0
1165c1179
< apply_magic(o_ptr, level, FALSE, FALSE, FALSE);
---
> apply_magic(0, o_ptr, level, FALSE, FALSE, FALSE);
1210a1225
> #endif
1217a1233
> #if 0
2930a2947
> #endif
2942c2959
< void do_cmd_store(void)
---
> void do_cmd_store(int Ind)
2943a2961,2963
> msg_print("The doors are locked.");
>
> #if 0
3158a3179
> #endif
diff -r src-280/tables.c mangband-000/src/server/tables.c
12a13,14
> #define SERVER
>
Only in src-280: types.h
diff -r src-280/util.c mangband-000/src/server/util.c
5a6,7
> #define SERVER
>
860a863
> #if 0
864a868
> #endif
1411a1416
> #if 0
1432a1438
> #endif
1437a1444
> #if 0
1464a1472
> #endif
1477c1485
< static bool after_macro = FALSE;
---
> /*static bool after_macro = FALSE;*/
1482c1490
< static bool parse_macro = FALSE;
---
> /*static bool parse_macro = FALSE;*/
1487c1495
< static bool parse_under = FALSE;
---
> /*static bool parse_under = FALSE;*/
1492c1500
< static bool parse_slash = FALSE;
---
> /*static bool parse_slash = FALSE;*/
1497c1505
< static bool strip_chars = FALSE;
---
> /*static bool strip_chars = FALSE;*/
1519a1528
> #if 0
1527a1537
> #endif
1535a1546
> #if 0
1537a1549
> #endif
1560a1573
> #if 0
1702a1716
> #endif
1769c1783,1784
< char inkey(void)
---
> #if 0
> char inkey(int Ind)
2013a2029
> #endif
2159a2176
> #if 0
2321a2339
> #endif
2328a2347
> #if 0
2351a2371
> #endif
2379c2399
< void msg_print(cptr msg)
---
> void msg_print(int cptr msg)
2380a2401,2405
>
> /* Ahh, the beautiful simplicity of it.... --KLJ-- */
> Send_message(msg);
>
> #if 0
2486a2512
> #endif
2493c2519
< void msg_format(cptr fmt, ...)
---
> void msg_format(int cptr fmt, ...)
2521a2548
> #if 0
2526a2554
> #endif
2533a2562
> #if 0
2535a2565
> #endif
2545a2576
> #if 0
2553a2585
> #endif
2560a2593
> #if 0
2562a2596
> #endif
2583a2618
> #if 0
2674a2710
> #endif
2681a2718
> #if 0
2683a2721
> #endif
2693a2732
> #if 0
2701a2741
> #endif
2717a2758
> #if 0
2805a2847
> #endif
2818c2860,2861
< bool get_string(cptr prompt, char *buf, int len)
---
> #if 0
> bool get_string(int cptr prompt, char *buf, int len)
2836a2880
> #endif
2846c2890,2891
< bool get_check(cptr prompt)
---
> #if 0
> bool get_check(int cptr prompt)
2879a2925
> #endif
2888a2935
> #if 0
2908a2956
> #endif
2916c2964,2965
< s16b get_quantity(cptr prompt, int max)
---
> #if 0
> s16b get_quantity(int cptr prompt, int max)
2976a3026
> #endif
2983a3034
> #if 0
2988a3040
> #endif
3006a3059,3061
> *
> * Note that when commands come in from the network inputs, that are
> * already nicely parsed. --KLJ--
3009a3065
> #if 0
3229a3286
> #endif
diff -r src-280/variable.c mangband-000/src/server/variable.c
12a13,14
> #define SERVER
>
19c21
< cptr copyright[5] =
---
> cptr copyright[6] =
21a24
> "also Copyright (c) 1997 Keldon L. Jones",
63,66c66,69
< bool character_generated; /* The character exists */
< bool character_dungeon; /* The character has a dungeon */
< bool character_loaded; /* The character was loaded from a savefile */
< bool character_saved; /* The character was just saved to a savefile */
---
> bool server_generated; /* The character exists */
> bool server_dungeon; /* The character has a dungeon */
> bool server_state_loaded; /* The server state was loaded from a savefile */
> bool server_saved; /* The character was just saved to a savefile */
67a71
> bool character_loaded; /* The character was loaded from a savefile */
101,103c105,107
< s16b cur_hgt; /* Current dungeon height */
< s16b cur_wid; /* Current dungeon width */
< s16b dun_level; /* Current dungeon level */
---
> /*s16b cur_hgt; */ /* Current dungeon height */
> /*s16b cur_wid; */ /* Current dungeon width */
> /*s16b dun_level; */ /* Current dungeon level */
107a112,116
> byte level_start_y[MAX_DEPTH]; /* Where do players start on each level? */
> byte level_start_x[MAX_DEPTH];
>
> s16b players_on_depth[MAX_DEPTH]; /* How many players are at each depth */
>
137c146
< s16b total_weight; /* Total weight being carried */
---
> /*s16b total_weight;*/ /* Total weight being carried */
141,142c150,151
< s16b inven_cnt; /* Number of items in inventory */
< s16b equip_cnt; /* Number of items in equipment */
---
> /*s16b inven_cnt;*/ /* Number of items in inventory */
> /*s16b equip_cnt;*/ /* Number of items in equipment */
292c301
< bool new_level_flag; /* Start a new level */
---
> /*bool new_level_flag;*/ /* Start a new level */
300,302c309,311
< s16b panel_row_min, panel_row_max;
< s16b panel_col_min, panel_col_max;
< s16b panel_col_prt, panel_row_prt;
---
> /*s16b panel_row_min, panel_row_max;
> s16b panel_col_min, panel_col_max;*/
> /*s16b panel_col_prt, panel_row_prt;*/
305,306c314,316
< s16b py;
< s16b px;
---
> /* This is now put in the player info --KLJ-- */
> /*s16b py;
> s16b px;*/
325a336,341
> /* The array of players */
> player_type **Players;
>
> /* An array to access a Player's ID */
> long GetInd[MAX_ID];
>
327c343,344
< char player_name[32];
---
> /* In the player info --KLJ-- */
> /*char player_name[32];*/
330c347,348
< char player_base[32];
---
> /* In the player info --KLJ-- */
> /*char player_base[32];*/
333c351,352
< char died_from[80];
---
> /* In the player info --KLJ-- */
> /*char died_from[80];*/
336c355,356
< char history[4][60];
---
> /* In the player info --KLJ-- */
> /*char history[4][60];*/
345c365
< s16b lite_n;
---
> /*s16b lite_n;
347c367
< byte lite_x[LITE_MAX];
---
> byte lite_x[LITE_MAX];*/
350a371,373
> *
> * This is now in the player info, so that every player sees the cave
> * differently --KLJ--
352c375
< s16b view_n;
---
> /*s16b view_n;
354c377
< byte view_x[VIEW_MAX];
---
> byte view_x[VIEW_MAX];*/
449c472
< term *ang_term[8];
---
> /*term *ang_term[8];*/
468c491
< cave_type *cave[MAX_HGT];
---
> cave_type **cave[MAX_DEPTH];
492a516,517
> *
> * This is now in the player info --KLJ--
494c519
< object_type *inventory;
---
> /* object_type *inventory; */
544a570,571
> *
> * Don't need this anymore --KLJ--
546c573
< static player_type p_body;
---
> /*static player_type p_body;*/
549a577,578
> *
> * Or this --KLJ--
551c580
< player_type *p_ptr = &p_body;
---
> /*player_type *p_ptr = &p_body;*/
554a584,585
> *
> * This is in the player info now --KLJ--
556c587
< player_race *rp_ptr;
---
> /*player_race *rp_ptr;
558c589
< player_magic *mp_ptr;
---
> player_magic *mp_ptr;*/
561,570d591
< /*
< * More spell info
< */
< u32b spell_learned1; /* bit mask of spells learned */
< u32b spell_learned2; /* bit mask of spells learned */
< u32b spell_worked1; /* bit mask of spells tried and worked */
< u32b spell_worked2; /* bit mask of spells tried and worked */
< u32b spell_forgotten1; /* bit mask of spells learned but forgotten */
< u32b spell_forgotten2; /* bit mask of spells learned but forgotten */
< byte spell_order[64]; /* order spells learned/remembered/forgotten */
572d592
<
577a598,599
> *
> * This is in the player info now --KLJ--
579c601
< s16b player_hp[PY_MAX_LEVEL];
---
> /*s16b player_hp[PY_MAX_LEVEL];*/
730c752
< bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
---
> bool (*ang_sort_comp)(int vptr u, vptr v, int a, int b);
736c758
< void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
---
> void (*ang_sort_swap)(int vptr u, vptr v, int a, int b);
diff -r src-280/wizard1.c mangband-000/src/server/wizard1.c
4a5,6
> #define SERVER
>
diff -r src-280/wizard2.c mangband-000/src/server/wizard2.c
12a13,14
> #define SERVER
>
diff -r src-280/xtra1.c mangband-000/src/server/xtra1.c
12a13,14
> #define SERVER
>
103a106
> #if 0
111a115
> #endif
119,120c123,129
< static void prt_stat(int stat)
< {
---
> static void prt_stat(int int stat)
> {
> player_type *p_ptr = Players[Ind];
>
> Send_stat(stat, p_ptr->stat_max[stat], p_ptr->stat_cur[stat]);
>
> #if 0
137a147
> #endif
146c156
< static void prt_title(void)
---
> static void prt_title(int Ind)
147a158,159
> player_type *p_ptr = Players[Ind];
>
149a162
> #if 0
154a168
> #endif
157c171
< else if (total_winner || (p_ptr->lev > PY_MAX_LEVEL))
---
> if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
168c182,183
< prt_field(p, ROW_TITLE, COL_TITLE);
---
> /*prt_field(p, ROW_TITLE, COL_TITLE);*/
> Send_title(p);
175c190
< static void prt_level(void)
---
> static void prt_level(int Ind)
176a192,202
> player_type *p_ptr = Players[Ind];
>
> int adv_exp;
>
> if (p_ptr->lev >= PY_MAX_LEVEL)
> adv_exp = 0;
> else adv_exp = (s32b)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L);
>
> Send_experience(p_ptr->lev, p_ptr->max_exp, p_ptr->exp, adv_exp);
>
> #if 0
190a217
> #endif
197c224
< static void prt_exp(void)
---
> static void prt_exp(int Ind)
198a226,236
> player_type *p_ptr = Players[Ind];
>
> int adv_exp;
>
> if (p_ptr->lev >= PY_MAX_LEVEL)
> adv_exp = 0;
> else adv_exp = (s32b)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L);
>
> Send_experience(p_ptr->lev, p_ptr->max_exp, p_ptr->exp, adv_exp);
>
> #if 0
212a251
> #endif
219c258
< static void prt_gold(void)
---
> static void prt_gold(int Ind)
221c260
< char tmp[32];
---
> player_type *p_ptr = Players[Ind];
223,225c262
< put_str("AU ", ROW_GOLD, COL_GOLD);
< sprintf(tmp, "%9ld", (long)p_ptr->au);
< c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
---
> Send_gold(p_ptr->au);
233c270
< static void prt_ac(void)
---
> static void prt_ac(int Ind)
235c272
< char tmp[32];
---
> player_type *p_ptr = Players[Ind];
237,239c274
< put_str("Cur AC ", ROW_AC, COL_AC);
< sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
< c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
---
> Send_ac(p_ptr->dis_ac, p_ptr->dis_to_a);
246c281
< static void prt_hp(void)
---
> static void prt_hp(int Ind)
248c283
< char tmp[32];
---
> player_type *p_ptr = Players[Ind];
250,278c285
< byte color;
<
<
< put_str("Max HP ", ROW_MAXHP, COL_MAXHP);
<
< sprintf(tmp, "%5d", p_ptr->mhp);
< color = TERM_L_GREEN;
<
< c_put_str(color, tmp, ROW_MAXHP, COL_MAXHP + 7);
<
<
< put_str("Cur HP ", ROW_CURHP, COL_CURHP);
<
< sprintf(tmp, "%5d", p_ptr->chp);
<
< if (p_ptr->chp >= p_ptr->mhp)
< {
< color = TERM_L_GREEN;
< }
< else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
< {
< color = TERM_YELLOW;
< }
< else
< {
< color = TERM_RED;
< }
<
< c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 7);
---
> Send_hp(p_ptr->mhp, p_ptr->chp);
281d287
<
285c291
< static void prt_sp(void)
---
> static void prt_sp(int Ind)
287,288c293
< char tmp[32];
< byte color;
---
> player_type *p_ptr = Players[Ind];
290d294
<
292c296
< if (!mp_ptr->spell_book) return;
---
> if (!mp_ptr->spell_book) Send_sp(0, 0);
294,321c298
<
< put_str("Max SP ", ROW_MAXSP, COL_MAXSP);
<
< sprintf(tmp, "%5d", p_ptr->msp);
< color = TERM_L_GREEN;
<
< c_put_str(color, tmp, ROW_MAXSP, COL_MAXSP + 7);
<
<
< put_str("Cur SP ", ROW_CURSP, COL_CURSP);
<
< sprintf(tmp, "%5d", p_ptr->csp);
<
< if (p_ptr->csp >= p_ptr->msp)
< {
< color = TERM_L_GREEN;
< }
< else if (p_ptr->csp > (p_ptr->msp * hitpoint_warn) / 10)
< {
< color = TERM_YELLOW;
< }
< else
< {
< color = TERM_RED;
< }
<
< /* Show mana */
< c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 7);
---
> else Send_sp(p_ptr->msp, p_ptr->csp);
328c305
< static void prt_depth(void)
---
> static void prt_depth(int Ind)
330c307
< char depths[32];
---
> player_type *p_ptr = Players[Ind];
332,346c309
< if (!dun_level)
< {
< (void)strcpy(depths, "Town");
< }
< else if (depth_in_feet)
< {
< (void)sprintf(depths, "%d ft", dun_level * 50);
< }
< else
< {
< (void)sprintf(depths, "Lev %d", dun_level);
< }
<
< /* Right-Adjust the "depth", and clear old values */
< prt(format("%7s", depths), 23, COL_DEPTH);
---
> Send_depth(p_ptr->dun_depth);
353c316
< static void prt_hunger(void)
---
> static void prt_hunger(int Ind)
355,359c318
< /* Fainting / Starving */
< if (p_ptr->food < PY_FOOD_FAINT)
< {
< c_put_str(TERM_RED, "Weak ", ROW_HUNGRY, COL_HUNGRY);
< }
---
> player_type *p_ptr = Players[Ind];
361,389c320
< /* Weak */
< else if (p_ptr->food < PY_FOOD_WEAK)
< {
< c_put_str(TERM_ORANGE, "Weak ", ROW_HUNGRY, COL_HUNGRY);
< }
<
< /* Hungry */
< else if (p_ptr->food < PY_FOOD_ALERT)
< {
< c_put_str(TERM_YELLOW, "Hungry", ROW_HUNGRY, COL_HUNGRY);
< }
<
< /* Normal */
< else if (p_ptr->food < PY_FOOD_FULL)
< {
< c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
< }
<
< /* Full */
< else if (p_ptr->food < PY_FOOD_MAX)
< {
< c_put_str(TERM_L_GREEN, "Full ", ROW_HUNGRY, COL_HUNGRY);
< }
<
< /* Gorged */
< else
< {
< c_put_str(TERM_GREEN, "Gorged", ROW_HUNGRY, COL_HUNGRY);
< }
---
> Send_food(p_ptr->food);
396c327
< static void prt_blind(void)
---
> static void prt_blind(int Ind)
397a329,330
> player_type *p_ptr = Players[Ind];
>
400c333
< c_put_str(TERM_ORANGE, "Blind", ROW_BLIND, COL_BLIND);
---
> Send_blind(TRUE);
404c337
< put_str(" ", ROW_BLIND, COL_BLIND);
---
> Send_blind(FALSE);
412c345
< static void prt_confused(void)
---
> static void prt_confused(int Ind)
413a347,348
> player_type *p_ptr = Players[Ind];
>
416c351
< c_put_str(TERM_ORANGE, "Confused", ROW_CONFUSED, COL_CONFUSED);
---
> Send_confused(TRUE);
420c355
< put_str(" ", ROW_CONFUSED, COL_CONFUSED);
---
> Send_confused(FALSE);
428c363
< static void prt_afraid(void)
---
> static void prt_afraid(int Ind)
429a365,366
> player_type *p_ptr = Players[Ind];
>
432c369
< c_put_str(TERM_ORANGE, "Afraid", ROW_AFRAID, COL_AFRAID);
---
> Send_fear(TRUE);
436c373
< put_str(" ", ROW_AFRAID, COL_AFRAID);
---
> Send_fear(FALSE);
444c381
< static void prt_poisoned(void)
---
> static void prt_poisoned(int Ind)
445a383,384
> player_type *p_ptr = Players[Ind];
>
448c387
< c_put_str(TERM_ORANGE, "Poisoned", ROW_POISONED, COL_POISONED);
---
> Send_poison(TRUE);
452c391
< put_str(" ", ROW_POISONED, COL_POISONED);
---
> Send_poison(FALSE);
464c403
< static void prt_state(void)
---
> static void prt_state(int Ind)
466c405
< byte attr = TERM_WHITE;
---
> player_type *p_ptr = Players[Ind];
468c407
< char text[16];
---
> bool p, s;
470d408
<
474,476c412
< attr = TERM_RED;
<
< strcpy(text, "Paralyzed!");
---
> p = TRUE;
478,480c414
<
< /* Resting */
< else if (resting)
---
> else
482,540c416
< int i;
<
< /* Start with "Rest" */
< strcpy(text, "Rest ");
<
< /* Extensive (timed) rest */
< if (resting >= 1000)
< {
< i = resting / 100;
< text[9] = '0';
< text[8] = '0';
< text[7] = '0' + (i % 10);
< if (i >= 10)
< {
< i = i / 10;
< text[6] = '0' + (i % 10);
< if (i >= 10)
< {
< text[5] = '0' + (i / 10);
< }
< }
< }
<
< /* Long (timed) rest */
< else if (resting >= 100)
< {
< i = resting;
< text[9] = '0' + (i % 10);
< i = i / 10;
< text[8] = '0' + (i % 10);
< text[7] = '0' + (i / 10);
< }
<
< /* Medium (timed) rest */
< else if (resting >= 10)
< {
< i = resting;
< text[9] = '0' + (i % 10);
< text[8] = '0' + (i / 10);
< }
<
< /* Short (timed) rest */
< else if (resting > 0)
< {
< i = resting;
< text[9] = '0' + (i);
< }
<
< /* Rest until healed */
< else if (resting == -1)
< {
< text[5] = text[6] = text[7] = text[8] = text[9] = '*';
< }
<
< /* Rest until done */
< else if (resting == -2)
< {
< text[5] = text[6] = text[7] = text[8] = text[9] = '&';
< }
---
> p = FALSE;
543,555d418
< /* Repeating */
< else if (command_rep)
< {
< if (command_rep > 999)
< {
< (void)sprintf(text, "Rep. %3d00", command_rep / 100);
< }
< else
< {
< (void)sprintf(text, "Repeat %3d", command_rep);
< }
< }
<
557c420
< else if (p_ptr->searching)
---
> if (p_ptr->searching)
559c422
< strcpy(text, "Searching ");
---
> s = TRUE;
561,562d423
<
< /* Nothing interesting */
565c426
< strcpy(text, " ");
---
> s = FALSE;
568,569c429
< /* Display the info (or blanks) */
< c_put_str(attr, text, ROW_STATE, COL_STATE);
---
> Send_state(p, s);
576c436
< static void prt_speed(void)
---
> static void prt_speed(int Ind)
577a438,439
> player_type *p_ptr = Players[Ind];
>
580,582d441
< int attr = TERM_WHITE;
< char buf[32] = "";
<
586,601c445
< /* Fast */
< if (i > 110)
< {
< attr = TERM_L_GREEN;
< sprintf(buf, "Fast (+%d)", (i - 110));
< }
<
< /* Slow */
< else if (i < 110)
< {
< attr = TERM_L_UMBER;
< sprintf(buf, "Slow (-%d)", (110 - i));
< }
<
< /* Display the speed */
< c_put_str(attr, format("%-14s", buf), ROW_SPEED, COL_SPEED);
---
> Send_speed(i - 110);
605c449
< static void prt_study(void)
---
> static void prt_study(int Ind)
606a451,452
> player_type *p_ptr = Players[Ind];
>
609c455
< put_str("Study", ROW_STUDY, 64);
---
> Send_study(TRUE);
613c459
< put_str(" ", ROW_STUDY, COL_STUDY);
---
> Send_study(FALSE);
618c464
< static void prt_cut(void)
---
> static void prt_cut(int Ind)
619a466,467
> player_type *p_ptr = Players[Ind];
>
622,653c470
< if (c > 1000)
< {
< c_put_str(TERM_L_RED, "Mortal wound", ROW_CUT, COL_CUT);
< }
< else if (c > 200)
< {
< c_put_str(TERM_RED, "Deep gash ", ROW_CUT, COL_CUT);
< }
< else if (c > 100)
< {
< c_put_str(TERM_RED, "Severe cut ", ROW_CUT, COL_CUT);
< }
< else if (c > 50)
< {
< c_put_str(TERM_ORANGE, "Nasty cut ", ROW_CUT, COL_CUT);
< }
< else if (c > 25)
< {
< c_put_str(TERM_ORANGE, "Bad cut ", ROW_CUT, COL_CUT);
< }
< else if (c > 10)
< {
< c_put_str(TERM_YELLOW, "Light cut ", ROW_CUT, COL_CUT);
< }
< else if (c)
< {
< c_put_str(TERM_YELLOW, "Graze ", ROW_CUT, COL_CUT);
< }
< else
< {
< put_str(" ", ROW_CUT, COL_CUT);
< }
---
> Send_cut(c);
658c475
< static void prt_stun(void)
---
> static void prt_stun(int Ind)
659a477,478
> player_type *p_ptr = Players[Ind];
>
662,677c481
< if (s > 100)
< {
< c_put_str(TERM_RED, "Knocked out ", ROW_STUN, COL_STUN);
< }
< else if (s > 50)
< {
< c_put_str(TERM_ORANGE, "Heavy stun ", ROW_STUN, COL_STUN);
< }
< else if (s)
< {
< c_put_str(TERM_ORANGE, "Stun ", ROW_STUN, COL_STUN);
< }
< else
< {
< put_str(" ", ROW_STUN, COL_STUN);
< }
---
> Send_stun(s);
779c583
< static void prt_frame_basic(void)
---
> static void prt_frame_basic(int Ind)
784,785c588,589
< prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
< prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS);
---
> /*prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
> prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS);*/
788c592
< prt_title();
---
> prt_title(Ind);
791,792c595,596
< prt_level();
< prt_exp();
---
> prt_level(Ind);
> prt_exp(Ind);
798c602
< prt_ac();
---
> prt_ac(Ind);
801c605
< prt_hp();
---
> prt_hp(Ind);
804c608
< prt_sp();
---
> prt_sp(Ind);
807c611
< prt_gold();
---
> prt_gold(Ind);
810c614
< prt_depth();
---
> prt_depth(Ind);
820c624
< static void prt_frame_extra(void)
---
> static void prt_frame_extra(int Ind)
823,824c627,628
< prt_cut();
< prt_stun();
---
> prt_cut(Ind);
> prt_stun(Ind);
827c631
< prt_hunger();
---
> prt_hunger(Ind);
830,833c634,637
< prt_blind();
< prt_confused();
< prt_afraid();
< prt_poisoned();
---
> prt_blind(Ind);
> prt_confused(Ind);
> prt_afraid(Ind);
> prt_poisoned(Ind);
836c640
< prt_state();
---
> prt_state(Ind);
839c643
< prt_speed();
---
> prt_speed(Ind);
842c646
< prt_study();
---
> prt_study(Ind);
850c654
< static void fix_inven(void)
---
> static void fix_inven(int Ind)
852,876c656,657
< int j;
<
< /* Scan windows */
< for (j = 0; j < 8; j++)
< {
< term *old = Term;
<
< /* No window */
< if (!ang_term[j]) continue;
<
< /* No relevant flags */
< if (!(window_flag[j] & PW_INVEN)) continue;
<
< /* Activate */
< Term_activate(ang_term[j]);
<
< /* Display inventory */
< display_inven();
<
< /* Fresh */
< Term_fresh();
<
< /* Restore */
< Term_activate(old);
< }
---
> /* Resend the inventory */
> display_inven(Ind);
884c665
< static void fix_equip(void)
---
> static void fix_equip(int Ind)
886,910c667,668
< int j;
<
< /* Scan windows */
< for (j = 0; j < 8; j++)
< {
< term *old = Term;
<
< /* No window */
< if (!ang_term[j]) continue;
<
< /* No relevant flags */
< if (!(window_flag[j] & PW_EQUIP)) continue;
<
< /* Activate */
< Term_activate(ang_term[j]);
<
< /* Display equipment */
< display_equip();
<
< /* Fresh */
< Term_fresh();
<
< /* Restore */
< Term_activate(old);
< }
---
> /* Resend the equipment */
> display_equip(Ind);
922c680
< static void fix_spell(void)
---
> static void fix_spell(int Ind)
923a682,705
> player_type *p_ptr = Players[Ind];
> int i;
>
> /* Warriors don't need this */
> if (!mp_ptr->spell_book)
> return;
>
> /* Check for blindness and no lite and confusion */
> if (p_ptr->blind || no_lite(Ind) || p_ptr->confused)
> {
> return;
> }
>
> /* Scan for appropriate books */
> for (i = 0; i < INVEN_WIELD; i++)
> {
> if (p_ptr->inventory[i].tval == mp_ptr->spell_book)
> {
> do_cmd_browse(i);
> }
> }
>
>
> #if 0
948a731
> #endif
955c738
< static void fix_player(void)
---
> static void fix_player(int Ind)
957,981c740,741
< int j;
<
< /* Scan windows */
< for (j = 0; j < 8; j++)
< {
< term *old = Term;
<
< /* No window */
< if (!ang_term[j]) continue;
<
< /* No relevant flags */
< if (!(window_flag[j] & PW_PLAYER)) continue;
<
< /* Activate */
< Term_activate(ang_term[j]);
<
< /* Display player */
< display_player(FALSE);
<
< /* Fresh */
< Term_fresh();
<
< /* Restore */
< Term_activate(old);
< }
---
> /* Resend the player info */
> display_player(TRUE);
991c751
< static void fix_message(void)
---
> static void fix_message(int Ind)
992a753
> #if 0
1032a794
> #endif
1041c803
< static void fix_overhead(void)
---
> static void fix_overhead(int Ind)
1042a805
> #if 0
1069a833
> #endif
1076c840
< static void fix_monster(void)
---
> static void fix_monster(int Ind)
1077a842
> #if 0
1102a868
> #endif
1113c879
< static void calc_spells(void)
---
> static void calc_spells(int Ind)
1114a881,882
> player_type *p_ptr = Players[Ind];
>
1127c895
< if (!character_generated) return;
---
> /*if (!character_generated) return;*/
1130c898
< if (character_xtra) return;
---
> /*if (character_xtra) return;*/
1151,1152c919,920
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32))))
1167c935
< if (!spell_learned1 && !spell_learned2) break;
---
> if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
1170c938
< j = spell_order[i];
---
> j = p_ptr->spell_order[i];
1183,1184c951,952
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32))))
1189c957
< spell_forgotten1 |= (1L << j);
---
> p_ptr->spell_forgotten1 |= (1L << j);
1193c961
< spell_forgotten2 |= (1L << (j - 32));
---
> p_ptr->spell_forgotten2 |= (1L << (j - 32));
1199c967
< spell_learned1 &= ~(1L << j);
---
> p_ptr->spell_learned1 &= ~(1L << j);
1203c971
< spell_learned2 &= ~(1L << (j - 32));
---
> p_ptr->spell_learned2 &= ~(1L << (j - 32));
1223c991
< if (!spell_learned1 && !spell_learned2) break;
---
> if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
1226c994
< j = spell_order[i];
---
> j = p_ptr->spell_order[i];
1233,1234c1001,1002
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32))))
1239c1007
< spell_forgotten1 |= (1L << j);
---
> p_ptr->spell_forgotten1 |= (1L << j);
1243c1011
< spell_forgotten2 |= (1L << (j - 32));
---
> p_ptr->spell_forgotten2 |= (1L << (j - 32));
1249c1017
< spell_learned1 &= ~(1L << j);
---
> p_ptr->spell_learned1 &= ~(1L << j);
1253c1021
< spell_learned2 &= ~(1L << (j - 32));
---
> p_ptr->spell_learned2 &= ~(1L << (j - 32));
1273c1041
< if (!spell_forgotten1 && !spell_forgotten2) break;
---
> if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break;
1276c1044
< j = spell_order[i];
---
> j = p_ptr->spell_order[i];
1289,1290c1057,1058
< (spell_forgotten1 & (1L << j)) :
< (spell_forgotten2 & (1L << (j - 32))))
---
> (p_ptr->spell_forgotten1 & (1L << j)) :
> (p_ptr->spell_forgotten2 & (1L << (j - 32))))
1295c1063
< spell_forgotten1 &= ~(1L << j);
---
> p_ptr->spell_forgotten1 &= ~(1L << j);
1299c1067
< spell_forgotten2 &= ~(1L << (j - 32));
---
> p_ptr->spell_forgotten2 &= ~(1L << (j - 32));
1305c1073
< spell_learned1 |= (1L << j);
---
> p_ptr->spell_learned1 |= (1L << j);
1309c1077
< spell_learned2 |= (1L << (j - 32));
---
> p_ptr->spell_learned2 |= (1L << (j - 32));
1336,1337c1104,1105
< (spell_learned1 & (1L << j)) :
< (spell_learned2 & (1L << (j - 32))))
---
> (p_ptr->spell_learned1 & (1L << j)) :
> (p_ptr->spell_learned2 & (1L << (j - 32))))
1377c1145
< static void calc_mana(void)
---
> static void calc_mana(int Ind)
1378a1147,1148
> player_type *p_ptr = Players[Ind];
>
1410c1180
< o_ptr = &inventory[INVEN_HANDS];
---
> o_ptr = &p_ptr->inventory[INVEN_HANDS];
1434,1439c1204,1209
< cur_wgt += inventory[INVEN_BODY].weight;
< cur_wgt += inventory[INVEN_HEAD].weight;
< cur_wgt += inventory[INVEN_ARM].weight;
< cur_wgt += inventory[INVEN_OUTER].weight;
< cur_wgt += inventory[INVEN_HANDS].weight;
< cur_wgt += inventory[INVEN_FEET].weight;
---
> cur_wgt += p_ptr->inventory[INVEN_BODY].weight;
> cur_wgt += p_ptr->inventory[INVEN_HEAD].weight;
> cur_wgt += p_ptr->inventory[INVEN_ARM].weight;
> cur_wgt += p_ptr->inventory[INVEN_OUTER].weight;
> cur_wgt += p_ptr->inventory[INVEN_HANDS].weight;
> cur_wgt += p_ptr->inventory[INVEN_FEET].weight;
1505c1275
< if (character_xtra) return;
---
> /*if (character_xtra) return;*/
1549c1319
< static void calc_hitpoints(void)
---
> static void calc_hitpoints(int Ind)
1550a1321,1322
> player_type *p_ptr = Players[Ind];
>
1557c1329
< mhp = player_hp[p_ptr->lev-1] + (bonus * p_ptr->lev / 2);
---
> mhp = p_ptr->player_hp[p_ptr->lev-1] + (bonus * p_ptr->lev / 2);
1594c1366
< static void calc_torch(void)
---
> static void calc_torch(int Ind)
1596c1368
< object_type *o_ptr = &inventory[INVEN_LITE];
---
> player_type *p_ptr = Players[Ind];
1597a1370,1371
> object_type *o_ptr = &p_ptr->inventory[INVEN_LITE];
>
1624c1398
< if (running && view_reduce_lite)
---
> if (p_ptr->running && view_reduce_lite)
1649c1423
< static int weight_limit(void)
---
> static int weight_limit(int Ind)
1650a1425,1426
> player_type *p_ptr = Players[Ind];
>
1681c1457
< static void calc_bonuses(void)
---
> static void calc_bonuses(int Ind)
1682a1459,1460
> player_type *p_ptr = Players[Ind];
>
1865c1643
< o_ptr = &inventory[i];
---
> o_ptr = &p_ptr->inventory[i];
2175c1953
< j = total_weight;
---
> j = p_ptr->total_weight;
2178c1956
< i = weight_limit();
---
> i = weight_limit(Ind);
2222c2000
< o_ptr = &inventory[INVEN_BOW];
---
> o_ptr = &p_ptr->inventory[INVEN_BOW];
2287c2065
< o_ptr = &inventory[INVEN_WIELD];
---
> o_ptr = &p_ptr->inventory[INVEN_WIELD];
2440c2218
< if (character_xtra) return;
---
> /*if (character_xtra) return;*/
2450c2228
< else if (inventory[INVEN_BOW].k_idx)
---
> else if (p_ptr->inventory[INVEN_BOW].k_idx)
2472c2250
< else if (inventory[INVEN_WIELD].k_idx)
---
> else if (p_ptr->inventory[INVEN_WIELD].k_idx)
2494c2272
< else if (inventory[INVEN_WIELD].k_idx)
---
> else if (p_ptr->inventory[INVEN_WIELD].k_idx)
2513c2291
< void notice_stuff(void)
---
> void notice_stuff(int Ind)
2514a2293,2294
> player_type *p_ptr = Players[Ind];
>
2523c2303
< combine_pack();
---
> combine_pack(Ind);
2530c2310
< reorder_pack();
---
> reorder_pack(Ind);
2538c2318
< void update_stuff(void)
---
> void update_stuff(int Ind)
2539a2320,2321
> player_type *p_ptr = Players[Ind];
>
2547c2329
< calc_bonuses();
---
> calc_bonuses(Ind);
2553c2335
< calc_torch();
---
> calc_torch(Ind);
2559c2341
< calc_hitpoints();
---
> calc_hitpoints(Ind);
2565c2347
< calc_mana();
---
> calc_mana(Ind);
2571c2353
< calc_spells();
---
> calc_spells(Ind);
2576c2358
< if (!character_generated) return;
---
> /*if (!character_generated) return;*/
2580c2362
< if (character_icky) return;
---
> /*if (character_icky) return;*/
2586c2368
< forget_lite();
---
> forget_lite(Ind);
2592c2374
< forget_view();
---
> forget_view(Ind);
2599c2381
< update_view();
---
> update_view(Ind);
2605c2387
< update_lite();
---
> update_lite(Ind);
2634c2416
< void redraw_stuff(void)
---
> void redraw_stuff(int Ind)
2635a2418,2419
> player_type *p_ptr = Players[Ind];
>
2641c2425
< if (!character_generated) return;
---
> /*if (!character_generated) return;*/
2645c2429
< if (character_icky) return;
---
> /*if (character_icky) return;*/
2654c2438
< Term_clear();
---
> /*Term_clear();*/
2661c2445
< prt_map();
---
> prt_map(Ind);
2672c2456
< prt_frame_basic();
---
> prt_frame_basic(Ind);
2678,2679c2462,2463
< prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
< prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS);
---
> /*prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
> prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS);*/
2685c2469
< prt_title();
---
> prt_title(Ind);
2691c2475
< prt_level();
---
> prt_level(Ind);
2697c2481
< prt_exp();
---
> prt_exp(Ind);
2714c2498
< prt_ac();
---
> prt_ac(Ind);
2720c2504
< prt_hp();
---
> prt_hp(Ind);
2726c2510
< prt_sp();
---
> prt_sp(Ind);
2732c2516
< prt_gold();
---
> prt_gold(Ind);
2738c2522
< prt_depth();
---
> prt_depth(Ind);
2756c2540
< prt_frame_extra();
---
> prt_frame_extra(Ind);
2762c2546
< prt_cut();
---
> prt_cut(Ind);
2768c2552
< prt_stun();
---
> prt_stun(Ind);
2774c2558
< prt_hunger();
---
> prt_hunger(Ind);
2780c2564
< prt_blind();
---
> prt_blind(Ind);
2786c2570
< prt_confused();
---
> prt_confused(Ind);
2792c2576
< prt_afraid();
---
> prt_afraid(Ind);
2798c2582
< prt_poisoned();
---
> prt_poisoned(Ind);
2804c2588
< prt_state();
---
> prt_state(Ind);
2810c2594
< prt_speed();
---
> prt_speed(Ind);
2816c2600
< prt_study();
---
> prt_study(Ind);
2824c2608
< void window_stuff(void)
---
> void window_stuff(int Ind)
2825a2610,2611
> player_type *p_ptr = Players[Ind];
>
2833c2619
< fix_inven();
---
> fix_inven(Ind);
2840c2626
< fix_equip();
---
> fix_equip(Ind);
2847c2633
< fix_spell();
---
> fix_spell(Ind);
2854c2640
< fix_player();
---
> fix_player(Ind);
2861c2647
< fix_message();
---
> fix_message(Ind);
2868c2654
< fix_overhead();
---
> fix_overhead(Ind);
2875c2661
< fix_monster();
---
> fix_monster(Ind);
2883c2669
< void handle_stuff(void)
---
> void handle_stuff(int Ind)
2884a2671,2672
> player_type *p_ptr = Players[Ind];
>
2886c2674
< if (p_ptr->update) update_stuff();
---
> if (p_ptr->update) update_stuff(Ind);
2889c2677
< if (p_ptr->redraw) redraw_stuff();
---
> if (p_ptr->redraw) redraw_stuff(Ind);
2892c2680
< if (p_ptr->window) window_stuff();
---
> if (p_ptr->window) window_stuff(Ind);
diff -r src-280/xtra2.c mangband-000/src/server/xtra2.c
12a13,14
> #define SERVER
>
25c27
< bool set_blind(int v)
---
> bool set_blind(int int v)
26a29,30
> player_type *p_ptr = Players[Ind];
>
80c84
< handle_stuff();
---
> handle_stuff(Ind);
90c94
< bool set_confused(int v)
---
> bool set_confused(int int v)
91a96,97
> player_type *p_ptr = Players[Ind];
>
130c136
< handle_stuff();
---
> handle_stuff(Ind);
140c146
< bool set_poisoned(int v)
---
> bool set_poisoned(int int v)
141a148,149
> player_type *p_ptr = Players[Ind];
>
180c188
< handle_stuff();
---
> handle_stuff(Ind);
190c198
< bool set_afraid(int v)
---
> bool set_afraid(int int v)
191a200,201
> player_type *p_ptr = Players[Ind];
>
230c240
< handle_stuff();
---
> handle_stuff(Ind);
240c250
< bool set_paralyzed(int v)
---
> bool set_paralyzed(int int v)
241a252,253
> player_type *p_ptr = Players[Ind];
>
280c292
< handle_stuff();
---
> handle_stuff(Ind);
292c304
< bool set_image(int v)
---
> bool set_image(int int v)
293a306,307
> player_type *p_ptr = Players[Ind];
>
338c352
< handle_stuff();
---
> handle_stuff(Ind);
348c362
< bool set_fast(int v)
---
> bool set_fast(int int v)
349a364,365
> player_type *p_ptr = Players[Ind];
>
388c404
< handle_stuff();
---
> handle_stuff(Ind);
398c414
< bool set_slow(int v)
---
> bool set_slow(int int v)
399a416,417
> player_type *p_ptr = Players[Ind];
>
438c456
< handle_stuff();
---
> handle_stuff(Ind);
448c466
< bool set_shield(int v)
---
> bool set_shield(int int v)
449a468,469
> player_type *p_ptr = Players[Ind];
>
488c508
< handle_stuff();
---
> handle_stuff(Ind);
499c519
< bool set_blessed(int v)
---
> bool set_blessed(int int v)
500a521,522
> player_type *p_ptr = Players[Ind];
>
539c561
< handle_stuff();
---
> handle_stuff(Ind);
549c571
< bool set_hero(int v)
---
> bool set_hero(int int v)
550a573,574
> player_type *p_ptr = Players[Ind];
>
592c616
< handle_stuff();
---
> handle_stuff(Ind);
602c626
< bool set_shero(int v)
---
> bool set_shero(int int v)
603a628,629
> player_type *p_ptr = Players[Ind];
>
645c671
< handle_stuff();
---
> handle_stuff(Ind);
655c681
< bool set_protevil(int v)
---
> bool set_protevil(int int v)
656a683,684
> player_type *p_ptr = Players[Ind];
>
692c720
< handle_stuff();
---
> handle_stuff(Ind);
702c730
< bool set_invuln(int v)
---
> bool set_invuln(int int v)
703a732,733
> player_type *p_ptr = Players[Ind];
>
742c772
< handle_stuff();
---
> handle_stuff(Ind);
752c782
< bool set_tim_invis(int v)
---
> bool set_tim_invis(int int v)
753a784,785
> player_type *p_ptr = Players[Ind];
>
795c827
< handle_stuff();
---
> handle_stuff(Ind);
805c837
< bool set_tim_infra(int v)
---
> bool set_tim_infra(int int v)
806a839,840
> player_type *p_ptr = Players[Ind];
>
848c882
< handle_stuff();
---
> handle_stuff(Ind);
858c892
< bool set_oppose_acid(int v)
---
> bool set_oppose_acid(int int v)
859a894,895
> player_type *p_ptr = Players[Ind];
>
895c931
< handle_stuff();
---
> handle_stuff(Ind);
905c941
< bool set_oppose_elec(int v)
---
> bool set_oppose_elec(int int v)
906a943,944
> player_type *p_ptr = Players[Ind];
>
942c980
< handle_stuff();
---
> handle_stuff(Ind);
952c990
< bool set_oppose_fire(int v)
---
> bool set_oppose_fire(int int v)
953a992,993
> player_type *p_ptr = Players[Ind];
>
989c1029
< handle_stuff();
---
> handle_stuff(Ind);
999c1039
< bool set_oppose_cold(int v)
---
> bool set_oppose_cold(int int v)
1000a1041,1042
> player_type *p_ptr = Players[Ind];
>
1036c1078
< handle_stuff();
---
> handle_stuff(Ind);
1046c1088
< bool set_oppose_pois(int v)
---
> bool set_oppose_pois(int int v)
1047a1090,1091
> player_type *p_ptr = Players[Ind];
>
1083c1127
< handle_stuff();
---
> handle_stuff(Ind);
1095c1139
< bool set_stun(int v)
---
> bool set_stun(int int v)
1096a1141,1142
> player_type *p_ptr = Players[Ind];
>
1211c1257
< handle_stuff();
---
> handle_stuff(Ind);
1223c1269
< bool set_cut(int v)
---
> bool set_cut(int int v)
1224a1271,1272
> player_type *p_ptr = Players[Ind];
>
1407c1455
< handle_stuff();
---
> handle_stuff(Ind);
1436c1484
< bool set_food(int v)
---
> bool set_food(int int v)
1437a1486,1487
> player_type *p_ptr = Players[Ind];
>
1605c1655
< handle_stuff();
---
> handle_stuff(Ind);
1618c1668
< void check_experience(void)
---
> void check_experience(int Ind)
1619a1670,1671
> player_type *p_ptr = Players[Ind];
>
1647c1699
< handle_stuff();
---
> handle_stuff(Ind);
1668c1720
< handle_stuff();
---
> handle_stuff(Ind);
1699c1751
< handle_stuff();
---
> handle_stuff(Ind);
1707c1759
< void gain_exp(s32b amount)
---
> void gain_exp(int s32b amount)
1708a1761,1762
> player_type *p_ptr = Players[Ind];
>
1720c1774
< check_experience();
---
> check_experience(Ind);
1727c1781
< void lose_exp(s32b amount)
---
> void lose_exp(int s32b amount)
1728a1783,1784
> player_type *p_ptr = Players[Ind];
>
1736c1792
< check_experience();
---
> check_experience(Ind);
1790c1846
< void monster_death(int m_idx)
---
> void monster_death(int int m_idx)
1792c1848
< int i, j, y, x, ny, nx;
---
> player_type *p_ptr = Players[Ind];
1793a1850,1851
> int i, j, y, x, ny, nx, Depth;
>
1806c1864
< bool visible = (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE));
---
> bool visible = (p_ptr->mon_vis[m_idx] || (r_ptr->flags1 & RF1_UNIQUE));
1819a1878
> Depth = m_ptr->dun_depth;
1838c1897
< scatter(&ny, &nx, y, x, d, 0);
---
> scatter(Depth, &ny, &nx, y, x, d, 0);
1841c1900
< if (!cave_clean_bold(ny, nx)) continue;
---
> if (!cave_clean_bold(Depth, ny, nx)) continue;
1847c1906
< object_level = (dun_level + r_ptr->level) / 2;
---
> object_level = (Depth + r_ptr->level) / 2;
1852c1911
< place_gold(ny, nx);
---
> place_gold(Depth, ny, nx);
1859c1918
< place_object(ny, nx, good, great);
---
> place_object(Depth, ny, nx, good, great);
1864c1923
< object_level = dun_level;
---
> object_level = Depth;
1873c1932
< lite_spot(ny, nx);
---
> everyone_lite_spot(Depth, ny, nx);
1876c1935
< if ((ny == py) && (nx == px))
---
> if ((ny == p_ptr->py) && (nx == p_ptr->px))
1908c1967
< apply_magic(&prize, -1, TRUE, TRUE, TRUE);
---
> apply_magic(Depth, &prize, -1, TRUE, TRUE, TRUE);
1911c1970
< drop_near(&prize, -1, y, x);
---
> drop_near(&prize, -1, Depth, y, x);
1921c1980
< apply_magic(&prize, -1, TRUE, TRUE, TRUE);
---
> apply_magic(Depth, &prize, -1, TRUE, TRUE, TRUE);
1924c1983
< drop_near(&prize, -1, y, x);
---
> drop_near(&prize, -1, Depth, y, x);
1947c2006
< while (!cave_valid_bold(y, x))
---
> while (!cave_valid_bold(Depth, y, x))
1952c2011
< scatter(&ny, &nx, y, x, d, 0);
---
> scatter(Depth, &ny, &nx, y, x, d, 0);
1959c2018
< delete_object(y, x);
---
> delete_object(Depth, y, x);
1965c2024
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
1974c2033
< lite_spot(y, x);
---
> everyone_lite_spot(Depth, y, x);
1985c2044
< total_winner = TRUE;
---
> p_ptr->total_winner = TRUE;
2029c2088
< bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
---
> bool mon_take_hit(int int m_idx, int dam, bool *fear, cptr note)
2030a2090,2091
> player_type *p_ptr = Players[Ind];
>
2066c2127
< else if (!m_ptr->ml)
---
> else if (!p_ptr->mon_vis[m_idx])
2112c2173
< if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
---
> if (p_ptr->mon_vis[m_idx] || (r_ptr->flags1 & RF1_UNIQUE))
2197c2258
< void panel_bounds(void)
---
> void panel_bounds(int Ind)
2199,2204c2260,2267
< panel_row_min = panel_row * (SCREEN_HGT / 2);
< panel_row_max = panel_row_min + SCREEN_HGT - 1;
< panel_row_prt = panel_row_min - 1;
< panel_col_min = panel_col * (SCREEN_WID / 2);
< panel_col_max = panel_col_min + SCREEN_WID - 1;
< panel_col_prt = panel_col_min - 13;
---
> player_type *p_ptr = Players[Ind];
>
> p_ptr->panel_row_min = p_ptr->panel_row * (SCREEN_HGT / 2);
> p_ptr->panel_row_max = p_ptr->panel_row_min + SCREEN_HGT - 1;
> p_ptr->panel_row_prt = p_ptr->panel_row_min - 1;
> p_ptr->panel_col_min = p_ptr->panel_col * (SCREEN_WID / 2);
> p_ptr->panel_col_max = p_ptr->panel_col_min + SCREEN_WID - 1;
> p_ptr->panel_col_prt = p_ptr->panel_col_min - 13;
2217c2280
< void verify_panel(void)
---
> void verify_panel(int Ind)
2219,2220c2282
< int y = py;
< int x = px;
---
> player_type *p_ptr = Players[Ind];
2222,2223c2284,2285
< int prow = panel_row;
< int pcol = panel_col;
---
> int y = p_ptr->py;
> int x = p_ptr->px;
2224a2287,2289
> int prow = p_ptr->panel_row;
> int pcol = p_ptr->panel_col;
>
2226c2291
< if ((y < panel_row_min + 2) || (y > panel_row_max - 2))
---
> if ((y < p_ptr->panel_row_min + 2) || (y > p_ptr->panel_row_max - 2))
2229c2294
< if (prow > max_panel_rows) prow = max_panel_rows;
---
> if (prow > p_ptr->max_panel_rows) prow = p_ptr->max_panel_rows;
2234c2299
< if ((x < panel_col_min + 4) || (x > panel_col_max - 4))
---
> if ((x < p_ptr->panel_col_min + 4) || (x > p_ptr->panel_col_max - 4))
2237c2302
< if (pcol > max_panel_cols) pcol = max_panel_cols;
---
> if (pcol > p_ptr->max_panel_cols) pcol = p_ptr->max_panel_cols;
2242c2307
< if ((prow == panel_row) && (pcol == panel_col)) return;
---
> if ((prow == p_ptr->panel_row) && (pcol == p_ptr->panel_col)) return;
2248,2249c2313,2314
< panel_row = prow;
< panel_col = pcol;
---
> p_ptr->panel_row = prow;
> p_ptr->panel_col = pcol;
2252c2317
< panel_bounds();
---
> panel_bounds(Ind);
2323c2388
< void ang_sort_aux(vptr u, vptr v, int p, int q)
---
> void ang_sort_aux(int vptr u, vptr v, int p, int q)
2372c2437
< void ang_sort(vptr u, vptr v, int n)
---
> void ang_sort(int vptr u, vptr v, int n)
2386c2451
< bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
---
> bool ang_sort_comp_distance(int vptr u, vptr v, int a, int b)
2387a2453,2454
> player_type *p_ptr = Players[Ind];
>
2394,2395c2461,2462
< kx = x[a]; kx -= px; kx = ABS(kx);
< ky = y[a]; ky -= py; ky = ABS(ky);
---
> kx = x[a]; kx -= p_ptr->px; kx = ABS(kx);
> ky = y[a]; ky -= p_ptr->py; ky = ABS(ky);
2401,2402c2468,2469
< kx = x[b]; kx -= px; kx = ABS(kx);
< ky = y[b]; ky -= py; ky = ABS(ky);
---
> kx = x[b]; kx -= p_ptr->px; kx = ABS(kx);
> ky = y[b]; ky -= p_ptr->py; ky = ABS(ky);
2418c2485
< void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
---
> void ang_sort_swap_distance(int vptr u, vptr v, int a, int b)
2457c2524
< bool target_able(int m_idx)
---
> bool target_able(int int m_idx)
2458a2526,2527
> player_type *p_ptr = Players[Ind];
>
2462c2531
< if (!m_ptr->ml) return (FALSE);
---
> if (!p_ptr->mon_vis[m_idx]) return (FALSE);
2465c2534
< if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
---
> if (!projectable(p_ptr->dun_depth, p_ptr->py, p_ptr->px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2485c2554
< bool target_okay(void)
---
> bool target_okay(int Ind)
2486a2556,2557
> player_type *p_ptr = Players[Ind];
>
2488c2559
< if (target_who < 0) return (TRUE);
---
> if (p_ptr->target_who < 0) return (TRUE);
2491c2562
< if (target_who > 0)
---
> if (p_ptr->target_who > 0)
2494c2565
< if (target_able(target_who))
---
> if (target_able(p_ptr->target_who))
2496c2567
< monster_type *m_ptr = &m_list[target_who];
---
> monster_type *m_ptr = &m_list[p_ptr->target_who];
2499,2500c2570,2571
< target_row = m_ptr->fy;
< target_col = m_ptr->fx;
---
> p_ptr->target_row = m_ptr->fy;
> p_ptr->target_col = m_ptr->fx;
2516c2587
< s16b target_pick(int y1, int x1, int dy, int dx)
---
> s16b target_pick(int int y1, int x1, int dy, int dx)
2517a2589,2590
> player_type *p_ptr = Players[Ind];
>
2526c2599
< for (i = 0; i < temp_n; i++)
---
> for (i = 0; i < p_ptr->temp_n; i++)
2529,2530c2602,2603
< x2 = temp_x[i];
< y2 = temp_y[i];
---
> x2 = p_ptr->temp_x[i];
> y2 = p_ptr->temp_y[i];
2583c2656
< bool target_set(void)
---
> bool target_set(int int dir)
2585c2658
< int i, d, m;
---
> player_type *p_ptr = Players[Ind];
2587,2588c2660
< int y = py;
< int x = px;
---
> int Depth = p_ptr->dun_depth;
2589a2662,2666
> int i, m;
>
> int y;
> int x;
>
2594,2595d2670
< char query;
<
2604,2605c2679,2682
< /* Go ahead and turn off target mode */
< target_who = 0;
---
> if (!dir)
> {
> x = p_ptr->px;
> y = p_ptr->py;
2607,2608c2684,2685
< /* Turn off health tracking */
< health_track(0);
---
> /* Go ahead and turn off target mode */
> p_ptr->target_who = 0;
2609a2687,2688
> /* Turn off health tracking */
> health_track(0);
2611,2612d2689
< /* Reset "temp" array */
< temp_n = 0;
2614,2617c2691,2692
< /* Collect "target-able" monsters */
< for (i = 1; i < m_max; i++)
< {
< monster_type *m_ptr = &m_list[i];
---
> /* Reset "temp" array */
> p_ptr->temp_n = 0;
2619,2620c2694,2697
< /* Skip "dead" monsters */
< if (!m_ptr->r_idx) continue;
---
> /* Collect "target-able" monsters */
> for (i = 1; i < m_max; i++)
> {
> monster_type *m_ptr = &m_list[i];
2622,2623c2699,2700
< /* Ignore "unreasonable" monsters */
< if (!target_able(i)) continue;
---
> /* Skip "dead" monsters */
> if (!m_ptr->r_idx) continue;
2625,2629c2702,2703
< /* Save this monster index */
< temp_x[temp_n] = m_ptr->fx;
< temp_y[temp_n] = m_ptr->fy;
< temp_n++;
< }
---
> /* Skip monsters not on this depth */
> if (m_ptr->dun_depth != Depth) continue;
2631,2633c2705,2706
< /* Set the sort hooks */
< ang_sort_comp = ang_sort_comp_distance;
< ang_sort_swap = ang_sort_swap_distance;
---
> /* Ignore "unreasonable" monsters */
> if (!target_able(i)) continue;
2635,2636c2708,2712
< /* Sort the positions */
< ang_sort(temp_x, temp_y, temp_n);
---
> /* Save this monster index */
> p_ptr->temp_x[p_ptr->temp_n] = m_ptr->fx;
> p_ptr->temp_y[p_ptr->temp_n] = m_ptr->fy;
> p_ptr->temp_n++;
> }
2637a2714,2716
> /* Set the sort hooks */
> ang_sort_comp = ang_sort_comp_distance;
> ang_sort_swap = ang_sort_swap_distance;
2639,2640c2718,2719
< /* Start near the player */
< m = 0;
---
> /* Sort the positions */
> ang_sort(p_ptr->temp_x, p_ptr->temp_y, p_ptr->temp_n);
2641a2721,2729
> /* Start near the player */
> m = 0;
> }
> else
> {
> /* Start where we last left off */
> m = p_ptr->look_index;
> }
>
2646c2734
< if (flag && temp_n)
---
> if (flag && p_ptr->temp_n)
2648,2649c2736,2737
< y = temp_y[m];
< x = temp_x[m];
---
> y = p_ptr->temp_y[m];
> x = p_ptr->temp_x[m];
2651c2739
< c_ptr = &cave[y][x];
---
> c_ptr = &cave[Depth][y][x];
2663c2751
< handle_stuff();
---
> handle_stuff(Ind);
2670c2758
< prt(out_val, 0, 0);
---
> /*prt(out_val, 0, 0);*/
2673,2674c2761,2762
< move_cursor_relative(y, x);
< query = inkey();
---
> /*move_cursor_relative(y, x);
> query = inkey();*/
2675a2764
> #if 0
2693a2783
> #endif
2696a2787
> #if 0
2769a2861
> #endif
2772c2864
< if (d)
---
> if (dir)
2775c2867
< i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
---
> i = target_pick(p_ptr->temp_y[m], p_ptr->temp_x[m], ddy[dir], ddx[dir]);
2781a2874
> #if 0
2859a2953
> #endif
2863c2957
< temp_n = 0;
---
> /*temp_n = 0;*/
2866c2960
< prt("", 0, 0);
---
> /*prt("", 0, 0);*/
2867a2962,2972
> p_ptr->look_index = m;
>
> if (dir == 5)
> {
> c_ptr = &cave[Depth][p_ptr->temp_x[m]][p_ptr->temp_y[m]];
>
> p_ptr->target_who = c_ptr->m_idx;
> p_ptr->target_col = p_ptr->temp_x[m];
> p_ptr->target_row = p_ptr->temp_y[m];
> }
>
2869c2974
< if (!target_who) return (FALSE);
---
> if (!p_ptr->target_who) return (FALSE);
2870a2976,2977
> p_ptr->temp_n = 0;
>
2886a2994,2995
> *
> * We just ask the client to send us a direction, unless we are confused --KLJ--
2888c2997
< bool get_aim_dir(int *dp)
---
> bool get_aim_dir(int Ind)
2892d3000
< char command;
2894,2896d3001
< cptr p;
<
<
2901,2904c3006
< if (use_old_target && target_okay()) dir = 5;
<
< /* Ask until satisfied */
< while (!dir)
---
> if (use_old_target && target_okay(Ind))
2906,2951c3008,3012
< /* Choose a prompt */
< if (!target_okay())
< {
< p = "Direction ('*' to choose a target, Escape to cancel)? ";
< }
< else
< {
< p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
< }
<
< /* Get a command (or Cancel) */
< if (!get_com(p, &command)) break;
<
< /* Convert various keys to "standard" keys */
< switch (command)
< {
< /* Use current target */
< case 'T':
< case 't':
< case '.':
< case '5':
< case '0':
< {
< dir = 5;
< break;
< }
<
< /* Set new target */
< case '*':
< {
< if (target_set()) dir = 5;
< break;
< }
<
< default:
< {
< dir = keymap_dirs[command & 0x7F];
< break;
< }
< }
<
< /* Verify requested targets */
< if ((dir == 5) && !target_okay()) dir = 0;
<
< /* Error */
< if (!dir) bell();
---
> dir = 5;
>
> /* XXX XXX Pretend we read this direction from the network */
> Handle_direction(dir);
> return (TRUE);
2954,2955c3015
< /* Save the direction */
< *dp = dir;
---
> Send_direction(Ind);
2957,2958c3017,3018
< /* No direction */
< if (!dir) return (FALSE);
---
> return (TRUE);
> }
2960,2961d3019
< /* Save the direction */
< command_dir = dir;
2963,2967c3021,3023
< /* Check for confusion */
< if (p_ptr->confused)
< {
< /* Warn the user */
< msg_print("You are confused.");
---
> bool get_item(int Ind)
> {
> Send_item_request(Ind);
2969,2973d3024
< /* Hack -- Random direction */
< *dp = ddd[rand_int(8)];
< }
<
< /* A "valid" direction was entered */
2978d3028
<
2988a3039
> #if 0
3037a3089
> #endif
Only in src-280: z-form.c
Only in src-280: z-form.h
Only in src-280: z-rand.c
Only in src-280: z-rand.h
Only in src-280: z-term.c
Only in src-280: z-term.h
Only in src-280: z-util.c
Only in src-280: z-util.h
Only in src-280: z-virt.c
Only in src-280: z-virt.h