… | |
… | |
29 | #include <sys/types.h> |
29 | #include <sys/types.h> |
30 | #include <sys/uio.h> |
30 | #include <sys/uio.h> |
31 | #include <object.h> |
31 | #include <object.h> |
32 | #include <funcpoint.h> |
32 | #include <funcpoint.h> |
33 | #include <loader.h> |
33 | #include <loader.h> |
|
|
34 | |
|
|
35 | #include <bitset> |
34 | |
36 | |
35 | int nrofallocobjects = 0; |
37 | int nrofallocobjects = 0; |
36 | static UUID uuid; |
38 | static UUID uuid; |
37 | const uint64 UUID_SKIP = 1<<19; |
39 | const uint64 UUID_SKIP = 1<<19; |
38 | |
40 | |
… | |
… | |
219 | SET_FLAG (ob1, FLAG_BEEN_APPLIED); |
221 | SET_FLAG (ob1, FLAG_BEEN_APPLIED); |
220 | |
222 | |
221 | if (QUERY_FLAG (ob2, FLAG_IDENTIFIED)) |
223 | if (QUERY_FLAG (ob2, FLAG_IDENTIFIED)) |
222 | SET_FLAG (ob2, FLAG_BEEN_APPLIED); |
224 | SET_FLAG (ob2, FLAG_BEEN_APPLIED); |
223 | |
225 | |
224 | |
226 | if ((ob1->flags ^ ob2->flags).reset (FLAG_INV_LOCKED).reset (FLAG_CLIENT_SENT).any () |
225 | /* the 0x400000 on flags2 is FLAG_INV_LOCK. I don't think something |
227 | || ob1->arch != ob2->arch |
226 | * being locked in inventory should prevent merging. |
|
|
227 | * 0x4 in flags3 is CLIENT_SENT |
|
|
228 | */ |
|
|
229 | if ((ob1->arch != ob2->arch) || |
|
|
230 | (ob1->flags[0] != ob2->flags[0]) || |
|
|
231 | (ob1->flags[1] != ob2->flags[1]) || |
|
|
232 | ((ob1->flags[2] & ~0x400000) != (ob2->flags[2] & ~0x400000)) || |
|
|
233 | ((ob1->flags[3] & ~0x4) != (ob2->flags[3] & ~0x4)) || |
|
|
234 | (ob1->name != ob2->name) || |
228 | || ob1->name != ob2->name |
235 | (ob1->title != ob2->title) || |
229 | || ob1->title != ob2->title |
236 | (ob1->msg != ob2->msg) || |
230 | || ob1->msg != ob2->msg |
237 | (ob1->weight != ob2->weight) || |
231 | || ob1->weight != ob2->weight |
238 | (memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) != 0) || |
232 | || memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) |
239 | (memcmp (&ob1->stats, &ob2->stats, sizeof (ob1->stats)) != 0) || |
233 | || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats) ) |
240 | (ob1->attacktype != ob2->attacktype) || |
234 | || ob1->attacktype != ob2->attacktype |
241 | (ob1->magic != ob2->magic) || |
235 | || ob1->magic != ob2->magic |
242 | (ob1->slaying != ob2->slaying) || |
236 | || ob1->slaying != ob2->slaying |
243 | (ob1->skill != ob2->skill) || |
237 | || ob1->skill != ob2->skill |
244 | (ob1->value != ob2->value) || |
238 | || ob1->value != ob2->value |
245 | (ob1->animation_id != ob2->animation_id) || |
239 | || ob1->animation_id != ob2->animation_id |
246 | (ob1->client_type != ob2->client_type) || |
240 | || ob1->client_type != ob2->client_type |
247 | (ob1->materialname != ob2->materialname) || |
241 | || ob1->materialname != ob2->materialname |
248 | (ob1->lore != ob2->lore) || |
242 | || ob1->lore != ob2->lore |
249 | (ob1->subtype != ob2->subtype) || |
243 | || ob1->subtype != ob2->subtype |
250 | (ob1->move_type != ob2->move_type) || |
244 | || ob1->move_type != ob2->move_type |
251 | (ob1->move_block != ob2->move_block) || |
245 | || ob1->move_block != ob2->move_block |
252 | (ob1->move_allow != ob2->move_allow) || |
246 | || ob1->move_allow != ob2->move_allow |
253 | (ob1->move_on != ob2->move_on) || |
247 | || ob1->move_on != ob2->move_on |
254 | (ob1->move_off != ob2->move_off) || (ob1->move_slow != ob2->move_slow) || (ob1->move_slow_penalty != ob2->move_slow_penalty)) |
248 | || ob1->move_off != ob2->move_off |
|
|
249 | || ob1->move_slow != ob2->move_slow |
|
|
250 | || ob1->move_slow_penalty != ob2->move_slow_penalty) |
255 | return 0; |
251 | return 0; |
256 | |
252 | |
257 | /* This is really a spellbook check - really, we should |
253 | /* This is really a spellbook check - really, we should |
258 | * check all objects in the inventory. |
254 | * check all objects in the inventory. |
259 | */ |
255 | */ |
… | |
… | |
1140 | { |
1136 | { |
1141 | CLEAR_FLAG (this, FLAG_APPLIED); |
1137 | CLEAR_FLAG (this, FLAG_APPLIED); |
1142 | tmp->container = 0; |
1138 | tmp->container = 0; |
1143 | } |
1139 | } |
1144 | |
1140 | |
1145 | tmp->contr->socket->update_look = 1; |
1141 | tmp->contr->socket->floorbox_update (); |
1146 | } |
1142 | } |
1147 | |
1143 | |
1148 | /* See if player moving off should effect something */ |
1144 | /* See if player moving off should effect something */ |
1149 | if (check_walk_off |
1145 | if (check_walk_off |
1150 | && ((move_type & tmp->move_off) |
1146 | && ((move_type & tmp->move_off) |
… | |
… | |
1487 | * it, so save a few ticks and start from there. |
1483 | * it, so save a few ticks and start from there. |
1488 | */ |
1484 | */ |
1489 | if (!(flag & INS_MAP_LOAD)) |
1485 | if (!(flag & INS_MAP_LOAD)) |
1490 | for (tmp = floor ? floor : GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1486 | for (tmp = floor ? floor : GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1491 | if (tmp->type == PLAYER) |
1487 | if (tmp->type == PLAYER) |
1492 | tmp->contr->socket->update_look = 1; |
1488 | tmp->contr->socket->floorbox_update (); |
1493 | |
1489 | |
1494 | /* If this object glows, it may affect lighting conditions that are |
1490 | /* If this object glows, it may affect lighting conditions that are |
1495 | * visible to others on this map. But update_all_los is really |
1491 | * visible to others on this map. But update_all_los is really |
1496 | * an inefficient way to do this, as it means los for all players |
1492 | * an inefficient way to do this, as it means los for all players |
1497 | * on the map will get recalculated. The players could very well |
1493 | * on the map will get recalculated. The players could very well |
… | |
… | |
1505 | |
1501 | |
1506 | /* updates flags (blocked, alive, no magic, etc) for this map space */ |
1502 | /* updates flags (blocked, alive, no magic, etc) for this map space */ |
1507 | update_object (op, UP_OBJ_INSERT); |
1503 | update_object (op, UP_OBJ_INSERT); |
1508 | |
1504 | |
1509 | /* Don't know if moving this to the end will break anything. However, |
1505 | /* Don't know if moving this to the end will break anything. However, |
1510 | * we want to have update_look set above before calling this. |
1506 | * we want to have floorbox_update called before calling this. |
1511 | * |
1507 | * |
1512 | * check_move_on() must be after this because code called from |
1508 | * check_move_on() must be after this because code called from |
1513 | * check_move_on() depends on correct map flags (so functions like |
1509 | * check_move_on() depends on correct map flags (so functions like |
1514 | * blocked() and wall() work properly), and these flags are updated by |
1510 | * blocked() and wall() work properly), and these flags are updated by |
1515 | * update_object(). |
1511 | * update_object(). |