forked from github/server
The new GM tool, added to the eressea/ directory. All that remains is to
salvage some mapper functionality and stuff it in there (and cleanup), then the mapper/ directory can go.
This commit is contained in:
parent
f261bf2f5b
commit
bb1ba6b366
|
@ -2787,7 +2787,9 @@ guard_on_cmd(unit * u, struct order * ord)
|
||||||
if (fval(u->region->terrain, SEA_REGION)) {
|
if (fval(u->region->terrain, SEA_REGION)) {
|
||||||
cmistake(u, ord, 2, MSG_EVENT);
|
cmistake(u, ord, 2, MSG_EVENT);
|
||||||
} else {
|
} else {
|
||||||
if (fval(u, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) {
|
if (fval(u, UFL_MOVED)) {
|
||||||
|
cmistake(u, ord, 187, MSG_EVENT);
|
||||||
|
} else if (fval(u->race, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) {
|
||||||
cmistake(u, ord, 95, MSG_EVENT);
|
cmistake(u, ord, 95, MSG_EVENT);
|
||||||
} else {
|
} else {
|
||||||
/* Monster der Monsterpartei dürfen immer bewachen */
|
/* Monster der Monsterpartei dürfen immer bewachen */
|
||||||
|
|
|
@ -610,7 +610,7 @@ damage_unit(unit *u, const char *dam, boolean physical, boolean magic)
|
||||||
int h;
|
int h;
|
||||||
int i, dead = 0, hp_rem = 0, heiltrank;
|
int i, dead = 0, hp_rem = 0, heiltrank;
|
||||||
|
|
||||||
if (fval(u, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) {
|
if (fval(u->race, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2618,7 +2618,7 @@ writeturn(void)
|
||||||
sprintf(zText, "%s/turn", basepath());
|
sprintf(zText, "%s/turn", basepath());
|
||||||
f = cfopen(zText, "w");
|
f = cfopen(zText, "w");
|
||||||
if (!f) return;
|
if (!f) return;
|
||||||
fprintf(f,"%d",turn);
|
fprintf(f, "%d\n", turn);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1131,6 +1131,11 @@ leave_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
|
|
||||||
|
if (fval(u, UFL_ENTER)) {
|
||||||
|
/* if we just entered this round, then we don't leave again */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION) && u->ship) {
|
if (fval(r->terrain, SEA_REGION) && u->ship) {
|
||||||
if(!fval(u->race, RCF_SWIM)) {
|
if(!fval(u->race, RCF_SWIM)) {
|
||||||
cmistake(u, ord, 11, MSG_MOVE);
|
cmistake(u, ord, 11, MSG_MOVE);
|
||||||
|
@ -1244,12 +1249,6 @@ do_misc(boolean lasttry)
|
||||||
if(lasttry) cmistake(u, ord, 6, MSG_MOVE);
|
if(lasttry) cmistake(u, ord, 6, MSG_MOVE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Gebäude auf dem Ozean sollte man betreten dürfen
|
|
||||||
if(rterrain(r) == T_OCEAN) {
|
|
||||||
if (lasttry) cmistake(u, ord, 297, MSG_MOVE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (!mayenter(r, u, b)) {
|
if (!mayenter(r, u, b)) {
|
||||||
if(lasttry) {
|
if(lasttry) {
|
||||||
sprintf(buf, "Der Eintritt in %s wurde verwehrt",
|
sprintf(buf, "Der Eintritt in %s wurde verwehrt",
|
||||||
|
@ -1277,11 +1276,13 @@ do_misc(boolean lasttry)
|
||||||
if (buildingowner(r, b) == 0) {
|
if (buildingowner(r, b) == 0) {
|
||||||
fset(u, UFL_OWNER);
|
fset(u, UFL_OWNER);
|
||||||
}
|
}
|
||||||
|
fset(u, UFL_ENTER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_SHIP:
|
case P_SHIP:
|
||||||
sh = getship(r);
|
sh = getship(r);
|
||||||
entership(u, sh, ord, lasttry);
|
entership(u, sh, ord, lasttry);
|
||||||
|
fset(u, UFL_ENTER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -718,6 +718,7 @@ create_backup(char *file)
|
||||||
char bfile[MAX_PATH];
|
char bfile[MAX_PATH];
|
||||||
int c = 1;
|
int c = 1;
|
||||||
|
|
||||||
|
if (access(file, R_OK) == 0) return;
|
||||||
do {
|
do {
|
||||||
sprintf(bfile, "%s.backup%d", file, c);
|
sprintf(bfile, "%s.backup%d", file, c);
|
||||||
c++;
|
c++;
|
||||||
|
@ -1956,7 +1957,7 @@ readgame(const char * filename, int backup)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
writegame(const char *filename, char quiet)
|
writegame(const char *filename, int quiet)
|
||||||
{
|
{
|
||||||
char *base;
|
char *base;
|
||||||
int n;
|
int n;
|
||||||
|
|
|
@ -37,7 +37,7 @@ FILE * cfopen(const char *filename, const char *mode);
|
||||||
int readorders(const char *);
|
int readorders(const char *);
|
||||||
int creategame(void);
|
int creategame(void);
|
||||||
extern int readgame(const char * filename, int backup);
|
extern int readgame(const char * filename, int backup);
|
||||||
int writegame(const char *filename, char quiet);
|
int writegame(const char *filename, int quiet);
|
||||||
|
|
||||||
extern void rsf(FILE * F, char *s, size_t len);
|
extern void rsf(FILE * F, char *s, size_t len);
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@ extern int a_readstring(struct attrib * a, FILE * F);
|
||||||
extern void a_writestring(const struct attrib * a, FILE * F);
|
extern void a_writestring(const struct attrib * a, FILE * F);
|
||||||
extern void a_finalizestring(struct attrib * a);
|
extern void a_finalizestring(struct attrib * a);
|
||||||
|
|
||||||
|
extern void create_backup(char *file);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -934,7 +934,7 @@ u_setfaction(unit * u, faction * f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vorsicht Sprüche können u->number == 0 (RS_FARVISION) haben! */
|
/* vorsicht Sprüche können u->number == RS_FARVISION haben! */
|
||||||
void
|
void
|
||||||
set_number(unit * u, int count)
|
set_number(unit * u, int count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct item;
|
||||||
#define UFL_SIEGE (1<<12) /* speedup: belagert eine burg, siehe attribut */
|
#define UFL_SIEGE (1<<12) /* speedup: belagert eine burg, siehe attribut */
|
||||||
#define UFL_TARGET (1<<13) /* speedup: hat ein target, siehe attribut */
|
#define UFL_TARGET (1<<13) /* speedup: hat ein target, siehe attribut */
|
||||||
#define UFL_WERE (1<<14)
|
#define UFL_WERE (1<<14)
|
||||||
|
#define UFL_ENTER (1<<15) /* unit has entered a ship/building and will not leave it */
|
||||||
|
|
||||||
/* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
|
/* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */
|
||||||
#define UFL_LOCKED (1<<16) /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */
|
#define UFL_LOCKED (1<<16) /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */
|
||||||
|
@ -210,7 +211,6 @@ extern struct building * inside_building(const struct unit * u);
|
||||||
extern void free_units(void);
|
extern void free_units(void);
|
||||||
extern struct faction * dfindhash(int no);
|
extern struct faction * dfindhash(int no);
|
||||||
extern void u_setfaction(struct unit * u, struct faction * f);
|
extern void u_setfaction(struct unit * u, struct faction * f);
|
||||||
/* vorsicht Sprüche können u->number == 0 (RS_FARVISION) haben! */
|
|
||||||
extern void set_number(struct unit * u, int count);
|
extern void set_number(struct unit * u, int count);
|
||||||
|
|
||||||
extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
|
extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
|
||||||
|
|
|
@ -19,7 +19,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
/* TODO: set from external function */
|
/* TODO: set from external function */
|
||||||
static int flags = LOG_FLUSH|LOG_CPERROR|LOG_CPWARNING;
|
int log_flags = LOG_FLUSH|LOG_CPERROR|LOG_CPWARNING;
|
||||||
static FILE * logfile;
|
static FILE * logfile;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -44,7 +44,7 @@ log_printf(const char * format, ...)
|
||||||
va_start(marker, format);
|
va_start(marker, format);
|
||||||
vfprintf(logfile, format, marker);
|
vfprintf(logfile, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
if (flags & LOG_FLUSH) {
|
if (log_flags & LOG_FLUSH) {
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ check_dupe(const char * format, const char * type)
|
||||||
if (dupes) {
|
if (dupes) {
|
||||||
fprintf(logfile, "%s: last error repeated %d times\n", last_type, dupes+1);
|
fprintf(logfile, "%s: last error repeated %d times\n", last_type, dupes+1);
|
||||||
if (logfile!=stderr) {
|
if (logfile!=stderr) {
|
||||||
if (flags & LOG_CPERROR) {
|
if (log_flags & LOG_CPERROR) {
|
||||||
fprintf(stderr, "%s: last error repeated %d times\n", last_type, dupes+1);
|
fprintf(stderr, "%s: last error repeated %d times\n", last_type, dupes+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,13 +113,13 @@ _log_warn(const char * format, ...)
|
||||||
vfprintf(logfile, format, marker);
|
vfprintf(logfile, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
if (logfile!=stderr) {
|
if (logfile!=stderr) {
|
||||||
if (flags & LOG_CPWARNING) {
|
if (log_flags & LOG_CPWARNING) {
|
||||||
fputs("WARNING: ", stderr);
|
fputs("WARNING: ", stderr);
|
||||||
va_start(marker, format);
|
va_start(marker, format);
|
||||||
vfprintf(stderr, format, marker);
|
vfprintf(stderr, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
}
|
}
|
||||||
if (flags & LOG_FLUSH) {
|
if (log_flags & LOG_FLUSH) {
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ _log_error(const char * format, ...)
|
||||||
vfprintf(logfile, format, marker);
|
vfprintf(logfile, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
if (logfile!=stderr) {
|
if (logfile!=stderr) {
|
||||||
if (flags & LOG_CPERROR) {
|
if (log_flags & LOG_CPERROR) {
|
||||||
fputs("ERROR: ", stderr);
|
fputs("ERROR: ", stderr);
|
||||||
va_start(marker, format);
|
va_start(marker, format);
|
||||||
vfprintf(stderr, format, marker);
|
vfprintf(stderr, format, marker);
|
||||||
|
@ -162,13 +162,13 @@ _log_info(unsigned int flag, const char * format, ...)
|
||||||
vfprintf(logfile, format, marker);
|
vfprintf(logfile, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
if (logfile!=stderr) {
|
if (logfile!=stderr) {
|
||||||
if (flags & flag) {
|
if (log_flags & flag) {
|
||||||
fprintf(stderr, "INFO[%u]: ", flag);
|
fprintf(stderr, "INFO[%u]: ", flag);
|
||||||
va_start(marker, format);
|
va_start(marker, format);
|
||||||
vfprintf(stderr, format, marker);
|
vfprintf(stderr, format, marker);
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
}
|
}
|
||||||
if (flags & LOG_FLUSH) {
|
if (log_flags & LOG_FLUSH) {
|
||||||
log_flush();
|
log_flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ extern "C" {
|
||||||
#define LOG_CPWARNING (1<<1)
|
#define LOG_CPWARNING (1<<1)
|
||||||
#define LOG_CPERROR (1<<2)
|
#define LOG_CPERROR (1<<2)
|
||||||
|
|
||||||
|
extern int log_flags;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,6 +73,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea\eres
|
||||||
{4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}
|
{4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmtool", "eressea\gmtool.vcproj", "{57BA2AEE-5C65-4839-9294-C0FA2915A06C}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{C14E3D2B-8189-4570-A4E3-9010C873E4FD} = {C14E3D2B-8189-4570-A4E3-9010C873E4FD}
|
||||||
|
{EF495253-2EEC-4F83-B6C0-D651F88B2198} = {EF495253-2EEC-4F83-B6C0-D651F88B2198}
|
||||||
|
{1D80D05F-BCF5-4971-8F06-D9581FD3B1F4} = {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}
|
||||||
|
{601CF164-F483-4DE7-8014-64BDD30680B5} = {601CF164-F483-4DE7-8014-64BDD30680B5}
|
||||||
|
{EDB0DE67-8215-4AF7-ACA1-F23CB11FF211} = {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}
|
||||||
|
{0EE778AB-8445-40DB-8F65-6BE378A91B97} = {0EE778AB-8445-40DB-8F65-6BE378A91B97}
|
||||||
|
{330712B5-8B27-4B17-B3CF-7A02CC0F93C3} = {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}
|
||||||
|
{4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
Debug = Debug
|
Debug = Debug
|
||||||
|
@ -150,6 +162,12 @@ Global
|
||||||
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Profile.Build.0 = Profile|Win32
|
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Profile.Build.0 = Profile|Win32
|
||||||
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.ActiveCfg = Release|Win32
|
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.ActiveCfg = Release|Win32
|
||||||
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.Build.0 = Release|Win32
|
{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.Build.0 = Release|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Debug.Build.0 = Debug|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Profile.ActiveCfg = Profile|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Profile.Build.0 = Profile|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Release.ActiveCfg = Release|Win32
|
||||||
|
{57BA2AEE-5C65-4839-9294-C0FA2915A06C}.Release.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
@ -7,10 +7,15 @@ SubDirHdrs $(SUBDIR)/../common/util ;
|
||||||
SubDirHdrs $(SUBDIR)/../common ;
|
SubDirHdrs $(SUBDIR)/../common ;
|
||||||
SubDirHdrs $(SUBDIR)/.. ;
|
SubDirHdrs $(SUBDIR)/.. ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) curses ] ;
|
||||||
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) lua ] ;
|
||||||
|
SubDirC++Flags -DHAVE_LUA ;
|
||||||
|
|
||||||
SubDirHdrs $(XMLHDRS) ;
|
SubDirHdrs $(XMLHDRS) ;
|
||||||
|
|
||||||
LUASERVER = eressea-lua ;
|
LUASERVER = eressea-lua ;
|
||||||
SERVER = eressea ;
|
SERVER = eressea ;
|
||||||
|
GMTOOL = gmtool ;
|
||||||
|
|
||||||
SERVER_SOURCES = main.c korrektur.c ;
|
SERVER_SOURCES = main.c korrektur.c ;
|
||||||
LUASERVER_SOURCES =
|
LUASERVER_SOURCES =
|
||||||
|
@ -32,25 +37,33 @@ LUASERVER_SOURCES =
|
||||||
console.c
|
console.c
|
||||||
;
|
;
|
||||||
|
|
||||||
|
GMTOOL_SOURCES =
|
||||||
|
<curses>listbox.c
|
||||||
|
gmtool.c
|
||||||
|
editing.c
|
||||||
|
;
|
||||||
|
|
||||||
|
# the curses-based GM tool
|
||||||
|
Main $(GMTOOL) : $(GMTOOL_SOURCES) ;
|
||||||
|
LinkLibraries $(GMTOOL) :
|
||||||
|
kernel modules items attributes spells races triggers util ;
|
||||||
|
libxml2 $(GMTOOL) ;
|
||||||
|
LINKLIBS on $(GMTOOL) += -L$(LUABIND_ROOT)/lib -lm -lncurses ;
|
||||||
|
|
||||||
|
# old eressea server. use only for testing.
|
||||||
LinkLibraries $(SERVER) :
|
LinkLibraries $(SERVER) :
|
||||||
gamecode kernel items modules attributes spells races triggers util ;
|
gamecode kernel items modules attributes spells races triggers util ;
|
||||||
LinkLibraries $(LUASERVER) :
|
|
||||||
gamecode kernel items modules attributes spells races triggers util ;
|
|
||||||
|
|
||||||
libxml2 $(SERVER) ;
|
libxml2 $(SERVER) ;
|
||||||
LINKLIBS on $(SERVER) += -L$(LUABIND_ROOT)/lib -lm ;
|
LINKLIBS on $(SERVER) += -L$(LUABIND_ROOT)/lib -lm ;
|
||||||
|
Main $(SERVER) : $(SERVER_SOURCES) ;
|
||||||
|
|
||||||
|
# eressea-server with lua scripting
|
||||||
|
LinkLibraries $(LUASERVER) :
|
||||||
|
gamecode kernel items modules attributes spells races triggers util ;
|
||||||
luabind $(LUASERVER) ;
|
luabind $(LUASERVER) ;
|
||||||
libxml2 $(LUASERVER) ;
|
libxml2 $(LUASERVER) ;
|
||||||
LINKLIBS on $(LUASERVER) += -lm -ldl -lstdc++ ;
|
LINKLIBS on $(LUASERVER) += -lm -ldl -lstdc++ ;
|
||||||
|
|
||||||
if ! $(WITHOUT_LUA) {
|
|
||||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) lua ] ;
|
|
||||||
SubDirC++Flags -DHAVE_LUA ;
|
|
||||||
UsingLua ;
|
UsingLua ;
|
||||||
UsingLuabind ;
|
UsingLuabind ;
|
||||||
|
|
||||||
Main $(LUASERVER) : $(LUASERVER_SOURCES) ;
|
Main $(LUASERVER) : $(LUASERVER_SOURCES) ;
|
||||||
}
|
|
||||||
|
|
||||||
Main $(SERVER) : $(SERVER_SOURCES) ;
|
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
/* vi: set ts=2:
|
||||||
|
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
* | | Enno Rehling <enno@eressea.de>
|
||||||
|
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||||
|
* | (c) 1998 - 2006 |
|
||||||
|
* | | This program may not be used, modified or distributed
|
||||||
|
* +-------------------+ without prior permission by the authors of Eressea.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
|
||||||
|
#include <config.h>
|
||||||
|
#include <curses.h>
|
||||||
|
|
||||||
|
#include "listbox.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
insert_selection(list_selection ** p_sel, list_selection * prev, const char * str, void * payload)
|
||||||
|
{
|
||||||
|
list_selection * sel = calloc(sizeof(list_selection), 1);
|
||||||
|
sel->str = strdup(str);
|
||||||
|
sel->data = payload;
|
||||||
|
if (*p_sel) {
|
||||||
|
list_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;
|
||||||
|
}
|
||||||
|
*p_sel = sel;
|
||||||
|
} else {
|
||||||
|
*p_sel = sel;
|
||||||
|
sel->prev = prev;
|
||||||
|
if (prev) sel->index=prev->index+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list_selection **
|
||||||
|
push_selection(list_selection ** p_sel, char * str, void * payload)
|
||||||
|
{
|
||||||
|
list_selection * sel = calloc(sizeof(list_selection), 1);
|
||||||
|
list_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SX (stdscr->_maxx)
|
||||||
|
#define SY (stdscr->_maxy)
|
||||||
|
|
||||||
|
list_selection *
|
||||||
|
do_selection(list_selection * sel, const char * title, void (*perform)(list_selection *, void *), void * data)
|
||||||
|
{
|
||||||
|
WINDOW * wn;
|
||||||
|
boolean update = true;
|
||||||
|
list_selection *s;
|
||||||
|
list_selection *top = sel;
|
||||||
|
list_selection *current = top;
|
||||||
|
int i;
|
||||||
|
int height = 0, width = (int)strlen(title)+8;
|
||||||
|
for (s=sel;s;s=s->next) {
|
||||||
|
if ((int)strlen(s->str)>width) width = (int)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, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
mvwprintw(wn, 0, 2, "[ %s ]", title);
|
||||||
|
update = false;
|
||||||
|
}
|
||||||
|
i = current->index-top->index;
|
||||||
|
wattron(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||||
|
wmove(wn, i + 1, 2);
|
||||||
|
waddstr(wn, "->");
|
||||||
|
wmove(wn, i + 1, 4);
|
||||||
|
waddnstr(wn, current->str, width);
|
||||||
|
wattroff(wn, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||||
|
|
||||||
|
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;
|
||||||
|
if (s==NULL) s = top;
|
||||||
|
while (s!=current) {
|
||||||
|
if (tolower(s->str[0])==tolower(input)) {
|
||||||
|
current = s;
|
||||||
|
update = true;
|
||||||
|
} else {
|
||||||
|
s = s->next;
|
||||||
|
if (s==NULL) s = top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef CURSES_LISTBOX
|
||||||
|
#define CURSES_LISTBOX
|
||||||
|
|
||||||
|
typedef struct list_selection {
|
||||||
|
struct list_selection * next;
|
||||||
|
struct list_selection * prev;
|
||||||
|
int index;
|
||||||
|
char * str;
|
||||||
|
void * data;
|
||||||
|
} list_selection;
|
||||||
|
|
||||||
|
extern struct list_selection * do_selection(struct list_selection * sel, const char * title, void (*perform)(struct list_selection *, void *), void * data);
|
||||||
|
extern struct list_selection ** push_selection(struct list_selection ** p_sel, char * str, void * payload);
|
||||||
|
extern void insert_selection(struct list_selection ** p_sel, struct list_selection * prev, const char * str, void * payload);
|
||||||
|
|
||||||
|
#endif /* CURSES_LISTBOX */
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* vi: set ts=2:
|
||||||
|
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
* | | Enno Rehling <enno@eressea.de>
|
||||||
|
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||||
|
* | (c) 1998 - 2006 |
|
||||||
|
* | | This program may not be used, modified or distributed
|
||||||
|
* +-------------------+ without prior permission by the authors of Eressea.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <eressea.h>
|
||||||
|
#include "editing.h"
|
||||||
|
|
||||||
|
#include <kernel/region.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
make_block(short x, short y, short radius, const struct terrain_type * terrain)
|
||||||
|
{
|
||||||
|
short cx, cy;
|
||||||
|
region *r;
|
||||||
|
|
||||||
|
if (terrain==NULL) return;
|
||||||
|
|
||||||
|
for (cx = x - radius; cx != x+radius; ++cx) {
|
||||||
|
for (cy = y - radius; cy != y+radius; ++cy) {
|
||||||
|
if (koor_distance(cx, cy, x, y) < radius) {
|
||||||
|
if (!findregion(cx, cy)) {
|
||||||
|
r = new_region(cx, cy);
|
||||||
|
terraform_region(r, terrain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
make_island(short x, short y, int size)
|
||||||
|
{
|
||||||
|
/* region_list * island; */
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* vi: set ts=2:
|
||||||
|
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
* | | Enno Rehling <enno@eressea.de>
|
||||||
|
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||||
|
* | (c) 1998 - 2006 |
|
||||||
|
* | | This program may not be used, modified or distributed
|
||||||
|
* +-------------------+ without prior permission by the authors of Eressea.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GM_EDITING
|
||||||
|
#define GM_EDITING
|
||||||
|
|
||||||
|
extern void make_block(short x, short y, short radius, const struct terrain_type * terrain);
|
||||||
|
extern void make_island(short x, short y, int size);
|
||||||
|
|
||||||
|
#endif /* GM_EDITING */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,77 @@
|
||||||
|
/* vi: set ts=2:
|
||||||
|
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
* | | Enno Rehling <enno@eressea.de>
|
||||||
|
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||||
|
* | (c) 1998 - 2006 |
|
||||||
|
* | | This program may not be used, modified or distributed
|
||||||
|
* +-------------------+ without prior permission by the authors of Eressea.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* types imported from eressea: */
|
||||||
|
struct region;
|
||||||
|
|
||||||
|
typedef struct extent {
|
||||||
|
/* Ein Vektor */
|
||||||
|
int width, height;
|
||||||
|
} extent;
|
||||||
|
|
||||||
|
typedef struct point {
|
||||||
|
/* Eine Koordinate in einer Ascii-Karte */
|
||||||
|
int x, y;
|
||||||
|
} point;
|
||||||
|
|
||||||
|
typedef struct coordinate {
|
||||||
|
/* Eine Koordinate in der Welt */
|
||||||
|
int x, y, p;
|
||||||
|
} coordinate;
|
||||||
|
|
||||||
|
typedef struct map_region {
|
||||||
|
struct region * r;
|
||||||
|
coordinate coord;
|
||||||
|
} map_region;
|
||||||
|
|
||||||
|
typedef struct view {
|
||||||
|
struct map_region * regions;
|
||||||
|
int plane;
|
||||||
|
coordinate topleft; /* upper left corner in map. */
|
||||||
|
extent extent; /* dimensions. */
|
||||||
|
} view;
|
||||||
|
|
||||||
|
typedef struct tag {
|
||||||
|
coordinate coord;
|
||||||
|
struct tag * nexthash;
|
||||||
|
} tag;
|
||||||
|
|
||||||
|
#define MAXTHASH 512
|
||||||
|
|
||||||
|
typedef struct selection {
|
||||||
|
tag * tags[MAXTHASH];
|
||||||
|
} selection;
|
||||||
|
|
||||||
|
typedef struct state {
|
||||||
|
coordinate cursor;
|
||||||
|
selection * selected;
|
||||||
|
struct state * undo;
|
||||||
|
struct faction * topf;
|
||||||
|
view display;
|
||||||
|
int modified;
|
||||||
|
unsigned int info_flags;
|
||||||
|
struct window * wnd_info;
|
||||||
|
struct window * wnd_map;
|
||||||
|
struct window * wnd_status;
|
||||||
|
} state;
|
||||||
|
|
||||||
|
typedef struct window {
|
||||||
|
boolean (*handlekey)(struct window * win, struct state * st, int key);
|
||||||
|
void (*paint)(struct window * win, const struct state * st);
|
||||||
|
|
||||||
|
WINDOW * handle;
|
||||||
|
struct window * next;
|
||||||
|
struct window * prev;
|
||||||
|
boolean initialized;
|
||||||
|
int update;
|
||||||
|
} window;
|
||||||
|
|
||||||
|
#define TWIDTH 2 /* width of tile */
|
||||||
|
#define THEIGHT 1 /* height of tile */
|
|
@ -251,16 +251,6 @@ game_init(void)
|
||||||
#ifdef INFOCMD_MODULE
|
#ifdef INFOCMD_MODULE
|
||||||
init_info();
|
init_info();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REMOVE_THIS
|
|
||||||
render_init();
|
|
||||||
{
|
|
||||||
FILE * F = fopen("messagetypes.txt", "w");
|
|
||||||
debug_messagetypes(F);
|
|
||||||
fclose(F);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SHORTPWDS
|
#ifdef SHORTPWDS
|
||||||
|
@ -434,6 +424,7 @@ usage(const char * prog, const char * arg)
|
||||||
"-x n : Lädt nur die ersten n regionen\n"
|
"-x n : Lädt nur die ersten n regionen\n"
|
||||||
"-f x y : Lädt nur die regionen ab (x,y)\n"
|
"-f x y : Lädt nur die regionen ab (x,y)\n"
|
||||||
"-v befehlsdatei : verarbeitet automatisch die angegebene Befehlsdatei\n"
|
"-v befehlsdatei : verarbeitet automatisch die angegebene Befehlsdatei\n"
|
||||||
|
"-q : be less verbose\n"
|
||||||
"-d datadir : gibt das datenverzeichnis an\n"
|
"-d datadir : gibt das datenverzeichnis an\n"
|
||||||
"-b basedir : gibt das basisverzeichnis an\n"
|
"-b basedir : gibt das basisverzeichnis an\n"
|
||||||
"-r resdir : gibt das resourceverzeichnis an\n"
|
"-r resdir : gibt das resourceverzeichnis an\n"
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <lua50/lua.h>
|
#include <lua50/lua.h>
|
||||||
#include <lua50/lauxlib.h>
|
#include <lua50/lauxlib.h>
|
||||||
#include <lua50/lualib.h>
|
#include <lua50/lualib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LUABIND_BETA
|
#ifndef LUABIND_BETA
|
||||||
|
@ -14,3 +19,5 @@ extern "C" {
|
||||||
# define LUABIND_DEVEL 2
|
# define LUABIND_DEVEL 2
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -374,7 +374,7 @@ do_selection(selection * sel, const char * title, void (*perform)(selection *, v
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
s = current->next;
|
s = current->next;
|
||||||
while (s!=current) {
|
while (s && s!=current) {
|
||||||
if (tolower(s->str[0])==tolower(input)) {
|
if (tolower(s->str[0])==tolower(input)) {
|
||||||
current = s;
|
current = s;
|
||||||
update = true;
|
update = true;
|
||||||
|
|
|
@ -70,9 +70,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
extern char *reportdir;
|
|
||||||
extern char *datadir;
|
|
||||||
extern char *basedir;
|
|
||||||
extern int maxregions;
|
extern int maxregions;
|
||||||
extern boolean dirtyload;
|
extern boolean dirtyload;
|
||||||
char datafile[256];
|
char datafile[256];
|
||||||
|
@ -1667,12 +1664,14 @@ main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
/* register_dungeon(); */
|
/* register_dungeon(); */
|
||||||
|
|
||||||
|
register_itemtypes();
|
||||||
register_xmlreader();
|
register_xmlreader();
|
||||||
init_data(xmlfile);
|
init_data(xmlfile);
|
||||||
|
|
||||||
init_locales();
|
init_locales();
|
||||||
init_attributes();
|
init_attributes();
|
||||||
|
init_races();
|
||||||
|
init_itemtypes();
|
||||||
init_rawmaterials();
|
init_rawmaterials();
|
||||||
|
|
||||||
init_gmcmd();
|
init_gmcmd();
|
||||||
|
|
|
@ -72,7 +72,6 @@ void NeuePartei(struct region * r);
|
||||||
void RemovePartei(void);
|
void RemovePartei(void);
|
||||||
int ParteiListe(void);
|
int ParteiListe(void);
|
||||||
int koor_distance(int a, int b, int x, int y);
|
int koor_distance(int a, int b, int x, int y);
|
||||||
int create_backup(char *file);
|
|
||||||
void SpecialFunction(struct region *r);
|
void SpecialFunction(struct region *r);
|
||||||
|
|
||||||
extern WINDOW *mywin;
|
extern WINDOW *mywin;
|
||||||
|
|
|
@ -55,8 +55,8 @@
|
||||||
|
|
||||||
<param name="entertain.base" value="0"/>
|
<param name="entertain.base" value="0"/>
|
||||||
<param name="entertain.perlevel" value="20"/>
|
<param name="entertain.perlevel" value="20"/>
|
||||||
<param name="nmr.timeout" value="4"/>
|
<param name="nmr.timeout" value="10"/>
|
||||||
<param name="nmr.removenewbie" value="2"/>
|
<param name="nmr.removenewbie" value="10"/>
|
||||||
<param name="GiveRestriction" value="3"/>
|
<param name="GiveRestriction" value="3"/>
|
||||||
<param name="hunger.long" value="1"/>
|
<param name="hunger.long" value="1"/>
|
||||||
<param name="rules.check_overload" value="0"/>
|
<param name="rules.check_overload" value="0"/>
|
||||||
|
@ -70,12 +70,12 @@
|
||||||
<xi:include href="eressea/temple.xml"/>
|
<xi:include href="eressea/temple.xml"/>
|
||||||
<strings>
|
<strings>
|
||||||
<string name="mailto">
|
<string name="mailto">
|
||||||
<text locale="de">eressea-server@eressea.upb.de</text>
|
<text locale="de">eressea-server@eressea.kn-bremen.de</text>
|
||||||
<text locale="en">eressea-server@eressea.upb.de</text>
|
<text locale="en">eressea-server@eressea.kn-bremen.de</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="newbie_info_1">
|
<string name="newbie_info_1">
|
||||||
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff ERESSEA BEFEHLE an eressea-server@eressea.upb.de zu senden. Am besten, du verwendest die Befehlsvorlage am Ende des Reports.</text>
|
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff ERESSEA BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden. Am besten, du verwendest die Befehlsvorlage am Ende des Reports.</text>
|
||||||
<text locale="en">Remember to send your orders to eressea-server@eressea.upb.de with the subject ERESSEA ORDERS.</text>
|
<text locale="en">Remember to send your orders to eressea-server@eressea.kn-bremen.de with the subject ERESSEA ORDERS.</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="mailcmd">
|
<string name="mailcmd">
|
||||||
<text locale="de">ERESSEA BEFEHLE</text>
|
<text locale="de">ERESSEA BEFEHLE</text>
|
||||||
|
|
|
@ -4009,16 +4009,6 @@
|
||||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - You cannot cast this spell in a swamp."</text>
|
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - You cannot cast this spell in a swamp."</text>
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - You cannot cast this spell in a swamp."</text>
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - You cannot cast this spell in a swamp."</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="error187" section="errors">
|
|
||||||
<type>
|
|
||||||
<arg name="unit" type="unit"/>
|
|
||||||
<arg name="region" type="region"/>
|
|
||||||
<arg name="command" type="order"/>
|
|
||||||
</type>
|
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Hier gibt es bereits gute Straßen."</text>
|
|
||||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - There are already sufficient roads here."</text>
|
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - There are already sufficient roads here."</text>
|
|
||||||
</message>
|
|
||||||
<message name="error186" section="errors">
|
<message name="error186" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
@ -4038,6 +4028,16 @@
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Zauber scheint ungewöhnlich schwach zu sein. Irgendetwas hat die magischen Energien abgeleitet."</text>
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Zauber scheint ungewöhnlich schwach zu sein. Irgendetwas hat die magischen Energien abgeleitet."</text>
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - the spell seems exceptionally weak. Something has interfred with the magical energies."</text>
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - the spell seems exceptionally weak. Something has interfred with the magical energies."</text>
|
||||||
</message>
|
</message>
|
||||||
|
<message name="error187" section="errors">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="region" type="region"/>
|
||||||
|
<arg name="command" type="order"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Einheit kann den Befehl in dieser nicht ausführen, da sie sich bewegt hat oder in einen Kampf verwickelt war."</text>
|
||||||
|
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The unit cannot execute this command because it has either moved or been in combat."</text>
|
||||||
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The unit cannot execute this command because it has either moved or been in combat."</text>
|
||||||
|
</message>
|
||||||
<message name="error184" section="errors">
|
<message name="error184" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
Loading…
Reference in New Issue