diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-15 22:01:43 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-15 22:01:43 +0000 |
commit | 37fa908ee1771a94b5e8b7a69205675a5ca1235f (patch) | |
tree | 519a8299f0df14bbf0643449e69060822355da9f /crawl-ref/source/items.cc | |
parent | a73c04ebd82cc74e5b73af7a90b4c5ad292361a9 (diff) | |
download | crawl-ref-37fa908ee1771a94b5e8b7a69205675a5ca1235f.tar.gz crawl-ref-37fa908ee1771a94b5e8b7a69205675a5ca1235f.zip |
General code cleanups.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5867 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 60a6e39bf8..5e5eba7580 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -366,9 +366,6 @@ int get_item_slot( int reserve ) void unlink_item( int dest ) { - int c = 0; - int cy = 0; - // Don't destroy non-items, may be called after an item has been // reduced to zero quantity however. if (dest == NON_ITEM || !is_valid_item( mitm[dest] )) @@ -380,14 +377,14 @@ void unlink_item( int dest ) // although it also contains items that are not linked in yet. // // Check if a monster has it: - for (c = 0; c < MAX_MONSTERS; c++) + for (int c = 0; c < MAX_MONSTERS; c++) { - struct monsters *monster = &menv[c]; + monsters *monster = &menv[c]; if (monster->type == -1) continue; - for (cy = 0; cy < NUM_MONSTER_SLOTS; cy++) + for (int cy = 0; cy < NUM_MONSTER_SLOTS; cy++) { if (monster->inv[cy] == dest) { @@ -428,7 +425,7 @@ void unlink_item( int dest ) } // Okay, item is buried, find item that's on top of it. - for (c = igrd[ mitm[dest].x ][ mitm[dest].y ]; c != NON_ITEM; + for (int c = igrd[ mitm[dest].x ][ mitm[dest].y ]; c != NON_ITEM; c = mitm[c].link) { // Find item linking to dest item. @@ -466,7 +463,7 @@ void unlink_item( int dest ) mitm[dest].props.clear(); // Look through all items for links to this item. - for (c = 0; c < MAX_ITEMS; c++) + for (int c = 0; c < MAX_ITEMS; c++) { if (is_valid_item( mitm[c] ) && mitm[c].link == dest) { @@ -482,8 +479,8 @@ void unlink_item( int dest ) } // Now check the grids to see if it's linked as a list top. - for (c = 2; c < (GXM - 1); c++) - for (cy = 2; cy < (GYM - 1); cy++) + for (int c = 2; c < (GXM - 1); c++) + for (int cy = 2; cy < (GYM - 1); cy++) { if (igrd[c][cy] == dest) { @@ -604,10 +601,7 @@ void lose_item_stack( int x, int y ) if (is_valid_item( mitm[o] )) { item_was_lost(mitm[o]); - - mitm[o].base_type = OBJ_UNASSIGNED; - mitm[o].quantity = 0; - mitm[o].props.clear(); + mitm[o].clear(); } o = next; @@ -627,10 +621,7 @@ void destroy_item_stack( int x, int y, int cause ) if (is_valid_item( mitm[o] )) { item_was_destroyed(mitm[o], cause); - - mitm[o].base_type = OBJ_UNASSIGNED; - mitm[o].quantity = 0; - mitm[o].props.clear(); + mitm[o].clear(); } o = next; |