the mapper is no longer maintained

This commit is contained in:
Enno Rehling 2008-05-20 21:17:02 +00:00
parent ede420cd3b
commit fef83c4df5
12 changed files with 0 additions and 6409 deletions

View file

@ -1,35 +0,0 @@
SubDir TOP mapper ;
TargetDirectory ;
SubDirHdrs $(SUBDIR)/../common/gamecode ;
SubDirHdrs $(SUBDIR)/../common/kernel ;
SubDirHdrs $(SUBDIR)/../common/util ;
SubDirHdrs $(SUBDIR)/../common ;
SubDirHdrs $(SUBDIR)/.. ;
SubDirHdrs $(XMLHDRS) ;
SOURCES =
logging.c
map_modify.c
map_partei.c
mapper.c
map_region.c
map_tools.c
map_units.c
;
Main mapper : $(SOURCES) ;
LinkLibraries mapper :
gamecode
items
spells
kernel
modules
attributes
races
triggers
util ;
libxml2 mapper ;
LINKLIBS on mapper += -L$(LUABIND_ROOT)/lib -lm -lncurses ;

View file

@ -1,107 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <config.h>
#include <eressea.h>
/* kernel includes */
#include <faction.h>
#include <unit.h>
#include <region.h>
#include <save.h>
#include <terrain.h>
#include <kernel/terrainid.h>
/* util includes */
#include <base36.h>
/* libc includes */
#include <string.h>
#include <stdio.h>
static FILE * log;
void
log_read(const char * filename)
{
FILE * log = fopen(filename, "r");
faction **fp = &factions;
char buf[64];
while (*fp) fp=&(*fp)->next;
fscanf(log, "LOGVERSION %u\n", &global.data_version);
while (!feof(log)) {
if(fscanf(log, "%s", buf) == EOF) break;
if (strcmp(buf, "UNIT")==0) {
short x, y;
unit * u;
region * r;
fscanf(log, "%s %hd %hd", buf, &x, &y);
u = readunit(log);
r = findregion(x, y);
if (r==NULL) {
r = new_region(x, y);
terraform(r, T_PLAIN);
}
if (u->region!=r) move_unit(u, r, NULL);
} else if (strcmp(buf, "REGION")==0) {
short x, y;
fscanf(log, "%hd %hd", &x, &y);
readregion(log, x, y);
} else if (strcmp(buf, "FACTION")==0) {
faction * f;
fscanf(log, "%s", buf);
f = findfaction(atoi36(buf));
if (f) {
readfaction(log);
} else {
*fp = readfaction(log);
fp=&(*fp)->next;
}
} else assert(0);
}
}
void
log_faction(const struct faction * f)
{
fprintf(log, "FACTION %s\n", factionid(f));
writefaction(log, f);
}
void
log_unit(const struct unit * u)
{
fprintf(log, "UNIT %s %d %d\n", unitid(u), u->region->x, u->region->y);
writeunit(log, u);
}
void
log_region(const struct region * r)
{
fprintf(log, "REGION %d %d\n", r->x, r->y);
writeregion(log, r);
}
void
log_start(const char * filename)
{
log = fopen(filename, "w+");
fprintf(log, "LOGVERSION %d\n", RELEASE_VERSION);
}
void
log_stop(void)
{
fclose(log);
log = NULL;
}

View file

@ -1,23 +0,0 @@
#ifndef _LOGGING_H
#define _LOGGING_H
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
extern void log_read(const char * logname);
extern void log_region(const struct region * r);
extern void log_unit(const struct unit * r);
extern void log_faction(const struct faction * f);
extern void log_start(const char * filename);
extern void log_stop(void);
#endif /* _LOGGING_H */

File diff suppressed because it is too large Load diff

View file

@ -1,555 +0,0 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <curses.h>
#include <eressea.h>
#include "mapper.h"
#include <modules/autoseed.h>
/* kernel includes */
#include <kernel/alliance.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/reports.h>
#include <kernel/save.h>
#include <kernel/skill.h>
#include <kernel/unit.h>
/* util includes */
#include <util/base36.h>
#include <util/goodies.h>
#include <language.h>
/* libc includes */
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#ifdef __USE_POSIX
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
const char * orderfile = NULL;
void
RemovePartei(void) {
faction *f, *F;
ally *a, *anext;
WINDOW *win;
char *fac_nr36;
int x;
unit *u;
region *r;
win = openwin(SX - 20, 5, "< Partei löschen >");
fac_nr36 = my_input(win, 2, 1, "Partei Nummer: ", NULL);
x = atoi36(fac_nr36);
if (fac_nr36 && *fac_nr36 && x > 0) {
wmove(win, 1, 2);
wclrtoeol(win);
wrefresh(win);
wmove(win, 1, win->_maxx);
waddch(win, '|');
wrefresh(win);
F = findfaction(x);
wmove(win, 1, 2);
if (F) {
wAddstr(factionname(F));
wrefresh(win);
wmove(win, 3, 4);
wattron(win, A_BOLD);
wAddstr("Alle Einheiten gehen verloren!");
wattroff(win, A_BOLD);
wmove(win, 3, 4);
beep();
if (yes_no(win, "Diese Partei wirklich löschen?", 'n')) {
for (f = factions; f; f = f->next)
if (f != F)
for (a = f->allies; a; a = anext) {
anext = a->next;
if (a->faction->no == F->no)
removelist(&f->allies, a);
}
for (r = firstregion(F); r != lastregion(F); r = r->next)
for (u = r->units; u; u = u->next)
if (u->faction == F)
set_number(u, 0);
modified = 1;
remove_empty_units();
removelist(&factions, F);
findfaction(-1); /* static lastfaction auf NULL setzen */
}
} else {
wprintw(win, (NCURSES_CONST char*)"Partei %d gibt es nicht.", x);
wmove(win, 3, 6);
wAddstr("<Taste>");
wrefresh(win);
getch();
}
}
delwin(win);
}
extern int left, top, breit, hoch;
typedef struct island {
vmap factions;
int maxage;
int x;
int y;
unsigned int land;
int age;
} island;
newfaction *
select_newfaction(const struct race * rc)
{
selection *prev, *ilist = NULL, **iinsert;
selection *selected = NULL;
newfaction *player = newfactions;
if (!player) return NULL;
insert_selection(&ilist, NULL, "new player", NULL);
iinsert=&ilist->next;
prev = ilist;
while (player) {
if (rc==NULL || player->race==rc) {
char str[80];
if (alliances!=NULL) {
snprintf(str, 70, "%s %d %s %s", player->bonus?"!":" ", player->allies?player->allies->id:0, locale_string(default_locale, rc_name(player->race, 0)), player->email);
} else {
snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email);
}
insert_selection(iinsert, prev, str, (void*)player);
prev = *iinsert;
iinsert = &prev->next;
}
player=player->next;
}
selected = do_selection(ilist, "Partei", NULL, NULL);
if (selected==NULL) return NULL;
return (newfaction*)selected->data;
}
void
NeuePartei(region * r)
{
int i, q, y;
char email[INPUT_BUFSIZE+1];
newfaction * nf, **nfp;
const struct locale * lang;
const struct race * frace;
int late, subscription = 0;
unit *u;
const char * passwd = NULL;
int locale_nr;
faction * f;
if (!r->land) {
warnung(0, "Ungeeignete Region! <Taste>");
return;
}
nf = select_newfaction(NULL);
if (nf!=NULL) {
frace = nf->race;
subscription = nf->subscription;
late = nf->bonus;
lang = nf->lang;
passwd = nf->password;
strcpy(email, nf->email);
if (late) {
WINDOW *win = openwin(SX - 10, 3, "< Neue Partei einfügen >");
if(r->age >= 5)
late = (int) map_input(win, 2, 1, "Startbonus", -1, 99, r->age/2);
else
late = (int) map_input(win, 2, 1, "Startbonus", -1, 99, 0);
delwin(win);
}
} else {
WINDOW *win = openwin(SX - 10, 12, "< Neue Partei einfügen >");
strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL));
if (!buf[0]) {
delwin(win);
return;
}
strcpy(email, buf);
for (f=factions;f;f=f->next) {
if (strcmp(email, f->email)==0 && f->age==0) {
warnung(0, "Neue Partei mit dieser Adresse existiert bereits.");
delwin(win);
return;
}
}
y = 3;
q = 0;
wmove(win, y, 4);
for (i = 0; i < MAXRACES; i++) if(playerrace(new_race[i])) {
sprintf(buf, "%d=%s; ", i, new_race[i]->_name[0]);
q += strlen(buf);
if (q > SX - 20) {
q = strlen(buf);
y++;
wmove(win, y, 4);
}
wAddstr(buf);
}
wrefresh(win);
y++;
do {
int nrace = (char) map_input(win, 2, y, "Rasse", -1, MAXRACES-1, 0);
if (nrace == -1) {
delwin(win);
return;
}
frace = new_race[nrace];
} while(!playerrace(frace));
y++;
late = (int) map_input(win, 2, y, "Startbonus", -1, 99, 0);
if(late == -1) {
delwin(win);
return;
}
i = 0; q = 0; y++;
wmove(win, y, 4);
while(localenames[i] != NULL) {
sprintf(buf, "%d=%s; ", i, localenames[i]);
q += strlen(buf);
if (q > SX - 20) {
q = strlen(buf);
y++;
wmove(win, y, 4);
}
wAddstr(buf);
i++;
}
wrefresh(win);
y++;
locale_nr = map_input(win, 2, 8, "Locale", -1, i-1, 0);
if(locale_nr == -1) {
delwin(win);
return;
}
lang = find_locale(localenames[locale_nr]);
delwin(win);
}
/* remove duplicate email addresses */
nfp=&newfactions;
while (*nfp) {
newfaction * nf = *nfp;
if (strcmp(email, nf->email)==0) {
*nfp = nf->next;
free(nf);
}
else nfp = &nf->next;
}
modified = 1;
u = addplayer(r, addfaction(email, passwd, frace, lang, subscription));
++numnewbies;
sprintf(buf, "newuser %s", email);
system(buf);
}
static void
ModifyPartei(faction * f)
{
int c, i, q, y;
int fmag = count_skill(f, SK_MAGIC);
int falch = count_skill(f, SK_ALCHEMY);
WINDOW *win;
unit *u;
sprintf(buf, "<%s >", factionname(f));
win = openwin(SX - 6, 12, buf);
wmove(win, 1, 2);
wprintw(win, (NCURSES_CONST char*)"Rasse: %s", f->race->_name[1]);
wmove(win, 2, 2);
wprintw(win, (NCURSES_CONST char*)"Einheiten: %d", f->no_units);
wmove(win, 3, 2);
wprintw(win, (NCURSES_CONST char*)"Personen: %d", f->num_people);
wmove(win, 4, 2);
wprintw(win, (NCURSES_CONST char*)"Silber: %d", f->money);
wmove(win, 5, 2);
wprintw(win, (NCURSES_CONST char*)"Magier: %d", fmag);
if (fmag) {
region *r;
freset(f, FL_DH);
waddnstr(win, " (", -1);
for (r = firstregion(f); r != lastregion(f); r = r->next)
for (u = r->units; u; u = u->next)
if (u->faction == f && has_skill(u, SK_MAGIC)) {
if (fval(f, FL_DH))
waddnstr(win, ", ", -1);
wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_level(u, SK_MAGIC));
fset(f, FL_DH);
}
waddch(win, ')');
}
wmove(win, 6, 2);
wprintw(win, (NCURSES_CONST char*)"Alchemisten: %d", falch);
if (falch) {
region *r;
waddnstr(win, " (", -1);
freset(f, FL_DH);
for (r = firstregion(f); r != lastregion(f); r = r->next)
for (u = r->units; u; u = u->next)
if (u->faction == f && has_skill(u, SK_ALCHEMY)) {
if (fval(f, FL_DH))
waddnstr(win, ", ", -1);
wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_level(u, SK_ALCHEMY));
fset(f, FL_DH);
}
waddch(win, ')');
}
wmove(win, 7, 2);
wprintw(win, (NCURSES_CONST char*)"Regionen: %d", f->nregions);
wmove(win, 8, 2);
wprintw(win, (NCURSES_CONST char*)"eMail: %s", f->email);
wmove(win, 10, 2);
wprintw(win, (NCURSES_CONST char*)"Neue (R)asse oder (e)Mail, (q)uit");
wrefresh(win);
for(;;) {
c = getch();
switch (tolower(c)) {
case 'q':
case 27:
delwin(win);
touchwin(stdscr);
return;
case 'r':
mywin = newwin(5, SX - 20, (SY - 5) / 2, (SX - 20) / 2);
wclear(mywin);
/*wborder(mywin, '|', '|', '-', '-', '.', '.', '`', '\'');*/
wborder(mywin, 0, 0, 0, 0, 0, 0, 0, 0);
Movexy(3, 0);
Addstr("< Rasse wählen >");
wrefresh(mywin);
y = 2;
q = 0;
wmove(mywin, y, 4);
for (i = 1; i < MAXRACES; i++) {
sprintf(buf, "%d=%s; ", i, new_race[i]->_name[0]);
q += strlen(buf);
if (q > SX - 25) {
q = strlen(buf);
y++;
wmove(mywin, y, 4);
}
wAddstr(buf);
}
q = map_input(mywin, 2, 1, "Rasse", 1, MAXRACES-1, old_race(f->race));
delwin(mywin);
touchwin(stdscr);
touchwin(win);
if (new_race[q] != f->race) {
modified = 1;
f->race = new_race[q];
wmove(win, 1, 2);
wprintw(win, (NCURSES_CONST char*)"Rasse: %s", f->race->_name[1]);
}
refresh();
wrefresh(win);
break;
case 'e':
strcpy(buf, my_input(0, 0, 0, "Neue eMail: ", NULL));
touchwin(stdscr);
touchwin(win);
if (strlen(buf)) {
strcpy(f->email, buf);
wmove(win, 8, 2);
wprintw(win, (NCURSES_CONST char*)"eMail: %s", f->email);
modified = 1;
}
refresh();
wrefresh(win);
break;
}
}
}
int
ParteiListe(void)
{
dbllist *P = NULL, *oben, *unten, *tmp;
faction *f;
char *s;
int x;
clear();
move(1, 1);
addstr("generiere Liste...");
refresh();
for (f = factions; f; f = f->next) {
if (SX > 104)
sprintf(buf, "%4s: %-30.30s %-12.12s %-24.24s", factionid(f),
f->name, f->race->_name[1], f->email);
else
sprintf(buf, "%4s: %-30.30s %-12.12s", factionid(f),
f->name, f->race->_name[1]);
adddbllist(&P, buf);
}
oben = unten = pointer = P;
pline = 0;
x = -1;
clear();
movexy(0, SY - 1);
hline('-', SX + 1);
movexy(0, SY);
addstr("<Ret> Daten; /: suchen; D: Löschen; q,Esc: Ende");
for (;;) {
if (x == -1) {
clear();
if(oben) {
for (unten = oben, x = 0; x < SY - 1 && unten->next; x++) {
movexy(3, x);
addstr(unten->s);
unten = unten->next;
}
}
if (x < SY - 1 && unten) { /* extra, weil sonst
* unten=NULL nach for() */
movexy(3, x);
addstr(unten->s);
}
movexy(0, SY - 1);
hline('-', SX + 1);
movexy(0, SY);
addstr("<Ret> Daten; /: suchen; D: Löschen; q,Esc: Ende");
}
movexy(0, pline);
addstr("->");
refresh();
x = getch();
movexy(0, pline);
addstr(" ");
switch (x) {
case 'q':
case 27:
return 0;
case 13:
case 10:
{
char fno[5];
strncpy(fno, pointer->s, 4);
fno[4]=0;
ModifyPartei(findfaction(atoi36(fno)));
}
break;
case 'D':
RemovePartei();
return 1;
case KEY_DOWN:
if (pointer->next) {
pline++;
pointer = pointer->next;
if (pline == SY - 1) {
x = 20;
do {
oben = oben->next;
unten = unten->next;
x--;
pline--;
} while (x && unten /*->next*/ );
x = -1;
}
} else
beep();
break;
case KEY_UP:
if (pointer->prev) {
pline--;
pointer = pointer->prev;
if (pline < 0) {
x = 20;
do {
oben = oben->prev;
unten = unten->prev;
x--;
pline++;
} while (x && oben->prev);
x = -1;
}
} else
beep();
break;
case KEY_NPAGE:
case KEY_RIGHT:
for (x = 20; x && unten; x--) {
oben = oben->next;
pointer = pointer->next;
unten = unten->next;
}
x = -1;
break;
case KEY_PPAGE:
case KEY_LEFT:
for (x = 20; x && oben->prev; x--) {
oben = oben->prev;
pointer = pointer->prev;
unten = unten->prev;
}
x = -1;
break;
case '/':
strcpy(buf, my_input(0, 0, 0, "Partei Nr. oder Name: ", NULL));
touchwin(stdscr); /* redraw erzwingen */
for (tmp = P; tmp; tmp = tmp->next) {
s = tmp->s;
while (s && strncasecmp(buf, s, strlen(buf))) {
s = strchr(s, ' ');
if (s)
s++;
}
if (s)
break;
}
if (tmp) {
pointer = tmp;
pline = 0;
if (tmp->prev) {
tmp = tmp->prev;
pline++;
}
oben = tmp;
x = -1;
} else
beep();
break;
}
}
}

View file

@ -1,402 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <curses.h>
#include <ctype.h>
#include <eressea.h>
#include "mapper.h"
/* kernel includes */
#include <kernel/alliance.h>
#include <kernel/building.h>
#include <kernel/curse.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/resources.h>
#include <kernel/ship.h>
#include <kernel/terrainid.h>
#include <kernel/unit.h>
/* modules includes */
/* util includes */
#include <base36.h>
/* libc includes */
#include <stdlib.h>
#include <string.h>
void
incat(char *buf, const int n, const size_t bufsize)
{
char s[10];
snprintf(s, 9, "%d", n);
sncat(buf, s, bufsize);
}
int rbottom;
dbllist *reglist = NULL;
static dbllist *runten = NULL, *roben = NULL;
#define LASTLINE SY-3
/* Letzte Zeile, in der Regionsinfo bei der Karte kommt */
static void
ClearRegion(void)
{
int line;
refresh();
for (line = 0; line < LASTLINE; line++) {
movexy(SX - 38, line);
clrtoeol();
}
}
void
ScrollRegList(int dir)
{
dbllist *hlp;
int line;
if ((dir == -1 && !runten->next) || (dir == 1 && !roben->prev))
return;
switch (dir) {
case -1:
for (line = 0; line < SY - 4 && runten->next; line++) {
roben = roben->next;
runten = runten->next;
}
ClearRegion();
for (line = 0, hlp = roben; line < LASTLINE && hlp; line++, hlp = hlp->next) {
movexy(SX - 37, line);
addstr(hlp->s);
}
rbottom = line;
break;
case 1:
for (line = 0; line < SY - 4 && roben->prev; line++) {
roben = roben->prev;
runten = runten->prev;
}
ClearRegion();
for (line = 0, hlp = roben; line < LASTLINE && hlp; line++, hlp = hlp->next) {
movexy(SX - 37, line);
addstr(hlp->s);
}
rbottom = line;
break;
}
}
void
saddstr(char *s)
{
if (s[0] < ' ')
s++;
addstr(s);
}
void
DisplayRegList(int neu)
{
int line;
dbllist *hlp;
ClearRegion();
if (!reglist) {
movexy(SX - 30, 0);
addstr("undefiniert");
refresh();
return;
}
if (neu)
runten = reglist;
else
runten = roben;
for (line = 0, hlp = runten; line < LASTLINE && hlp; line++, hlp = hlp->next) {
movexy(SX - 37, line);
saddstr(hlp->s);
if (runten->next)
runten = runten->next;
}
rbottom = line;
if (neu)
roben = reglist;
refresh();
}
void
SpecialFunction(region *r)
{
WINDOW *win;
variant zero_effect;
zero_effect.i = 0;
win = openwin(60, 5, "< Specials Regions >");
wmove(win, 1, 2);
wAddstr("1 - set Godcurse (n.imm), 2 - set Peace-Curse (imm)");
wmove(win, 2, 2);
wrefresh(win);
switch(getch()) {
case '1':
if (get_curse(r->attribs, ct_find("godcursezone"))==NULL) {
curse * c = create_curse(NULL, &r->attribs, ct_find("godcursezone"),
100, 100, zero_effect, 0);
curse_setflag(c, CURSE_ISNEW|CURSE_IMMUNE);
modified = 1;
break;
}
case '2':
if(!is_cursed_internal(r->attribs, ct_find("peacezone"))) {
curse * c = create_curse(NULL, &r->attribs, ct_find("peacezone"), 100, 2, zero_effect, 0);
curse_setflag(c, CURSE_IMMUNE);
modified = 1;
}
default:
break;
}
delwin(win);
}
static int
count_all_money(const region * r)
{
const unit *u;
int m = rmoney(r);
for (u = r->units; u; u = u->next)
m += get_money(u);
return m;
}
char Tchar[MAXRACES] = "ZEOGMTDIHK~uifdwtbrsz";
void
showregion(region * r, char full)
{
unit *u;
building *b;
ship *sh;
faction *f;
int d,pp=0, ecount[MAXRACES], count[MAXRACES];
char str[256];
int iron = -1, ironlevel = -1,
laen = -1, laenlevel = -1,
stone = -1, stonelevel = -1;
struct rawmaterial *res;
if (reglist) {
freelist(reglist);
reglist = NULL;
}
if (!r) return;
memset(ecount, 0, sizeof(ecount));
strncpy(str, rname(r, NULL), 24);
str[24] = 0;
sprintf(buf, "%s (%d,%d)", str, r->x, r->y);
adddbllist(&reglist, buf);
memset(str,'¯',strlen(buf)+1);
str[strlen(buf)+1] = 0;
adddbllist(&reglist, str);
sprintf(buf, " %hd turns old:", r->age);
adddbllist(&reglist, buf);
if (rterrain(r) != T_OCEAN && rterrain(r)!=T_FIREWALL) {
sprintf(buf, " %d peasants, %d(%d) silver", rpeasants(r), rmoney(r), count_all_money(r));
adddbllist(&reglist, buf);
sprintf(buf, " %d horses, %d/%d/%d ",
rhorses(r), rtrees(r,2), rtrees(r,1), rtrees(r,0));
if (fval(r,RF_MALLORN))
sncat(buf, "mallorn", BUFSIZE);
else
sncat(buf, "trees", BUFSIZE);
adddbllist(&reglist, buf);
for(res=r->resources;res;res=res->next) {
const item_type * itype = resource2item(res->type->rtype);
if(itype == olditemtype[I_IRON]) {
iron = res->amount;
ironlevel = res->level + itype->construction->minskill - 1;
} else if(itype == olditemtype[I_LAEN]) {
laen = res->amount;
laenlevel = res->level + itype->construction->minskill - 1;
} else if(itype == olditemtype[I_STONE]) {
stone = res->amount;
stonelevel = res->level + itype->construction->minskill - 1;
}
}
strcpy(buf, " ");
if(iron != -1) {
incat(buf, iron, BUFSIZE);
sncat(buf, " iron/", BUFSIZE);
incat(buf, ironlevel, BUFSIZE);
}
if(laen != -1) {
if(iron != -1) {
sncat(buf, ", ", BUFSIZE);
}
incat(buf, laen, BUFSIZE);
sncat(buf, " laen/", BUFSIZE);
incat(buf, laenlevel, BUFSIZE);
}
if(iron != -1 || laen != -1) {
adddbllist(&reglist, buf);
}
if(stone != -1) {
snprintf(buf, BUFSIZE, " %d stone/%d", stone, stonelevel);
adddbllist(&reglist, buf);
}
}
if (fval(r, RF_CHAOTIC)) {
adddbllist(&reglist, "chaotisch");
}
if (r->planep) {
strcpy(buf,"Plane: ");
strncpy(str, r->planep->name, 30);
str[30] = 0; sncat(buf, str, BUFSIZE);
sncat(buf, " (", BUFSIZE);
sncat(buf, r->planep->name, BUFSIZE);
sncat(buf, ")", BUFSIZE);
adddbllist(&reglist, buf);
}
NL(reglist);
if (rterrain(r) != T_OCEAN) {
strcpy(buf, "buildings:");
if (!r->buildings) {
sncat(buf, " keine", BUFSIZE);
adddbllist(&reglist, buf);
} else if (full) {
adddbllist(&reglist, buf);
for (b = r->buildings; b; b = b->next) {
adddbllist(&reglist, Buildingid(b));
for (u = r->units; u; u = u->next)
if (u->building == b && fval(u, UFL_OWNER)) {
strncpy(str, u->name, 27);
str[27] = 0;
sprintf(buf, " %s (%s)", str, unitid(u));
adddbllist(&reglist, buf);
strncpy(str, factionname(u->faction), 34);
str[34] = 0;
sprintf(buf, " %s", str);
adddbllist(&reglist, buf);
break;
}
if (!u)
adddbllist(&reglist, " steht leer");
}
} else {
d = 0;
for (b = r->buildings; b; b = b->next)
d++;
sncat(buf, " ", BUFSIZE);
incat(buf, d, BUFSIZE);
adddbllist(&reglist, buf);
}
NL(reglist);
}
strcpy(buf, "ships:");
if (!r->ships) {
sncat(buf, " keine", BUFSIZE);
adddbllist(&reglist, buf);
} else if (full) {
adddbllist(&reglist, buf);
for (sh = r->ships; sh; sh = sh->next) {
adddbllist(&reglist, Shipid(sh));
for (u = r->units; u; u = u->next)
if (u->ship == sh && fval(u, UFL_OWNER)) {
strncpy(str, u->name, 28);
str[28] = 0;
sprintf(buf, " %s (%s)", str, unitid(u));
adddbllist(&reglist, buf);
sprintf(buf, " %s", factionname(u->faction));
adddbllist(&reglist, buf);
break;
}
if (!u)
adddbllist(&reglist, " ohne Besitzer");
}
} else {
d = 0;
for (sh = r->ships; sh; sh = sh->next)
d++;
sncat(buf, " ", BUFSIZE);
incat(buf, d, BUFSIZE);
adddbllist(&reglist, buf);
}
NL(reglist);
if (!factions)
return;
strcpy(buf, "factions:");
if (!r->units) {
sncat(buf, " keine", BUFSIZE);
adddbllist(&reglist, buf);
} else {
adddbllist(&reglist, buf);
for (f = factions; f; f = f->next)
f->num_people = f->no_units = 0;
for (u = r->units; u; u = u->next) {
if (u->faction) {
u->faction->no_units++;
u->faction->num_people += u->number;
} else
fprintf(stderr,"Unit %s hat keine faction!\n",unitid(u));
}
for (f = factions; f; f = f->next)
if (f->no_units) {
if (alliances==NULL) {
sprintf(buf, " %-29.29s (%s)", f->name, factionid(f));
} else if (f->alliance != NULL) {
sprintf(buf, " %-26.26s (%s/%d)", f->name, factionid(f), f->alliance->id);
} else {
sprintf(buf, " %-26.26s (%s/-)", f->name, factionid(f));
}
adddbllist(&reglist, buf);
sprintf(buf, " Einheiten: %d; Leute: %d %c",
f->no_units, f->num_people, Tchar[old_race(f->race)]);
adddbllist(&reglist, buf);
}
for (d = RC_UNDEAD; d < MAXRACES; d++)
ecount[d] = count[d] = 0;
for (u = r->units; u; u = u->next) {
if (u->race >= new_race[RC_UNDEAD])
pp=1;
ecount[old_race(u->race)]++;
count[old_race(u->race)] += u->number;
}
if (pp) {
NL(reglist);
adddbllist(&reglist, "Monster, Zauber usw.:");
for (d = RC_UNDEAD; d < MAXRACES; d++) {
if (count[d]) {
sprintf(buf, " %s: %d in %d", new_race[d]->_name[0], count[d], ecount[d]);
adddbllist(&reglist, buf);
}
}
}
}
NL(reglist);
}

View file

@ -1,405 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <curses.h>
#include <eressea.h>
#include "mapper.h"
/* kernel includes */
#include <building.h>
#include <region.h>
#include <ship.h>
#include <unit.h>
/* util includes */
#include <base36.h>
/* libc includes */
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void
adddbllist(dbllist ** SP, const char *s)
{
dbllist *S, *X;
S = calloc(1, sizeof(dbllist) + strlen(s));
strcpy(S->s, s);
S->next = 0;
if (*SP) {
for (X = *SP; X->next; X = X->next);
X->next = S;
S->prev = X;
} else {
S->prev = 0;
*SP = S;
}
}
char *
Unitid(unit * u)
{
static char buf[NAMESIZE];
static char un[30];
strncpy(un, u->name, 25);
un[25] = 0;
sprintf(buf, "%s (%s)", un, unitid(u));
return buf;
}
char *
Buildingid(building * b)
{
static char buf[35];
sprintf(buf, "\002%s (%s), Größe %d",
buildingtype(b->type, b, b->size /*, NULL */),
buildingid(b), b->size);
return buf;
}
char *
Shipid(ship * sh)
{
static char buf[30];
sprintf(buf, "\023%s (%s)", sh->type->name[0], shipid(sh));
return buf;
}
char *
BuildingName(building * b)
{
static char buf[35];
sprintf(buf, "%s (%s)",
buildingtype(b->type, b, b->size /*, NULL*/), buildingid(b));
return buf;
}
int
map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre)
{
char lbuf[10];
int val, ch, cx, nw = 0;
if (!win) {
win = openwin(50, 3, 0);
nw = y = 1;
x = 2;
} else
wrefresh(win);
do {
char zText[160];
sprintf(lbuf, "%d", pre);
wmove(win, y, x);
curs_set(1);
sprintf(zText, "%s (%d..%d): %d", text, mn, mx, pre);
wprintw(win, (NCURSES_CONST char*)zText);
wrefresh(win);
/* getyx(win, y, x); */
cx = x + strlen(zText)/* getcurx(win) */- strlen(lbuf);
val = strlen(lbuf);
do {
ch = getch();
if (ch==8 || ch == KEY_BACKSPACE || ch == KEY_LEFT) {
if (val == 0)
beep();
else {
val--;
wmove(win, y, val + cx);
waddch(win, ' ');
wmove(win, y, val + cx);
wrefresh(win);
}
} else if (ch == 10 || ch == 13) {
curs_set(0);
} else if ((ch == '-' && val == 0) || (ch >= '0' && ch <= '9' && val < 10)) {
waddch(win, ch);
lbuf[val] = (char) ch;
val++;
} else
beep();
wrefresh(win);
} while (!(ch == 10 || ch == 13));
lbuf[val] = 0;
val = atoi(lbuf);
if (val < mn || val > mx)
beep();
} while (val < mn || val > mx);
if (nw)
delwin(win);
return val;
}
void
warnung(WINDOW * win, const char *text)
{
if (!win) {
win = openwin(strlen(text) + 4, 3, "< WARNING >");
wmove(win, 1, 2);
}
wprintw(win, (NCURSES_CONST char*)"%s", text);
beep();
wrefresh(win);
getch();
delwin(win);
}
boolean
yes_no(WINDOW * win, const char *text, const char def)
{
int ch;
boolean mywin = false;
if (!win) {
win = openwin(strlen(text) + 10, 3, 0);
wmove(win, 1, 2);
mywin = true;
}
wprintw(win, (NCURSES_CONST char*)"%s (%c/%c)", text, def == 'j' ? 'J' : 'j', def == 'n' ? 'N' : 'n');
wrefresh(win);
ch = getch();
if (mywin) {
delwin(win);
}
if (ch == 10 || ch == 13)
ch = def;
return (boolean)((ch == 'j' || ch == 'J' || ch == 'y' || ch == 'Y')?true:false);
}
char *
my_input(WINDOW * win, int x, int y, const char *text, const char *def)
{
static char lbuf[INPUT_BUFSIZE+1];
int val, ch, p, nw = 0;
if (!win) {
win = openwin(SX - 10, 3, 0);
nw = 1;
y = 1;
x = 2;
}
wmove(win, y, x);
wAddstr(text);
if(def) {
strcpy(lbuf, def);
wAddstr(lbuf);
p = x + strlen(text);
val = strlen(lbuf);
wmove(win, y, p + val);
} else {
p = x + strlen(text);
wmove(win, y, p);
val = 0;
}
wrefresh(win);
curs_set(1);
wcursyncup(win);
do {
ch = getch();
if (ch == KEY_BACKSPACE || ch == KEY_LEFT) {
if (val == 0)
beep();
else {
val--;
wmove(win, y, val + p);
waddch(win, ' ');
wmove(win, y, val + p);
wrefresh(win);
}
} else if (ch == '\n') {
curs_set(0);
} if(val >= INPUT_BUFSIZE) {
beep();
} else if (isprint(ch)) {
waddch(win, ch);
lbuf[val] = (char) ch;
val++;
} else
beep();
wrefresh(win);
} while (!(ch == '\n'));
if (nw) {
wclear(win);
delwin(win);
}
curs_set(0);
lbuf[val] = 0;
return lbuf;
}
void
insert_selection(selection ** p_sel, selection * prev, const char * str, void * payload)
{
selection * sel = calloc(sizeof(selection), 1);
sel->str = strdup(str);
sel->data = payload;
if (*p_sel) {
selection * s;
sel->next = *p_sel;
sel->prev = sel->next->prev;
sel->next->prev=sel;
if (sel->prev) {
sel->prev->next = sel;
sel->index=sel->prev->index+1;
}
for (s=sel->next;s;s=s->next) {
s->index = s->prev->index+1;
}
} else {
*p_sel = sel;
sel->prev = prev;
if (prev) sel->index=prev->index+1;
}
}
selection **
push_selection(selection ** p_sel, char * str, void * payload)
{
selection * sel = calloc(sizeof(selection), 1);
selection * prev = NULL;
sel->str = str;
sel->data = payload;
while (*p_sel) {
prev = *p_sel;
p_sel=&prev->next;
}
*p_sel = sel;
if (prev) {
sel->prev = prev;
sel->index = prev->index+1;
}
return p_sel;
}
selection *
do_selection(selection * sel, const char * title, void (*perform)(selection *, void *), void * data)
{
WINDOW * wn;
boolean update = true;
selection *s;
selection *top = sel;
selection *current = top;
int i;
int height=0, width=strlen(title)+8;
for (s=sel;s;s=s->next) {
if (strlen(s->str)>(unsigned)width) width = strlen(s->str);
++height;
}
if (height==0 || width==0) return NULL;
if (width+3>SX) width=SX-4;
if (height+2>SY) height=SY-2;
wn = newwin(height+2, width+4, (SY - height - 2) / 2, (SX - width - 4) / 2);
for (;;) {
int input;
if (update) {
wclear(wn);
for (s=top;s!=NULL && top->index+height!=s->index;s=s->next) {
i = s->index-top->index;
wmove(wn, i + 1, 4);
waddnstr(wn, s->str, -1);
}
/*wborder(wn, '|', '|', '-', '-', '+', '+', '+', '+');*/
wborder(wn, 0, 0, 0, 0, 0, 0, 0, 0);
wmove(wn, 0, 2);
sprintf(buf, "[ %s ]", title);
waddnstr(wn, buf, width);
update = false;
}
i = current->index-top->index;
wmove(wn, i + 1, 2);
waddstr(wn, "->");
wmove(wn, i + 1, 4);
wattron(wn, A_BOLD);
waddnstr(wn, current->str, width);
wattroff(wn, A_BOLD);
wrefresh(wn);
input = getch();
wmove(wn, i + 1, 2);
waddstr(wn, " ");
wmove(wn, i + 1, 4);
waddnstr(wn, current->str, width);
switch (input) {
case KEY_DOWN:
if (current->next) {
current = current->next;
if (current->index-height>=top->index) {
top=current;
update = true;
}
}
break;
case KEY_UP:
if (current->prev) {
if (current==top) {
top = sel;
while (top->index+height<current->index) top=top->next;
update = true;
}
current = current->prev;
}
break;
case 27:
case 'q':
delwin(wn);
return NULL;
case 10:
case 13:
if (perform) perform(current, data);
else {
delwin(wn);
return current;
}
break;
default:
s = current->next;
while (s && s!=current) {
if (tolower(s->str[0])==tolower(input)) {
current = s;
update = true;
} else {
s = s->next;
}
}
}
}
}
FILE *
mapperFopen(const char *defName, const char *mode)
{
char nameBuf[80];
FILE *fileP;
strncpy(nameBuf, my_input(0,0,0,"Ausgabe in File: ", defName), 79);
nameBuf[79] = 0;
fileP = fopen(nameBuf, mode);
if(!fileP) {
warnung(NULL, "Can't open file for writing");
}
return fileP;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,79 +0,0 @@
M A P P E R
¯¯¯¯¯¯¯¯¯¯¯
Parameter:
-ddatadir -> load/save dir
-cx,y -> jumpto x,y
-t -> Testkeys
Kurze Erklärung der Funktionen in den einzelnen Bereichen. Sind mehrere Tasten
möglich, sind diese mit , getrennt.
- Überall
? Kurz-Hilfe
q Beenden
<,> Springt an Anfang/Ende der Liste
Cursortasten bewegt Cursor/Zeiger; in Listen bewegt Crsr links/rechts
den Zeiger +/- 20 Zeilen.
^L redraw
- Karte
Shift+Cursor scrollt die Karte unter dem Cursor
T Terraform Region (mit Highlight: Terraform alle Regionen)
h Highlight Bereich (kein Scrollen möglich! m,p,j, x, y
gesperrt)
H Highlight bestimmte Merkmale (Partei, bewohnt, Burgen,
Schiffe)
C Create Block
P Neue Partei einfügen
D Partei löschen
S Daten Speichern
e,u Einheiten-Liste
p Partei-Liste
M Modify-Region (oder Regionen bei Highlight Bereich)
x neue X-Koordinate eingeben
y neue Y-Koordinate eingeben
m,j neue X- und Y-Koordinate eingeben
c springe an Position Clipunit
E Lösche Clipunit (es wird nicht die Einheit an sich
gelöscht, sondern nur Clipunit=0).
i,r ausführlichere Regionsinfos rechts
[,],PGUP,PGDN Flipt Seiten der langen Regionsinfo
q QUIT (mit Sicherheitsabfrage)
Speichert nach Abfrage, wenn Daten verändert wurden
- Einheiten-Liste
Cursortasten bewegt Pointer; => bei Einheit, -> bei Burg/Schiff
/ Sucht Text
n Sucht Text weiter
M Einheit verändern
N Neue Einheit schaffen
g,G Einheit in Clipunit bzw. Schiff in Clipschiff
P Clipunit hier einfügen
D Clipunit löschen
s Clipschiff hier einfügen oder neues Schiff
S Clipschiff löschen (Einheiten verlassen Schiff! Ozean!!)
b Neues Gebäude
B Gebäude löschen (Einheiten verlassen Gebäude)
E Lösche Clipunit (es wird nicht die Einheit an sich
gelöscht, sondern nur Clipunit=0).
U Einheits-Nummer eingeben (falls "auto-detect" nicht
klappt
q,Esc Ende Einheiten-Liste
- Regions-Menu
Cursortasten bewegt Pointer; => Wert kann verändert werden
-> Wert kann nicht verändert werden
Return: bei => Wert neu eingeben
s Neues Schiff
S Schiff löschen
b Neues Gebäude
B Gebäude löschen
q,Esc Ende Regions-Menu
Ansonsten: RTFS :)
Faroul

View file

@ -1,151 +0,0 @@
# Microsoft Developer Studio Project File - Name="mapper" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mapper - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mapper.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mapper.mak" CFG="mapper - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mapper - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "mapper - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mapper - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Za /W4 /GX /Z7 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
!ELSEIF "$(CFG)" == "mapper - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Za /W4 /Gm /ZI /Od /I "../common/kernel" /I "../common/gamecode" /I "../common/util" /I "../common" /I ".." /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /S (*.h ../*.h ../common/kernel/*.h ../common/attributes/*.h ../common/spells/*.h ../common/triggers/*.h ../common/items/*.h ../common/modules/*.h ../common/util/*.h) ../common/util/Debug/*.sbr ../common/items/Debug/*.sbr ../common/attributes/Debug/*.sbr ../common/kernel/Debug/*.sbr ../common/spells/Debug/*.sbr ../common/modules/Debug/*.sbr
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 curses.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "mapper - Win32 Release"
# Name "mapper - Win32 Debug"
# Begin Group "Header"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=.\autoseed.h
# End Source File
# Begin Source File
SOURCE=.\logging.h
# End Source File
# Begin Source File
SOURCE=.\mapper.h
# End Source File
# Begin Source File
SOURCE=..\modules\oceannames.h
# End Source File
# Begin Source File
SOURCE=..\modules\score.h
# End Source File
# Begin Source File
SOURCE=..\common\triggers\triggers.h
# End Source File
# Begin Source File
SOURCE=..\modules\weather.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\autoseed.c
# End Source File
# Begin Source File
SOURCE=.\logging.c
# End Source File
# Begin Source File
SOURCE=.\map_modify.c
# End Source File
# Begin Source File
SOURCE=.\map_partei.c
# End Source File
# Begin Source File
SOURCE=.\map_region.c
# End Source File
# Begin Source File
SOURCE=.\map_tools.c
# End Source File
# Begin Source File
SOURCE=.\map_units.c
# End Source File
# Begin Source File
SOURCE=.\mapper.c
# End Source File
# End Target
# End Project

View file

@ -1,127 +0,0 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef MAPPER_H
#define MAPPER_H
#define INPUT_BUFSIZE 80
#include <terrain.h>
#ifndef ISLANDSIZE
# define ISLANDSIZE ((rand()%3)?(25+rand()%10):(11+rand()%14))
#endif
#ifndef NCURSES_CONST
#ifdef __PDCURSES__
# define NCURSES_CONST
#else
# define NCURSES_CONST const
#endif
#endif
struct race;
typedef struct dbllist dbllist;
struct dbllist {
dbllist *next, *prev;
char s[1];
};
typedef struct tagregion {
struct tagregion *next;
struct region *r;
} tagregion;
extern tagregion *Tagged;
extern const struct terrain_type * select_terrain(const struct terrain_type * default_terrain);
void saddstr(char *s);
struct region *SeedPartei(void);
void Exit(int level);
int showunits(struct region * r);
void showregion(struct region * r, char full);
int modify_region(struct region * r);
void NeueBurg(struct region * r);
void NeuesSchiff(struct region * r);
void create_island(struct region *r, int n, const struct terrain_type * t);
void make_ocean_block(short x, short y);
void make_new_block(int x, int y);
void moveln(const int x);
char *my_input(WINDOW * win, int x, int y, const char *text, const char *def);
void make_new_region(short x, short y);
int map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre);
boolean yes_no(WINDOW * win, const char *text, const char def);
void warnung(WINDOW * win, const char *text);
FILE *mapperFopen(const char *defName, const char *mode);
void adddbllist(dbllist ** S, const char *s);
void ScrollRegList(int dir);
void DisplayRegList(int neu);
void NeuePartei(struct region * r);
void RemovePartei(void);
int ParteiListe(void);
int koor_distance(int a, int b, int x, int y);
void SpecialFunction(struct region *r);
extern WINDOW *mywin;
extern dbllist *reglist;
extern int MINX, MINY, MAXX, MAXY, pline;
extern dbllist *pointer;
extern char modified;
extern char *datadir;
extern struct unit *clipunit;
extern struct region *clipregion;
extern struct ship *clipship;
#define SX (stdscr->_maxx-1)
#define SY (stdscr->_maxy-1)
#define NL(S) adddbllist(&S," ")
#define wAddstr(x) waddnstr(win, (NCURSES_CONST char*)x,-1)
#define Addstr(x) waddnstr(mywin, (NCURSES_CONST char*)x,-1)
#define Movexy(x,y) wmove(mywin,y,x)
#define movexy(x,y) move(y,x)
/* move(zeile, spalte) ist "verkehrt"... */
extern WINDOW * openwin(int b, int h, const char* t);
#define S_SIGWINCH 1
char *Unitid(struct unit * u);
char *Buildingid(struct building * b);
char *Shipid(struct ship * sh);
char *BuildingName(struct building * b);
/* map_tools */
typedef struct selection {
struct selection * next;
struct selection * prev;
int index;
char * str;
void * data;
} selection;
struct selection * do_selection(struct selection * sel, const char * title, void (*perform)(struct selection *, void *), void * data);
struct selection ** push_selection(struct selection ** p_sel, char * str, void * payload);
void insert_selection(struct selection ** p_sel, struct selection * prev, const char * str, void * payload);
void block_create(short x1, short y1, int size, char chaotisch, int special, const terrain_type * terrain);
extern void read_orders(const char * filename);
extern int numnewbies;
#define sncat(b, s, size) strncat ((b), s, size - strlen (b))
extern struct newfaction * newfactions;
#endif /* MAPPER_H */