- prevent heros from being promoted twice

- don't initialize order parser twice
- Übergabe von Helden an TEMP-Einheiten erlauben
This commit is contained in:
Enno Rehling 2008-03-03 16:43:09 +00:00
parent 1fb793509c
commit 68edb409fb
4 changed files with 23 additions and 4 deletions
src/common

View file

@ -152,7 +152,7 @@ give_men(int n, unit * u, unit * u2, struct order * ord)
/* snotlings may not be given to the peasants. */ /* snotlings may not be given to the peasants. */
error = 307; error = 307;
#ifdef HEROES #ifdef HEROES
} else if (u2 && (fval(u, UFL_HERO) != fval(u2, UFL_HERO))) { } else if (u2 && u2->number && (fval(u, UFL_HERO) != fval(u2, UFL_HERO))) {
/* heroes may not be given to non-heroes and vice versa*/ /* heroes may not be given to non-heroes and vice versa*/
error = 75; error = 75;
#endif #endif

View file

@ -2233,6 +2233,11 @@ promotion_cmd(unit * u, struct order * ord)
{ {
int money, people; int money, people;
if (fval(u, UFL_HERO)) {
/* TODO: message "is already a hero" */
return 0;
}
if (maxheroes(u->faction) < countheroes(u->faction)+u->number) { if (maxheroes(u->faction) < countheroes(u->faction)+u->number) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "heroes_maxed", "max count", ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "heroes_maxed", "max count",
maxheroes(u->faction), countheroes(u->faction))); maxheroes(u->faction), countheroes(u->faction)));
@ -3803,9 +3808,8 @@ warn_password(void)
} }
void void
processorders (void) init_processor(void)
{ {
region *r;
int p; int p;
p = 10; p = 10;
@ -3962,7 +3966,18 @@ processorders (void)
p+=10; p+=10;
add_proc_global(p, &renumber_factions, "Neue Nummern"); add_proc_global(p, &renumber_factions, "Neue Nummern");
}
void
processorders (void)
{
static int init = 0;
region *r;
if (!init) {
init_processor();
init = 1;
}
process(); process();
/*************************************************/ /*************************************************/

View file

@ -35,6 +35,8 @@
#include <string.h> #include <string.h>
#undef SUMMARY_BOM /* write a BOM in the summary file */
typedef struct summary { typedef struct summary {
int waffen; int waffen;
int factions; int factions;
@ -149,10 +151,12 @@ report_summary(summary * s, summary * o, boolean full)
} }
F = cfopen(zText, "w"); F = cfopen(zText, "w");
if (!F) return; if (!F) return;
#ifdef SUMMARY_BOM
else { else {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf }; const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F); fwrite(utf8_bom, 1, 3, F);
} }
#endif
printf("Schreibe Zusammenfassung (parteien)...\n"); printf("Schreibe Zusammenfassung (parteien)...\n");
fprintf(F, "%s\n%s\n\n", global.gamename, gamedate2(default_locale)); fprintf(F, "%s\n%s\n\n", global.gamename, gamedate2(default_locale));
fprintf(F, "Auswertung Nr: %d\n\n", turn); fprintf(F, "Auswertung Nr: %d\n\n", turn);

View file

@ -107,7 +107,7 @@ use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
region * r = u->region; region * r = u->region;
int holz = 0; int holz = 0;
/* für die Aufforstung von Mallornwäldern braucht man Mallorn */ /* mallorn is required to make mallorn forests, wood for regular ones */
if (fval(r, RF_MALLORN)) { if (fval(r, RF_MALLORN)) {
holz = use_pooled(u, rt_find("mallorn"), holz = use_pooled(u, rt_find("mallorn"),
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount); GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);