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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.363 by root, Sun Jan 29 02:47:04 2017 UTC vs.
Revision 1.365 by root, Sat Nov 17 23:33:17 2018 UTC

45uint32_t object::create_count; 45uint32_t object::create_count;
46uint32_t object::destroy_count; 46uint32_t object::destroy_count;
47 47
48//+GPL 48//+GPL
49 49
50short freearr_x[SIZEOFFREE] = { 50int freearr_x[SIZEOFFREE] = {
51 0, 51 0,
52 0, 1, 1, 1, 0, -1, -1, -1, 52 0, 1, 1, 1, 0, -1, -1, -1,
53 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 53 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1,
54 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1 54 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1
55}; 55};
56short freearr_y[SIZEOFFREE] = { 56int freearr_y[SIZEOFFREE] = {
57 0, 57 0,
58 -1, -1, 0, 1, 1, 1, 0, -1, 58 -1, -1, 0, 1, 1, 1, 0, -1,
59 -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, 59 -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2,
60 -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3 60 -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3
61}; 61};
639 * need for monsters, but doesn't hurt to do it for everything. 639 * need for monsters, but doesn't hurt to do it for everything.
640 * by doing so, when a monster is created, it has good starting 640 * by doing so, when a monster is created, it has good starting
641 * values for the body_used info, so when items are created 641 * values for the body_used info, so when items are created
642 * for it, they can be properly equipped. 642 * for it, they can be properly equipped.
643 */ 643 */
644 for (int i = NUM_BODY_LOCATIONS; i--; ) 644 for (int i = 0; i < NUM_BODY_LOCATIONS; ++i)
645 slot[i].used = slot[i].info; 645 slot[i].used = slot[i].info;
646 646
647 attachable::instantiate (); 647 attachable::instantiate ();
648} 648}
649 649
2075 */ 2075 */
2076int 2076int
2077find_first_free_spot (const object *ob, maptile *m, int x, int y) 2077find_first_free_spot (const object *ob, maptile *m, int x, int y)
2078{ 2078{
2079 for (int i = 0; i < SIZEOFFREE; i++) 2079 for (int i = 0; i < SIZEOFFREE; i++)
2080 if (!ob->blocked (m, x + freearr_x[i], y + freearr_y[i])) 2080 if (!ob->blocked (m, x + DIRX (i), y + DIRY (i)))
2081 return i; 2081 return i;
2082 2082
2083 return -1; 2083 return -1;
2084} 2084}
2085 2085
2350 int mflags; 2350 int mflags;
2351 2351
2352 if (dir < 0) 2352 if (dir < 0)
2353 return 0; /* exit condition: invalid direction */ 2353 return 0; /* exit condition: invalid direction */
2354 2354
2355 dx = x + freearr_x[dir]; 2355 dx = x + DIRX (dir);
2356 dy = y + freearr_y[dir]; 2356 dy = y + DIRY (dir);
2357 2357
2358 mflags = get_map_flags (m, &m, dx, dy, &dx, &dy); 2358 mflags = get_map_flags (m, &m, dx, dy, &dx, &dy);
2359 2359
2360 /* This functional arguably was incorrect before - it was 2360 /* This functional arguably was incorrect before - it was
2361 * checking for P_WALL - that was basically seeing if 2361 * checking for P_WALL - that was basically seeing if

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines