1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
26 | #include <stdio.h> |
26 | #include <stdio.h> |
27 | #include <sys/types.h> |
27 | #include <sys/types.h> |
28 | #include <sys/uio.h> |
28 | #include <sys/uio.h> |
29 | #include <object.h> |
29 | #include <object.h> |
30 | #include <sproto.h> |
30 | #include <sproto.h> |
31 | #include <loader.h> |
|
|
32 | |
31 | |
33 | #include <bitset> |
32 | #include <bitset> |
34 | |
33 | |
35 | UUID UUID::cur; |
34 | UUID UUID::cur; |
36 | static uint64_t seq_next_save; |
35 | static uint64_t seq_next_save; |
… | |
… | |
248 | * Improvements made with merge: Better checking on potion, and also |
247 | * Improvements made with merge: Better checking on potion, and also |
249 | * check weight |
248 | * check weight |
250 | */ |
249 | */ |
251 | bool object::can_merge_slow (object *ob1, object *ob2) |
250 | bool object::can_merge_slow (object *ob1, object *ob2) |
252 | { |
251 | { |
253 | /* A couple quicksanity checks */ |
252 | /* A couple quick sanity checks */ |
254 | if (ob1 == ob2 |
253 | if (ob1 == ob2 |
255 | || ob1->type != ob2->type |
254 | || ob1->type != ob2->type |
256 | || fabs (ob1->speed - ob2->speed) >= MIN_ACTIVE_SPEED |
|
|
257 | || ob1->value != ob2->value |
255 | || ob1->value != ob2->value |
258 | || ob1->name != ob2->name) |
256 | || ob1->name != ob2->name |
|
|
257 | || fabs (ob1->speed - ob2->speed) >= MIN_ACTIVE_SPEED) |
259 | return 0; |
258 | return 0; |
260 | |
259 | |
261 | /* Do not merge objects if nrof would overflow, assume nrof |
260 | /* Do not merge objects if nrof would overflow, assume nrof |
262 | * is always 0 .. 2**31-1 */ |
261 | * is always 0 .. 2**31-1 */ |
263 | if (ob1->nrof > 0x7fffffff - ob2->nrof) |
262 | if (ob1->nrof > 0x7fffffff - ob2->nrof) |
… | |
… | |
284 | || ob1->magic != ob2->magic |
283 | || ob1->magic != ob2->magic |
285 | || ob1->slaying != ob2->slaying |
284 | || ob1->slaying != ob2->slaying |
286 | || ob1->skill != ob2->skill |
285 | || ob1->skill != ob2->skill |
287 | || ob1->value != ob2->value |
286 | || ob1->value != ob2->value |
288 | || ob1->animation_id != ob2->animation_id |
287 | || ob1->animation_id != ob2->animation_id |
289 | || (ob1->face != ob2->face && !ob1->animation_id) // face and animation are dependent on each other |
288 | || (ob1->face != ob2->face && !ob1->animation_id) // face and animation are dependend on each other |
290 | || ob1->client_type != ob2->client_type |
289 | || ob1->client_type != ob2->client_type |
291 | || ob1->material != ob2->material |
290 | || ob1->material != ob2->material |
292 | || ob1->lore != ob2->lore |
291 | || ob1->lore != ob2->lore |
293 | || ob1->subtype != ob2->subtype |
292 | || ob1->subtype != ob2->subtype |
294 | || ob1->move_type != ob2->move_type |
293 | || ob1->move_type != ob2->move_type |
… | |
… | |
1269 | |
1268 | |
1270 | object *prev = this; |
1269 | object *prev = this; |
1271 | |
1270 | |
1272 | for (archetype *at = (archetype *)arch->more; at; at = (archetype *)at->more) |
1271 | for (archetype *at = (archetype *)arch->more; at; at = (archetype *)at->more) |
1273 | { |
1272 | { |
1274 | object *op = arch_to_object (at); |
1273 | object *op = at->instance (); |
1275 | |
1274 | |
1276 | op->name = name; |
1275 | op->name = name; |
1277 | op->name_pl = name_pl; |
1276 | op->name_pl = name_pl; |
1278 | op->title = title; |
1277 | op->title = title; |
1279 | |
1278 | |
… | |
… | |
2563 | // TODO: this does not seem to serve any purpose anymore? |
2562 | // TODO: this does not seem to serve any purpose anymore? |
2564 | #if 0 |
2563 | #if 0 |
2565 | // insert the "Close Container" object. |
2564 | // insert the "Close Container" object. |
2566 | if (archetype *closer = new_container->other_arch) |
2565 | if (archetype *closer = new_container->other_arch) |
2567 | { |
2566 | { |
2568 | object *closer = arch_to_object (new_container->other_arch); |
2567 | object *closer = new_container->other_arch->instance (); |
2569 | closer->flag [FLAG_NO_MAP_SAVE] = 1; |
2568 | closer->flag [FLAG_NO_MAP_SAVE] = 1; |
2570 | new_container->insert (closer); |
2569 | new_container->insert (closer); |
2571 | } |
2570 | } |
2572 | #endif |
2571 | #endif |
2573 | |
2572 | |