… | |
… | |
85 | /* Save some cycles - instead of calling get_map_flags(), just get the value |
85 | /* Save some cycles - instead of calling get_map_flags(), just get the value |
86 | * directly. |
86 | * directly. |
87 | */ |
87 | */ |
88 | mapspace &ms = m->at (sx, sy); |
88 | mapspace &ms = m->at (sx, sy); |
89 | |
89 | |
90 | int mflags = ms.flags (); |
90 | int mflags = ms.flags (); |
91 | int blocked = ms.move_block; |
91 | int blocked = ms.move_block; |
92 | |
92 | |
93 | /* If space is currently not blocked by anything, no need to |
93 | /* If space is currently not blocked by anything, no need to |
94 | * go further. Not true for players - all sorts of special |
94 | * go further. Not true for players - all sorts of special |
95 | * things we need to do for players. |
95 | * things we need to do for players. |
… | |
… | |
114 | * true. If we get through the entire stack, that must mean |
114 | * true. If we get through the entire stack, that must mean |
115 | * ob is blocking it, so return 0. |
115 | * ob is blocking it, so return 0. |
116 | */ |
116 | */ |
117 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
117 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
118 | { |
118 | { |
|
|
119 | bool block = OB_MOVE_BLOCK (ob, tmp); |
|
|
120 | |
119 | /* This must be before the checks below. Code for inventory checkers. */ |
121 | /* This must be before the checks below. Code for inventory checkers. */ |
120 | if (tmp->type == CHECK_INV && OB_MOVE_BLOCK (ob, tmp)) |
122 | if (block && tmp->type == CHECK_INV) |
121 | { |
123 | { |
122 | bool have = check_inv_recursive (ob, tmp); |
124 | bool have = check_inv_recursive (ob, tmp); |
123 | |
125 | |
124 | /* If last_sp is set, the player/monster needs an object, |
126 | /* If last_sp is set, the player/monster needs an object, |
125 | * so we check for it. If they don't have it, they can't |
127 | * so we check for it. If they don't have it, they can't |
… | |
… | |
137 | */ |
139 | */ |
138 | if (have) |
140 | if (have) |
139 | return 1; |
141 | return 1; |
140 | } |
142 | } |
141 | } |
143 | } |
|
|
144 | else if (block && tmp->type == T_MATCH) |
|
|
145 | { |
|
|
146 | //TODO |
|
|
147 | } |
142 | else |
148 | else |
143 | { |
149 | { |
144 | /* Broke apart a big nasty if into several here to make |
150 | /* Broke apart a big nasty if into several here to make |
145 | * this more readable. first check - if the space blocks |
151 | * this more readable. first check - if the space blocks |
146 | * movement, can't move here. |
152 | * movement, can't move here. |
147 | * second - if a monster, can't move there, unless it is a |
153 | * second - if a monster, can't move there, unless it is a |
148 | * dm. |
154 | * dm. |
149 | */ |
155 | */ |
150 | if (OB_MOVE_BLOCK (ob, tmp)) |
156 | if (block) |
151 | return 1; |
157 | return 1; |
152 | |
158 | |
153 | if (tmp->flag [FLAG_ALIVE] |
159 | if (tmp->flag [FLAG_ALIVE] |
154 | && tmp->head_ () != ob |
160 | && tmp->head_ () != ob |
155 | && tmp != ob |
161 | && tmp != ob |