summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/levcomp.ypp
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-19 18:02:31 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-19 18:02:31 +0000
commit6e304ee422e24338bde6ca84c420702d7d719993 (patch)
tree08bee3585e67a17a8b946df063185136cd95d148 /crawl-ref/source/util/levcomp.ypp
parentdb54671af1f255d5f886ff79ffe8b2232585f1c3 (diff)
downloadcrawl-ref-6e304ee422e24338bde6ca84c420702d7d719993.tar.gz
crawl-ref-6e304ee422e24338bde6ca84c420702d7d719993.zip
Separate CHANCE and WEIGHT. CHANCE is a probability, WEIGHT is a raw number used as a generation weight (i.e. WEIGHT is what the old CHANCE used to be).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7501 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/util/levcomp.ypp')
-rw-r--r--crawl-ref/source/util/levcomp.ypp38
1 files changed, 34 insertions, 4 deletions
diff --git a/crawl-ref/source/util/levcomp.ypp b/crawl-ref/source/util/levcomp.ypp
index f2bb2b17b6..a678937ea9 100644
--- a/crawl-ref/source/util/levcomp.ypp
+++ b/crawl-ref/source/util/levcomp.ypp
@@ -53,11 +53,11 @@ level_range set_range(const char *s, int start, int end)
%expect 2
%token <i> DEFAULT_DEPTH SHUFFLE SUBST TAGS KFEAT KITEM KMONS KMASK
-%token <i> NAME DEPTH ORIENT PLACE CHANCE MONS ITEM MARKER COLOUR
+%token <i> NAME DEPTH ORIENT PLACE CHANCE WEIGHT MONS ITEM MARKER COLOUR
%token <i> PRELUDE MAIN VALIDATE VETO NSUBST WELCOME LFLAGS BFLAGS
%token <i> FLOORCOL ROCKCOL
-%token <i> COMMA INTEGER CHARACTER
+%token <i> COMMA COLON PERC INTEGER CHARACTER
%token <text> STRING MAP_LINE MONSTER_NAME ITEM_INFO
%token <text> LUA_LINE
@@ -152,6 +152,7 @@ name : NAME STRING
metaline : place
| depth
| chance
+ | weight
| orientation
| welcome
| mons
@@ -468,11 +469,40 @@ depth : DEPTH {}
}
;
-chance : CHANCE INTEGER
+chance : CHANCE INTEGER COLON INTEGER PERC
{
lc_map.main.add(
yylineno,
- make_stringf("chance(\"%d\")", $2));
+ make_stringf("chance(%d, %d)", $2, $4 * 100));
+ }
+ |
+ CHANCE INTEGER COLON INTEGER
+ {
+ lc_map.main.add(
+ yylineno,
+ make_stringf("chance(%d, %d)", $2, $4));
+ }
+ |
+ CHANCE INTEGER PERC
+ {
+ lc_map.main.add(
+ yylineno,
+ make_stringf("chance(0, %d)", $2 * 100));
+ }
+ |
+ CHANCE INTEGER
+ {
+ lc_map.main.add(
+ yylineno,
+ make_stringf("chance(0, %d)", $2));
+ }
+ ;
+
+weight : WEIGHT INTEGER
+ {
+ lc_map.main.add(
+ yylineno,
+ make_stringf("weight(%d)", $2));
}
;