diff --git a/src/economy.test.c b/src/economy.test.c index 6303b2ae8..47194ef86 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -217,7 +217,7 @@ static unit *setup_trade_unit(CuTest *tc, region *r, const struct race *rc) { } static void test_trade_insect(CuTest *tc) { - /* Insekten können in Wüsten und Sümpfen auch ohne Burgen handeln. */ + /* Insekten k�nnen in W�sten und S�mpfen auch ohne Burgen handeln. */ unit *u; region *r; const item_type *it_luxury; @@ -239,6 +239,8 @@ static void test_trade_insect(CuTest *tc) { LOC(u->faction->locale, resourcename(it_luxury->rtype, 0)))); set_item(u, it_silver, 10); + CuAssertPtrEquals(tc, r, u->region); + CuAssertPtrEquals(tc, (void *)it_luxury, (void *)r_luxury(u->region)); produce(u->region); CuAssertIntEquals(tc, 1, get_item(u, it_luxury)); CuAssertIntEquals(tc, 5, get_item(u, it_silver)); diff --git a/src/kernel/race.c b/src/kernel/race.c index a73c0e699..ceb2029c4 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -106,17 +106,18 @@ static void rc_setoption(race *rc, int k, const char *value) { rc->options->key[1] = RCO_NONE; v = rc->options->value; } else { - for (i=0;!v && i < MAXOPTIONS && rc->options->key[i]!=RCO_NONE;++i) { + for (i=0;!v && i < MAXOPTIONS;++i) { if (rc->options->key[i]==key) { v = rc->options->value+i; + break; } - } - if (!v) { - assert(ioptions->value+i; - rc->options->key[i] = key; - if (i+1options->key[i+1]=RCO_NONE; + if (rc->options->key[i]==RCO_NONE) { + v = rc->options->value+i; + rc->options->key[i] = key; + if (i+1 < MAXOPTIONS) { + rc->options->key[i+1]=RCO_NONE; + } + break; } } }