- Bugfix Mapper, Cntrl-T

- Neues Target 'dmalloc'
This commit is contained in:
Christian Schlittchen 2001-02-09 15:17:31 +00:00
parent c04678f0d1
commit 633e0f4902
6 changed files with 44 additions and 50 deletions

View File

@ -19,7 +19,7 @@ ARFLAGS = cr
CTAGSFLAGS = --langmap=c:.c.h --c-types=-m CTAGSFLAGS = --langmap=c:.c.h --c-types=-m
CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \ CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \
-Wpointer-arith -Werror-implicit-function-declaration \ -Wpointer-arith -Werror-implicit-function-declaration \
-Wno-char-subscripts -Wshadow \ -Wno-char-subscripts \
-march=pentiumpro -fPIC $(INCLUDES) -march=pentiumpro -fPIC $(INCLUDES)
LDFLAGS = $(LIBS) LDFLAGS = $(LIBS)
@ -78,6 +78,13 @@ ifeq ($(CONFIG), profile)
LDFLAGS += -g -pg LDFLAGS += -g -pg
endif endif
ifeq ($(CONFIG), dmalloc)
BUILD_DIR = Dmalloc-$(ARCHITECTURE)
CFLAGS += -g -DDMALLOC
LDFLAGS += -g
LIBS += -ldmalloc
endif
# #
## Dependencies ## Dependencies
@ -106,7 +113,7 @@ PUBLISH_DIR = $(ERESSEA)/$(BUILD_DIR)
env: env:
@$(MAKEENV) @$(MAKEENV)
debug release profile:: env $(PUBLISH_DIR) $(PUBLISH_DIR) debug release profile dmalloc:: env $(PUBLISH_DIR) $(PUBLISH_DIR)
$(MAKE) CONFIG=$@ recurse-subdirs-$@ $(MAKE) CONFIG=$@ recurse-subdirs-$@
## ##
@ -115,11 +122,12 @@ debug release profile:: env $(PUBLISH_DIR) $(PUBLISH_DIR)
recurse-subdirs-debug:: subdirs-debug publish-debug recurse-subdirs-debug:: subdirs-debug publish-debug
recurse-subdirs-release:: subdirs-release publish-release recurse-subdirs-release:: subdirs-release publish-release
recurse-subdirs-profile:: subdirs-profile publish-profile recurse-subdirs-profile:: subdirs-profile publish-profile
recurse-subdirs-dmalloc:: subdirs-dmalloc publish-dmalloc
recurse-clean:: clean recurse-clean:: clean
recurse-depend:: depend recurse-depend:: depend
subdirs-debug subdirs-release subdirs-profile clean depend:: subdirs-debug subdirs-release subdirs-profile subdirs-dmalloc clean depend::
@mkdir -p $(PUBLISH_DIR) @mkdir -p $(PUBLISH_DIR)
@if [ -n "$(SUBDIRS)" ]; then \ @if [ -n "$(SUBDIRS)" ]; then \
for subdir in x-placeholder-dir $(SUBDIRS); do \ for subdir in x-placeholder-dir $(SUBDIRS); do \
@ -134,11 +142,12 @@ subdirs-debug subdirs-release subdirs-profile clean depend::
publish-debug:: subdirs-debug publish-debug:: subdirs-debug
publish-release:: subdirs-release publish-release:: subdirs-release
publish-profile:: subdirs-profile publish-profile:: subdirs-profile
publish-dmalloc:: subdirs-dmalloc
publish-debug publish-release publish-profile:: $(PUBLISH_DIR)/$(LIBRARY) $(PUBLISH_DIR)/$(BINARY) publish-debug publish-release publish-profile publish-dmalloc:: $(PUBLISH_DIR)/$(LIBRARY) $(PUBLISH_DIR)/$(BINARY)
clean:: $(BUILD_DIR) $(PUBLISH_DIR) clean:: $(BUILD_DIR) $(PUBLISH_DIR)
rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* Dmalloc-$(ARCHITECTURE)/*
$(BUILD_DIR) $(PUBLISH_DIR): $(BUILD_DIR) $(PUBLISH_DIR):
@mkdir $@ @mkdir $@

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.7 2001/02/03 13:45:29 enno Exp $ * $Id: laws.c,v 1.8 2001/02/09 15:17:30 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2828,31 +2828,13 @@ processorders (void)
if (turn == 0) srand(time((time_t *) NULL)); if (turn == 0) srand(time((time_t *) NULL));
else srand(turn); else srand(turn);
new_units(); new_units();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Monster KI..."); puts(" - Monster KI...");
plan_monsters(); plan_monsters();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
set_passw(); /* und pruefe auf illegale Befehle */ set_passw(); /* und pruefe auf illegale Befehle */
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Defaults und Instant-Befehle..."); puts(" - Defaults und Instant-Befehle...");
setdefaults(); setdefaults();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
instant_orders(); instant_orders();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
mail(); mail();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Altern"); puts(" - Altern");
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
@ -2884,9 +2866,6 @@ processorders (void)
puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)"); puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)");
do_misc(0); do_misc(0);
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Verlassen"); puts(" - Verlassen");
do_leave(); do_leave();
@ -2897,13 +2876,7 @@ processorders (void)
jihad_attacks(); jihad_attacks();
puts(" - Attackieren"); puts(" - Attackieren");
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
if(nobattle == false) do_battle(); if(nobattle == false) do_battle();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
if (turn == 0) srand(time((time_t *) NULL)); if (turn == 0) srand(time((time_t *) NULL));
else srand(turn); else srand(turn);
@ -2931,9 +2904,6 @@ processorders (void)
puts(" - Gebäudeunterhalt (1. Versuch)"); puts(" - Gebäudeunterhalt (1. Versuch)");
maintain_buildings(false); maintain_buildings(false);
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Sterben"); puts(" - Sterben");
quit(); quit();

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: battle.c,v 1.7 2001/02/09 13:53:51 corwin Exp $ * $Id: battle.c,v 1.8 2001/02/09 15:17:31 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -3499,9 +3499,11 @@ do_battle(void)
/* Auswirkungen berechnen: */ /* Auswirkungen berechnen: */
aftermath(b); aftermath(b);
/*
#if MALLOCDBG #if MALLOCDBG
assert(_CrtCheckMemory()); assert(_CrtCheckMemory());
#endif #endif
*/
/* Hier ist das Gefecht beendet, und wir können die /* Hier ist das Gefecht beendet, und wir können die
* Hilfsstrukturen * wieder löschen: */ * Hilfsstrukturen * wieder löschen: */

View File

@ -11,3 +11,10 @@ CC = gcc
LD = gcc LD = gcc
INSTALL = cp INSTALL = cp
CFLAGS += -DHAVE_GETCURX
# ifdef DMALLOC
# LIBS += -ldmalloc
# CFLAGS += -DDMALLOC
# endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_tools.c,v 1.4 2001/02/09 13:53:53 corwin Exp $ * $Id: map_tools.c,v 1.5 2001/02/09 15:17:31 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -94,7 +94,7 @@ BuildingName(building * b)
int int
map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre) map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre)
{ {
char buf[10]; char lbuf[10];
int val, ch, cx, nw = 0; int val, ch, cx, nw = 0;
if (!win) { if (!win) {
win = openwin(50, 3, 0); win = openwin(50, 3, 0);
@ -103,13 +103,13 @@ map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre)
} else } else
wrefresh(win); wrefresh(win);
do { do {
sprintf(buf, "%d", pre); sprintf(lbuf, "%d", pre);
wmove(win, y, x); wmove(win, y, x);
curs_set(1); curs_set(1);
wprintw(win, (NCURSES_CONST char*)"%s (%d..%d): %d", text, mn, mx, pre); wprintw(win, (NCURSES_CONST char*)"%s (%d..%d): %d", text, mn, mx, pre);
wrefresh(win); wrefresh(win);
#ifdef HAVE_GETCURX #ifdef HAVE_GETCURX
cx = getcurx(win) - strlen(buf); cx = getcurx(win) - strlen(lbuf);
#else #else
cx = (int)(x + strlen(text) + 7 + log10(abs(mn)) + log10(abs(mx))); cx = (int)(x + strlen(text) + 7 + log10(abs(mn)) + log10(abs(mx)));
if (mx < 0) if (mx < 0)
@ -117,7 +117,7 @@ map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre)
if (mn < 0) if (mn < 0)
cx++; cx++;
#endif #endif
val = strlen(buf); val = strlen(lbuf);
do { do {
ch = getch(); ch = getch();
if (ch==8 || ch == KEY_BACKSPACE || ch == KEY_LEFT) { if (ch==8 || ch == KEY_BACKSPACE || ch == KEY_LEFT) {
@ -134,14 +134,14 @@ map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre)
curs_set(0); curs_set(0);
} else if ((ch == '-' && val == 0) || (ch >= '0' && ch <= '9' && val < 10)) { } else if ((ch == '-' && val == 0) || (ch >= '0' && ch <= '9' && val < 10)) {
waddch(win, ch); waddch(win, ch);
buf[val] = (char) ch; lbuf[val] = (char) ch;
val++; val++;
} else } else
beep(); beep();
wrefresh(win); wrefresh(win);
} while (!(ch == 10 || ch == 13)); } while (!(ch == 10 || ch == 13));
buf[val] = 0; lbuf[val] = 0;
val = atoi(buf); val = atoi(lbuf);
if (val < mn || val > mx) if (val < mn || val > mx)
beep(); beep();
} while (val < mn || val > mx); } while (val < mn || val > mx);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: mapper.c,v 1.7 2001/02/09 13:53:53 corwin Exp $ * $Id: mapper.c,v 1.8 2001/02/09 15:17:31 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -715,10 +715,16 @@ movearound(int rx, int ry) {
} }
break; break;
case 0x14: case 0x14:
while (Tagged) {
removelist(&Tagged, Tagged); tagregion *tag_next;
tag = Tagged;
while (tag) {
tag_next = tag->next;
removelist(&Tagged, tag);
tag = tag_next;
}
ch=-9; ch=-9;
break; } break;
case 'G': case 'G':
rx=tx; ry=ty; rx=tx; ry=ty;
recalc_everything(&x, &y, &rx, &ry); recalc_everything(&x, &y, &rx, &ry);