From 7ce4f0c31ffe27368d7a62298dcb45fd244904b1 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 7 Jan 2009 12:03:36 +0000 Subject: Yet another fix to the arena win/loss/tie logic. During arena mode don't reserve any of mitm[] when creating new items, and when mitm[] fills up call arena_cull_items() instead of _cull_items(), since in arena mode we can cull via how boring/interesting the items are rather than having to consider game balance and fairness to the player. Allow the arena to veto monster placement, rather than culling them immediately after they're placed. New arena tags: * "no_bands" prevents band members from being placed. * "move_spawners" teleports test spawners every turn to spread their summons randomly over the arena. * "ban_glyphs:" lists a set of text glyphs of types of monsters which shouldn't be allowed in the arena. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8300 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index a05a5d8e9e..200656794c 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -26,6 +26,7 @@ REVISION("$Rev$"); #include "externs.h" +#include "arena.h" #include "beam.h" #include "branch.h" #include "cloud.h" @@ -60,6 +61,7 @@ REVISION("$Rev$"); #include "skills2.h" #include "spl-book.h" #include "spl-util.h" +#include "state.h" #include "stuff.h" #include "stash.h" #include "tiles.h" @@ -323,6 +325,9 @@ int get_item_slot( int reserve ) { ASSERT( reserve >= 0 ); + if (crawl_state.arena) + reserve = 0; + int item = NON_ITEM; for (item = 0; item < (MAX_ITEMS - reserve); item++) @@ -331,7 +336,16 @@ int get_item_slot( int reserve ) if (item >= MAX_ITEMS - reserve) { - item = (reserve <= 10) ? _cull_items() : NON_ITEM; + if (crawl_state.arena) + { + item = arena_cull_items(); + // If arena_cull_items() can't free up any space then + // _cull_items() won't be able to either, so give up. + if (item == NON_ITEM) + return (NON_ITEM); + } + else + item = (reserve <= 10) ? _cull_items() : NON_ITEM; if (item == NON_ITEM) return (NON_ITEM); -- cgit v1.2.3-54-g00ecf