Memory-Overwrite

This commit is contained in:
Enno Rehling 2002-01-20 11:35:06 +00:00
parent 35867d3a5c
commit 1909d754b1
4 changed files with 12 additions and 9 deletions

View File

@ -1374,8 +1374,8 @@ manufacture(unit * u, const item_type * itype, int want)
if (n>0) { if (n>0) {
i_change(&u->items, itype, n); i_change(&u->items, itype, n);
if (want==INT_MAX) want = n; if (want==INT_MAX) want = n;
add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs, msg_message("manufacture",
new_message(u->faction, "manufacture%u:unit%r:region%i:amount%i:wanted%X:resource", u, u->region, n, want, itype->rtype)); "unit region amount wanted resource", u, u->region, n, want, itype->rtype));
} }
} }
@ -1807,8 +1807,8 @@ create_potion(unit * u, const potion_type * ptype, int want)
default: default:
i_change(&u->items, ptype->itype, built); i_change(&u->items, ptype->itype, built);
if (want==INT_MAX) want = built; if (want==INT_MAX) want = built;
add_message(&u->faction->msgs, ADDMSG(&u->faction->msgs, msg_message(u->faction, "manufacture",
new_message(u->faction, "manufacture%u:unit%r:region%i:amount%i:wanted%X:resource", u, u->region, built, want, ptype->itype->rtype)); "unit region amount wanted resource", u, u->region, built, want, ptype->itype->rtype));
break; break;
} }
} }

View File

@ -3004,7 +3004,7 @@ make_summary(boolean count_new)
struct language * plang = s->languages; struct language * plang = s->languages;
while (plang && plang->locale != lang) plang=plang->next; while (plang && plang->locale != lang) plang=plang->next;
if (!plang) { if (!plang) {
plang = calloc(sizeof(plang), 1); plang = calloc(sizeof(struct language), 1);
plang->next = s->languages; plang->next = s->languages;
s->languages = plang; s->languages = plang;
plang->locale = lang; plang->locale = lang;

View File

@ -15,11 +15,11 @@
#ifndef MESSAGE_H #ifndef MESSAGE_H
#define MESSAGE_H #define MESSAGE_H
struct faction; #include <util/message.h>
struct warning;
struct message; struct message;
struct messageclass; struct messageclass;
struct faction;
struct warning; struct warning;
struct msglevel; struct msglevel;

View File

@ -2751,6 +2751,7 @@ heal_all(void)
region *r; region *r;
unit *u; unit *u;
faction *f; faction *f;
struct message * msg = msg_message("healall", "");
for(f=factions; f; f=f->next) { for(f=factions; f; f=f->next) {
freset(f, FL_DH); freset(f, FL_DH);
@ -2766,13 +2767,15 @@ heal_all(void)
} }
} }
for(f=factions; f; f=f->next) { for (f=factions; f; f=f->next) {
if(fval(f,FL_DH)) { if(fval(f,FL_DH)) {
add_message(&f->msgs, new_message(f, "healall")); add_message(&f->msgs, msg);
freset(f, FL_DH); freset(f, FL_DH);
} }
} }
msg_release(msg);
return 0; return 0;
} }