… | |
… | |
153 | new_draw_info (NDI_UNIQUE, 0, this, "The exit is closed"); |
153 | new_draw_info (NDI_UNIQUE, 0, this, "The exit is closed"); |
154 | return; |
154 | return; |
155 | } |
155 | } |
156 | } |
156 | } |
157 | |
157 | |
|
|
158 | if (map) |
|
|
159 | if (INVOKE_MAP (LEAVE, map, ARG_PLAYER (contr))) |
|
|
160 | return; |
|
|
161 | |
|
|
162 | /* If it is a player login, he has yet to be inserted anyplace. |
|
|
163 | * otherwise, we need to deal with removing the player here. |
|
|
164 | */ |
|
|
165 | remove (); |
|
|
166 | |
158 | /* try to find a spot for the player */ |
167 | /* try to find a spot for the player */ |
159 | if (ob_blocked (this, newmap, x, y)) |
168 | if (ob_blocked (this, newmap, x, y)) |
160 | { /* First choice blocked */ |
169 | { /* First choice blocked */ |
161 | /* We try to find a spot for the player, starting closest in. |
170 | /* We try to find a spot for the player, starting closest in. |
162 | * We could use find_first_free_spot, but that doesn't randomize it at all, |
171 | * We could use find_first_free_spot, but that doesn't randomize it at all, |
… | |
… | |
182 | else |
191 | else |
183 | /* not much we can do in this case. */ |
192 | /* not much we can do in this case. */ |
184 | LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", &newmap->path, x, y); |
193 | LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", &newmap->path, x, y); |
185 | } |
194 | } |
186 | |
195 | |
187 | if (map) |
|
|
188 | if (INVOKE_MAP (LEAVE, map, ARG_PLAYER (contr))) |
|
|
189 | return; |
|
|
190 | |
|
|
191 | if (INVOKE_PLAYER (MAP_CHANGE, contr, ARG_MAP (newmap), ARG_INT (x), ARG_INT (y))) |
196 | if (INVOKE_PLAYER (MAP_CHANGE, contr, ARG_MAP (newmap), ARG_INT (x), ARG_INT (y))) |
192 | return; |
197 | return; |
193 | |
198 | |
194 | if (INVOKE_MAP (ENTER, newmap, ARG_PLAYER (contr), ARG_INT (x), ARG_INT (y))) |
199 | if (INVOKE_MAP (ENTER, newmap, ARG_PLAYER (contr), ARG_INT (x), ARG_INT (y))) |
195 | return; |
200 | return; |
196 | |
|
|
197 | /* If it is a player login, he has yet to be inserted anyplace. |
|
|
198 | * otherwise, we need to deal with removing the player here. |
|
|
199 | */ |
|
|
200 | remove (); |
|
|
201 | |
201 | |
202 | this->x = x; |
202 | this->x = x; |
203 | this->y = y; |
203 | this->y = y; |
204 | map = newmap; |
204 | map = newmap; |
205 | |
205 | |
… | |
… | |
518 | { |
518 | { |
519 | LOG (llevDebug, "cleanup begin.\n"); |
519 | LOG (llevDebug, "cleanup begin.\n"); |
520 | |
520 | |
521 | in_cleanup = true; |
521 | in_cleanup = true; |
522 | |
522 | |
523 | if (init_done) |
523 | if (init_done && !in_cleanup) |
524 | emergency_save (); |
524 | emergency_save (); |
525 | |
525 | |
526 | LOG (llevDebug, "running cleanup handlers.\n"); |
526 | LOG (llevDebug, "running cleanup handlers.\n"); |
527 | INVOKE_GLOBAL (CLEANUP); |
527 | INVOKE_GLOBAL (CLEANUP); |
528 | |
528 | |