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. */
struct person {
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 defence;
int damage;
@ -191,7 +180,6 @@ extern "C" {
int speed;
int reload;
int last_action;
#endif
struct weapon *missile; /* missile weapon */
struct weapon *melee; /* melee weapon */
} *person;

View File

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

View File

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

View File

@ -291,7 +291,7 @@ void free_messagelist(mlist *msgs)
message *add_message(message_list ** pm, message * m)
{
assert(m && m->type);
if (!lomem && m != NULL) {
if (m != NULL) {
struct mlist *mnew = malloc(sizeof(struct mlist));
if (*pm == NULL) {
*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);
}
u->_name = obuf[0] ? strdup(obuf) : 0;
if (lomem) {
READ_STR(data->store, NULL, 0);
}
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;
}
READ_INT(data->store, &number);
set_number(u, number);
@ -557,7 +552,6 @@ unit *read_unit(gamedata *data)
p = n = 0;
orderp = &u->orders;
while (obuf[0]) {
if (!lomem) {
order *ord = parse_order(obuf, u->faction->locale);
if (ord != NULL) {
if (++n < MAXORDERS) {
@ -573,7 +567,7 @@ unit *read_unit(gamedata *data)
else if (n == MAXORDERS) {
log_info("%s had %d or more orders", unitname(u), MAXORDERS);
}
if (ord != NULL)
if (ord != NULL) {
free_order(ord);
}
}
@ -659,15 +653,10 @@ void write_unit(gamedata *data, const unit * u)
}
static void read_regioninfo(gamedata *data, const region *r, char *info, size_t len) {
if (lomem) {
READ_STR(data->store, NULL, 0);
}
else {
READ_STR(data->store, info, len);
if (unicode_utf8_trim(info) != 0) {
log_warning("trim region %d info to '%s'", r->uid, info);
}
}
}
static region *readregion(gamedata *data, int x, int y)
@ -1288,16 +1277,11 @@ struct building *read_building(gamedata *data) {
log_warning("trim building %s name to '%s'", itoa36(b->no), name);
}
b->name = strdup(name);
if (lomem) {
READ_STR(store, NULL, 0);
}
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);
}
READ_INT(store, &b->size);
READ_STR(store, name, sizeof(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);
}
sh->name = strdup(name);
if (lomem) {
READ_STR(store, NULL, 0);
}
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);
}
READ_STR(store, name, sizeof(name));
sh->type = st_find(name);
if (sh->type == NULL) {

View File

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