- 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
CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \
-Wpointer-arith -Werror-implicit-function-declaration \
-Wno-char-subscripts -Wshadow \
-Wno-char-subscripts \
-march=pentiumpro -fPIC $(INCLUDES)
LDFLAGS = $(LIBS)
@ -78,6 +78,13 @@ ifeq ($(CONFIG), profile)
LDFLAGS += -g -pg
endif
ifeq ($(CONFIG), dmalloc)
BUILD_DIR = Dmalloc-$(ARCHITECTURE)
CFLAGS += -g -DDMALLOC
LDFLAGS += -g
LIBS += -ldmalloc
endif
#
## Dependencies
@ -106,7 +113,7 @@ PUBLISH_DIR = $(ERESSEA)/$(BUILD_DIR)
env:
@$(MAKEENV)
debug release profile:: env $(PUBLISH_DIR) $(PUBLISH_DIR)
debug release profile dmalloc:: env $(PUBLISH_DIR) $(PUBLISH_DIR)
$(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-release:: subdirs-release publish-release
recurse-subdirs-profile:: subdirs-profile publish-profile
recurse-subdirs-dmalloc:: subdirs-dmalloc publish-dmalloc
recurse-clean:: clean
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)
@if [ -n "$(SUBDIRS)" ]; then \
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-release:: subdirs-release
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)
rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/*
rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* Dmalloc-$(ARCHITECTURE)/*
$(BUILD_DIR) $(PUBLISH_DIR):
@mkdir $@

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -2828,31 +2828,13 @@ processorders (void)
if (turn == 0) srand(time((time_t *) NULL));
else srand(turn);
new_units();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Monster KI...");
plan_monsters();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
set_passw(); /* und pruefe auf illegale Befehle */
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Defaults und Instant-Befehle...");
setdefaults();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
instant_orders();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
mail();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Altern");
for (f = factions; f; f = f->next) {
@ -2884,9 +2866,6 @@ processorders (void)
puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)");
do_misc(0);
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Verlassen");
do_leave();
@ -2897,13 +2876,7 @@ processorders (void)
jihad_attacks();
puts(" - Attackieren");
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
if(nobattle == false) do_battle();
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
if (turn == 0) srand(time((time_t *) NULL));
else srand(turn);
@ -2931,9 +2904,6 @@ processorders (void)
puts(" - Gebäudeunterhalt (1. Versuch)");
maintain_buildings(false);
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
puts(" - Sterben");
quit();

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -3499,9 +3499,11 @@ do_battle(void)
/* Auswirkungen berechnen: */
aftermath(b);
/*
#if MALLOCDBG
assert(_CrtCheckMemory());
#endif
*/
/* Hier ist das Gefecht beendet, und wir können die
* Hilfsstrukturen * wieder löschen: */

View File

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

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -94,7 +94,7 @@ BuildingName(building * b)
int
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;
if (!win) {
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
wrefresh(win);
do {
sprintf(buf, "%d", pre);
sprintf(lbuf, "%d", pre);
wmove(win, y, x);
curs_set(1);
wprintw(win, (NCURSES_CONST char*)"%s (%d..%d): %d", text, mn, mx, pre);
wrefresh(win);
#ifdef HAVE_GETCURX
cx = getcurx(win) - strlen(buf);
cx = getcurx(win) - strlen(lbuf);
#else
cx = (int)(x + strlen(text) + 7 + log10(abs(mn)) + log10(abs(mx)));
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)
cx++;
#endif
val = strlen(buf);
val = strlen(lbuf);
do {
ch = getch();
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);
} else if ((ch == '-' && val == 0) || (ch >= '0' && ch <= '9' && val < 10)) {
waddch(win, ch);
buf[val] = (char) ch;
lbuf[val] = (char) ch;
val++;
} else
beep();
wrefresh(win);
} while (!(ch == 10 || ch == 13));
buf[val] = 0;
val = atoi(buf);
lbuf[val] = 0;
val = atoi(lbuf);
if (val < mn || val > mx)
beep();
} while (val < mn || val > mx);

View File

@ -1,6 +1,6 @@
/* 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
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -715,10 +715,16 @@ movearound(int rx, int ry) {
}
break;
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;
break;
} break;
case 'G':
rx=tx; ry=ty;
recalc_everything(&x, &y, &rx, &ry);