diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-08 12:33:36 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-08 12:33:36 +0000 |
commit | 6e44de32ed92d31968e1490c7d10ba27e98ee392 (patch) | |
tree | 41970a37d7fc853521bb09642048d8b0404694ed /crawl-ref/source/items.cc | |
parent | cebfd4f93efdfe6cc517f1bda0a59699a8149d3e (diff) | |
download | crawl-ref-6e44de32ed92d31968e1490c7d10ba27e98ee392.tar.gz crawl-ref-6e44de32ed92d31968e1490c7d10ba27e98ee392.zip |
Apply Abyss unlinked item fix and the changes to the starting equipment
to 0.4.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6456 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index e373e6f93b..ccce30d015 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1686,11 +1686,11 @@ bool move_item_to_grid( int *const obj, int x, int y ) // Need to actually move object, so first unlink from old position. unlink_item( *obj ); - // move item to coord: + // Move item to coord. mitm[*obj].x = x; mitm[*obj].y = y; - // link item to top of list. + // Link item to top of list. mitm[*obj].link = igrd[x][y]; igrd[x][y] = *obj; @@ -1710,11 +1710,21 @@ bool move_item_to_grid( int *const obj, int x, int y ) void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y ) { + if (igrd[x][y] == NON_ITEM) + return; + // Tell all items in stack what the new coordinate is. for (int o = igrd[x][y]; o != NON_ITEM; o = mitm[o].link) { mitm[o].x = targ_x; mitm[o].y = targ_y; + + // Link last of the stack to the top of the old stack. + if (mitm[o].link == NON_ITEM && igrd[targ_x][targ_y] != NON_ITEM) + { + mitm[o].link = igrd[targ_x][targ_y]; + break; + } } igrd[targ_x][targ_y] = igrd[x][y]; |