ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/map.C
(Generate patch)

Comparing deliantra/server/common/map.C (file contents):
Revision 1.164 by root, Fri Oct 16 01:19:12 2009 UTC vs.
Revision 1.165 by root, Tue Oct 20 05:57:08 2009 UTC

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); 119 if (OB_MOVE_BLOCK (ob, tmp))
120
121 /* This must be before the checks below. Code for inventory checkers. */
122 if (block && tmp->type == CHECK_INV)
123 { 120 {
124 bool have = check_inv_recursive (ob, tmp); 121 if (tmp->type == CHECK_INV)
125
126 /* If last_sp is set, the player/monster needs an object,
127 * so we check for it. If they don't have it, they can't
128 * pass through this space.
129 */
130 if (tmp->last_sp)
131 { 122 {
132 if (!have) 123 bool have = check_inv_recursive (ob, tmp);
124
125 // last_sp set means we block if we don't have.
126 if (logical_xor (have, tmp->last_sp))
127 return 1;
128 }
129 else if (tmp->type == T_MATCH)
130 {
131 // T_MATCH allows "entrance" iff the match is true
132 // == blocks if the match fails
133
134 // we could have used an INVOKE_OBJECT, but decided against it, as we
135 // assume that T_MATCH is very common.
136 if (!match (tmp->slaying, ob, tmp, ob))
133 return 1; 137 return 1;
134 } 138 }
135 else 139 else
136 { 140 return 1; // unconditional block
137 /* In this case, the player must not have the object - 141
138 * if they do, they can't pass through.
139 */
140 if (have)
141 return 1;
142 }
143 }
144 else if (block && tmp->type == T_MATCH)
145 {
146 //TODO
147 }
148 else 142 } else {
149 { 143 // space does not block the ob, directly, but
150 /* Broke apart a big nasty if into several here to make 144 // anything alive that is not a door still
151 * this more readable. first check - if the space blocks 145 // blocks anything but wizards.
152 * movement, can't move here.
153 * second - if a monster, can't move there, unless it is a
154 * dm.
155 */
156 if (block)
157 return 1;
158 146
159 if (tmp->flag [FLAG_ALIVE] 147 if (tmp->flag [FLAG_ALIVE]
160 && tmp->head_ () != ob 148 && tmp->head_ () != ob
161 && tmp != ob 149 && tmp != ob
162 && tmp->type != DOOR 150 && tmp->type != DOOR
163 && !tmp->flag [FLAG_WIZ]) 151 && !tmp->flag [FLAG_WIZPASS])
164 return 1; 152 return 1;
165 } 153 }
166 } 154 }
167 155
168 return 0; 156 return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines