forked from github/server
Unicode WIP, does not compile.
- made battle.c compile and cleaned up a lot of German text. - fixed the create_order command to accept and respect quotes.
This commit is contained in:
parent
6b4ad684af
commit
8be7d65977
|
@ -70,7 +70,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define dbgprintf(a) fprintf a;
|
||||
static FILE *bdebug;
|
||||
#undef DELAYED_OFFENSE /* non-guarding factions cannot attack after moving */
|
||||
|
||||
|
@ -156,20 +155,20 @@ fleeregion(const unit * u)
|
|||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
static char *
|
||||
sidename(side * s, boolean truename)
|
||||
static xmlChar *
|
||||
sidename(side * s)
|
||||
{
|
||||
#define SIDENAMEBUFLEN 256
|
||||
static char sidename_buf[SIDENAMEBUFLEN];
|
||||
|
||||
if(s->stealthfaction && truename == false) {
|
||||
if (s->stealthfaction) {
|
||||
snprintf(sidename_buf, SIDENAMEBUFLEN,
|
||||
"%s", factionname(s->stealthfaction));
|
||||
} else {
|
||||
snprintf(sidename_buf, SIDENAMEBUFLEN,
|
||||
"%s", factionname(s->bf->faction));
|
||||
}
|
||||
return sidename_buf;
|
||||
return (xmlChar *)sidename_buf;
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -224,18 +223,6 @@ armedmen(const unit * u)
|
|||
return n;
|
||||
}
|
||||
|
||||
static void
|
||||
battle_log(const char *s)
|
||||
{
|
||||
#if SHOW_DEBUG
|
||||
puts(s);
|
||||
putc('\n');
|
||||
#endif
|
||||
if (bdebug) {
|
||||
dbgprintf((bdebug, "%s\n", s));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
message_all(battle * b, message * m)
|
||||
{
|
||||
|
@ -255,35 +242,15 @@ message_all(battle * b, message * m)
|
|||
void
|
||||
battlerecord(battle * b, const char *s)
|
||||
{
|
||||
struct message * m = msg_message("msg_battle", "string", s);
|
||||
struct message * m = msg_message("battle_msg", "string", s);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
}
|
||||
|
||||
void
|
||||
battlemsg(battle * b, unit * u, const char * s)
|
||||
{
|
||||
bfaction * bf;
|
||||
struct message * m;
|
||||
plane * p = rplane(b->region);
|
||||
watcher * w;
|
||||
|
||||
sprintf(buf, "%s %s", unitname(u), s);
|
||||
m = msg_message("msg_battle", "string", buf);
|
||||
for (bf=b->factions;bf;bf=bf->next) {
|
||||
message_faction(b, bf->faction, m);
|
||||
}
|
||||
if (p) for (w=p->watchers;w;w=w->next) {
|
||||
for (bf = b->factions;bf;bf=bf->next) if (bf->faction==w->faction) break;
|
||||
if (bf==NULL) message_faction(b, w->faction, m);
|
||||
}
|
||||
msg_release(m);
|
||||
}
|
||||
|
||||
static void
|
||||
fbattlerecord(battle * b, faction * f, const char *s)
|
||||
{
|
||||
message * m = msg_message("msg_battle", "string", s);
|
||||
message * m = msg_message("battle_msg", "string", s);
|
||||
message_faction(b, f, m);
|
||||
msg_release(m);
|
||||
}
|
||||
|
@ -945,7 +912,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
unit *du = df->unit;
|
||||
battle *b = df->side->battle;
|
||||
int heiltrank = 0;
|
||||
char debugbuf[512];
|
||||
|
||||
/* Schild */
|
||||
void **si;
|
||||
|
@ -1054,9 +1020,8 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
kritchance = min(0.9, kritchance);
|
||||
|
||||
while (chance(kritchance)) {
|
||||
if (battledebug) {
|
||||
sprintf(debugbuf, "%s/%d landet einen kritischen Treffer", unitid(au), at.index);
|
||||
battle_log(debugbuf);
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "%s/%d landet einen kritischen Treffer", unitid(au), at.index);
|
||||
}
|
||||
da += dice_rand(damage);
|
||||
}
|
||||
|
@ -1136,11 +1101,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
}
|
||||
}
|
||||
|
||||
if (battledebug) {
|
||||
sprintf(debugbuf, "Verursacht %dTP, Rüstung %d: %d -> %d HP",
|
||||
da, ar, df->person[dt.index].hp, df->person[dt.index].hp - rda);
|
||||
}
|
||||
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
if (rda > 0) {
|
||||
|
@ -1156,8 +1116,9 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
df->person[dt.index].hp -= rda;
|
||||
|
||||
if (df->person[dt.index].hp > 0) { /* Hat überlebt */
|
||||
if (battledebug) {
|
||||
battle_log(debugbuf);
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "Damage %d, armor %d: %d -> %d HP\n",
|
||||
da, ar, df->person[dt.index].hp, df->person[dt.index].hp - rda);
|
||||
}
|
||||
if (au->race == new_race[RC_DAEMON]) {
|
||||
#ifdef TODO_RUNESWORD
|
||||
|
@ -1226,9 +1187,9 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (battledebug) {
|
||||
strcat(debugbuf, ", tot");
|
||||
battle_log(debugbuf);
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "Damage %d, armor %d: %d -> %d HP, tot.\n",
|
||||
da, ar, df->person[dt.index].hp, df->person[dt.index].hp - rda);
|
||||
}
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
|
@ -1519,7 +1480,6 @@ do_combatmagic(battle *b, combatmagic_t was)
|
|||
double power;
|
||||
const spell *sp;
|
||||
const struct locale * lang = mage->faction->locale;
|
||||
char cmd[128];
|
||||
order * ord;
|
||||
|
||||
switch(was) {
|
||||
|
@ -1538,10 +1498,7 @@ do_combatmagic(battle *b, combatmagic_t was)
|
|||
if (sp == NULL)
|
||||
continue;
|
||||
|
||||
snprintf(cmd, 128, "%s \"%s\"",
|
||||
LOC(lang, keywords[K_CAST]), spell_name(sp, lang));
|
||||
|
||||
ord = parse_order(cmd, lang);
|
||||
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
||||
if (cancast(mage, sp, 1, 1, ord) == false) {
|
||||
free_order(ord);
|
||||
continue;
|
||||
|
@ -1616,7 +1573,6 @@ do_combatspell(troop at)
|
|||
void **mg;
|
||||
order * ord;
|
||||
int sl;
|
||||
char cmd[128];
|
||||
const struct locale * lang = mage->faction->locale;
|
||||
|
||||
sp = get_combatspell(mage, 1);
|
||||
|
@ -1624,9 +1580,7 @@ do_combatspell(troop at)
|
|||
fi->magic = 0; /* Hat keinen Kampfzauber, kämpft nichtmagisch weiter */
|
||||
return;
|
||||
}
|
||||
snprintf(cmd, 128, "%s \"%s\"",
|
||||
LOC(lang, keywords[K_CAST]), spell_name(sp, lang));
|
||||
ord = parse_order(cmd, lang);
|
||||
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
||||
if (cancast(mage, sp, 1, 1, ord) == false) {
|
||||
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
|
||||
return;
|
||||
|
@ -1849,6 +1803,20 @@ attack_message(const troop at, const troop dt, const weapon * wp, int dist)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
debug_hit(troop at, const weapon * awp, troop dt, const weapon * dwp, int skdiff, int dist, boolean success)
|
||||
{
|
||||
fprintf(bdebug, "%.4s/%d [%6s/%d] %s %.4s/%d [%6s/%d] with %d distance %d",
|
||||
unitid(at.fighter->unit), at.index,
|
||||
LOC(default_locale, awp ? resourcename(awp->type->itype->rtype, 0) : "unarmed"),
|
||||
weapon_effskill(at, dt, awp, true, dist>1),
|
||||
success?"hits":"misses",
|
||||
unitid(dt.fighter->unit), dt.index,
|
||||
LOC(default_locale, dwp ? resourcename(dwp->type->itype->rtype, 0) : "unarmed"),
|
||||
weapon_effskill(dt, at, dwp, false, dist>1),
|
||||
skdiff, dist);
|
||||
}
|
||||
|
||||
int
|
||||
hits(troop at, troop dt, weapon * awp)
|
||||
{
|
||||
|
@ -1857,8 +1825,6 @@ hits(troop at, troop dt, weapon * awp)
|
|||
battle * b = at.fighter->side->battle;
|
||||
#endif
|
||||
fighter *af = at.fighter, *df = dt.fighter;
|
||||
unit *au = af->unit, *du = df->unit;
|
||||
char debugbuf[512];
|
||||
const armor_type * armor, * shield;
|
||||
int skdiff = 0;
|
||||
int dist = get_unitrow(af, df->side) + get_unitrow(df, af->side) - 1;
|
||||
|
@ -1889,25 +1855,14 @@ hits(troop at, troop dt, weapon * awp)
|
|||
/* Verteidiger bekommt eine Rüstung */
|
||||
armor = select_armor(dt, true);
|
||||
shield = select_armor(dt, false);
|
||||
sprintf(debugbuf, "%.4s/%d [%6s/%d] attackiert %.4s/%d [%6s/%d] mit %d dist %d",
|
||||
unitid(au), at.index,
|
||||
(awp != NULL) ?
|
||||
locale_string(default_locale, resourcename(awp->type->itype->rtype, 0)) : "unbewaffnet",
|
||||
weapon_effskill(at, dt, awp, true, dist>1),
|
||||
unitid(du), dt.index,
|
||||
(dwp != NULL) ?
|
||||
locale_string(default_locale, resourcename(dwp->type->itype->rtype, 0)) : "unbewaffnet",
|
||||
weapon_effskill(dt, at, dwp, false, dist>1),
|
||||
skdiff, dist);
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
smallbuf = attack_message(at, dt, awp, dist);
|
||||
}
|
||||
#endif
|
||||
if (contest(skdiff, armor, shield)) {
|
||||
if (battledebug) {
|
||||
strcat(debugbuf, " und trifft.");
|
||||
battle_log(debugbuf);
|
||||
if (bdebug) {
|
||||
debug_hit(at, awp, dt, dwp, skdiff, dist, true);
|
||||
}
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
|
@ -1917,9 +1872,8 @@ hits(troop at, troop dt, weapon * awp)
|
|||
#endif
|
||||
return 1;
|
||||
}
|
||||
if (battledebug) {
|
||||
strcat(debugbuf, ".");
|
||||
battle_log(debugbuf);
|
||||
if (bdebug) {
|
||||
debug_hit(at, awp, dt, dwp, skdiff, dist, false);
|
||||
}
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
|
@ -2114,9 +2068,8 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
}
|
||||
if (reload && wp && wp->type->reload && !getreload(ta)) {
|
||||
int i = setreload(ta);
|
||||
if (battledebug) {
|
||||
sprintf(buf, " Nachladen gesetzt: %d", i);
|
||||
battle_log(buf);
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, " reloading %d turns\n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2712,9 +2665,9 @@ aftermath(battle * b)
|
|||
/* Beute verteilen */
|
||||
for (l=df->loot; l; l=l->next) {
|
||||
const item_type * itype = l->type;
|
||||
sprintf(buf, "%s erbeute%s %d %s.", unitname(du), du->number==1?"t":"n",
|
||||
l->number, locale_string(default_locale, resourcename(itype->rtype, l->number!=1)));
|
||||
fbattlerecord(b, du->faction, buf);
|
||||
message * m = msg_message("battle_loot", "unit amount item", du, l->number, itype->rtype);
|
||||
message_faction(b, du->faction, m);
|
||||
msg_release(m);
|
||||
i_change(&du->items, itype, l->number);
|
||||
}
|
||||
|
||||
|
@ -2752,12 +2705,11 @@ aftermath(battle * b)
|
|||
free(trollsave);
|
||||
#endif
|
||||
|
||||
if (battledebug) {
|
||||
sprintf(buf, "The battle lasted %d turns, %s and %s.\n",
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "The battle lasted %d turns, %s and %s.\n",
|
||||
b->turn,
|
||||
b->has_tactics_turn==true?"had a tactic turn":"had no tactic turn",
|
||||
battle_was_relevant==true?"was relevant":"was not relevant.");
|
||||
battle_log(buf);
|
||||
b->has_tactics_turn?"had a tactic turn":"had no tactic turn",
|
||||
battle_was_relevant?"was relevant":"was not relevant.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2774,8 +2726,8 @@ battle_punit(unit * u, battle * b)
|
|||
spunit(&S, f, u, 4, see_battle);
|
||||
for (x = S; x; x = x->next) {
|
||||
fbattlerecord(b, f, x->s);
|
||||
if (battledebug && u->faction == f) {
|
||||
battle_log(x->s);
|
||||
if (bdebug && u->faction == f) {
|
||||
fputs(x->s, bdebug);
|
||||
}
|
||||
}
|
||||
if (S)
|
||||
|
@ -2824,26 +2776,29 @@ static void
|
|||
print_header(battle * b)
|
||||
{
|
||||
bfaction * bf;
|
||||
char zText[1024];
|
||||
|
||||
for (bf=b->factions;bf;bf=bf->next) {
|
||||
message * m;
|
||||
faction * f = bf->faction;
|
||||
const char * lastf = NULL;
|
||||
const xmlChar * lastf = NULL;
|
||||
boolean first = false;
|
||||
side * s;
|
||||
size_t size;
|
||||
|
||||
buf[0] = 0;
|
||||
zText[0] = 0;
|
||||
size = sizeof(zText);
|
||||
for (s=b->sides; s; s=s->next) {
|
||||
fighter *df;
|
||||
for (df=s->fighters;df;df=df->next) {
|
||||
if (is_attacker(df)) {
|
||||
if (first) strcat(buf, ", ");
|
||||
if (first) size -= strlcat(zText, ", ", size);
|
||||
if (lastf) {
|
||||
strcat(buf, lastf);
|
||||
size -= strlcat(zText, (const char *)lastf, size);
|
||||
first = true;
|
||||
}
|
||||
if (seematrix(f, s) == true)
|
||||
lastf = sidename(s, false);
|
||||
lastf = sidename(s);
|
||||
else
|
||||
lastf = LOC(f->locale, "unknown_faction_dative");
|
||||
break;
|
||||
|
@ -2851,13 +2806,13 @@ print_header(battle * b)
|
|||
}
|
||||
}
|
||||
if (first) {
|
||||
strcat(buf, " ");
|
||||
strcat(buf, LOC(f->locale, "and"));
|
||||
strcat(buf, " ");
|
||||
size -= strlcat(zText, " ", size);
|
||||
size -= strlcat(zText, (const char *)LOC(f->locale, "and"), size);
|
||||
size -= strlcat(zText, " ", size);
|
||||
}
|
||||
if (lastf) strcat(buf, lastf);
|
||||
if (lastf) size -= strlcat(zText, (const char *)lastf, size);
|
||||
|
||||
m = msg_message("battle::starters", "factions", buf);
|
||||
m = msg_message("battle::starters", "factions", zText);
|
||||
message_faction(b, f, m);
|
||||
msg_release(m);
|
||||
}
|
||||
|
@ -2871,23 +2826,25 @@ print_stats(battle * b)
|
|||
int i = 0;
|
||||
for (s=b->sides;s;s=s->next) {
|
||||
bfaction *bf;
|
||||
char *k;
|
||||
|
||||
++i;
|
||||
|
||||
for (bf=b->factions;bf;bf=bf->next) {
|
||||
faction * f = bf->faction;
|
||||
const char * loc_army = LOC(f->locale, "battle_army");
|
||||
const xmlChar * loc_army = LOC(f->locale, "battle_army");
|
||||
char * bufp;
|
||||
const xmlChar * header;
|
||||
size_t rsize, size;
|
||||
int komma;
|
||||
const xmlChar * sname = seematrix(f, s) ? sidename(s) : LOC(f->locale, "unknown_faction");
|
||||
message * msg;
|
||||
char buf[1024];
|
||||
|
||||
fbattlerecord(b, f, " ");
|
||||
|
||||
slprintf(buf, sizeof(buf), "%s %d: %s", loc_army, army_index(s),
|
||||
seematrix(f, s) ? sidename(s, false) : LOC(f->locale, "unknown_faction"));
|
||||
fbattlerecord(b, f, buf);
|
||||
msg = msg_message("msg_army", "index name", army_index(s), sname);
|
||||
message_faction(b, f, msg);
|
||||
msg_release(msg);
|
||||
|
||||
bufp = buf;
|
||||
size = sizeof(buf);
|
||||
|
@ -2898,7 +2855,7 @@ print_stats(battle * b)
|
|||
if (enemy(s2, s)) {
|
||||
const char * abbrev = seematrix(f, s2)?sideabkz(s2, false):"-?-";
|
||||
rsize = slprintf(bufp, size, "%s %s %d(%s)",
|
||||
komma++ ? "," : header, loc_army, army_index(s2), abbrev);
|
||||
komma++ ? "," : (const char*)header, loc_army, army_index(s2), abbrev);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
@ -2915,7 +2872,7 @@ print_stats(battle * b)
|
|||
if (friendly(s2, s)) {
|
||||
const char * abbrev = seematrix(f, s2)?sideabkz(s2, false):"-?-";
|
||||
rsize = slprintf(bufp, size, "%s %s %d(%s)",
|
||||
komma++ ? "," : header, loc_army, army_index(s2), abbrev);
|
||||
komma++ ? "," : (const char*)header, loc_army, army_index(s2), abbrev);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
bufp += rsize;
|
||||
|
@ -2931,7 +2888,7 @@ print_stats(battle * b)
|
|||
for (s2=b->sides;s2;s2=s2->next) {
|
||||
if (s->relations[s2->index] & E_ATTACKING) {
|
||||
const char * abbrev = seematrix(f, s2)?sideabkz(s2, false):"-?-";
|
||||
rsize = slprintf(bufp, size, "%s %s %d(%s)", komma++ ? "," : header, loc_army,
|
||||
rsize = slprintf(bufp, size, "%s %s %d(%s)", komma++ ? "," : (const char*)header, loc_army,
|
||||
army_index(s2), abbrev);
|
||||
if (rsize>size) rsize = size-1;
|
||||
size -= rsize;
|
||||
|
@ -2940,17 +2897,14 @@ print_stats(battle * b)
|
|||
}
|
||||
if (komma) fbattlerecord(b, f, buf);
|
||||
}
|
||||
buf[77] = (char)0;
|
||||
for (k = buf; *k; ++k) *k = '-';
|
||||
battlerecord(b, buf);
|
||||
if (battledebug && s->bf->faction) {
|
||||
|
||||
if (bdebug && s->bf->faction) {
|
||||
if (s->bf->faction->alliance) {
|
||||
slprintf(buf, sizeof(buf), "##### %s (%s/%d)", s->bf->faction->name, itoa36(s->bf->faction->no),
|
||||
fprintf(bdebug, "##### %s (%s/%d)\n", s->bf->faction->name, itoa36(s->bf->faction->no),
|
||||
s->bf->faction->alliance?s->bf->faction->alliance->id:0);
|
||||
} else {
|
||||
slprintf(buf, sizeof(buf), "##### %s (%s)", s->bf->faction->name, itoa36(s->bf->faction->no));
|
||||
fprintf(bdebug, "##### %s (%s)\n", s->bf->faction->name, itoa36(s->bf->faction->no));
|
||||
}
|
||||
battle_log(buf);
|
||||
}
|
||||
print_fighters(b, s);
|
||||
}
|
||||
|
@ -3018,16 +2972,10 @@ make_fighter(battle * b, unit * u, side * s1, boolean attack)
|
|||
const group * g = NULL;
|
||||
const attrib *a = a_find(u->attribs, &at_otherfaction);
|
||||
const faction *stealthfaction = a?get_otherfaction(a):NULL;
|
||||
static const struct item_type * it_demonseye;
|
||||
static boolean init = false;
|
||||
unsigned int flags = 0;
|
||||
|
||||
assert(u->number);
|
||||
if (fval(u, UFL_PARTEITARNUNG)!=0) flags |= SIDE_STEALTH;
|
||||
if (!init) {
|
||||
it_demonseye = it_find("demonseye");
|
||||
init=true;
|
||||
}
|
||||
|
||||
if (fval(u, UFL_GROUP)) {
|
||||
const attrib * agroup = a_find(u->attribs, &at_group);
|
||||
|
@ -3213,17 +3161,6 @@ make_fighter(battle * b, unit * u, side * s1, boolean attack)
|
|||
}
|
||||
}
|
||||
|
||||
if (it_demonseye && i_get(u->items, it_demonseye)) {
|
||||
char lbuf[80];
|
||||
const char * s = LOC(default_locale, rc_name(u->race, 3));
|
||||
char * c = lbuf;
|
||||
while (*s) *c++ = (char)toupper(*s++);
|
||||
*c = 0;
|
||||
fig->person[0].hp = unit_max_hp(u) * 3;
|
||||
slprintf(buf, sizeof(buf), "Eine Stimme ertönt über dem Schlachtfeld. 'DIESES %sKIND IST MEIN. IHR SOLLT ES NICHT HABEN.'. Eine leuchtende Aura umgibt %s", lbuf, unitname(u));
|
||||
battlerecord(b, buf);
|
||||
}
|
||||
|
||||
s1->size[statusrow(fig->status)] += u->number;
|
||||
s1->size[SUM_ROW] += u->number;
|
||||
if (u->race->battle_flags & BF_NOBLOCK) {
|
||||
|
@ -3379,7 +3316,7 @@ make_battle(region * r)
|
|||
bdebug = fopen(zFilename, "w");
|
||||
if (!bdebug) log_error(("battles können nicht debugged werden\n"));
|
||||
else {
|
||||
dbgprintf((bdebug, "In %s findet ein Kampf statt:\n", rname(r, NULL)));
|
||||
fprintf(bdebug, "In %s findet ein Kampf statt:\n", rname(r, NULL));
|
||||
}
|
||||
obs_count++;
|
||||
}
|
||||
|
@ -3503,8 +3440,6 @@ battle_report(battle * b)
|
|||
boolean komma;
|
||||
bfaction *bf;
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
for (s=b->sides; s; s=s->next) {
|
||||
for(s2=b->sides; s2; s2=s2->next) {
|
||||
if (s->alive-s->removed > 0 && s2->alive-s2->removed > 0 && enemy(s, s2)) {
|
||||
|
@ -3520,6 +3455,7 @@ battle_report(battle * b)
|
|||
|
||||
for (bf=b->factions;bf;bf=bf->next) {
|
||||
faction * fac = bf->faction;
|
||||
char buf[1024];
|
||||
char * bufp = buf;
|
||||
size_t size = sizeof(buf), rsize;
|
||||
message * m;
|
||||
|
@ -3537,7 +3473,7 @@ battle_report(battle * b)
|
|||
int r, k = 0, * alive = get_alive(s);
|
||||
int l = FIGHT_ROW;
|
||||
const char * abbrev = seematrix(fac, s)?sideabkz(s, false):"-?-";
|
||||
const char * loc_army = LOC(fac->locale, "battle_army");
|
||||
const xmlChar * loc_army = LOC(fac->locale, "battle_army");
|
||||
char buffer[32];
|
||||
|
||||
if (komma) {
|
||||
|
@ -3799,15 +3735,12 @@ init_battle(region * r, battle **bp)
|
|||
if (fval(u, UFL_LONGACTION)) continue;
|
||||
|
||||
if (peace_ct && curse_active(get_curse(r->attribs, peace_ct))) {
|
||||
sprintf(buf, "Hier ist es so schön friedlich, %s möchte "
|
||||
"hier niemanden angreifen.", unitname(u));
|
||||
mistake(u, ord, buf, MSG_BATTLE);
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "peace_active", ""));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (slave_ct && curse_active(get_curse(u->attribs, slave_ct))) {
|
||||
sprintf(buf, "%s kämpft nicht.", unitname(u));
|
||||
mistake(u, ord, buf, MSG_BATTLE);
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "slave_active", ""));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3848,13 +3781,7 @@ init_battle(region * r, battle **bp)
|
|||
cmistake(u, ord, 47, MSG_BATTLE);
|
||||
continue;
|
||||
}
|
||||
/* xmas */
|
||||
if (u2->no==atoi36("xmas") && u2->irace==new_race[RC_GNOME]) {
|
||||
a_add(&u->attribs, a_new(&at_key))->data.i = atoi36("coal");
|
||||
sprintf(buf, "%s ist böse gewesen...", unitname(u));
|
||||
mistake(u, ord, buf, MSG_BATTLE);
|
||||
continue;
|
||||
} if (u2->faction->age < NewbieImmunity()) {
|
||||
if (u2->faction->age < NewbieImmunity()) {
|
||||
add_message(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "newbie_immunity_error", "turns", NewbieImmunity()));
|
||||
continue;
|
||||
|
@ -3901,10 +3828,9 @@ init_battle(region * r, battle **bp)
|
|||
c1->side->bf->attacker = true;
|
||||
|
||||
set_enemy(c1->side, c2->side, true);
|
||||
if (battledebug && !enemy(c1->side, c2->side)) {
|
||||
sprintf(buf, "%s attackiert %s", sidename(c1->side, false),
|
||||
sidename(c2->side, false));
|
||||
battle_log(buf);
|
||||
if (bdebug && !enemy(c1->side, c2->side)) {
|
||||
fprintf(bdebug, "%s attacks %s\n", sidename(c1->side),
|
||||
sidename(c2->side));
|
||||
}
|
||||
fighting = true;
|
||||
}
|
||||
|
@ -4098,10 +4024,8 @@ battle_flee(battle * b)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if (battledebug && runners > 0) {
|
||||
char lbuf[256];
|
||||
sprintf(lbuf, "Flucht: %d aus %s", runners, itoa36(fig->unit->no));
|
||||
battle_log(lbuf);
|
||||
if (bdebug && runners > 0) {
|
||||
fprintf(bdebug, "Fleeing: %d from %s\n", runners, itoa36(fig->unit->no));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4172,10 +4096,8 @@ do_battle(region * r)
|
|||
#endif
|
||||
|
||||
for (;battle_report(b) && b->turn<=COMBAT_TURNS;++b->turn) {
|
||||
if (battledebug) {
|
||||
char lbuf[256];
|
||||
sprintf(lbuf, "*** Runde: %d", b->turn);
|
||||
battle_log(lbuf);
|
||||
if (bdebug) {
|
||||
fprintf(bdebug, "*** Turn: %d\n", b->turn);
|
||||
}
|
||||
battle_flee(b);
|
||||
battle_update(b);
|
||||
|
|
|
@ -238,7 +238,6 @@ extern "C" {
|
|||
extern troop select_enemy(struct fighter * af, int minrow, int maxrow, int select);
|
||||
extern int count_enemies(struct battle * b, const struct fighter * af, int minrow, int maxrow, int select);
|
||||
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
|
||||
extern void battlemsg(battle * b, struct unit * u, const char * s);
|
||||
extern void battlerecord(battle * b, const char *s);
|
||||
extern void message_all(battle * b, struct message * m);
|
||||
extern void message_faction(battle * b, struct faction * f, struct message * m);
|
||||
|
|
|
@ -1646,13 +1646,19 @@ largestbuilding (const region * r, boolean img)
|
|||
return best;
|
||||
}
|
||||
|
||||
const char *
|
||||
xmlChar *
|
||||
write_unitname(const unit * u, xmlChar * buffer, size_t size)
|
||||
{
|
||||
snprintf((char*)buffer, size, "%s (%s)", (const char*)u->name, itoa36(u->no));
|
||||
buffer[size-1] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const xmlChar *
|
||||
unitname(const unit * u)
|
||||
{
|
||||
char *ubuf = idbuf[(++nextbuf) % 8];
|
||||
snprintf(ubuf, sizeof(name), "%s (%s)", u->name, itoa36(u->no));
|
||||
ubuf[sizeof(name)-1] = 0;
|
||||
return ubuf;
|
||||
return write_unitname(u, (xmlChar*)ubuf, sizeof(name));
|
||||
}
|
||||
|
||||
/* -- Erschaffung neuer Einheiten ------------------------------ */
|
||||
|
@ -2074,7 +2080,7 @@ init_locale(const struct locale * lang)
|
|||
|
||||
tokens = get_translations(lang, UT_TERRAINS);
|
||||
for (terrain=terrains();terrain!=NULL;terrain=terrain->next) {
|
||||
var.v = terrain;
|
||||
var.v = (void*)terrain;
|
||||
addtoken(tokens, LOC(lang, terrain->_name), var);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,7 +258,8 @@ struct region *findunitregion(const struct unit * su);
|
|||
|
||||
char *estring(const char *s);
|
||||
char *cstring(const char *s);
|
||||
const char *unitname(const struct unit * u);
|
||||
extern const xmlChar *unitname(const struct unit * u);
|
||||
extern xmlChar * write_unitname(const struct unit * u, xmlChar * buffer, size_t size);
|
||||
|
||||
struct building *largestbuilding(const struct region * r, boolean img);
|
||||
|
||||
|
|
|
@ -267,6 +267,7 @@ create_order(keyword_t kwd, const struct locale * lang, const char * params, ...
|
|||
va_list marker;
|
||||
char zBuffer[DISPLAYSIZE];
|
||||
char * sptr = zBuffer;
|
||||
char quote = 0;
|
||||
|
||||
va_start(marker, params);
|
||||
while (params) {
|
||||
|
@ -275,8 +276,18 @@ create_order(keyword_t kwd, const struct locale * lang, const char * params, ...
|
|||
case ' ':
|
||||
/* ignore these, they are syntactical sugar */
|
||||
break;
|
||||
case '"':
|
||||
case '\'':
|
||||
*sptr++ = *params;
|
||||
if (!quote) quote = *params;
|
||||
else if (quote==*params) {
|
||||
quote = 0;
|
||||
*sptr++ = ' ';
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
sptr += strlcpy(sptr, va_arg(marker, const char *), sizeof(zBuffer)-(sptr-zBuffer));
|
||||
if (!quote) *sptr++ = ' ';
|
||||
break;
|
||||
case 'd':
|
||||
sptr += strlcpy(sptr, itoa10(va_arg(marker, int)), sizeof(zBuffer)-(sptr-zBuffer));
|
||||
|
|
|
@ -35,6 +35,7 @@ typedef struct order {
|
|||
} order;
|
||||
|
||||
/* constructor */
|
||||
extern order * create_order(keyword_t kwd, const struct locale * lang, const char * params, ...);
|
||||
extern order * parse_order(const xmlChar * s, const struct locale * lang);
|
||||
extern void replace_order(order ** dst, order * orig, const order * src);
|
||||
|
||||
|
|
|
@ -267,20 +267,16 @@ sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
|||
battle *b = fi->side->battle;
|
||||
cvector *fgs;
|
||||
void **fig;
|
||||
int force;
|
||||
int force = lovar(power * 15);
|
||||
int k = 0;
|
||||
|
||||
/* Immer aus der ersten Reihe nehmen */
|
||||
static const char * msgt[] = {
|
||||
"ruft ein fürchterliches Unwetter über seine Feinde, doch es gab niemanden mehr, den dies treffen konnte.",
|
||||
"ruft ein fürchterliches Unwetter über seine Feinde, doch der magische Regen zeigt keinen Effekt.",
|
||||
"ruft ein fürchterliches Unwetter über seine Feinde, Der magischen Regen lässt alles Eisen rosten."
|
||||
};
|
||||
unused(sp);
|
||||
|
||||
force = lovar(power * 15);
|
||||
|
||||
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW-1, SELECT_ADVANCE|SELECT_FIND)) {
|
||||
battlemsg(b, fi->unit, msgt[0]);
|
||||
message * msg = msg_message("rust_effect_0", "mage", fi->unit);
|
||||
message_all(b, msg);
|
||||
msg_release(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -339,11 +335,15 @@ sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
|||
|
||||
if (k == 0) {
|
||||
/* keine Waffen mehr da, die zerstört werden könnten */
|
||||
battlemsg(b, fi->unit, msgt[1]);
|
||||
message * msg = msg_message("rust_effect_1", "mage", fi->unit);
|
||||
message_all(b, msg);
|
||||
msg_release(msg);
|
||||
fi->magic = 0; /* kämpft nichtmagisch weiter */
|
||||
level = 0;
|
||||
} else {
|
||||
battlemsg(b, fi->unit, msgt[2]);
|
||||
message * msg = msg_message("rust_effect_2", "mage", fi->unit);
|
||||
message_all(b, msg);
|
||||
msg_release(msg);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <kernel/curse.h>
|
||||
#include <util/nrmessage.h>
|
||||
#include <util/bsdstring.h>
|
||||
|
||||
struct curse_type;
|
||||
extern void ct_register(const struct curse_type * ct);
|
||||
|
@ -544,6 +545,7 @@ sp_summon_familiar(castorder *co)
|
|||
direction_t d;
|
||||
message * msg;
|
||||
xmlChar zText[NAMESIZE];
|
||||
size_t size;
|
||||
|
||||
if (get_familiar(mage) != NULL ) {
|
||||
cmistake(mage, co->order, 199, MSG_MAGIC);
|
||||
|
@ -591,6 +593,7 @@ sp_summon_familiar(castorder *co)
|
|||
if (rc->bonus[sk] > -5) dh++;
|
||||
}
|
||||
zText[0] = 0;
|
||||
size = sizeof(zText);
|
||||
for (sk=0;sk<MAXSKILLS;sk++) {
|
||||
if (rc->bonus[sk] > -5) {
|
||||
dh--;
|
||||
|
@ -598,12 +601,12 @@ sp_summon_familiar(castorder *co)
|
|||
dh1 = 1;
|
||||
} else {
|
||||
if (dh == 0) {
|
||||
strncat((char*)zText, (const char*)LOC(mage->faction->locale, "list_and"), sizeof(zText));
|
||||
size -= strlcat((char*)zText, (const char*)LOC(mage->faction->locale, "list_and"), size);
|
||||
} else {
|
||||
strncat((char*)zText, (const char*)", ", sizeof(zText));
|
||||
size -= strlcat((char*)zText, (const char*)", ", size);
|
||||
}
|
||||
}
|
||||
strncat((char*)zText, (const char*)skillname(sk, mage->faction->locale), sizeof(zText));
|
||||
size -= strlcat((char*)zText, (const char*)skillname(sk, mage->faction->locale), size);
|
||||
}
|
||||
}
|
||||
ADDMSG(&mage->faction->msgs, msg_message("familiar_describe",
|
||||
|
|
|
@ -6955,4 +6955,9 @@
|
|||
<text locale="en">An alp died before it reached its target.</text>
|
||||
</string>
|
||||
|
||||
<string name="unarmed">
|
||||
<text locale="de">unbewaffnet</text>
|
||||
<text locale="en">unarmed</text>
|
||||
</string>
|
||||
|
||||
</strings>
|
||||
|
|
|
@ -1060,6 +1060,27 @@
|
|||
<text locale="de">"Ein Alp hat sein Opfer gefunden und springt auf den Rücken von $unit($target)!"</text>
|
||||
</message>
|
||||
|
||||
<message name="rust_effect_0" section="events">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) ruft ein fürchterliches Unwetter über seine Feinde, doch es gab niemanden mehr, den dies treffen konnte."</text>
|
||||
</message>
|
||||
|
||||
<message name="rust_effect_1" section="events">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) ruft ein fürchterliches Unwetter über seine Feinde, doch der magische Regen zeigt keinen Effekt."</text>
|
||||
</message>
|
||||
|
||||
<message name="rust_effect_2" section="events">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) ruft ein fürchterliches Unwetter über seine Feinde, Der magischen Regen lässt alles Eisen rosten."</text>
|
||||
</message>
|
||||
|
||||
<message name="summon_alp_effect" section="events">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
|
@ -1272,13 +1293,21 @@
|
|||
<text locale="fr">"$unit($unit) hit $int($hits) times and killed $int($kills) enemies."</text>
|
||||
<text locale="en">"$unit($unit) hit $int($hits) times and killed $int($kills) enemies."</text>
|
||||
</message>
|
||||
<message name="msg_battle" section="battle">
|
||||
<message name="battle_msg" section="battle">
|
||||
<type>
|
||||
<arg name="string" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$string"</text>
|
||||
<text locale="en">"$string"</text>
|
||||
</message>
|
||||
<message name="battle_army" section="battle">
|
||||
<type>
|
||||
<arg name="index" type="int"/>
|
||||
<arg name="name" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Heer $int($index): $name"</text>
|
||||
<text locale="en">"Army $int($index): $name"</text>
|
||||
</message>
|
||||
<message name="sp_bloodsacrifice_effect" section="magic">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -7599,4 +7628,34 @@
|
|||
<text locale="en">"$unit($unit) is stricken by a strange disease."</text>
|
||||
</message>
|
||||
|
||||
<message name="battle_loot" section="battle">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="amount" type="int"/>
|
||||
<arg name="item" type="resource"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) erbeutet $int($amount) $resource($item,$amount)."</text>
|
||||
<text locale="en">"$unit($unit) collects $int($amount) $resource($item,$amount)."</text>
|
||||
</message>
|
||||
|
||||
<message name="peace_active" section="battle">
|
||||
<type>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Es ist so schön friedlich, man möchte hier niemanden angreifen."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - It's so quiet and peaceful, nobody wants to attack anybody right now."</text>
|
||||
</message>
|
||||
|
||||
<message name="slave_active" section="battle">
|
||||
<type>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Diese Einheit kämpft nicht."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - This unit will not fight."</text>
|
||||
</message>
|
||||
|
||||
</messages>
|
||||
|
|
Loading…
Reference in New Issue