fix meldungen pflanze

fix pflanze Kräuter wurde nie aufgerufen, der aufruf sprang sofort in
pflanze Bäume, was falsch war.
fix ifdef Bauern_fressen_nicht
This commit is contained in:
Katja Zedel 2002-03-06 20:18:37 +00:00
parent 5bba58f875
commit ddc2ca0bf0
5 changed files with 105 additions and 94 deletions

View File

@ -2513,7 +2513,9 @@ plant(region *r, unit *u, int raw)
/* Skill prüfen */
skill = eff_skill(u, SK_HERBALISM, r);
if (skill < 6) {
cmistake(u, findorder(u, u->thisorder), 150, MSG_PRODUCE);
add_message(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "plant_skills",
"skill minskill product", SK_HERBALISM, 6, htype->itype->rtype, 1));
return;
}
/* Wasser des Lebens prüfen */
@ -2570,9 +2572,18 @@ planttrees(region *r, unit *u, int raw)
/* Skill prüfen */
skill = eff_skill(u, SK_HERBALISM, r);
if (skill < 6) {
cmistake(u, findorder(u, u->thisorder), 150, MSG_PRODUCE);
add_message(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "plant_skills",
"skill minskill product", SK_HERBALISM, 6, itype->rtype, 1));
return;
}
if (fval(r, RF_MALLORN) && skill < 7 ) {
add_message(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "plant_skills",
"skill minskill product", SK_HERBALISM, 7, itype->rtype, 1));
return;
}
n = new_get_pooled(u, itype->rtype, GET_DEFAULT);
/* Samen prüfen */
if (n==0) {
@ -2599,6 +2610,65 @@ planttrees(region *r, unit *u, int raw)
ADDMSG(&u->faction->msgs, msg_message("plant",
"unit region amount herb", u, r, planted, itype->rtype));
}
/* züchte bäume */
void
breedtrees(region *r, unit *u, int raw)
{
int n, i, skill, planted = 0;
const item_type * itype;
int current_season = season(turn);
/* Bäume züchten geht nur im Frühling */
if (current_season != SEASON_SPRING){
planttrees(r, u, raw);
return;
}
if (rterrain(r) == T_OCEAN) {
return;
}
/* Mallornbäume kann man nur in Mallornregionen züchten */
if (fval(r, RF_MALLORN)) {
itype = &it_mallornseed;
} else {
itype = &it_seed;
}
/* Skill prüfen */
skill = eff_skill(u, SK_HERBALISM, r);
if (skill < 12) {
planttrees(r, u, raw);
return;
}
n = new_get_pooled(u, itype->rtype, GET_DEFAULT);
/* Samen prüfen */
if (n==0) {
add_message(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "resource_missing", "missing",
itype->rtype));
return;
}
/* wenn eine Anzahl angegeben wurde, nur soviel verbrauchen */
n = min(raw, n);
n = min(skill*u->number, n);
/* Für jeden Samen Talent*5% Erfolgschance. */
for(i = n; i>0; i--) {
if (rand()%100 < skill*5) planted++;
}
rsettrees(r, 1, rtrees(r, 1)+planted);
/* Alles ok. Abziehen. */
produceexp(u, SK_HERBALISM, u->number);
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
add_message(&u->faction->msgs, new_message(u->faction,
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype));
}
#endif
void
@ -2633,78 +2703,18 @@ pflanze(region *r, unit *u)
}
#if GROWING_TREES
else if (p==P_TREES){
planttrees(r, u, m);
breedtrees(r, u, m);
return;
}
else if (itype!=NULL){
if (itype==&it_mallornseed || itype==&it_seed){
planttrees(r, u, m);
breedtrees(r, u, m);
return;
}
}
#endif
}
#if GROWING_TREES
/* züchte bäume */
void
breedtrees(region *r, unit *u, int raw)
{
int n, i, skill, planted = 0;
const item_type * itype;
int current_season = season(turn);
/* Bäume züchten geht nur im Frühling */
if (current_season != SEASON_SPRING){
planttrees(r, u, raw);
return;
}
if (rterrain(r) == T_OCEAN) {
return;
}
/* Mallornbäume kann man nur in Mallornregionen züchten */
if (fval(r, RF_MALLORN)) {
itype = &it_mallornseed;
} else {
itype = &it_seed;
}
/* Skill prüfen */
skill = eff_skill(u, SK_HERBALISM, r);
if (skill < 12) {
cmistake(u, findorder(u, u->thisorder), 150, MSG_PRODUCE);
return;
}
n = new_get_pooled(u, itype->rtype, GET_DEFAULT);
/* Samen prüfen */
if (n==0) {
add_message(&u->faction->msgs,
msg_error(u, findorder(u, u->thisorder), "resource_missing", "missing",
itype->rtype));
return;
}
/* wenn eine Anzahl angegeben wurde, nur soviel verbrauchen */
n = min(raw, n);
n = min(skill*u->number, n);
/* Für jeden Samen Talent*5% Erfolgschance. */
for(i = n; i>0; i--) {
if (rand()%100 < skill*5) planted++;
}
rsettrees(r, 1, rtrees(r, 1)+planted);
/* Alles ok. Abziehen. */
produceexp(u, SK_HERBALISM, u->number);
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
add_message(&u->faction->msgs, new_message(u->faction,
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype));
}
#endif
/* züchte pferde */
void
@ -3304,11 +3314,9 @@ produce(void)
zuechte(r, u);
break;
#if GROWING_TREES
case K_PFLANZE:
planttrees(r, u, INT_MAX);
pflanze(r, u);
break;
#endif
case K_RESEARCH:
research(r, u);

View File

@ -538,9 +538,9 @@ peasants(region * r)
* den Bauern genug für 11 Bauern pro Ebene ohne Wald. Der Wald
* breitet sich nicht in Gebiete aus, die bebaut werden. */
int peasants, n, i;
int peasants, n, i, satiated, money;
#if PEASANTS_DO_NOT_STARVE == 0
int dead, satiated, money;
int dead;
#endif
attrib * a;

View File

@ -850,7 +850,7 @@ sp_chaosrow(fighter * fi, int level, int force, spell * sp)
int chance;
int k = 0;
int minrow = FIGHT_ROW;
int maxrow = AVOID_ROW - 1;
int maxrow = NUMROWS;
switch (sp->id) {
case SPL_CHAOSROW:
@ -895,7 +895,7 @@ sp_chaosrow(fighter * fi, int level, int force, spell * sp)
if (df->unit->race->battle_flags & BF_NOBLOCK) {
df->side->nonblockers[df->status+FIRST_ROW] -= df->alive;
}
row = FIRST_ROW + (rand()% AVOID_ROW);
row = FIRST_ROW + (rand()% NUMROWS);
df->status = (status_t)row - FIRST_ROW;
df->side->size[row] += df->alive;
if (df->unit->race->battle_flags & BF_NOBLOCK) {

View File

@ -335,6 +335,18 @@
<text locale="de">"$unit($unit) in $region($region): '$command' - Man benötigt mindestens $int($minskill) $skill($skill), um $resource($product,0) zu produzieren."</text>
</message>
<message name="plant_skills" section="production">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
<arg name="skill" type="skill"></arg>
<arg name="minskill" type="int"></arg>
<arg name="product" type="resource"></arg>
</type>
<text locale="de">"$unit($unit) in $region($region): '$command' - Man benötigt mindestens $int($minskill) $skill($skill), um $resource($product,0) zu pflanzen."</text>
</message>
<message name="skill_needed">
<type>
<arg name="unit" type="unit"></arg>
@ -2198,19 +2210,6 @@
</locale>
</message>
<message name="error150">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<locale name="de">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - Zum Pflanzen braucht man mindestens Kräuterkunde 6."</text>
</nr>
</locale>
</message>
<message name="error151">
<type>
<arg name="unit" type="unit"></arg>
@ -3285,16 +3284,6 @@
</locale>
</message>
<message name="error227" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<text locale="de">"$unit($unit) in $region($region): '$command' - Dafür braucht ein Einheit mindestens Kräuterkunde 7."</text>
<text locale="en">"$unit($unit) in $region($region): '$command' - A skill of herbalism 7 or higher is required."</text>
</message>
<message name="error228">
<type>
<arg name="unit" type="unit"></arg>

View File

@ -4388,4 +4388,18 @@
</locale>
</message>
<message name="plant_skills" section="production">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
<arg name="skill" type="skill"></arg>
<arg name="minskill" type="int"></arg>
<arg name="product" type="resource"></arg>
</type>
<text locale="en">"$unit($unit) in $region($region): '$command' - At least $skill($skill) $int($minskill) is needed for planting $resource($product,0)."</text>
</message>
</messages>