2001-01-25 10:37:55 +01:00
|
|
|
/* vi: set ts=2:
|
|
|
|
*
|
|
|
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
|
|
|
* 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
|
|
|
|
|
2001-02-03 14:45:35 +01:00
|
|
|
#define INPUT_BUFSIZE 80
|
|
|
|
|
|
|
|
#include <terrain.h>
|
|
|
|
|
2001-01-25 10:37:55 +01:00
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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, terrain_t t);
|
2001-04-01 08:58:45 +02:00
|
|
|
void make_ocean_block(int x, int y);
|
2001-01-25 10:37:55 +01:00
|
|
|
void make_new_block(int x, int y);
|
|
|
|
void moveln(const int x);
|
2001-02-09 14:53:53 +01:00
|
|
|
char *my_input(WINDOW * win, int x, int y, const char *text, const char *def);
|
2001-01-25 10:37:55 +01:00
|
|
|
void make_new_region(int x, int 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);
|
2001-05-11 22:19:22 +02:00
|
|
|
FILE *mapperFopen(const char *defName, const char *mode);
|
2001-01-25 10:37:55 +01:00
|
|
|
void adddbllist(dbllist ** S, const char *s);
|
|
|
|
void ScrollRegList(int dir);
|
|
|
|
void DisplayRegList(int neu);
|
|
|
|
char GetTerrain(struct region * r);
|
|
|
|
void NeuePartei(struct region * r);
|
|
|
|
void RemovePartei(void);
|
|
|
|
int ParteiListe(void);
|
|
|
|
int koor_distance(int a, int b, int x, int y);
|
|
|
|
int readgame(boolean backup);
|
|
|
|
int create_backup(char *file);
|
|
|
|
|
|
|
|
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;
|
|
|
|
#ifdef AMIGA
|
|
|
|
#define SX (stdscr->_maxx)
|
|
|
|
#define SY (stdscr->_maxy)
|
|
|
|
#else
|
|
|
|
#define SX (stdscr->_maxx-1)
|
|
|
|
#define SY (stdscr->_maxy-1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NL(S) adddbllist(&S," ")
|
|
|
|
|
|
|
|
#define wAddstr(x) waddnstr(win,x,-1)
|
|
|
|
#define Addstr(x) waddnstr(mywin,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, char * str, void * payload);
|
|
|
|
|
|
|
|
#define sncat(b, s, size) strncat ((b), s, size - strlen (b))
|
|
|
|
|
|
|
|
#endif /* MAPPER_H */
|