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 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 (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 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 |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
441 | goto fail; |
441 | goto fail; |
442 | } |
442 | } |
443 | } |
443 | } |
444 | |
444 | |
445 | // assemble new chain |
445 | // assemble new chain |
446 | new_head->min_x = new_head->max_x = new_head->x; |
446 | new_head->max_x = new_head->x; |
447 | new_head->min_y = new_head->max_y = new_head->y; |
|
|
448 | |
447 | |
449 | archetype *less = new_head; |
448 | archetype *less = new_head; |
450 | for (auto (p, parts.begin () + 1); p != parts.end (); ++p) |
449 | for (auto (p, parts.begin () + 1); p != parts.end (); ++p) |
451 | { |
450 | { |
452 | archetype *at = *p; |
451 | archetype *at = *p; |
… | |
… | |
457 | at->flag [FLAG_ALIVE] = new_head->flag [FLAG_ALIVE]; |
456 | at->flag [FLAG_ALIVE] = new_head->flag [FLAG_ALIVE]; |
458 | at->flag [FLAG_NO_PICK] = new_head->flag [FLAG_NO_PICK]; |
457 | at->flag [FLAG_NO_PICK] = new_head->flag [FLAG_NO_PICK]; |
459 | at->flag [FLAG_MONSTER] = new_head->flag [FLAG_MONSTER]; |
458 | at->flag [FLAG_MONSTER] = new_head->flag [FLAG_MONSTER]; |
460 | at->flag [FLAG_IS_FLOOR] = new_head->flag [FLAG_IS_FLOOR]; |
459 | at->flag [FLAG_IS_FLOOR] = new_head->flag [FLAG_IS_FLOOR]; |
461 | |
460 | |
462 | new_head->min_x = min (new_head->min_x, at->x); |
|
|
463 | new_head->min_y = min (new_head->min_y, at->y); |
|
|
464 | new_head->max_x = max (new_head->max_x, at->x); |
461 | new_head->max_x = max (new_head->max_x, at->x); |
465 | new_head->max_y = max (new_head->max_y, at->y); |
|
|
466 | |
462 | |
467 | at->head = new_head; |
463 | at->head = new_head; |
468 | less->more = at; |
464 | less->more = at; |
469 | less = at; |
465 | less = at; |
470 | } |
466 | } |