Atrinik Server  4.0
define.h
Go to the documentation of this file.
1 
2 /*************************************************************************
3  * Atrinik, a Multiplayer Online Role Playing Game *
4  * *
5  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
6  * *
7  * Fork from Crossfire (Multiplayer game for X-windows). *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the Free Software *
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
22  * *
23  * The author can be reached at admin@atrinik.org *
24  ************************************************************************/
25 
39 #ifndef DEFINE_H
40 #define DEFINE_H
41 
42 #ifndef NAME_MAX
43 #define NAME_MAX 255
44 #endif
45 
47 #define MAX_STAT 30
48 
49 #define MIN_STAT 1
50 
51 #define MAX_ANIMATIONS 256
52 
58 #define IDENTIFY_NORMAL 0
59 
60 #define IDENTIFY_ALL 1
61 
62 #define IDENTIFY_MARKED 2
63 
70 #define SPLIST_MODE_ADD 0
71 
72 #define SPLIST_MODE_REMOVE 1
73 
74 #define SPLIST_MODE_UPDATE 2
75 
78 #define CHOSEN_SKILL_NO (99999)
79 
81 #define PORTAL_DESTINATION_NAME "Town portal destination"
82 #define PORTAL_ACTIVE_NAME "Existing town portal"
83 
89 #define BLOCKED_LOS_VISIBLE 0x00
90 
91 #define BLOCKED_LOS_IGNORE 0x01
92 
93 #define BLOCKED_LOS_BLOCKSVIEW 0x02
94 
95 #define BLOCKED_LOS_BLOCKED 0x04
96 
97 #define BLOCKED_LOS_OUT_OF_MAP 0x08
98 
122 #define PLAYER 1
123 
126 #define BULLET 2
127 
130 #define ROD 3
131 
134 #define TREASURE 4
135 
138 #define POTION 5
139 
142 #define FOOD 6
143 
146 #define REGION_MAP 7
147 
150 #define BOOK 8
151 
154 #define CLOCK 9
155 
158 #define MATERIAL 10
159 
162 #define DUPLICATOR 11
163 
166 #define LIGHTNING 12
167 
170 #define ARROW 13
171 
174 #define BOW 14
175 
178 #define WEAPON 15
179 
182 #define ARMOUR 16
183 
186 #define PEDESTAL 17
187 
190 #define CONFUSION 19
191 
194 #define DOOR 20
195 
198 #define KEY 21
199 
202 #define MAP 22
203 
206 #define MAGIC_MIRROR 28
207 
210 #define SPELL 29
211 
214 #define SHIELD 33
215 
218 #define HELMET 34
219 
222 #define PANTS 35
223 
226 #define MONEY 36
227 
230 #define PAINTING 37
231 
234 #define AMULET 39
235 
238 #define PLAYER_MOVER 40
239 
242 #define CREATOR 42
243 
246 #define SKILL 43
247 
250 #define EXPERIENCE 44
251 /*
252  * A trinket.
253  */
254 #define TRINKET 45
255 
258 #define BLINDNESS 49
259 
262 #define GOD 50
263 
267 #define DETECTOR 51
268 
271 #define SKILL_ITEM 52
272 
275 #define DEAD_OBJECT 53
276 
279 #define DRINK 54
280 
284 #define MARKER 55
285 
288 #define HOLY_ALTAR 56
289 
292 #define PEARL 59
293 
296 #define GEM 60
297 
300 #define SOUND_AMBIENT 61
301 
304 #define FIREWALL 62
305 
308 #define CHECK_INV 64
309 
312 #define EXIT 66
313 
316 #define SHOP_FLOOR 68
317 
320 #define RING 70
321 
324 #define FLOOR 71
325 
328 #define FLESH 72
329 
332 #define INORGANIC 73
333 
336 #define LIGHT_APPLY 74
337 
340 #define WALL 77
341 
344 #define LIGHT_SOURCE 78
345 
349 #define MISC_OBJECT 79
350 
353 #define MONSTER 80
354 
357 #define SPAWN_POINT 81
358 
361 #define LIGHT_REFILL 82
362 
365 #define SPAWN_POINT_MOB 83
366 
369 #define SPAWN_POINT_INFO 84
370 
373 #define BOOK_SPELL 85
374 
377 #define ORGANIC 86
378 
381 #define CLOAK 87
382 
385 #define CONE 88
386 
389 #define SPINNER 90
390 
393 #define GATE 91
394 
397 #define BUTTON 92
398 
401 #define TYPE_HANDLE 93
402 
405 #define WORD_OF_RECALL 96
406 
409 #define SIGN 98
410 
413 #define BOOTS 99
414 
417 #define GLOVES 100
418 
421 #define BASE_INFO 101
422 
429 #define RANDOM_DROP 102
430 
433 #define BRACERS 104
434 
437 #define POISONING 105
438 
441 #define SAVEBED 106
442 
445 #define WAND 109
446 
449 #define ABILITY 110
450 
453 #define SCROLL 111
454 
457 #define DIRECTOR 112
458 
461 #define GIRDLE 113
462 
465 #define FORCE 114
466 
469 #define POTION_EFFECT 115
470 
473 #define JEWEL 116
474 
477 #define NUGGET 117
478 
481 #define EVENT_OBJECT 118
482 
485 #define WAYPOINT_OBJECT 119
486 
489 #define QUEST_CONTAINER 120
490 
493 #define CONTAINER 122
494 
498 #define WEALTH 125
499 
502 #define BEACON 126
503 
506 #define MAP_EVENT_OBJ 127
507 
510 #define COMPASS 151
511 
514 #define MAP_INFO 152
515 
518 #define SWARM_SPELL 153
519 
522 #define RUNE 154
523 
526 #define CLIENT_MAP_INFO 155
527 
530 #define POWER_CRYSTAL 156
531 
534 #define CORPSE 157
535 
538 #define DISEASE 158
539 
542 #define SYMPTOM 159
543 
544 #define OBJECT_TYPE_MAX 160
545 
566 #define ST1_CONTAINER_NORMAL 0
567 
568 #define ST1_CONTAINER_CORPSE 1
569 
570 #define ST1_CONTAINER_DEAD_PL 2
571 
572 #define ST1_CONTAINER_QUIVER 3
573 
575 #define ST1_CONTAINER_NORMAL_player 64
576 
577 #define ST1_CONTAINER_CORPSE_player 65
578 
580 #define ST1_CONTAINER_NORMAL_party 128
581 
582 #define ST1_CONTAINER_CORPSE_party 129
583 
590 #define ST1_DOOR_NORMAL 0
591 
592 #define ST1_DOOR_CURTAIN 1
593 
600 #define ST_BD_REMOVE 1
601 
602 #define ST_BD_BUILD 2
603 
610 #define ST_MAT_FLOOR 1
611 
612 #define ST_MAT_WALL 2
613 
614 #define ST_MAT_ITEM 3
615 
616 #define ST_MAT_WIN 4
617 
624 #define CLIENT_MAP_LABEL 1
625 
626 #define CLIENT_MAP_TOOLTIP 2
627 
628 #define CLIENT_MAP_HIDE 3
629 
636 #define POTION_NORMAL 0
637 
638 #define POTION_BALM 1
639 
640 #define POTION_DUST 2
641 
644 
654 #define SIZEOFFREE1 8
655 
656 #define SIZEOFFREE2 24
657 
658 #define SIZEOFFREE3 48
659 
660 #define SIZEOFFREE 49
661 
664 #define NROFREALSPELLS 52
665 
666 #define NRSPELLPATHS 20
667 
676 #define TERRAIN_NOTHING 0
677 
678 #define TERRAIN_AIRBREATH 1
679 
680 #define TERRAIN_WATERWALK 2
681 
682 #define TERRAIN_WATERBREATH 4
683 
684 #define TERRAIN_FIREWALK 8
685 
686 #define TERRAIN_FIREBREATH 16
687 
688 #define TERRAIN_CLOUDWALK 32
689 
690 #define TERRAIN_WATER_SHALLOW 64
691 
692 #define TERRAIN_ALL 0xffff
693 
732 #define FLAG_BITMASK(p) BIT_MASK(p % 32)
733 
741 #define SET_FLAG(xyz, p) \
742  BIT_SET((xyz)->flags[p / 32], p % 32)
743 
751 #define CLEAR_FLAG(xyz, p) \
752  BIT_CLEAR((xyz)->flags[p / 32], p % 32)
753 
761 #define QUERY_FLAG(xyz, p) \
762  BIT_QUERY((xyz)->flags[p / 32], p % 32)
763 
771 #define FLIP_FLAG(xyz, p) \
772  BIT_FLIP((xyz)->flags[p / 32], p % 32)
773 
784 #define CHANGE_FLAG(op, flag, cond) \
785  BIT_CHANGE((op)->flags[flag / 32], flag % 32, cond)
786 
797 #define SET_MULTI_FLAG(xyz, p) \
798  do { \
799  for (object *_tos_ = xyz; _tos_; _tos_ = _tos_->more) { \
800  SET_FLAG(_tos_, p); \
801  } \
802  } while (0)
803 
804 #define CLEAR_MULTI_FLAG(xyz, p) \
805  do { \
806  for (object *_tos_ = xyz; _tos_; _tos_ = _tos_->more) { \
807  CLEAR_FLAG(_tos_, p); \
808  } \
809  } while (0)
810 
811 #define SET_OR_CLEAR_MULTI_FLAG(_head, _flag) \
812  do { \
813  if (QUERY_FLAG(_head, _flag)) { \
814  SET_MULTI_FLAG((_head)->more, _flag); \
815  } else { \
816  CLEAR_MULTI_FLAG((_head)->more, _flag); \
817  } \
818  } while (0)
819 
820 #define SET_OR_CLEAR_MULTI_FLAG_IF_CLONE(_head, _flag) \
821  do { \
822  bool _has_head_ = QUERY_FLAG(_head, _flag); \
823  bool _has_clone_ = QUERY_FLAG(&(_head)->arch->clone, _flag); \
824  if (_has_head_ && !_has_clone_) { \
825  SET_MULTI_FLAG((_head), _flag); \
826  } else if (!_has_head_ && _has_clone_) { \
827  CLEAR_MULTI_FLAG((_head), _flag); \
828  } \
829  } while (0)
830 
837 #define IS_WEAPON(op) (op->type == ARROW || op->type == BOW || op->type == WEAPON)
838 
839 #define IS_ARMOR(op) (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || op->type == BRACERS || op->type == GIRDLE || op->type == PANTS)
840 
841 #define IS_LIVE(op) ((op)->type == PLAYER || QUERY_FLAG((op), FLAG_MONSTER))
842 
843 #define IS_ARROW(op) (op->type == ARROW || op->type == BULLET)
844 
845 #define IS_ATTACK_SPELL(op) ((op)->type == BULLET || (op)->type == CONE || (op)->type == LIGHTNING)
846 
868 #define FLAG_SLEEP 0
869 
872 #define FLAG_CONFUSED 1
873 
876 #define FLAG_PARALYZED 2
877 
880 #define FLAG_SCARED 3
881 
884 #define FLAG_BLIND 4
885 
888 #define FLAG_IS_INVISIBLE 5
889 
892 #define FLAG_IS_ETHEREAL 6
893 
896 #define FLAG_IS_GOOD 7
897 
900 #define FLAG_NO_PICK 8
901 
904 #define FLAG_WALK_ON 9
905 
908 #define FLAG_NO_PASS 10
909 
912 #define FLAG_ANIMATE 11
913 
916 #define FLAG_SLOW_MOVE 12
917 
918 #define FLAG_FLYING 13
919 
922 #define FLAG_MONSTER 14
923 
926 #define FLAG_FRIENDLY 15
927 
930 #define FLAG_REMOVED 16
931 
934 #define FLAG_BEEN_APPLIED 17
935 
938 #define FLAG_AUTO_APPLY 18
939 
942 #define FLAG_IS_NEUTRAL 20
943 
946 #define FLAG_SEE_INVISIBLE 21
947 
950 #define FLAG_CAN_ROLL 22
951 
956 #define FLAG_CONNECT_RESET 23
957 
960 #define FLAG_IS_TURNABLE 24
961 
964 #define FLAG_WALK_OFF 25
965 
968 #define FLAG_FLY_ON 26
969 
972 #define FLAG_FLY_OFF 27
973 
976 #define FLAG_IS_USED_UP 28
977 
980 #define FLAG_IDENTIFIED 29
981 
984 #define FLAG_REFLECTING 30
985 
988 #define FLAG_CHANGING 31
989 
990 /* Start of values in flags[1] */
991 
996 #define FLAG_SPLITTING 32
997 
1000 #define FLAG_HITBACK 33
1001 
1004 #define FLAG_STARTEQUIP 34
1005 
1008 #define FLAG_BLOCKSVIEW 35
1009 
1012 #define FLAG_UNDEAD 36
1013 
1016 #define FLAG_CAN_STACK 37
1017 
1020 #define FLAG_UNAGGRESSIVE 38
1021 
1024 #define FLAG_REFL_MISSILE 39
1025 
1028 #define FLAG_REFL_SPELL 40
1029 
1032 #define FLAG_NO_MAGIC 41
1033 
1036 #define FLAG_NO_FIX_PLAYER 42
1037 
1040 #define FLAG_IS_EVIL 43
1041 
1044 #define FLAG_SOULBOUND 44
1045 
1049 #define FLAG_RUN_AWAY 45
1050 
1054 #define FLAG_PASS_THRU 46
1055 
1058 #define FLAG_CAN_PASS_THRU 47
1059 
1062 #define FLAG_OUTDOOR 48
1063 
1066 #define FLAG_UNIQUE 49
1067 
1070 #define FLAG_NO_DROP 50
1071 
1074 #define FLAG_INDESTRUCTIBLE 51
1075 
1078 #define FLAG_CAST_SPELL 52
1079 
1082 #define FLAG_TWO_HANDED 54
1083 
1086 #define FLAG_USE_BOW 55
1087 
1090 #define FLAG_USE_ARMOUR 56
1091 
1094 #define FLAG_USE_WEAPON 57
1095 
1098 #define FLAG_CONNECT_NO_PUSH 58
1099 
1102 #define FLAG_CONNECT_NO_RELEASE 59
1103 
1106 #define FLAG_READY_BOW 60
1107 
1110 #define FLAG_XRAYS 61
1111 
1114 #define FLAG_NO_APPLY 62
1115 
1118 #define FLAG_IS_FLOOR 63
1119 
1120 /* Start of values in flags[2] */
1121 
1125 #define FLAG_LIFESAVE 64
1126 
1129 #define FLAG_IS_MAGICAL 65
1130 
1133 #define FLAG_STAND_STILL 67
1134 
1137 #define FLAG_RANDOM_MOVE 68
1138 
1141 #define FLAG_ONLY_ATTACK 69
1142 
1146 #define FLAG_STEALTH 71
1147 
1150 #define FLAG_IS_LINKED 73
1151 
1154 #define FLAG_CURSED 74
1155 
1158 #define FLAG_DAMNED 75
1159 
1162 #define FLAG_IS_BUILDABLE 76
1163 
1166 #define FLAG_NO_PVP 77
1167 
1170 #define FLAG_IS_THROWN 80
1171 
1174 #define FLAG_IS_MALE 83
1175 
1178 #define FLAG_IS_FEMALE 84
1179 
1182 #define FLAG_APPLIED 85
1183 
1186 #define FLAG_INV_LOCKED 86
1187 
1190 #define FLAG_READY_WEAPON 90
1191 
1194 #define FLAG_NO_SKILL_IDENT 91
1195 
1198 #define FLAG_SEE_IN_DARK 93
1199 
1202 #define FLAG_IS_CAULDRON 94
1203 
1206 #define FLAG_DUST 95
1207 
1208 /* Start of values in flags[3] */
1209 
1213 #define FLAG_ONE_HIT 97
1214 
1217 #define FLAG_DRAW_DOUBLE_ALWAYS 98
1218 
1221 #define FLAG_BERSERK 99
1222 
1225 #define FLAG_NO_ATTACK 100
1226 
1229 #define FLAG_INVULNERABLE 101
1230 
1233 #define FLAG_QUEST_ITEM 102
1234 
1239 #define FLAG_IS_TRAPPED 103
1240 
1243 #define FLAG_SYS_OBJECT 110
1244 
1247 #define FLAG_USE_FIX_POS 111
1248 
1251 #define FLAG_UNPAID 112
1252 
1255 #define FLAG_HIDDEN 113
1256 
1259 #define FLAG_MAKE_INVISIBLE 114
1260 
1263 #define FLAG_MAKE_ETHEREAL 115
1264 
1267 #define FLAG_IS_PLAYER 116
1268 
1274 #define FLAG_IS_NAMED 117
1275 
1279 #define FLAG_SPAWN_MOB 118
1280 
1284 #define FLAG_NO_TELEPORT 119
1285 
1288 #define FLAG_CORPSE 120
1289 
1293 #define FLAG_CORPSE_FORCED 121
1294 
1297 #define FLAG_PLAYER_ONLY 122
1298 
1302 #define FLAG_ONE_DROP 124
1303 
1306 #define FLAG_PERM_CURSED 125
1307 
1310 #define FLAG_PERM_DAMNED 126
1311 
1314 #define FLAG_DOOR_CLOSED 127
1315 
1318 #define FLAG_IS_SPELL 128
1319 
1322 #define FLAG_IS_MISSILE 129
1323 
1326 #define FLAG_DRAW_DIRECTION 130
1327 
1330 #define FLAG_DRAW_DOUBLE 131
1331 
1335 #define FLAG_IS_ASSASSINATION 132
1336 
1339 #define FLAG_OBJECT_WAS_MOVED 133
1340 
1343 #define FLAG_NO_SAVE 134
1344 
1347 #define NUM_FLAGS 135
1348 
1349 #define NUM_FLAGS_32 5
1350 
1353 #define IS_SYS_INVISIBLE(__ob_) \
1354  QUERY_FLAG(__ob_, FLAG_SYS_OBJECT)
1355 
1356 #define IS_INVISIBLE(__ob_, __player_) \
1357  ((QUERY_FLAG(__ob_, FLAG_SYS_OBJECT) || QUERY_FLAG(__ob_, FLAG_IS_INVISIBLE)) && ((__player_)->type != PLAYER || !CONTR((__player_))->tsi))
1358 
1359 #define SLOW_PENALTY(xyz) ((xyz)->stats.exp)
1360 
1361 #define EXIT_PATH(xyz) ((xyz)->slaying)
1362 #define EXIT_X(xyz) ((xyz)->stats.hp)
1363 #define EXIT_Y(xyz) ((xyz)->stats.sp)
1364 
1370 #define COST_BUY 0
1371 
1372 #define COST_SELL 1
1373 
1374 #define COST_TRUE 2
1375 
1377 #define DIRX(xyz) freearr_x[(xyz)->direction]
1378 #define DIRY(xyz) freearr_y[(xyz)->direction]
1379 
1380 #define ARMOUR_SPEED(xyz) (xyz)->last_sp
1381 #define ARMOUR_SPELLS(xyz) (xyz)->last_heal
1382 
1404 #define DISTATT 1
1405 
1406 #define RUNATT 2
1407 
1408 #define HITRUN 3
1409 
1410 #define WAITATT 4
1411 
1412 #define RUSH 5
1413 
1414 #define ALLRUN 6
1415 
1416 #define DISTHIT 7
1417 
1418 #define WAIT2 8
1419 
1420 #define UNUSED_MOVE 16
1421 
1428 #define CIRCLE1 32
1429 
1431 #define CIRCLE2 48
1432 
1437 #define PACEH 64
1438 
1445 #define PACEH2 80
1446 
1452 #define RANDO 96
1453 
1455 #define RANDO2 112
1456 
1461 #define PACEV 128
1462 
1469 #define PACEV2 144
1470 
1472 #define WPOINT 176
1473 
1474 /* bitmasks for upper and lower 4 bits from 8 bit fields */
1475 #define LO4 15
1476 #define HI4 240
1477 
1480 #define BLANK_FACE_NAME "blank.111"
1481 
1488  /* Basic flags, always use one of these */
1493  /* Optional flags, for bitwise or with a basic flag */
1497 };
1498 
1500 #define MIN_ACTIVE_SPEED 0.00001f
1501 
1503 #define QUEST_CONTAINER_ARCHETYPE "quest_container"
1504 
1509 #define QUEST_NAME(_quest) \
1510  ((_quest)->race != NULL ? (_quest)->race : (_quest)->name)
1511 
1518 #define QUEST_STATUS_INVALID -1
1519 
1520 #define QUEST_STATUS_STARTED 0
1521 
1522 #define QUEST_STATUS_COMPLETED 1
1523 
1524 #define QUEST_STATUS_FAILED 2
1525 
1532 #define QUEST_TYPE_NONE 0
1533 
1534 #define QUEST_TYPE_KILL 1
1535 
1536 #define QUEST_TYPE_ITEM 2
1537 
1541 #define QUEST_TYPE_ITEM_DROP 3
1542 
1546 #define QUEST_TYPE_SPECIAL 4
1547 
1561 #define INTERFACE_TIMEOUT_CHARS 50
1562 
1565 #define INTERFACE_TIMEOUT_SECONDS 5
1566 
1569 #define INTERFACE_TIMEOUT_INITIAL 5
1570 
1574 #define INTERFACE_TIMEOUT_MAX 60 * 5
1575 
1578 #define INTERFACE_TIMEOUT(ret) ((long) (((double) MAX(INTERFACE_TIMEOUT_CHARS, \
1579  (ret)) / INTERFACE_TIMEOUT_CHARS) * INTERFACE_TIMEOUT_SECONDS) - \
1580  INTERFACE_TIMEOUT_SECONDS + INTERFACE_TIMEOUT_INITIAL)
1581 
1588 #define SPAWN_RELATIVE_LEVEL_GREEN 1
1589 
1590 #define SPAWN_RELATIVE_LEVEL_BLUE 2
1591 
1592 #define SPAWN_RELATIVE_LEVEL_YELLOW 3
1593 
1594 #define SPAWN_RELATIVE_LEVEL_ORANGE 4
1595 
1596 #define SPAWN_RELATIVE_LEVEL_RED 5
1597 
1598 #define SPAWN_RELATIVE_LEVEL_PURPLE 6
1599 
1604 #define MOVE_MAX_HEIGHT_DIFF 12
1605 
1630 #define FOR_MAP_LAYER_BEGIN(_m, _x, _y, _layer, _sub_layer, _obj) \
1631  { \
1632  int __sub_layer; \
1633  object *__tmp, *__next; \
1634  tag_t __next_tag; \
1635  for (__sub_layer = ((_sub_layer) == -1 ? 0 : (_sub_layer)); __sub_layer < ((_layer) == LAYER_SYS ? 1 : ((_sub_layer) == -1 ? NUM_SUB_LAYERS : ((_sub_layer) + 1))); __sub_layer++) \
1636  { \
1637  for (__tmp = (_layer) == LAYER_SYS ? GET_MAP_OB((_m), (_x), (_y)) : GET_MAP_OB_LAYER((_m), (_x), (_y), (_layer), __sub_layer); __tmp && __tmp->layer == (_layer) && __tmp->sub_layer == __sub_layer; __tmp = __next) \
1638  { \
1639  __next = __tmp->above; \
1640  __next_tag = 0; \
1641  if (__next) \
1642  { \
1643  __next_tag = __next->count; \
1644  } \
1645  (_obj) = __tmp;
1646 
1650 #define FOR_MAP_LAYER_BREAK \
1651  __sub_layer = NUM_SUB_LAYERS; \
1652  break; \
1653 
1654 
1657 #define FOR_MAP_LAYER_END \
1658  if (__next && !OBJECT_VALID(__next, __next_tag)) \
1659  { \
1660  FOR_MAP_LAYER_BREAK; \
1661  } \
1662  } \
1663  } \
1664  }
1665 
1691 #define FOR_INV_PREPARE(op_, it_) \
1692  do { \
1693  object *it_ = (op_)->inv; \
1694  FOR_OB_AND_BELOW_PREPARE(it_);
1695 
1698 #define FOR_INV_FINISH() \
1699  FOR_OB_AND_BELOW_FINISH(); \
1700  } while(0)
1701 
1710 #define FOR_ABOVE_PREPARE(op_, it_) \
1711  do { \
1712  object *it_ = (op_)->above; \
1713  FOR_OB_AND_ABOVE_PREPARE(it_);
1714 
1717 #define FOR_ABOVE_FINISH() \
1718  FOR_OB_AND_ABOVE_FINISH(); \
1719  } while(0)
1720 
1729 #define FOR_BELOW_PREPARE(op_, it_) \
1730  do { \
1731  object *it_ = (op_)->below; \
1732  FOR_OB_AND_BELOW_PREPARE(it_);
1733 
1736 #define FOR_BELOW_FINISH() \
1737  FOR_OB_AND_BELOW_FINISH(); \
1738  } while(0)
1739 
1752 #define FOR_MAP_PREPARE(map_, mx_, my_, it_) \
1753  do { \
1754  object *it_ = GET_MAP_OB((map_), (mx_), (my_)); \
1755  FOR_OB_AND_ABOVE_PREPARE(it_);
1756 
1759 #define FOR_MAP_FINISH() \
1760  FOR_OB_AND_ABOVE_FINISH(); \
1761  } while(0)
1762 
1769 #define FOR_OB_AND_ABOVE_PREPARE(op_) FOR_OB_PREPARE(op_, above, __LINE__)
1770 
1773 #define FOR_OB_AND_ABOVE_FINISH() FOR_OB_FINISH()
1774 
1781 #define FOR_OB_AND_BELOW_PREPARE(op_) FOR_OB_PREPARE(op_, below, __LINE__)
1782 
1785 #define FOR_OB_AND_BELOW_FINISH() FOR_OB_FINISH()
1786 
1797 #define FOR_OB_PREPARE(op_, field_, suffix_) FOR_OB_PREPARE2(op_, field_, suffix_)
1798 
1808 #define FOR_OB_PREPARE2(op_, field_, suffix_) \
1809  do { \
1810  object *next##suffix_ = (op_); \
1811  tag_t next_tag##suffix_ = next##suffix_ == NULL ? 0 : next##suffix_->count;\
1812  while (((op_) = next##suffix_) != NULL) { \
1813  if (OBJECT_DESTROYED(next##suffix_, next_tag##suffix_)) {\
1814  break; \
1815  } \
1816  next##suffix_ = next##suffix_->field_; \
1817  next_tag##suffix_ = next##suffix_ == NULL ? 0 : next##suffix_->count;
1818 
1821 #define FOR_OB_FINISH() \
1822  } \
1823  } while(0)
1824 
1837 static inline int
1838 absdir (int d)
1839 {
1840  while (d < 1) {
1841  d += 8;
1842  }
1843 
1844  while (d > 8) {
1845  d -= 8;
1846  }
1847 
1848  return d;
1849 }
1850 
1851 #endif
Always apply, never unapply.
Definition: define.h:1490
Regular apply.
Definition: define.h:1489
Allow unapplying cursed items.
Definition: define.h:1495
Always unapply, never apply.
Definition: define.h:1491
static int absdir(int d)
Definition: define.h:1838
Do not merge unapplied items.
Definition: define.h:1494
Do not trigger an event.
Definition: define.h:1496
apply_flag
Definition: define.h:1487
Used internally.
Definition: define.h:1492