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

Comparing deliantra/server/server/main.C (file contents):
Revision 1.95 by root, Sat Mar 17 22:11:23 2007 UTC vs.
Revision 1.100 by root, Mon Apr 30 04:25:30 2007 UTC

203 contr->maplevel = newmap->path; 203 contr->maplevel = newmap->path;
204 contr->count = 0; 204 contr->count = 0;
205 } 205 }
206 206
207 /* Update any golems */ 207 /* Update any golems */
208 if (type == PLAYER && contr->ranges[range_golem]) 208 if (type == PLAYER)
209 if (object *golem = contr->golem)
209 { 210 {
210 int i = find_free_spot (contr->ranges[range_golem], newmap, x, y, 1, SIZEOFFREE); 211 int i = find_free_spot (golem, newmap, x, y, 1, SIZEOFFREE);
211 212
212 if (i < 0) 213 if (i < 0)
213 { 214 golem->destroy ();
214 contr->ranges[range_golem]->destroy ();
215 contr->ranges[range_golem] = 0;
216 }
217 else 215 else
218 { 216 {
219 newmap->insert (contr->ranges[range_golem], x + freearr_x[i], y + freearr_y[i]); 217 newmap->insert (golem, x + freearr_x[i], y + freearr_y[i]);
220 218 golem->direction = find_dir_2 (x - golem->x, y - golem->y);
221 contr->ranges[range_golem]->direction =
222 find_dir_2 (x - contr->ranges[range_golem]->x, y - contr->ranges[range_golem]->y);
223 } 219 }
224 } 220 }
225 221
226 /* since the players map is already loaded, we don't need to worry 222 /* since the players map is already loaded, we don't need to worry
227 * about pending objects. 223 * about pending objects.
228 */ 224 */
229 remove_all_pets (newmap); 225 remove_all_pets (newmap);
327 LOG (llevError, "BUG: process_events(): Free object on list\n"); 323 LOG (llevError, "BUG: process_events(): Free object on list\n");
328 op->set_speed (0); 324 op->set_speed (0);
329 continue; 325 continue;
330 } 326 }
331 327
332 /* I've seen occasional crashes due to this - the object is removed,
333 * and thus the map it points to (last map it was on) may be bogus
334 * The real bug is to try to find out the cause of this - someone
335 * is probably calling remove_ob without either an insert_ob or
336 * free_object afterwards, leaving an object dangling. But I'd
337 * rather log this and continue on instead of crashing.
338 * Don't remove players - when a player quits, the object is in
339 * sort of a limbo, of removed, but something we want to keep
340 * around.
341 */
342 if (QUERY_FLAG (op, FLAG_REMOVED) && op->type != PLAYER && op->map && op->map->in_memory != MAP_IN_MEMORY)
343 {
344 LOG (llevError, "BUG: process_events(): Removed object on list\n");
345 char *dump = dump_object (op);
346 LOG (llevError, dump);
347 free (dump);
348 op->destroy ();
349 continue;
350 }
351
352 if (!op->has_active_speed ()) 328 if (!op->has_active_speed ())
353 { 329 {
354 LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), " 330 LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), "
355 "but is on active list\n", op->debug_desc (), op->speed); 331 "but is on active list\n", op->debug_desc (), op->speed);
356 op->set_speed (0); 332 op->set_speed (0);
357 continue; 333 continue;
358 } 334 }
359 335
360 if (op->map == NULL && op->env == NULL && op->name && op->type != MAP) 336 if (op->flag [FLAG_REMOVED])
361 { 337 {
362 LOG (llevError, "BUG: process_events(): Object without map or " 338 LOG (llevError, "BUG: process_events(): removed object is on active list: %s\n",
363 "inventory is on active list: %s (%d)\n", &op->name, op->count); 339 op->debug_desc ());
364 op->set_speed (0); 340 op->set_speed (0);
365 continue; 341 continue;
366 } 342 }
367 343
368 /* Animate the object. Bug or feature that anim_speed 344 /* Animate the object. Bug or feature that anim_speed

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines