Pferdezüchter kriegen xp für Zucht auch wenn kein Pferd entsteht.
This commit is contained in:
Enno Rehling 2007-01-01 12:14:56 +00:00
parent 97342e5b81
commit 229706e6e4
1 changed files with 52 additions and 54 deletions

View File

@ -2552,31 +2552,29 @@ plant_cmd(unit *u, struct order * ord)
static void static void
breedhorses(region *r, unit *u) breedhorses(region *r, unit *u)
{ {
int n, c; int n, c;
int gezuechtet = 0; int gezuechtet = 0;
struct building * b = inside_building(u); struct building * b = inside_building(u);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
if (btype!=bt_find("stables")) { if (btype!=bt_find("stables")) {
cmistake(u, u->thisorder, 122, MSG_PRODUCE); cmistake(u, u->thisorder, 122, MSG_PRODUCE);
return; return;
} }
if (get_item(u, I_HORSE) < 2) { if (get_item(u, I_HORSE) < 2) {
cmistake(u, u->thisorder, 107, MSG_PRODUCE); cmistake(u, u->thisorder, 107, MSG_PRODUCE);
return; return;
} }
n = min(u->number * eff_skill(u, SK_HORSE_TRAINING, r), get_item(u, I_HORSE)); n = min(u->number * eff_skill(u, SK_HORSE_TRAINING, r), get_item(u, I_HORSE));
for (c = 0; c < n; c++) { for (c = 0; c < n; c++) {
if (rng_int() % 100 < eff_skill(u, SK_HORSE_TRAINING, r)) { if (rng_int() % 100 < eff_skill(u, SK_HORSE_TRAINING, r)) {
i_change(&u->items, olditemtype[I_HORSE], 1); i_change(&u->items, olditemtype[I_HORSE], 1);
gezuechtet++; gezuechtet++;
} }
} }
if (gezuechtet > 0) { produceexp(u, SK_HORSE_TRAINING, u->number);
produceexp(u, SK_HORSE_TRAINING, u->number);
}
ADDMSG(&u->faction->msgs, msg_message("raised", ADDMSG(&u->faction->msgs, msg_message("raised",
"unit amount", u, gezuechtet)); "unit amount", u, gezuechtet));
@ -2585,42 +2583,42 @@ breedhorses(region *r, unit *u)
static void static void
breed_cmd(unit *u, struct order * ord) breed_cmd(unit *u, struct order * ord)
{ {
int m; int m;
const char *s; const char *s;
param_t p; param_t p;
region *r = u->region; region *r = u->region;
/* züchte [<anzahl>] <parameter> */ /* züchte [<anzahl>] <parameter> */
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
s = getstrtoken(); s = getstrtoken();
m = atoi(s); m = atoi(s);
sprintf(buf, "%d", m); sprintf(buf, "%d", m);
if (!strcmp(buf, s)) { if (!strcmp(buf, s)) {
/* first came a want-paramter */ /* first came a want-paramter */
s = getstrtoken(); s = getstrtoken();
} else { } else {
m = INT_MAX; m = INT_MAX;
} }
if(!s[0]){ if(!s[0]){
p = P_ANY; p = P_ANY;
} else { } else {
p = findparam(s, u->faction->locale); p = findparam(s, u->faction->locale);
} }
switch (p) { switch (p) {
case P_HERBS: case P_HERBS:
plant(r, u, m); plant(r, u, m);
return; return;
case P_TREES: case P_TREES:
breedtrees(r, u, m); breedtrees(r, u, m);
return; return;
default: default:
breedhorses(r, u); breedhorses(r, u);
return; return;
} }
} }
static const char * static const char *