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

Comparing deliantra/server/socket/info.C (file contents):
Revision 1.34 by pippijn, Thu Mar 1 12:28:17 2007 UTC vs.
Revision 1.35 by root, Sun Mar 11 02:12:45 2007 UTC

419 sprintf (buf, "Player: %s the %s", (const char *) pl->name, (const char *) pl->contr->title); 419 sprintf (buf, "Player: %s the %s", (const char *) pl->name, (const char *) pl->contr->title);
420 else 420 else
421 sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); 421 sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title);
422} 422}
423 423
424
425/** 424/**
426 * Helper for magic map creation. 425 * Helper for magic map creation.
427 * 426 *
428 * Takes a player, the map_mark array and an x and y starting position. 427 * Takes a player, the map_mark array and an x and y starting position.
429 * pl is the player. 428 * pl is the player.
437magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) 436magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py)
438{ 437{
439 int x, y, dx, dy, mflags; 438 int x, y, dx, dy, mflags;
440 sint16 nx, ny; 439 sint16 nx, ny;
441 maptile *mp; 440 maptile *mp;
442 facetile *f;
443 441
444 for (dx = -1; dx <= 1; dx++) 442 for (dx = -1; dx <= 1; dx++)
445 { 443 {
446 for (dy = -1; dy <= 1; dy++) 444 for (dy = -1; dy <= 1; dy++)
447 { 445 {
459 if (mflags & P_OUT_OF_MAP) 457 if (mflags & P_OUT_OF_MAP)
460 continue; 458 continue;
461 459
462 if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) 460 if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0)
463 { 461 {
464 f = GET_MAP_FACE (mp, nx, ny, 0); 462 int f = GET_MAP_FACE (mp, nx, ny, 0);
465 if (f == blank_face) 463 if (f == blank_face)
464 {
466 f = GET_MAP_FACE (mp, nx, ny, 1); 465 f = GET_MAP_FACE (mp, nx, ny, 1);
467 if (f == blank_face) 466 if (f == blank_face)
468 f = GET_MAP_FACE (mp, nx, ny, 2); 467 f = GET_MAP_FACE (mp, nx, ny, 2);
468 }
469
470 int magicmap = faces [f].magicmap;
469 471
470 /* Should probably have P_NO_MAGIC here also, but then shops don't 472 /* Should probably have P_NO_MAGIC here also, but then shops don't
471 * work. 473 * work.
472 */ 474 */
473 if (mflags & P_BLOCKSVIEW) 475 if (mflags & P_BLOCKSVIEW)
474 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | (f ? f->magicmap : 0); 476 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | magicmap;
475 else 477 else
476 { 478 {
477 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | (f ? f->magicmap : 0); 479 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | magicmap;
478 magic_mapping_mark_recursive (pl, map_mark, x, y); 480 magic_mapping_mark_recursive (pl, map_mark, x, y);
479 } 481 }
480 } 482 }
481 } 483 }
482 } 484 }
483} 485}
484
485 486
486/** 487/**
487 * Creates magic map for player. 488 * Creates magic map for player.
488 * 489 *
489 * Note: For improved magic mapping display, the space that blocks 490 * Note: For improved magic mapping display, the space that blocks
496 * is for open spaces. map_mark should already have been initialised 497 * is for open spaces. map_mark should already have been initialised
497 * to zero before this is called. 498 * to zero before this is called.
498 * strength is an initial strength*2 rectangular area that we automatically 499 * strength is an initial strength*2 rectangular area that we automatically
499 * see in/penetrate through. 500 * see in/penetrate through.
500 */ 501 */
501
502void 502void
503magic_mapping_mark (object *pl, char *map_mark, int strength) 503magic_mapping_mark (object *pl, char *map_mark, int strength)
504{ 504{
505 int x, y, mflags; 505 int x, y, mflags;
506 sint16 nx, ny; 506 sint16 nx, ny;
507 maptile *mp; 507 maptile *mp;
508 facetile *f;
509 508
510 for (x = -strength; x < strength; x++) 509 for (x = -strength; x < strength; x++)
511 { 510 {
512 for (y = -strength; y < strength; y++) 511 for (y = -strength; y < strength; y++)
513 { 512 {
514 mp = pl->map; 513 mp = pl->map;
515 nx = pl->x + x; 514 nx = pl->x + x;
516 ny = pl->y + y; 515 ny = pl->y + y;
516
517 mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); 517 mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny);
518 if (mflags & P_OUT_OF_MAP) 518 if (mflags & P_OUT_OF_MAP)
519 continue; 519 continue;
520 else 520
521 int f = GET_MAP_FACE (mp, nx, ny, 0);
522 if (f == blank_face)
521 { 523 {
522 f = GET_MAP_FACE (mp, nx, ny, 0);
523 if (f == blank_face)
524 f = GET_MAP_FACE (mp, nx, ny, 1); 524 f = GET_MAP_FACE (mp, nx, ny, 1);
525 if (f == blank_face) 525 if (f == blank_face)
526 f = GET_MAP_FACE (mp, nx, ny, 2); 526 f = GET_MAP_FACE (mp, nx, ny, 2);
527 } 527 }
528 528
529 int magicmap = faces [f].magicmap;
530
529 if (mflags & P_BLOCKSVIEW) 531 if (mflags & P_BLOCKSVIEW)
530 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | (f ? f->magicmap : 0); 532 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_WALL | magicmap;
531 else 533 else
532 { 534 {
533 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | (f ? f->magicmap : 0); 535 map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] = FACE_FLOOR | magicmap;
534 magic_mapping_mark_recursive (pl, map_mark, x, y); 536 magic_mapping_mark_recursive (pl, map_mark, x, y);
535 } 537 }
536 } 538 }
537 } 539 }
538} 540}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines