forked from github/server
regionsmeldungen privatisiert.
bitte nochmal mit dem lauf von dieser woche testen.
This commit is contained in:
parent
b575761264
commit
389a3adb18
|
@ -57,6 +57,7 @@
|
||||||
#include <attrib.h>
|
#include <attrib.h>
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
|
#include <util/message.h>
|
||||||
|
|
||||||
/* libs includes */
|
/* libs includes */
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -1014,10 +1015,10 @@ forgetskill(unit * u)
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
|
|
||||||
if ((talent = findskill(s, u->faction->locale)) != NOSKILL) {
|
if ((talent = findskill(s, u->faction->locale)) != NOSKILL) {
|
||||||
|
struct message * m = add_message(&u->faction->msgs,
|
||||||
|
msg_message("forget", "unit skill", u, talent));
|
||||||
|
msg_release(m);
|
||||||
set_skill(u, talent, 0);
|
set_skill(u, talent, 0);
|
||||||
/* sprintf(buf, "%s vergißt das Talent %s.", u, talent); */
|
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
|
||||||
"forget%u:unit%t:skill", u, talent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,10 +1031,11 @@ report_donations(void)
|
||||||
for (sp = spenden; sp; sp = sp->next) {
|
for (sp = spenden; sp; sp = sp->next) {
|
||||||
region * r = sp->region;
|
region * r = sp->region;
|
||||||
if (sp->betrag > 0) {
|
if (sp->betrag > 0) {
|
||||||
add_message(&r->msgs, new_message(sp->f1,
|
struct message * msg = msg_message("donation",
|
||||||
"donation%f:from%f:to%i:amount", sp->f1, sp->f2, sp->betrag));
|
"from to amount", sp->f1, sp->f2, sp->betrag);
|
||||||
add_message(&r->msgs, new_message(sp->f2,
|
r_addmessage(r, sp->f1, msg);
|
||||||
"donation%f:from%f:to%i:amount", sp->f1, sp->f2, sp->betrag));
|
r_addmessage(r, sp->f2, msg);
|
||||||
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1112,8 +1114,9 @@ maintain(building * b, boolean full)
|
||||||
}
|
}
|
||||||
if (paid && c>0) {
|
if (paid && c>0) {
|
||||||
/* TODO: wieviel von was wurde bezahlt */
|
/* TODO: wieviel von was wurde bezahlt */
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
message * msg = add_message(&u->faction->msgs,
|
||||||
"maintenance%u:unit%b:building", u, b));
|
msg_message("maintenance", "unit building", u, b));
|
||||||
|
msg_release(msg);
|
||||||
fset(b, BLD_MAINTAINED);
|
fset(b, BLD_MAINTAINED);
|
||||||
if (work) fset(b, BLD_WORKING);
|
if (work) fset(b, BLD_WORKING);
|
||||||
for (c=0;b->type->maintenance[c].number;++c) {
|
for (c=0;b->type->maintenance[c].number;++c) {
|
||||||
|
@ -1143,8 +1146,9 @@ maintain(building * b, boolean full)
|
||||||
assert(cost==0);
|
assert(cost==0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
message * msg = add_message(&u->faction->msgs,
|
||||||
"maintenancefail%u:unit%b:building", u, b));
|
msg_message("maintenancefail", "unit building", u, b));
|
||||||
|
msg_release(msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1200,6 +1204,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
add_message(&f->msgs, msg);
|
add_message(&f->msgs, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
msg_release(msg);
|
||||||
destroy_building(b);
|
destroy_building(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1220,7 +1225,7 @@ maintain_buildings(boolean crash)
|
||||||
struct message * msg = msg_message("nomaintenance", "building", b);
|
struct message * msg = msg_message("nomaintenance", "building", b);
|
||||||
if (u) {
|
if (u) {
|
||||||
add_message(&u->faction->msgs, msg);
|
add_message(&u->faction->msgs, msg);
|
||||||
add_message(&r->msgs, msg);
|
r_addmessage(r, u->faction, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
#include <goodies.h>
|
#include <goodies.h>
|
||||||
#include <rand.h>
|
#include <rand.h>
|
||||||
|
#include <util/message.h>
|
||||||
|
|
||||||
#ifdef AT_OPTION
|
#ifdef AT_OPTION
|
||||||
/* attributes includes */
|
/* attributes includes */
|
||||||
|
@ -521,8 +522,9 @@ peasants(region * r)
|
||||||
dead++;
|
dead++;
|
||||||
|
|
||||||
if(dead > 0) {
|
if(dead > 0) {
|
||||||
|
message * msg = add_message(&r->msgs, msg_message("phunger", "dead", dead));
|
||||||
|
msg_release(msg);
|
||||||
peasants -= dead;
|
peasants -= dead;
|
||||||
add_message(&r->msgs, new_message(NULL, "phunger%i:dead", dead));
|
|
||||||
}
|
}
|
||||||
rsetpeasants(r, peasants);
|
rsetpeasants(r, peasants);
|
||||||
}
|
}
|
||||||
|
@ -1398,7 +1400,6 @@ deliverMail(faction * f, region * r, unit * u, const char *s, unit * receiver)
|
||||||
{
|
{
|
||||||
char message[DISPLAYSIZE + 1];
|
char message[DISPLAYSIZE + 1];
|
||||||
|
|
||||||
|
|
||||||
strcpy(message, strcheck(s, DISPLAYSIZE));
|
strcpy(message, strcheck(s, DISPLAYSIZE));
|
||||||
|
|
||||||
if (!receiver) { /* BOTSCHAFT an PARTEI */
|
if (!receiver) { /* BOTSCHAFT an PARTEI */
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <rand.h>
|
#include <rand.h>
|
||||||
|
#include <util/message.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -959,7 +960,7 @@ randomevents(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
building *b, *b2;
|
building *b, *b2;
|
||||||
unit *u, *u2;
|
unit *u;
|
||||||
int n;
|
int n;
|
||||||
int unfed;
|
int unfed;
|
||||||
|
|
||||||
|
@ -1158,15 +1159,9 @@ randomevents(void)
|
||||||
if (rc && rpeasants(rc) > 0 && !fval(rc, RF_ORCIFIED)) chance += 2;
|
if (rc && rpeasants(rc) > 0 && !fval(rc, RF_ORCIFIED)) chance += 2;
|
||||||
}
|
}
|
||||||
if (rand()%100 < chance) {
|
if (rand()%100 < chance) {
|
||||||
|
message * msg = add_message(&r->msgs, msg_message("deorcified", "region", r));
|
||||||
|
msg_release(msg);
|
||||||
freset(r, RF_ORCIFIED);
|
freset(r, RF_ORCIFIED);
|
||||||
for (u2 = r->units; u2; u2 = u2->next ) freset(u2->faction, FL_DH);
|
|
||||||
for (u2 = r->units; u2; u2 = u2->next ) {
|
|
||||||
if (!fval(u2->faction, FL_DH)) {
|
|
||||||
add_message(&r->msgs, new_message(u2->faction,
|
|
||||||
"deorcified%r:region", r));
|
|
||||||
fset(u2->faction, FL_DH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
attrib *a = a_find(r->attribs, &at_orcification);
|
attrib *a = a_find(r->attribs, &at_orcification);
|
||||||
|
@ -1177,14 +1172,7 @@ randomevents(void)
|
||||||
if (rand()%100 < chance) {
|
if (rand()%100 < chance) {
|
||||||
fset(r, RF_ORCIFIED);
|
fset(r, RF_ORCIFIED);
|
||||||
a_remove(&r->attribs, a);
|
a_remove(&r->attribs, a);
|
||||||
for (u2 = r->units; u2; u2 = u2->next) freset(u2->faction, FL_DH);
|
add_message(&r->msgs, msg_message("orcified", "region", r));
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
|
||||||
if (!fval(u2->faction, FL_DH)) {
|
|
||||||
add_message(&r->msgs, new_message(u2->faction,
|
|
||||||
"orcified%r:region", r));
|
|
||||||
fset(u2->faction, FL_DH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
a->data.i -= max(10,a->data.i/10);
|
a->data.i -= max(10,a->data.i/10);
|
||||||
if (a->data.i <= 0) a_remove(&r->attribs, a);
|
if (a->data.i <= 0) a_remove(&r->attribs, a);
|
||||||
|
@ -1199,30 +1187,16 @@ randomevents(void)
|
||||||
switch(rterrain(r)) {
|
switch(rterrain(r)) {
|
||||||
case T_VOLCANO:
|
case T_VOLCANO:
|
||||||
if (rand()%100 < 5) {
|
if (rand()%100 < 5) {
|
||||||
|
message * msg = add_message(&r->msgs, msg_message("volcanostartsmoke", "region", r));
|
||||||
|
msg_release(msg);
|
||||||
rsetterrain(r, T_VOLCANO_SMOKING);
|
rsetterrain(r, T_VOLCANO_SMOKING);
|
||||||
/* Meldungen generieren */
|
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
|
||||||
for (u = r->units; u; u = u->next ) {
|
|
||||||
if (!fval(u->faction, FL_DH)) {
|
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
|
||||||
"volcanostartsmoke%r:region", r));
|
|
||||||
fset(u->faction, FL_DH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_VOLCANO_SMOKING:
|
case T_VOLCANO_SMOKING:
|
||||||
if (rand()%100 < 10) {
|
if (rand()%100 < 10) {
|
||||||
|
message * msg = add_message(&r->msgs, msg_message("volcanostopsmoke", "region", r));
|
||||||
|
msg_release(msg);
|
||||||
rsetterrain(r, T_VOLCANO);
|
rsetterrain(r, T_VOLCANO);
|
||||||
/* Meldungen generieren */
|
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
|
||||||
for (u = r->units; u; u = u->next ) {
|
|
||||||
if (!fval(u->faction, FL_DH)) {
|
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
|
||||||
"volcanostopsmoke%r:region", r));
|
|
||||||
fset(u->faction, FL_DH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (rand()%100 < 8) {
|
} else if (rand()%100 < 8) {
|
||||||
volcano_outbreak(r);
|
volcano_outbreak(r);
|
||||||
}
|
}
|
||||||
|
@ -1368,20 +1342,22 @@ randomevents(void)
|
||||||
log_printf("%d %s in %s.\n", u->number,
|
log_printf("%d %s in %s.\n", u->number,
|
||||||
race[u->race].name[1], regionname(r, NULL));
|
race[u->race].name[1], regionname(r, NULL));
|
||||||
|
|
||||||
add_message(&r->msgs, new_message(NULL,
|
{
|
||||||
"undeadrise%r:region", r));
|
message * msg = msg_message("undeadrise", "region amount", r, undead);
|
||||||
|
add_message(&r->msgs, msg);
|
||||||
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
|
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
|
||||||
for (u=r->units;u;u=u->next) {
|
for (u=r->units;u;u=u->next) {
|
||||||
if (fval(u->faction, FL_DH)) continue;
|
if (fval(u->faction, FL_DH)) continue;
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&u->faction->msgs, new_message(NULL,
|
add_message(&u->faction->msgs, msg);
|
||||||
"undeadrise%r:region", r));
|
}
|
||||||
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int i = deathcount(r);
|
int i = deathcount(r);
|
||||||
if (i) {
|
if (i) {
|
||||||
/* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */
|
/* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */
|
||||||
deathcounts(r, (int)(1+i*0.03));
|
deathcounts(r, (int)(-i*0.03));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1405,6 +1381,8 @@ randomevents(void)
|
||||||
if (woodcount(r) >= 40 && rand()%100 < 33) {
|
if (woodcount(r) >= 40 && rand()%100 < 33) {
|
||||||
int trees = rtrees(r);
|
int trees = rtrees(r);
|
||||||
int treemen = rand()%(max(50,trees)/3);
|
int treemen = rand()%(max(50,trees)/3);
|
||||||
|
struct message * msg;
|
||||||
|
|
||||||
treemen = max(25, treemen);
|
treemen = max(25, treemen);
|
||||||
woodcounts(r, -40);
|
woodcounts(r, -40);
|
||||||
trees = max(0, trees-treemen);
|
trees = max(0, trees-treemen);
|
||||||
|
@ -1420,15 +1398,15 @@ randomevents(void)
|
||||||
|
|
||||||
log_printf("%d Ents in %s.\n", u->number, regionname(r, NULL));
|
log_printf("%d Ents in %s.\n", u->number, regionname(r, NULL));
|
||||||
|
|
||||||
add_message(&r->msgs, new_message(NULL,
|
msg = msg_message("entrise", "region amount", r, u->number);
|
||||||
"entrise%r:region", r));
|
add_message(&r->msgs, msg);
|
||||||
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
|
for (u=r->units;u;u=u->next) freset(u->faction, FL_DH);
|
||||||
for (u=r->units;u;u=u->next) {
|
for (u=r->units;u;u=u->next) {
|
||||||
if (fval(u->faction, FL_DH)) continue;
|
if (fval(u->faction, FL_DH)) continue;
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&u->faction->msgs, new_message(NULL,
|
add_message(&u->faction->msgs, msg);
|
||||||
"entrise%r:region", r));
|
|
||||||
}
|
}
|
||||||
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1511,6 +1489,7 @@ void growlaen(void) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
attrib *a=a_new(&at_laen);
|
attrib *a=a_new(&at_laen);
|
||||||
|
struct message * msg = NULL;
|
||||||
a_add(&rl->region->attribs, a);
|
a_add(&rl->region->attribs, a);
|
||||||
rsetlaen(rl->region, add_laen[z]);
|
rsetlaen(rl->region, add_laen[z]);
|
||||||
|
|
||||||
|
@ -1519,11 +1498,12 @@ void growlaen(void) {
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) && eff_skill(u, SK_MINING, rl->region) >= olditemtype[I_EOG]->minskill)
|
if (!fval(u->faction, FL_DH) && eff_skill(u, SK_MINING, rl->region) >= olditemtype[I_EOG]->minskill)
|
||||||
{
|
{
|
||||||
add_message(&rl->region->msgs, new_message(u->faction,
|
if (!msg) msg = msg_message("unveileog", "unit region", u, rl->region);
|
||||||
"unveileog%u:unit%r:region", u, rl->region));
|
r_addmessage(rl->region, u->faction, msg);
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (msg) msg_release(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(add_laen);
|
free(add_laen);
|
||||||
|
|
|
@ -443,34 +443,6 @@ sabotage(region * r, unit * u)
|
||||||
sink_ship(r, sh, buffer, 1, u);
|
sink_ship(r, sh, buffer, 1, u);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if 0
|
|
||||||
case P_BUILDING:
|
|
||||||
if(u->building) {
|
|
||||||
/* TODO: Gebäude zerstören */
|
|
||||||
} else {
|
|
||||||
building *b = getbuilding(r);
|
|
||||||
unit *owner;
|
|
||||||
|
|
||||||
if(!b) {
|
|
||||||
cmistake(u, findorder(u, u->thisorder), 6, MSG_EVENT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
owner = buildingowner(r, b);
|
|
||||||
|
|
||||||
if(owner == NULL || eff_skill(u, SK_STEALTH, r) > wahrnehmung(r,owner->faction) {
|
|
||||||
/* Besser Curse benutzen, einfacher */
|
|
||||||
a = a_add(b->attribs, a_new(&at_sabotaged));
|
|
||||||
a->data.i = 1+rand()%(eff_skll(u, SK_SPY, r));
|
|
||||||
} else if(owner) { /* Ertappt */
|
|
||||||
add_message(&u->faction->msgs,
|
|
||||||
new_message(u->faction, "sabot_building_fail%u:unit", u);
|
|
||||||
add_message(&r->msgs,
|
|
||||||
new_message(owner->faction, "sabot_building_detect%u:unit", u);
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
cmistake(u, findorder(u, u->thisorder), 9, MSG_EVENT);
|
cmistake(u, findorder(u, u->thisorder), 9, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <message.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -2544,8 +2545,8 @@ plagues(region * r, boolean ismagic)
|
||||||
gestorben = rpeasants(r) - peasants;
|
gestorben = rpeasants(r) - peasants;
|
||||||
|
|
||||||
if (gestorben > 0) {
|
if (gestorben > 0) {
|
||||||
add_message(&r->msgs, new_message(NULL,
|
message * msg = add_message(&r->msgs, msg_message("pest", "dead", gestorben));
|
||||||
"pest%i:dead", gestorben));
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
rsetpeasants(r, peasants);
|
rsetpeasants(r, peasants);
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,22 +435,22 @@ caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
|
||||||
switch (mtype) {
|
switch (mtype) {
|
||||||
case MSG_INCOME:
|
case MSG_INCOME:
|
||||||
assert(f);
|
assert(f);
|
||||||
add_message(&f->msgs, msg_message("msg_economy", "string", s));
|
m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
|
||||||
break;
|
break;
|
||||||
case MSG_BATTLE:
|
case MSG_BATTLE:
|
||||||
assert(0 || !"battle-meldungen nicht über addmessage machen");
|
assert(0 || !"battle-meldungen nicht über addmessage machen");
|
||||||
break;
|
break;
|
||||||
case MSG_MOVE:
|
case MSG_MOVE:
|
||||||
assert(f);
|
assert(f);
|
||||||
add_message(&f->msgs, msg_message("msg_movement", "string", s));
|
m = add_message(&f->msgs, msg_message("msg_movement", "string", s));
|
||||||
break;
|
break;
|
||||||
case MSG_COMMERCE:
|
case MSG_COMMERCE:
|
||||||
assert(f);
|
assert(f);
|
||||||
add_message(&f->msgs, msg_message("msg_economy", "string", s));
|
m = add_message(&f->msgs, msg_message("msg_economy", "string", s));
|
||||||
break;
|
break;
|
||||||
case MSG_PRODUCE:
|
case MSG_PRODUCE:
|
||||||
assert(f);
|
assert(f);
|
||||||
add_message(&f->msgs, msg_message("msg_production", "string", s));
|
m = add_message(&f->msgs, msg_message("msg_production", "string", s));
|
||||||
break;
|
break;
|
||||||
case MSG_MAGIC:
|
case MSG_MAGIC:
|
||||||
case MSG_COMMENT:
|
case MSG_COMMENT:
|
||||||
|
@ -470,6 +470,7 @@ caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
|
||||||
default:
|
default:
|
||||||
assert(!"Ungültige Msg-Klasse!");
|
assert(!"Ungültige Msg-Klasse!");
|
||||||
}
|
}
|
||||||
|
if (m) msg_release(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -549,7 +550,7 @@ add_message(message_list** pm, message * m)
|
||||||
*pm = malloc(sizeof(message_list));
|
*pm = malloc(sizeof(message_list));
|
||||||
(*pm)->end=&(*pm)->begin;
|
(*pm)->end=&(*pm)->begin;
|
||||||
}
|
}
|
||||||
mnew->msg = m;
|
mnew->msg = msg_addref(m);
|
||||||
mnew->next = NULL;
|
mnew->next = NULL;
|
||||||
*((*pm)->end) = mnew;
|
*((*pm)->end) = mnew;
|
||||||
(*pm)->end=&mnew->next;
|
(*pm)->end=&mnew->next;
|
||||||
|
@ -563,8 +564,7 @@ free_messages(message_list * m)
|
||||||
struct mlist * x = m->begin;
|
struct mlist * x = m->begin;
|
||||||
while (x) {
|
while (x) {
|
||||||
m->begin = x->next;
|
m->begin = x->next;
|
||||||
msg_free(x->msg);
|
msg_release(x->msg);
|
||||||
free(x);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -922,7 +922,7 @@ r_getmessages(struct region * r, const struct faction * viewer)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
struct message *
|
||||||
r_addmessage(struct region * r, const struct faction * viewer, struct message * msg)
|
r_addmessage(struct region * r, const struct faction * viewer, struct message * msg)
|
||||||
{
|
{
|
||||||
struct individual_message * imsg;
|
struct individual_message * imsg;
|
||||||
|
@ -936,5 +936,5 @@ r_addmessage(struct region * r, const struct faction * viewer, struct message *
|
||||||
r->individual_messages = imsg;
|
r->individual_messages = imsg;
|
||||||
imsg->viewer = viewer;
|
imsg->viewer = viewer;
|
||||||
}
|
}
|
||||||
add_message(&imsg->msgs, msg);
|
return add_message(&imsg->msgs, msg);
|
||||||
}
|
}
|
|
@ -86,7 +86,7 @@ typedef struct region {
|
||||||
} region;
|
} region;
|
||||||
|
|
||||||
extern struct message_list * r_getmessages(struct region * r, const struct faction * viewer);
|
extern struct message_list * r_getmessages(struct region * r, const struct faction * viewer);
|
||||||
extern void r_addmessage(struct region * r, const struct faction * viewer, struct message * msg);
|
extern struct message * r_addmessage(struct region * r, const struct faction * viewer, struct message * msg);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int x;
|
int x;
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
|
#include <message.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <rand.h>
|
#include <rand.h>
|
||||||
|
|
||||||
|
@ -945,14 +946,16 @@ sp_goodwinds(castorder *co)
|
||||||
if(u->ship != sh ) /* nur den Schiffsbesatzungen! */
|
if(u->ship != sh ) /* nur den Schiffsbesatzungen! */
|
||||||
continue;
|
continue;
|
||||||
if(!fval(u->faction, FL_DH) ) {
|
if(!fval(u->faction, FL_DH) ) {
|
||||||
|
message * m = msg_message("wind_effect", "mage ship", cansee(u->faction, r, mage, 0) ? mage:NULL, sh);
|
||||||
|
r_addmessage(r, u->faction, m);
|
||||||
|
msg_release(m);
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
|
||||||
"wind_effect%u:mage%h:ship", cansee(u->faction, r, mage, 0) ? mage:NULL, sh));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fval(mage->faction, FL_DH)) {
|
if (!fval(mage->faction, FL_DH)) {
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
message * m = msg_message("wind_effect", "mage ship", mage, sh);
|
||||||
"wind_effect%u:mage%h:ship", mage, sh));
|
r_addmessage(r, mage->faction, m);
|
||||||
|
msg_release(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -997,17 +1000,26 @@ sp_magicstreet(castorder *co)
|
||||||
|
|
||||||
/* melden, 1x pro Partei */
|
/* melden, 1x pro Partei */
|
||||||
freset(mage->faction, FL_DH);
|
freset(mage->faction, FL_DH);
|
||||||
|
{
|
||||||
|
message * seen = msg_message("path_effect", "mage region", mage, r);
|
||||||
|
message * unseen = NULL;
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) ) {
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
"path_effect%u:mage%r:region", cansee(u->faction, r, mage, 0) ? mage:NULL, r));
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("path_effect", "mage region", NULL, r);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)){
|
if(!fval(mage->faction, FL_DH)){
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
add_message(&mage->faction->msgs, seen);
|
||||||
"path_effect%u:mage%r:region", mage, r));
|
}
|
||||||
|
msg_release(seen);
|
||||||
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -1036,7 +1048,6 @@ sp_summonent(castorder *co)
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
int power = co->force;
|
int power = co->force;
|
||||||
unit *u;
|
unit *u;
|
||||||
unit *u2;
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
int ents;
|
int ents;
|
||||||
|
|
||||||
|
@ -1065,21 +1076,26 @@ sp_summonent(castorder *co)
|
||||||
|
|
||||||
rsettrees(r, rtrees(r) - ents);
|
rsettrees(r, rtrees(r) - ents);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
{
|
||||||
freset(mage->faction, FL_DH);
|
message * seen = msg_message("ent_effect", "mage amount", mage, ents);
|
||||||
for(u2 = r->units; u2; u2 = u2->next ) freset(u2->faction, FL_DH);
|
message * unseen = NULL;
|
||||||
for(u2 = r->units; u2; u2 = u2->next ) {
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
if (!fval(u2->faction, FL_DH) ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
fset(u2->faction, FL_DH);
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
add_message(&r->msgs, new_message(u2->faction,
|
fset(u->faction, FL_DH);
|
||||||
"ent_effect%u:mage%i:amount", cansee(u2->faction, r, mage, 0)?mage:NULL, u->number));
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("ent_effect", "mage amount", NULL, ents);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)){
|
if(!fval(mage->faction, FL_DH)){
|
||||||
/* dann steht niemand von der Magierpartei in der Region, sieht also
|
add_message(&mage->faction->msgs, seen);
|
||||||
* auch keine Regionsmeldung. ergo: global anzeigen */
|
}
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
msg_release(seen);
|
||||||
"ent_effect%u:mage%i:amount", mage, u->number));
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -1168,21 +1184,26 @@ sp_maelstrom(castorder *co)
|
||||||
create_curse(mage,&mage->attribs,C_MAELSTROM,0,power,power,power,0);
|
create_curse(mage,&mage->attribs,C_MAELSTROM,0,power,power,power,0);
|
||||||
set_curseflag(r->attribs, C_MAELSTROM, 0, CURSE_ISNEW);
|
set_curseflag(r->attribs, C_MAELSTROM, 0, CURSE_ISNEW);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
{
|
||||||
freset(mage->faction, FL_DH);
|
message * seen = msg_message("maelstrom_effect", "mage", mage);
|
||||||
|
message * unseen = NULL;
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) ) {
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
"maelstrom_effect%u:mage", cansee(u->faction, r, mage, 0) ? mage:NULL));
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("maelstrom_effect", "mage", NULL);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)){
|
if(!fval(mage->faction, FL_DH)){
|
||||||
/* dann steht niemand von der Magierpartei in der Region, sieht also
|
add_message(&mage->faction->msgs, seen);
|
||||||
* auch keine Regionsmeldung. ergo: global anzeigen */
|
}
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
msg_release(seen);
|
||||||
"maelstrom_effect%u:mage", mage));
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -1220,21 +1241,26 @@ sp_mallorn(castorder *co)
|
||||||
rsettrees(r, rtrees(r)/2);
|
rsettrees(r, rtrees(r)/2);
|
||||||
fset(r, RF_MALLORN);
|
fset(r, RF_MALLORN);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
{
|
||||||
freset(mage->faction, FL_DH);
|
message * seen = msg_message("mallorn_effect", "mage", mage);
|
||||||
|
message * unseen = NULL;
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) ) {
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
"mallorn_effect%u:mage", cansee(u->faction, r, mage, 0) ? mage:NULL));
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("mallorn_effect", "mage", NULL);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)){
|
if(!fval(mage->faction, FL_DH)){
|
||||||
/* dann steht niemand von der Magierpartei in der Region, sieht also
|
add_message(&mage->faction->msgs, seen);
|
||||||
* auch keine Regionsmeldung. ergo: global anzeigen */
|
}
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
msg_release(seen);
|
||||||
"mallorn_effect%u:mage", mage));
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -1266,22 +1292,26 @@ sp_blessedharvest(castorder *co)
|
||||||
* (Max(Dauer), Max(Stärke))*/
|
* (Max(Dauer), Max(Stärke))*/
|
||||||
create_curse(mage,&r->attribs,C_BLESSEDHARVEST,0,power,power,1,0);
|
create_curse(mage,&r->attribs,C_BLESSEDHARVEST,0,power,power,1,0);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
{
|
||||||
freset(mage->faction, FL_DH);
|
message * seen = msg_message("harvest_effect", "mage", mage);
|
||||||
|
message * unseen = NULL;
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) ) {
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
"harvest_effect%u:mage", cansee(u->faction, r, mage, 0) ? mage:NULL));
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("harvest_effect", "mage", NULL);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)) {
|
if(!fval(mage->faction, FL_DH)) {
|
||||||
/* dann steht niemand von der Magierpartei in der Region, sieht also
|
add_message(&mage->faction->msgs, seen);
|
||||||
* auch keine Regionsmeldung. ergo: global anzeigen */
|
}
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
msg_release(seen);
|
||||||
"harvest_effect%u:mage", mage));
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
return cast_level;
|
return cast_level;
|
||||||
}
|
}
|
||||||
|
@ -1312,22 +1342,26 @@ sp_hain(castorder *co)
|
||||||
trees = lovar(force * 10) + force;
|
trees = lovar(force * 10) + force;
|
||||||
rsettrees(r, rtrees(r) + trees);
|
rsettrees(r, rtrees(r) + trees);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
{
|
||||||
freset(mage->faction, FL_DH);
|
message * seen = msg_message("growtree_effect", "mage amount", mage, trees);
|
||||||
|
message * unseen = NULL;
|
||||||
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
for (u = r->units; u; u = u->next ) {
|
for (u = r->units; u; u = u->next ) {
|
||||||
if (!fval(u->faction, FL_DH) ) {
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_DH);
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
"growtree_effect%u:mage%i:amount",
|
r_addmessage(r, u->faction, seen);
|
||||||
cansee(u->faction, r, mage, 0) ? mage:NULL, trees));
|
} else {
|
||||||
|
if (!unseen) unseen = msg_message("growtree_effect", "mage amount", NULL, trees);
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!fval(mage->faction, FL_DH)) {
|
if(!fval(mage->faction, FL_DH)) {
|
||||||
/* dann steht niemand von der Magierpartei in der Region, sieht also
|
add_message(&mage->faction->msgs, seen);
|
||||||
* auch keine Regionsmeldung. ergo: global anzeigen */
|
}
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
msg_release(seen);
|
||||||
"growtree_effect%u:mage%i:amount", mage, trees));
|
if (unseen) msg_release(unseen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -1426,6 +1460,30 @@ sp_rosthauch(castorder *co)
|
||||||
return min(success, cast_level);
|
return min(success, cast_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Report a spell's effect to the units in the region.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
report_effect(region * r, unit * mage, message * seen, message * unseen)
|
||||||
|
{
|
||||||
|
unit * u;
|
||||||
|
for (u = r->units; u; u = u->next ) freset(u->faction, FL_DH);
|
||||||
|
for (u = r->units; u; u = u->next ) {
|
||||||
|
if (!fval(u->faction, FL_DH) ) {
|
||||||
|
fset(u->faction, FL_DH);
|
||||||
|
if (cansee(u->faction, r, mage, 0)) {
|
||||||
|
r_addmessage(r, u->faction, seen);
|
||||||
|
} else if (unseen) {
|
||||||
|
r_addmessage(r, u->faction, unseen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!fval(mage->faction, FL_DH)) {
|
||||||
|
add_message(&mage->faction->msgs, seen);
|
||||||
|
}
|
||||||
|
msg_release(seen);
|
||||||
|
if (unseen) msg_release(unseen);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* Name: Kälteschutz
|
/* Name: Kälteschutz
|
||||||
* Stufe: 3
|
* Stufe: 3
|
||||||
|
@ -2084,14 +2142,14 @@ sp_holyground(castorder *co)
|
||||||
unit *mage = (unit *)co->magician;
|
unit *mage = (unit *)co->magician;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
int power = co->force;
|
int power = co->force;
|
||||||
|
message * msg = r_addmessage(r, mage->faction, msg_message("holyground", "mage", mage));
|
||||||
|
msg_release(msg);
|
||||||
|
|
||||||
create_curse(mage, &r->attribs, C_HOLYGROUND, 0,
|
create_curse(mage, &r->attribs, C_HOLYGROUND, 0,
|
||||||
power*power, 1, 0, 0);
|
power*power, 1, 0, 0);
|
||||||
|
|
||||||
set_curseflag(mage->building->attribs, C_HOLYGROUND, 0, CURSE_NOAGE);
|
set_curseflag(mage->building->attribs, C_HOLYGROUND, 0, CURSE_NOAGE);
|
||||||
|
|
||||||
add_message(&r->msgs, new_message(mage->faction, "holyground%u:mage", mage));
|
|
||||||
|
|
||||||
a_removeall(&r->attribs, &at_deathcount);
|
a_removeall(&r->attribs, &at_deathcount);
|
||||||
|
|
||||||
return cast_level;
|
return cast_level;
|
||||||
|
@ -4880,28 +4938,14 @@ sp_puttorest(castorder *co)
|
||||||
region *r = co->rt;
|
region *r = co->rt;
|
||||||
unit *mage = (unit *)co->magician;
|
unit *mage = (unit *)co->magician;
|
||||||
int laid_to_rest = 0;
|
int laid_to_rest = 0;
|
||||||
unit *u;
|
|
||||||
|
|
||||||
laid_to_rest = dice(co->force * 2, 100);
|
laid_to_rest = dice(co->force * 2, 100);
|
||||||
laid_to_rest = max(laid_to_rest, deathcount(r));
|
laid_to_rest = max(laid_to_rest, deathcount(r));
|
||||||
|
|
||||||
deathcounts(r, -laid_to_rest);
|
deathcounts(r, -laid_to_rest);
|
||||||
|
|
||||||
/* melden, 1x pro partei */
|
report_effect(r, mage,
|
||||||
for (u = r->units; u; u = u->next) freset(u->faction, FL_DH);
|
msg_message("puttorest", "mage", mage),
|
||||||
|
msg_message("puttorest", "mage", NULL));
|
||||||
for (u = r->units; u; u = u->next) {
|
|
||||||
if (!fval(u->faction, FL_DH)) {
|
|
||||||
fset(u->faction, FL_DH);
|
|
||||||
add_message(&r->msgs, new_message(u->faction,
|
|
||||||
"puttorest%u:mage", cansee(u->faction, r, mage, 0) ? mage:NULL));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fval(mage->faction, FL_DH)){
|
|
||||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
|
||||||
"puttorest%u:mage", mage));
|
|
||||||
}
|
|
||||||
return co->level;
|
return co->level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
/* libc includes */
|
||||||
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -79,6 +80,7 @@ msg_create(const struct message_type * type, void * args[])
|
||||||
message * msg = (message *)malloc(sizeof(message));
|
message * msg = (message *)malloc(sizeof(message));
|
||||||
msg->type = type;
|
msg->type = type;
|
||||||
msg->parameters = calloc(sizeof(void*), type->nparameters);
|
msg->parameters = calloc(sizeof(void*), type->nparameters);
|
||||||
|
msg->refcount=1;
|
||||||
for (i=0;i!=type->nparameters;++i) {
|
for (i=0;i!=type->nparameters;++i) {
|
||||||
msg->parameters[i] = args[i];
|
msg->parameters[i] = args[i];
|
||||||
}
|
}
|
||||||
|
@ -130,8 +132,24 @@ mt_find(const char * name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
msg_free(message *m)
|
msg_free(message *msg)
|
||||||
{
|
{
|
||||||
free((void*)m->parameters);
|
assert(msg->refcount==0);
|
||||||
free(m);
|
free((void*)msg->parameters);
|
||||||
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
msg_release(struct message * msg)
|
||||||
|
{
|
||||||
|
if (--msg->refcount) return;
|
||||||
|
msg_free(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct message *
|
||||||
|
msg_addref(struct message * msg)
|
||||||
|
{
|
||||||
|
++msg->refcount;
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ typedef struct message_type {
|
||||||
typedef struct message {
|
typedef struct message {
|
||||||
const struct message_type * type;
|
const struct message_type * type;
|
||||||
const void ** parameters;
|
const void ** parameters;
|
||||||
|
int refcount;
|
||||||
} message;
|
} message;
|
||||||
|
|
||||||
extern struct message_type * mt_new(const char * name, const char ** args);
|
extern struct message_type * mt_new(const char * name, const char ** args);
|
||||||
|
@ -33,8 +34,9 @@ extern struct message * msg_create(const struct message_type * type, void * args
|
||||||
extern struct message * msg_create_va(const struct message_type * type, ...);
|
extern struct message * msg_create_va(const struct message_type * type, ...);
|
||||||
/* msg_create(&mt_simplesentence, "enno", "eats", "chocolate", &locale_de);
|
/* msg_create(&mt_simplesentence, "enno", "eats", "chocolate", &locale_de);
|
||||||
* parameters must be in the same order as they were for mt_new! */
|
* parameters must be in the same order as they were for mt_new! */
|
||||||
extern void msg_free(struct message *m);
|
|
||||||
/* remove message and associated data from memory */
|
extern void msg_release(struct message * msg);
|
||||||
|
extern struct message * msg_addref(struct message * msg);
|
||||||
|
|
||||||
extern const char * mt_name(const struct message_type* mtype);
|
extern const char * mt_name(const struct message_type* mtype);
|
||||||
|
|
||||||
|
|
|
@ -1880,6 +1880,17 @@ undo_deadpeasants(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
fix_undead3percent(void)
|
||||||
|
{
|
||||||
|
region * r = regions;
|
||||||
|
while (r) {
|
||||||
|
int dead = deathcount(r);
|
||||||
|
deathcounts(r, -(dead/2));
|
||||||
|
r = r->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void
|
static void
|
||||||
fix_targetregion_resolve(void)
|
fix_targetregion_resolve(void)
|
||||||
|
@ -2235,6 +2246,7 @@ korrektur(void)
|
||||||
#endif
|
#endif
|
||||||
fix_migrants();
|
fix_migrants();
|
||||||
fix_allies();
|
fix_allies();
|
||||||
|
do_once(atoi36("ud3p"), fix_undead3percent());
|
||||||
do_once(atoi36("fhrb"), fix_herbs());
|
do_once(atoi36("fhrb"), fix_herbs());
|
||||||
do_once(atoi36("ftos"), fix_timeouts());
|
do_once(atoi36("ftos"), fix_timeouts());
|
||||||
do_once(atoi36("fixsl"), fix_prices());
|
do_once(atoi36("fixsl"), fix_prices());
|
||||||
|
|
Loading…
Reference in New Issue