remove lomem code, it was a bad idea

This commit is contained in:
Enno Rehling 2017-11-25 20:24:57 +01:00
parent 85306165d6
commit 599efb2e76
6 changed files with 32 additions and 69 deletions

View File

@ -172,17 +172,6 @@ extern "C" {
int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */ int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */
struct person { struct person {
int hp; /* Trefferpunkte der Personen */ int hp; /* Trefferpunkte der Personen */
#ifdef LOMEM
int attack : 8; /* (Magie) Attackenbonus der Personen */
int defence : 8; /* (Magie) Paradenbonus der Personen */
int damage : 8; /* (Magie) Schadensbonus der Personen im Nahkampf */
int damage_rear : 8; /* (Magie) Schadensbonus der Personen im Fernkampf */
int flags : 8; /* (Magie) Diverse Flags auf Kaempfern */
int speed : 8; /* (Magie) Geschwindigkeitsmultiplkator. */
int reload : 4; /* Anzahl Runden, die die Waffe x noch laden muss.
* dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
int last_action : 4; /* In welcher Runde haben wir zuletzt etwas getan */
#else
int attack; int attack;
int defence; int defence;
int damage; int damage;
@ -191,7 +180,6 @@ extern "C" {
int speed; int speed;
int reload; int reload;
int last_action; int last_action;
#endif
struct weapon *missile; /* missile weapon */ struct weapon *missile; /* missile weapon */
struct weapon *melee; /* melee weapon */ struct weapon *melee; /* melee weapon */
} *person; } *person;

View File

@ -95,7 +95,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
struct settings global; struct settings global;
bool lomem = false;
int turn = 0; int turn = 0;
const char *parameters[MAXPARAMS] = { const char *parameters[MAXPARAMS] = {

View File

@ -141,7 +141,6 @@ extern "C" {
extern const char *parameters[]; extern const char *parameters[];
extern settings global; extern settings global;
extern bool lomem; /* save memory */
extern int turn; extern int turn;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -291,7 +291,7 @@ void free_messagelist(mlist *msgs)
message *add_message(message_list ** pm, message * m) message *add_message(message_list ** pm, message * m)
{ {
assert(m && m->type); assert(m && m->type);
if (!lomem && m != NULL) { if (m != NULL) {
struct mlist *mnew = malloc(sizeof(struct mlist)); struct mlist *mnew = malloc(sizeof(struct mlist));
if (*pm == NULL) { if (*pm == NULL) {
*pm = malloc(sizeof(message_list)); *pm = malloc(sizeof(message_list));

View File

@ -487,16 +487,11 @@ unit *read_unit(gamedata *data)
log_warning("trim unit %s name to '%s'", itoa36(u->no), obuf); log_warning("trim unit %s name to '%s'", itoa36(u->no), obuf);
} }
u->_name = obuf[0] ? strdup(obuf) : 0; u->_name = obuf[0] ? strdup(obuf) : 0;
if (lomem) { READ_STR(data->store, obuf, sizeof(obuf));
READ_STR(data->store, NULL, 0); if (unicode_utf8_trim(obuf)!=0) {
} log_warning("trim unit %s info to '%s'", itoa36(u->no), obuf);
else {
READ_STR(data->store, obuf, sizeof(obuf));
if (unicode_utf8_trim(obuf)!=0) {
log_warning("trim unit %s info to '%s'", itoa36(u->no), obuf);
}
u->display = obuf[0] ? strdup(obuf) : 0;
} }
u->display = obuf[0] ? strdup(obuf) : 0;
READ_INT(data->store, &number); READ_INT(data->store, &number);
set_number(u, number); set_number(u, number);
@ -557,24 +552,23 @@ unit *read_unit(gamedata *data)
p = n = 0; p = n = 0;
orderp = &u->orders; orderp = &u->orders;
while (obuf[0]) { while (obuf[0]) {
if (!lomem) { order *ord = parse_order(obuf, u->faction->locale);
order *ord = parse_order(obuf, u->faction->locale); if (ord != NULL) {
if (++n < MAXORDERS) {
if (!is_persistent(ord) || ++p < MAXPERSISTENT) {
*orderp = ord;
orderp = &ord->next;
ord = NULL;
}
else if (p == MAXPERSISTENT) {
log_info("%s had %d or more persistent orders", unitname(u), MAXPERSISTENT);
}
}
else if (n == MAXORDERS) {
log_info("%s had %d or more orders", unitname(u), MAXORDERS);
}
if (ord != NULL) { if (ord != NULL) {
if (++n < MAXORDERS) { free_order(ord);
if (!is_persistent(ord) || ++p < MAXPERSISTENT) {
*orderp = ord;
orderp = &ord->next;
ord = NULL;
}
else if (p == MAXPERSISTENT) {
log_info("%s had %d or more persistent orders", unitname(u), MAXPERSISTENT);
}
}
else if (n == MAXORDERS) {
log_info("%s had %d or more orders", unitname(u), MAXORDERS);
}
if (ord != NULL)
free_order(ord);
} }
} }
READ_STR(data->store, obuf, sizeof(obuf)); READ_STR(data->store, obuf, sizeof(obuf));
@ -659,14 +653,9 @@ void write_unit(gamedata *data, const unit * u)
} }
static void read_regioninfo(gamedata *data, const region *r, char *info, size_t len) { static void read_regioninfo(gamedata *data, const region *r, char *info, size_t len) {
if (lomem) { READ_STR(data->store, info, len);
READ_STR(data->store, NULL, 0); if (unicode_utf8_trim(info) != 0) {
} log_warning("trim region %d info to '%s'", r->uid, info);
else {
READ_STR(data->store, info, len);
if (unicode_utf8_trim(info) != 0) {
log_warning("trim region %d info to '%s'", r->uid, info);
}
} }
} }
@ -1288,16 +1277,11 @@ struct building *read_building(gamedata *data) {
log_warning("trim building %s name to '%s'", itoa36(b->no), name); log_warning("trim building %s name to '%s'", itoa36(b->no), name);
} }
b->name = strdup(name); b->name = strdup(name);
if (lomem) { READ_STR(store, name, sizeof(name));
READ_STR(store, NULL, 0); if (unicode_utf8_trim(name)!=0) {
} log_warning("trim building %s info to '%s'", itoa36(b->no), name);
else {
READ_STR(store, name, sizeof(name));
if (unicode_utf8_trim(name)!=0) {
log_warning("trim building %s info to '%s'", itoa36(b->no), name);
}
b->display = strdup(name);
} }
b->display = strdup(name);
READ_INT(store, &b->size); READ_INT(store, &b->size);
READ_STR(store, name, sizeof(name)); READ_STR(store, name, sizeof(name));
b->type = bt_find(name); b->type = bt_find(name);
@ -1347,16 +1331,11 @@ ship *read_ship(gamedata *data)
log_warning("trim ship %s name to '%s'", itoa36(sh->no), name); log_warning("trim ship %s name to '%s'", itoa36(sh->no), name);
} }
sh->name = strdup(name); sh->name = strdup(name);
if (lomem) { READ_STR(store, name, sizeof(name));
READ_STR(store, NULL, 0); if (unicode_utf8_trim(name)!=0) {
} log_warning("trim ship %s info to '%s'", itoa36(sh->no), name);
else {
READ_STR(store, name, sizeof(name));
if (unicode_utf8_trim(name)!=0) {
log_warning("trim ship %s info to '%s'", itoa36(sh->no), name);
}
sh->display = strdup(name);
} }
sh->display = strdup(name);
READ_STR(store, name, sizeof(name)); READ_STR(store, name, sizeof(name));
sh->type = st_find(name); sh->type = st_find(name);
if (sh->type == NULL) { if (sh->type == NULL) {

View File

@ -62,7 +62,6 @@ static void load_inifile(void)
set_datapath(str); set_datapath(str);
} }
lomem = config_get_int("game.lomem", lomem) ? 1 : 0;
verbosity = config_get_int("game.verbose", 2); verbosity = config_get_int("game.verbose", 2);
memdebug = config_get_int("game.memcheck", memdebug); memdebug = config_get_int("game.memcheck", memdebug);
#ifdef USE_CURSES #ifdef USE_CURSES
@ -79,7 +78,6 @@ static const char * valid_keys[] = {
"game.locale", "game.locale",
"game.verbose", "game.verbose",
"game.report", "game.report",
"game.lomem",
"game.memcheck", "game.memcheck",
"game.email", "game.email",
"game.mailcmd", "game.mailcmd",