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

Comparing deliantra/server/server/build_map.C (file contents):
Revision 1.46 by root, Fri Nov 6 13:31:47 2009 UTC vs.
Revision 1.47 by root, Sun Nov 29 17:41:08 2009 UTC

341 */ 341 */
342 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off 342 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off
343 343
344 wall->destroy (); 344 wall->destroy ();
345 345
346 wall = arch_to_object (new_arch); 346 wall = new_arch->instance ();
347 wall->type = BUILDABLE_WALL; 347 wall->type = BUILDABLE_WALL;
348 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y); 348 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y);
349 wall->flag = old_flags; 349 wall->flag = old_flags;
350} 350}
351 351
417 /* Not found, log & bail out */ 417 /* Not found, log & bail out */
418 LOG (llevError, "apply_builder_floor: unable to find archetype %s.\n", &material->slaying); 418 LOG (llevError, "apply_builder_floor: unable to find archetype %s.\n", &material->slaying);
419 return; 419 return;
420 } 420 }
421 421
422 tmp = arch_to_object (new_floor); 422 tmp = new_floor->instance ();
423 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 423 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
424 SET_FLAG (tmp, FLAG_UNIQUE); 424 SET_FLAG (tmp, FLAG_UNIQUE);
425 SET_FLAG (tmp, FLAG_IS_FLOOR); 425 SET_FLAG (tmp, FLAG_IS_FLOOR);
426 tmp->type = FLOOR; 426 tmp->type = FLOOR;
427 insert_ob_in_map_at (tmp, pl->map, above_floor, above_floor ? INS_BELOW_ORIGINATOR : INS_ON_TOP, x, y); 427 insert_ob_in_map_at (tmp, pl->map, above_floor, above_floor ? INS_BELOW_ORIGINATOR : INS_ON_TOP, x, y);
436 yt = y + freearr_y[i]; 436 yt = y + freearr_y[i];
437 tmp = GET_MAP_OB (pl->map, xt, yt); 437 tmp = GET_MAP_OB (pl->map, xt, yt);
438 if (!tmp) 438 if (!tmp)
439 { 439 {
440 /* Must insert floor & wall */ 440 /* Must insert floor & wall */
441 tmp = arch_to_object (new_floor); 441 tmp = new_floor->instance ();
442 /* Better make the floor unique */ 442 /* Better make the floor unique */
443 SET_FLAG (tmp, FLAG_UNIQUE); 443 SET_FLAG (tmp, FLAG_UNIQUE);
444 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 444 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
445 tmp->type = FLOOR; 445 tmp->type = FLOOR;
446 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt); 446 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
447 /* Insert wall if exists. Note: if it doesn't, the map is weird... */ 447 /* Insert wall if exists. Note: if it doesn't, the map is weird... */
448 if (new_wall) 448 if (new_wall)
449 { 449 {
450 tmp = arch_to_object (new_wall); 450 tmp = new_wall->instance ();
451 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 451 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
452 tmp->type = BUILDABLE_WALL; 452 tmp->type = BUILDABLE_WALL;
453 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt); 453 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
454 } 454 }
455 } 455 }
509 { 509 {
510 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying); 510 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying);
511 return; 511 return;
512 } 512 }
513 513
514 tmp = arch_to_object (new_wall); 514 tmp = new_wall->instance ();
515 tmp->type = BUILDABLE_WALL; 515 tmp->type = BUILDABLE_WALL;
516 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 516 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
517 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y); 517 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y);
518 518
519 /* If existing wall, remove it, no need to fix other walls */ 519 /* If existing wall, remove it, no need to fix other walls */
579 /* Create item, set flag, insert in map */ 579 /* Create item, set flag, insert in map */
580 arch = archetype::find (item->slaying); 580 arch = archetype::find (item->slaying);
581 if (!arch) 581 if (!arch)
582 return; 582 return;
583 583
584 tmp = arch_to_object (arch); 584 tmp = arch->instance ();
585 585
586 if (!floor->flag[FLAG_IS_BUILDABLE] || (floor->above) && (!can_build_over (pl->map, tmp, x, y))) 586 if (!floor->flag[FLAG_IS_BUILDABLE] || (floor->above) && (!can_build_over (pl->map, tmp, x, y)))
587 /* Floor has something on top that interferes with building */ 587 /* Floor has something on top that interferes with building */
588 { 588 {
589 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); 589 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here.");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines