- Bugfixes and code-merges between freeze and HEAD branch. Minor changes that should not affect the code

- Bugfix to P_BERSERK
This commit is contained in:
Enno Rehling 2003-07-29 09:48:03 +00:00
parent a722850e95
commit 8823db9702
303 changed files with 2766 additions and 2065 deletions

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,18 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_AGGRESSIVE
#define H_ATTRIBUTE_AGGRESSIVE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_aggressive;
extern struct attrib * make_aggressive(int chance);
extern void init_aggressive(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,9 +12,19 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_MOVEMENT
#define H_ATTRIBUTE_MOVEMENT
#ifdef __cplusplus
extern "C" {
#endif
extern boolean get_movement(attrib ** alist, int type);
extern void set_movement(struct attrib ** alist, int type);
extern void init_movement(void);
extern struct attrib_type at_movement;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -10,4 +10,16 @@
without prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_ATTRIBUTES
#define H_ATTRIBUTE_ATTRIBUTES
#ifdef __cplusplus
extern "C" {
#endif
extern void init_attributes(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,7 +12,18 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_FLEECHANCE
#define H_ATTRIBUTE_FLEECHANCE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_fleechance;
extern struct attrib * make_fleechance(float fleechance);
extern void init_fleechance(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,9 +12,21 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_FOLLOW
#define H_ATTRIBUTE_FOLLOW
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_follow;
struct unit;
extern struct attrib * make_follow(struct unit * u);
extern void init_follow(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,8 +11,12 @@
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef GIVEITEM_H
#define GIVEITEM_H
#ifndef H_ATTRIBUTE_GIVEITEM
#define H_ATTRIBUTE_GIVEITEM
#ifdef __cplusplus
extern "C" {
#endif
struct building;
struct item;
@ -20,4 +24,8 @@ extern struct attrib_type at_giveitem;
extern struct attrib * make_giveitem(struct building * b, struct item * items);
extern void init_giveitem(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,8 +12,22 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_GM
#define H_ATTRIBUTE_GM
#ifdef __cplusplus
extern "C" {
#endif
/* this is an attribute used by the kernel (isallied) */
struct plane;
extern struct attrib_type at_gm;
extern struct attrib * make_gm(const struct plane *pl);
extern void init_gm(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,9 +12,21 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_HATE
#define H_ATTRIBUTE_HATE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_hate;
struct unit;
extern struct attrib * make_hate(struct unit * u);
extern void init_hate(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,7 +12,19 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_ICEBERG
#define H_ATTRIBUTE_ICEBERG
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_iceberg;
extern struct attrib * make_iceberg(direction_t dir);
extern void init_iceberg(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,9 +12,21 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_KEY
#define H_ATTRIBUTE_KEY
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_key;
extern struct attrib * make_key(int key);
extern struct attrib * find_key(struct attrib * alist, int key);
extern struct attrib * add_key(struct attrib ** alist, int key);
extern void init_key(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,9 +12,17 @@
* prior permission by the authors of Eressea.
*/
#ifdef __cplusplus
extern "C" {
#endif
struct resource_type;
struct unit;
typedef int (*mm_fun)(const struct unit * u, const struct resource_type * rtype, int value);
extern struct attrib_type at_matmod;
extern struct attrib * make_matmod(mm_fun function);
#ifdef __cplusplus
}
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,12 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_MOVED
#define H_ATTRIBUTE_MOVED
#ifdef __cplusplus
extern "C" {
#endif
struct attrib;
struct attrib_type;
@ -21,3 +27,8 @@ extern void init_moved(void);
extern struct attrib_type at_moved;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,5 +12,17 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_OPTION
#define H_ATTRIBUTE_OPTION
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_option_news;
extern void init_option(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,7 +12,14 @@
* prior permission by the authors of Eressea.
*/
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_orcification;
extern struct attrib * make_orcification(int orcification);
extern void init_orcification(void);
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,9 +11,17 @@
* prior permission by the authors of Eressea.
*/
#ifdef __cplusplus
extern "C" {
#endif
struct faction;
struct attrib;
extern struct attrib_type at_otherfaction;
extern void init_otherfaction(void);
extern struct faction * get_otherfaction(const struct attrib * a);
extern struct attrib * make_otherfaction(struct faction * f);
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -2,7 +2,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -13,5 +13,16 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_OVERRRIDEROADS
#define H_ATTRIBUTE_OVERRRIDEROADS
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_overrideroads;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,12 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_RACENAME_H
#define H_ATTRIBUTE_RACENAME_H
#ifdef __cplusplus
extern "C" {
#endif
struct attrib_type;
struct attrib;
@ -20,3 +26,9 @@ extern const char * get_racename(struct attrib * alist);
extern void init_racename(void);
extern struct attrib_type at_racename;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -2,7 +2,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -13,5 +13,17 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_RACEPREFIX
#define H_ATTRIBUTE_RACEPREFIX
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_raceprefix;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,18 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_REDUCEPRODUCTION
#define H_ATTRIBUTE_REDUCEPRODUCTION
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib * make_reduceproduction(int percent, int time);
extern struct attrib_type at_reduceproduction;
extern void init_reduceproduction(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,12 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_SYNONYM
#define H_ATTRIBUTE_SYNONYM
#ifdef __cplusplus
extern "C" {
#endif
struct attrib_type;
struct attrib;
@ -21,3 +27,8 @@ typedef struct {
extern void init_synonym(void);
extern struct attrib_type at_synonym;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,8 +12,20 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_TARGETREGION
#define H_ATTRIBUTE_TARGETREGION
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_targetregion;
struct region;
extern struct attrib * make_targetregion(struct region *);
extern void init_targetregion(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>

View file

@ -2,19 +2,25 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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.
$Id: ugroup.h,v 1.1 2001/04/28 12:03:12 corwin Exp $
*/
#ifndef AUGROUP_H
#define AUGROUP_H
#ifndef H_ATTRIBUTE_UGROUP
#define H_ATTRIBUTE_UGROUP
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_ugroup;
void init_ugroup(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,8 +12,20 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ATTRIBUTE_VIEWRANGE
#define H_ATTRIBUTE_VIEWRANGE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_viewrange;
extern struct attrib * make_viewrange(const char *function);
extern struct attrib * add_viewrange(struct attrib ** alist, const char *function);
extern void init_viewrange(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,8 +11,11 @@
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef CREATION_H
#define CREATION_H
#ifndef H_GC_CREATION
#define H_GC_CREATION
#ifdef __cplusplus
extern "C" {
#endif
/* entweder eine grosse Insel (Chance 2/3) mit 25 bis 34 Felder oder eine
* kleine Insel (Chance 1/3) mit 11 bis 24 Feldern. */
@ -32,4 +35,7 @@ void writemap(FILE * F, int mode);
void regionspells(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -158,7 +158,7 @@ reset_translations(void)
}
/* implementation */
void
static void
cr_output_str_list(FILE * F, const char *title, const strlist * S, const faction * f)
{
char *s;
@ -612,14 +612,14 @@ cr_output_unit(FILE * F, const region * r,
}
fprintf(F, "%d;Partei\n", u->faction->no);
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
if (fval(u, FL_PARTEITARNUNG))
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, FL_PARTEITARNUNG)));
if (fval(u, UFL_PARTEITARNUNG))
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
if (otherfaction)
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
} else {
if (fval(u, FL_PARTEITARNUNG)) {
if (fval(u, UFL_PARTEITARNUNG)) {
/* faction info is hidden */
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, FL_PARTEITARNUNG)));
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
} else {
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
const faction * otherfaction = a_otherfaction?get_otherfaction(a_otherfaction):NULL;
@ -686,7 +686,7 @@ cr_output_unit(FILE * F, const region * r,
fprintf(F, "%d;alias\n", -i);
i = get_money(u);
fprintf(F, "%d;Kampfstatus\n", u->status);
if(fval(u, FL_NOAID)) {
if(fval(u, UFL_NOAID)) {
fputs("1;unaided\n", F);
}
i = u_geteffstealth(u);
@ -698,7 +698,7 @@ cr_output_unit(FILE * F, const region * r,
c = hp_status(u);
if (c && *c && (u->faction == f || omniscient(f)))
fprintf(F, "\"%s\";hp\n", add_translation(c, locale_string(u->faction->locale, c)));
if (fval(u, FL_HUNGER) && (u->faction == f))
if (fval(u, UFL_HUNGER) && (u->faction == f))
fputs("1;hunger\n", F);
if (is_mage(u)) {
fprintf(F, "%d;Aura\n", get_spellpoints(u));
@ -835,7 +835,7 @@ show_enemies(FILE * F, const faction_list* flist)
for (;flist!=NULL;flist=flist->next) {
if (flist->data) {
int fno = flist->data->no;
fprintf(F, "ENEMY %u\n%d;partei\n", fno);
fprintf(F, "ENEMY %u\n%u;partei\n", fno, fno);
}
}
}
@ -1291,7 +1291,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
fprintf(F, "%d;Laen\n", rlaen(r));
#endif
/* trade */
if(rpeasants(r)/TRADE_FRACTION > 0) {
if (!TradeDisabled() && rpeasants(r)/TRADE_FRACTION > 0) {
fputs("PREISE\n", F);
while (dmd) {
const char * ch = resourcename(dmd->type->itype->rtype, 0);
@ -1334,7 +1334,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
for (ru = a_find(r->attribs, &at_travelunit); ru; ru = ru->nexttype) {
unit * u = (unit*)ru->data.v;
if (cansee_durchgezogen(f, r, u, 0) && r!=u->region) {
if (!u->ship || !fval(u, FL_OWNER)) continue;
if (!u->ship || !fval(u, UFL_OWNER)) continue;
if (!seeships) fprintf(F, "DURCHSCHIFFUNG\n");
seeships = true;
fprintf(F, "\"%s\"\n", shipname(u->ship));
@ -1359,7 +1359,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
for (b = rbuildings(r); b; b = b->next) {
int fno = -1;
u = buildingowner(r, b);
if (u && !fval(u, FL_PARTEITARNUNG)) {
if (u && !fval(u, UFL_PARTEITARNUNG)) {
const faction * sf = visible_faction(f,u);
fno = sf->no;
}
@ -1370,7 +1370,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
for (sh = r->ships; sh; sh = sh->next) {
int fno = -1;
u = shipowner(r, sh);
if (u && !fval(u, FL_PARTEITARNUNG)) {
if (u && !fval(u, UFL_PARTEITARNUNG)) {
const faction * sf = visible_faction(f,u);
fno = sf->no;
}

View file

@ -2,13 +2,19 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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.
*/
#ifndef H_GC_CREPORT
#define H_GC_CREPORT
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
struct faction_list;
@ -23,3 +29,9 @@ extern void creport_init(void);
extern void report_init(void);
extern void report_cleanup(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -21,7 +21,6 @@
#define RESERVE_DONATIONS 1 /* shall we reserve objects given to us by other factions? */
#define RESERVE_GIVE 1 /* reserve anything that's given from one unit to another? */
#define TWOPASS_GIVE 0 /* give items in two passes: first to others, than to self */
#include <config.h>
#include "eressea.h"
@ -98,6 +97,15 @@ static int entertaining;
static int norders;
static request *oa;
static int
giverestriction() {
static int value = -1;
if (value<0) {
value = atoi(get_param(global.parameters, "GiveRestriction"));
}
return value;
}
int
income(const unit * u)
{
@ -121,13 +129,13 @@ static struct scramble {
int rnd;
} * vec;
int
static int
scramblecmp(const void *p1, const void *p2)
{
return ((struct scramble *)p1)->rnd - ((struct scramble *)p2)->rnd;
}
void
static void
scramble(void *data, int n, size_t width)
{
int i;
@ -348,7 +356,7 @@ expandrecruit(region * r, request * recruitorders)
}
}
void
static void
recruit(region * r, unit * u, strlist * S,
request ** recruitorders)
{
@ -374,7 +382,7 @@ recruit(region * r, unit * u, strlist * S,
unit *u2;
for (u2 = r->units; u2; u2 = u2->next)
if (fval(u2, FL_WARMTH)) {
if (fval(u2, UFL_WARMTH)) {
usepotion = true;
break;
}
@ -467,7 +475,7 @@ recruit(region * r, unit * u, strlist * S,
}
/* ------------------------------------------------------------- */
int
static int
count_max_migrants(faction * f)
{
int x = (int)(log10(count_all(f) / 50.0) * 20);
@ -476,7 +484,7 @@ count_max_migrants(faction * f)
extern const char* resname(resource_t res, int i);
void
static void
add_give(unit * u, unit * u2, int n, const resource_type * rtype, const char * cmd, int error)
{
if (error)
@ -494,7 +502,7 @@ add_give(unit * u, unit * u2, int n, const resource_type * rtype, const char * c
}
}
void
static void
addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error)
{
add_give(u, u2, n, oldresourcetype[res], cmd, error);
@ -504,7 +512,7 @@ addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error)
/* Derzeit fallen nur Silber und Pferde an die Region
* */
void
static void
give_peasants(int n, const item_type * itype, unit * src)
{
region *r = src->region;
@ -516,17 +524,18 @@ give_peasants(int n, const item_type * itype, unit * src)
}
}
int
static int
give_item(int want, const item_type * itype, unit * src, unit * dest, const char * cmd)
{
short error = 0;
int n;
assert(itype!=NULL);
n = new_get_pooled(src, item2resource(itype), GET_DEFAULT);
n = min(want, n);
if (dest && src->faction != dest->faction && src->faction->age < GIVERESTRICTION) {
if (dest && src->faction != dest->faction && src->faction->age < giverestriction()) {
ADDMSG(&src->faction->msgs, msg_error(src, cmd, "giverestriction",
"turns", GIVERESTRICTION));
"turns", giverestriction()));
return -1;
} else if (n == 0) {
error = 36;
@ -564,16 +573,16 @@ TODO: Einen Trigger benutzen!
return 0;
}
void
static void
givemen(int n, unit * u, unit * u2, const char * cmd)
{
ship *sh;
int k = 0;
int error = 0;
if (u2 && u->faction != u2->faction && u->faction->age < GIVERESTRICTION) {
if (u2 && u->faction != u2->faction && u->faction->age < giverestriction()) {
ADDMSG(&u->faction->msgs, msg_error(u, cmd, "giverestriction",
"turns", GIVERESTRICTION));
"turns", giverestriction()));
return;
} else if (u == u2) {
error = 10;
@ -584,9 +593,9 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
#endif
} else if ((u && unit_has_cursed_item(u)) || (u2 && unit_has_cursed_item(u2))) {
error = 78;
} else if (fval(u, FL_LOCKED) || fval(u, FL_HUNGER) || is_cursed(u->attribs, C_SLAVE, 0)) {
} else if (fval(u, UFL_LOCKED) || fval(u, UFL_HUNGER) || is_cursed(u->attribs, C_SLAVE, 0)) {
error = 74;
} else if (u2 && (fval(u2, FL_LOCKED)|| is_cursed(u2->attribs, C_SLAVE, 0))) {
} else if (u2 && (fval(u2, UFL_LOCKED)|| is_cursed(u2->attribs, C_SLAVE, 0))) {
error = 75;
} else if (u2 != (unit *) NULL
&& u2->faction != u->faction
@ -687,7 +696,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
return;
}
if (fval(u, FL_LOCKED) || fval(u, FL_HUNGER)) {
if (fval(u, UFL_LOCKED) || fval(u, UFL_HUNGER)) {
cmistake(u, S->s, 74, MSG_COMMERCE);
return;
}
@ -793,7 +802,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
}
static void
dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
dogive(region * r, unit * u, strlist * S, int mode)
/*
* mode=0: give to any units
* mode=1: give to other units and peasants only
@ -816,12 +825,6 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
/* not to myself */
if (u2 && u2->faction==u->faction) return;
break;
#if TWOPASS_GIVE
case 2:
/* not to peasants or others */
if (!u2 || u2->faction!=u->faction) return;
break;
#endif
default:
assert(!"invalid mode for dogive");
}
@ -831,7 +834,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
}
/* Damit Tarner nicht durch die Fehlermeldung enttarnt werden können */
if (u2 && (!cansee(u->faction,r,u2,0) && !ucontact(u2, u) && !fval(u2, FL_TAKEALL))) {
if (u2 && (!cansee(u->faction,r,u2,0) && !ucontact(u2, u) && !fval(u2, UFL_TAKEALL))) {
cmistake(u, S->s, notfound_error, MSG_COMMERCE);
return;
}
@ -840,9 +843,9 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
return;
}
/* FL_TAKEALL ist ein grober Hack. Generalisierung tut not, ist aber nicht
/* UFL_TAKEALL ist ein grober Hack. Generalisierung tut not, ist aber nicht
* wirklich einfach. */
if (r->planep && fval(r->planep, PFL_NOGIVE) && (!u2 || !fval(u2, FL_TAKEALL))) {
if (r->planep && fval(r->planep, PFL_NOGIVE) && (!u2 || !fval(u2, UFL_TAKEALL))) {
cmistake(u, S->s, 268, MSG_COMMERCE);
return;
}
@ -866,7 +869,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
cmistake(u, S->s, 32, MSG_EVENT);
return;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 49, MSG_EVENT);
return;
}
@ -874,13 +877,13 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
cmistake(u, S->s, 40, MSG_EVENT);
return;
}
freset(u, FL_OWNER);
fset(u2, FL_OWNER);
freset(u, UFL_OWNER);
fset(u2, UFL_OWNER);
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_message("givecommand", "unit receipient", u, u2));
if (u->faction != u2->faction) {
add_message(&u2->faction->msgs,
ADDMSG(&u2->faction->msgs,
msg_message("givecommand", "unit receipient",
ucansee(u2->faction, u, u_unknown()), u2));
}
@ -891,15 +894,15 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
return;
}
/* if ((u->race->ec_flags & NOGIVE) || fval(u,FL_LOCKED)) {*/
/* if ((u->race->ec_flags & NOGIVE) || fval(u,UFL_LOCKED)) {*/
if (u->race->ec_flags & NOGIVE && u2!=NULL) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race));
return;
}
/* sperrt hier auch personenübergaben!
if (u2 && !(u2->race->ec_flags & GETITEM)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_notake", "race", u2->race));
return;
}
@ -909,7 +912,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
if (findparam(s, u->faction->locale) == P_HERBS) {
boolean given = false;
if (!(u->race->ec_flags & GIVEITEM)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race));
return;
}
@ -970,7 +973,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
if (*s == 0) {
if (!(u->race->ec_flags & GIVEITEM)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race));
return;
}
@ -998,7 +1001,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
i = findparam(s, u->faction->locale);
if (i == P_PERSON) {
if (!(u->race->ec_flags & GIVEPERSON)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_noregroup", "race", u->race));
return;
}
@ -1008,7 +1011,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
}
if (!(u->race->ec_flags & GIVEITEM)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race));
return;
}
@ -1048,7 +1051,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
i = findparam(s, u->faction->locale);
if (i == P_PERSON) {
if (!(u->race->ec_flags & GIVEPERSON)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_noregroup", "race", u->race));
return;
}
@ -1058,7 +1061,7 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
if (u2!=NULL) {
if (!(u->race->ec_flags & GIVEITEM)) {
add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_error(u, S->s, "race_nogive", "race", u->race));
return;
}
@ -1077,16 +1080,15 @@ dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
cmistake(u, S->s, 123, MSG_COMMERCE);
}
/* ------------------------------------------------------------- */
void
static void
forgetskill(unit * u)
{
skill_t talent;
const char *s = getstrtoken();
if ((talent = findskill(s, u->faction->locale)) != NOSKILL) {
struct message * m = add_message(&u->faction->msgs,
ADDMSG(&u->faction->msgs,
msg_message("forget", "unit skill", u, talent));
msg_release(m);
set_level(u, talent, 0);
}
}
@ -1258,7 +1260,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
int loss = 0;
fset(u->faction, FL_MARK);
freset(u, FL_OWNER);
freset(u, UFL_OWNER);
leave(r,u);
n = u->number;
for (i = 0; i < n; i++) {
@ -1333,11 +1335,8 @@ economics(void)
break;
case K_GIVE:
dogive(r, u, S, S->s[0]=='@'?true:false, TWOPASS_GIVE);
break;
case K_LIEFERE:
dogive(r, u, S, true, TWOPASS_GIVE);
dogive(r, u, S, 0);
break;
case K_FORGET:
@ -1347,20 +1346,6 @@ economics(void)
}
}
}
#if TWOPASS_GIVE
for (u = r->units; u; u = u->next) {
for (S = u->orders; S; S = S->next) {
switch (igetkeyword(S->s, u->faction->locale)) {
case K_GIVE:
dogive(r, u, S, S->s[0]=='@'?true:false, 2);
break;
case K_LIEFERE:
dogive(r, u, S, true, 2);
break;
}
}
}
#endif
/* RECRUIT orders */
for (u = r->units; u; u = u->next) {
@ -1472,7 +1457,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
int amount, skill;
/* momentan kann man keine ressourcen abbauen, wenn man dafür
* materialverbruach hat: */
* Materialverbrauch hat: */
assert(itype!=NULL && itype->construction->materials==NULL);
if (itype == olditemtype[I_WOOD] && fval(r, RF_MALLORN)) {
@ -2097,7 +2082,7 @@ attrib_type at_trades = {
NO_READ
};
void
static void
buy(region * r, unit * u, request ** buyorders, const char * cmd)
{
int n, k;
@ -2184,7 +2169,7 @@ buy(region * r, unit * u, request ** buyorders, const char * cmd)
o->qty = n;
addlist(buyorders, o);
if (n && !fval(u, FL_TRADER)) fset(u, FL_TRADER);
if (n) fset(u, UFL_TRADER);
}
/* ------------------------------------------------------------- */
@ -2365,7 +2350,7 @@ expandselling(region * r, request * sellorders)
}
}
void
static void
sell(region * r, unit * u, request ** sellorders, const char * cmd)
{
const item_type * itype;
@ -2485,7 +2470,7 @@ sell(region * r, unit * u, request ** sellorders, const char * cmd)
o->type.ltype = ltype;
addlist(sellorders, o);
if (n && !fval(u, FL_TRADER)) fset(u, FL_TRADER);
if (n) fset(u, UFL_TRADER);
}
}
/* ------------------------------------------------------------- */
@ -2528,7 +2513,7 @@ expandstealing(region * r, request * stealorders)
use_all(u, R_SILVER, n);
oa[i].unit->n = n;
change_money(oa[i].unit, n);
add_message(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
}
add_income(oa[i].unit, IC_STEAL, oa[i].unit->wants, oa[i].unit->n);
}
@ -2536,7 +2521,7 @@ expandstealing(region * r, request * stealorders)
}
/* ------------------------------------------------------------- */
void
static void
plant(region *r, unit *u, int raw)
{
int n, i, skill, planted = 0;
@ -2652,7 +2637,7 @@ planttrees(region *r, unit *u, int raw)
}
/* züchte bäume */
void
static void
breedtrees(region *r, unit *u, int raw)
{
int n, i, skill, planted = 0;
@ -2711,7 +2696,7 @@ breedtrees(region *r, unit *u, int raw)
#endif
void
static void
pflanze(region *r, unit *u)
{
int m;
@ -2747,7 +2732,7 @@ pflanze(region *r, unit *u)
return;
}
else if (itype!=NULL){
if (itype==&it_mallornseed || itype==&it_seed){
if (itype==&it_mallornseed || itype==&it_seed) {
breedtrees(r, u, m);
return;
}
@ -2757,7 +2742,7 @@ pflanze(region *r, unit *u)
/* züchte pferde */
void
static void
breedhorses(region *r, unit *u)
{
int n, c;
@ -2790,7 +2775,7 @@ breedhorses(region *r, unit *u)
"raised%u:unit%i:amount", u, gezuechtet));
}
void
static void
zuechte(region *r, unit *u)
{
int m;
@ -2879,7 +2864,7 @@ research(region *r, unit *u)
}
}
int
static int
wahrnehmung(region * r, faction * f)
{
unit *u;
@ -2900,7 +2885,7 @@ wahrnehmung(region * r, faction * f)
return w;
}
void
static void
steal(region * r, unit * u, request ** stealorders)
{
int n, i, id;
@ -3063,6 +3048,10 @@ entertain(region * r, unit * u)
{
int max_e;
request *o;
static int entertainbase = 0;
static int entertainperlevel = 0;
if (!entertainbase) entertainbase = atoi(get_param(global.parameters, "entertain.base"));
if (!entertainperlevel) entertainperlevel = atoi(get_param(global.parameters, "entertain.perlevel"));
if (fval(u, UFL_WERE)) {
cmistake(u, findorder(u, u->thisorder), 58, MSG_INCOME);
@ -3086,7 +3075,7 @@ entertain(region * r, unit * u)
return;
}
u->wants = u->number * (ENTERTAINBASE + effskill(u, SK_ENTERTAINMENT) * ENTERTAINPERLEVEL);
u->wants = u->number * (entertainbase + effskill(u, SK_ENTERTAINMENT) * entertainperlevel);
if ((max_e = geti()) != 0)
u->wants = min(u->wants,max_e);
@ -3294,7 +3283,7 @@ produce(void)
for (u = r->units; u; u = u->next) {
strlist * s;
if (u->race == new_race[RC_SPELL] || fval(u, FL_LONGACTION))
if (u->race == new_race[RC_SPELL] || fval(u, UFL_LONGACTION))
continue;
if (u->race == new_race[RC_INSECT] && r_insectstalled(r) &&
@ -3306,25 +3295,26 @@ produce(void)
continue;
}
for (s=u->orders;s;s=s->next) {
todo = igetkeyword(s->s, u->faction->locale);
switch (todo) {
if (!TradeDisabled()) {
for (s=u->orders;s;s=s->next) {
todo = igetkeyword(s->s, u->faction->locale);
switch (todo) {
case K_BUY:
buy(r, u, &buyorders, s->s);
break;
case K_SELL:
sell(r, u, &sellorders, s->s);
break;
}
}
}
if (fval(u, FL_TRADER)) {
attrib * a = a_find(u->attribs, &at_trades);
if (a && a->data.i) {
produceexp(u, SK_TRADE, u->number);
if (fval(u, UFL_TRADER)) {
attrib * a = a_find(u->attribs, &at_trades);
if (a && a->data.i) {
produceexp(u, SK_TRADE, u->number);
}
u->thisorder[0]=0;
continue;
}
u->thisorder[0]=0;
continue;
}
todo = igetkeyword(u->thisorder, u->faction->locale);
@ -3383,11 +3373,11 @@ produce(void)
}
}
split_allocations(r);
/* Entertainment (expandentertainment) und Besteuerung (expandtax) vor den
* Befehlen, die den Bauern mehr Geld geben, damit man aus den Zahlen der
* letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung
* auszugeben bereit sind. */
split_allocations(r);
if (entertaining) expandentertainment(r);
expandwork(r);
if (taxorders) expandtax(r, taxorders);

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -19,8 +19,11 @@
* permission from the authors.
*/
#ifndef ECONOMY_H
#define ECONOMY_H
#ifndef H_GC_ECONOMY
#define H_GC_ECONOMY
#ifdef __cplusplus
extern "C" {
#endif
/* Welchen Teil des Silbers die Bauern fuer Unterhaltung ausgeben (1/20), und
* wiviel Silber ein Unterhalter pro Talentpunkt bekommt. */
@ -44,7 +47,6 @@ extern int income(const struct unit * u);
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
#define MAXNEWBIES 5
void scramble(void *v1, int n, size_t width);
void economics(void);
void produce(void);
extern int entertainmoney(const struct region * r);
@ -55,4 +57,7 @@ extern void add_spende(struct faction * f1, struct faction * f2, int betrag, str
void report_donations(void);
extern void init_economy(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -194,9 +194,6 @@
<File
RelativePath=".\randenc.h">
</File>
<File
RelativePath=".\study.h">
</File>
</Filter>
<Filter
Name="Spells"

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -27,7 +27,6 @@
#include <modules/infocmd.h>
/* gamecode includes */
#include "creation.h"
#include "economy.h"
#include "monster.h"
#include "randenc.h"
@ -101,6 +100,15 @@ extern int * age;
boolean nobattle = false;
/* ------------------------------------------------------------- */
static int
RemoveNMRNewbie() {
static int value = -1;
if (value<0) {
value = atoi(get_param(global.parameters, "nmr.removenewbie"));
}
return value;
}
static void
restart(unit *u, const race * rc)
{
@ -138,7 +146,7 @@ checkorders(void)
puts(" - Warne späte Spieler...");
for (f = factions; f; f = f->next)
if (f->no!=MONSTER_FACTION && turn - f->lastorders == NMRTIMEOUT - 1)
if (f->no!=MONSTER_FACTION && turn - f->lastorders == NMRTimeout() - 1)
ADDMSG(&f->msgs, msg_message("turnreminder", ""));
}
/* ------------------------------------------------------------- */
@ -159,7 +167,7 @@ get_food(region *r)
int need = lifestyle(u);
/* Erstmal zurücksetzen */
freset(u, FL_HUNGER);
freset(u, UFL_HUNGER);
need -= get_money(u);
if (need > 0) {
@ -190,7 +198,8 @@ get_food(region *r)
unit *v;
for (v = r->units; need && v; v = v->next) {
if (v->faction != u->faction && alliedunit(v, u->faction, HELP_MONEY) && !is_monstrous(v)) {
if (v->faction != u->faction && alliedunit(v, u->faction, HELP_MONEY)
&& !is_monstrous(v)) {
int give = lifestyle(v);
give = max(0, get_money(v) - give);
give = min(need, give);
@ -210,7 +219,7 @@ get_food(region *r)
int lspp = lifestyle(u)/u->number;
if (lspp > 0) {
int number = (need+lspp-1)/lspp;
if (hunger(number, u)) fset(u, FL_HUNGER);
if (hunger(number, u)) fset(u, UFL_HUNGER);
}
}
}
@ -322,8 +331,7 @@ live(region * r)
#if NEW_MIGRATION == 1
/* Arbeitsversion */
void
static void
calculate_emigration(region *r)
{
direction_t i;
@ -1043,7 +1051,7 @@ transfer_faction(faction *f, faction *f2)
}
#endif
void
static void
quit(void)
{
region *r;
@ -1147,13 +1155,11 @@ quit(void)
remove("inactive");
for (f = factions; f; f = f->next) {
if(fval(f, FL_NOIDLEOUT)) f->lastorders = turn;
#if NMRTIMEOUT
if (turn - f->lastorders >= NMRTIMEOUT) {
if(fval(f, FFL_NOIDLEOUT)) f->lastorders = turn;
if (NMRTimeout()>0 && turn - f->lastorders >= NMRTimeout()) {
destroyfaction(f);
continue;
}
#endif
if (fval(f, FFL_OVERRIDE)) {
free(f->override);
f->override = strdup(itoa36(rand()));
@ -1173,7 +1179,7 @@ quit(void)
f->lastorders, f->override, f->subscription);
}
if (turn - f->lastorders >= (NMRTIMEOUT - 1)) {
if (NMRTimeout()>0 && turn - f->lastorders >= (NMRTimeout() - 1)) {
inactivefaction(f);
continue;
}
@ -1183,8 +1189,7 @@ quit(void)
age = calloc(turn+1, sizeof(int));
for (f = factions; f; f = f->next) if (f->no != MONSTER_FACTION) {
#if REMOVENMRNEWBIE
if(!fval(f, FL_NOIDLEOUT)) {
if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
if (f->age>=0 && f->age <= turn) ++age[f->age];
if (f->age == 2 || f->age == 3) {
if (f->lastorders == turn - 2) {
@ -1194,7 +1199,6 @@ quit(void)
}
}
}
#endif
#if defined(ALLIANCES) && !defined(ALLIANCEJOIN)
if (f->alliance==NULL) {
destroyfaction(f);
@ -1351,7 +1355,7 @@ set_display(region * r, unit * u, strlist * S)
cmistake(u, S->s, 145, MSG_PRODUCE);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 5, MSG_PRODUCE);
break;
}
@ -1371,7 +1375,7 @@ set_display(region * r, unit * u, strlist * S)
cmistake(u, S->s, 144, MSG_PRODUCE);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 12, MSG_PRODUCE);
break;
}
@ -1398,7 +1402,7 @@ set_display(region * r, unit * u, strlist * S)
cmistake(u, S->s, 145, MSG_EVENT);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 148, MSG_EVENT);
break;
}
@ -1511,14 +1515,14 @@ set_synonym(unit * u, strlist *S)
return;
}
void
static void
set_group(unit * u)
{
const char * s = getstrtoken();
join_group(u, s);
}
void
static void
set_name(region * r, unit * u, strlist * S)
{
char **s;
@ -1574,7 +1578,7 @@ set_name(region * r, unit * u, strlist * S)
cmistake(u, S->s, 145, MSG_PRODUCE);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 148, MSG_PRODUCE);
break;
}
@ -1653,7 +1657,7 @@ set_name(region * r, unit * u, strlist * S)
cmistake(u, S->s, 144, MSG_PRODUCE);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 12, MSG_PRODUCE);
break;
}
@ -1692,7 +1696,7 @@ set_name(region * r, unit * u, strlist * S)
cmistake(u, S->s, 145, MSG_EVENT);
break;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, S->s, 148, MSG_EVENT);
break;
}
@ -1788,7 +1792,7 @@ mailfaction(unit * u, int n, strlist * S, const char * s)
cmistake(u, S->s, 66, MSG_MESSAGE);
}
void
static void
distributeMail(region * r, unit * u, strlist * S)
{
unit *u2;
@ -1933,7 +1937,7 @@ distributeMail(region * r, unit * u, strlist * S)
}
}
void
static void
mail(void)
{
region *r;
@ -1950,7 +1954,7 @@ mail(void)
}
/* ------------------------------------------------------------- */
void
static void
report_option(unit * u, const char * sec, char *cmd)
{
const messageclass * mc;
@ -1969,7 +1973,7 @@ report_option(unit * u, const char * sec, char *cmd)
set_msglevel(&u->faction->warnings, mc->name, -1);
}
void
static void
set_passw(void)
{
region *r;
@ -2135,7 +2139,7 @@ set_passw(void)
}
}
boolean
static boolean
display_item(faction *f, unit *u, const item_type * itype)
{
FILE *fp;
@ -2179,7 +2183,7 @@ display_item(faction *f, unit *u, const item_type * itype)
return true;
}
boolean
static boolean
display_potion(faction *f, unit *u, const potion_type * ptype)
{
attrib *a;
@ -2202,7 +2206,7 @@ display_potion(faction *f, unit *u, const potion_type * ptype)
return true;
}
boolean
static boolean
display_race(faction *f, unit *u, const race * rc)
{
FILE *fp;
@ -2304,7 +2308,7 @@ display_race(faction *f, unit *u, const race * rc)
return true;
}
void
static void
instant_orders(void)
{
region *r;
@ -2421,9 +2425,9 @@ instant_orders(void)
case P_HELP:
param = getstrtoken();
if( findparam(param, u->faction->locale) == P_NOT) {
fset(u, FL_NOAID);
fset(u, UFL_NOAID);
} else {
freset(u, FL_NOAID);
freset(u, UFL_NOAID);
}
break;
@ -2490,7 +2494,7 @@ instant_orders(void)
cmistake(u, S->s, 304, MSG_EVENT);
break;
}
if (fval(u, FL_HUNGER)) {
if (fval(u, UFL_HUNGER)) {
cmistake(u, S->s, 223, MSG_EVENT);
break;
}
@ -2575,7 +2579,7 @@ remove_unequipped_guarded(void)
}
}
void
static void
bewache_an(void)
{
region *r;
@ -2585,7 +2589,7 @@ bewache_an(void)
/* letzte schnellen befehle - bewache */
for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) {
if (!fval(u, FL_MOVED)) {
if (!fval(u, UFL_MOVED)) {
for (S = u->orders; S; S = S->next) {
if (igetkeyword(S->s, u->faction->locale) == K_GUARD && getparam(u->faction->locale) != P_NOT) {
if (rterrain(r) != T_OCEAN) {
@ -2617,7 +2621,7 @@ bewache_an(void)
}
}
void
static void
sinkships(void)
{
region *r;
@ -2742,7 +2746,7 @@ reorder(void)
cmistake(u, o->s, 258, MSG_EVENT);
} else if (v->building != u->building || v->ship!=u->ship) {
cmistake(u, o->s, 259, MSG_EVENT);
} else if (fval(u, FL_OWNER)) {
} else if (fval(u, UFL_OWNER)) {
cmistake(u, o->s, 260, MSG_EVENT);
} else if (v == u) {
cmistake(u, o->s, 10, MSG_EVENT);
@ -2754,7 +2758,7 @@ reorder(void)
v->next = u;
break;
case P_BEFORE:
if (fval(v, FL_OWNER)) {
if (fval(v, UFL_OWNER)) {
cmistake(u, o->s, 261, MSG_EVENT);
} else {
vp=&r->units;
@ -2791,7 +2795,7 @@ evict(void)
for (u=r->units;u;u=u->next) {
for (S = u->orders; S; S = S->next) if (igetkeyword(S->s, u->faction->locale)==K_EVICT) {
/* Nur der Kapitän bzw Burgherr kann jemanden rausschmeißen */
if(!fval(u, FL_OWNER)) {
if(!fval(u, UFL_OWNER)) {
/* Die Einheit ist nicht der Eigentümer */
cmistake(u,S->s,49,MSG_EVENT);
continue;
@ -2948,7 +2952,7 @@ renumber(void)
cmistake(u,S->s,144,MSG_EVENT);
continue;
}
if(!fval(u, FL_OWNER)) {
if(!fval(u, UFL_OWNER)) {
cmistake(u,S->s,146,MSG_EVENT);
continue;
}
@ -2976,7 +2980,7 @@ renumber(void)
cmistake(u,S->s,145,MSG_EVENT);
continue;
}
if(!fval(u, FL_OWNER)) {
if(!fval(u, UFL_OWNER)) {
cmistake(u,S->s,148,MSG_EVENT);
continue;
}
@ -3199,13 +3203,13 @@ setdefaults (void)
if (getparam(u->faction->locale) == P_TEMP) break;
case K_BESIEGE:
case K_ENTERTAIN:
case K_RESEARCH:
case K_TAX:
case K_RESEARCH:
case K_SPY:
case K_STEAL:
case K_SABOTAGE:
case K_STUDY:
case K_TAX:
case K_TEACH:
case K_TEACH:
case K_ZUECHTE:
#if GROWING_TREES
case K_PFLANZE:
@ -3224,11 +3228,9 @@ setdefaults (void)
case K_MOVE:
case K_WEREWOLF:
cmd = S->s;
#if HUNGER_DISABLES_LONGORDERS
if (fval(u, FL_HUNGER)) {
if (LongHunger() && fval(u, UFL_HUNGER)) {
cmd = locale_string(u->faction->locale, "defaultorder");
}
#endif
set_string(&u->thisorder, cmd);
break;
@ -3242,7 +3244,7 @@ setdefaults (void)
* werden. */
if(trade == true) {
/* fset(u, FL_LONGACTION); */
/* fset(u, UFL_LONGACTION); */
set_string(&u->thisorder, "");
}
/* thisorder kopieren wir nun nach lastorder. in lastorder steht
@ -3360,7 +3362,7 @@ monthly_healing(void)
u->hp = umhp;
}
if((u->race->flags & RCF_NOHEAL) || fval(u, FL_HUNGER) || fspecial(u->faction, FS_UNDEAD))
if((u->race->flags & RCF_NOHEAL) || fval(u, UFL_HUNGER) || fspecial(u->faction, FS_UNDEAD))
continue;
if(rterrain(r) == T_OCEAN && !u->ship && !(canswim(u)))
@ -3596,8 +3598,10 @@ processorders (void)
magic();
remove_empty_units();
puts(" - Lehren");
teaching();
if (!global.disabled[K_TEACH]) {
puts(" - Lehren");
teaching();
}
puts(" - Lernen");
learn();

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -19,31 +19,31 @@
* permission from the authors.
*/
#ifndef LAWS_H
#define LAWS_H
#ifndef H_GC_LAWS
#define H_GC_LAWS
#ifdef __cplusplus
extern "C" {
#endif
void quit(void);
int getoption(void);
int wanderoff(struct region * r, int p);
void demographics(void);
void instant_orders(void);
void last_orders(void);
void set_passw(void);
void stripunit(struct unit * u);
void mail(void);
void find_address(void);
void bewache_an(void);
void remove_unequipped_guarded(void);
extern void sinkships(void);
/* eressea-specific. put somewhere else, please. */
#include "resolve.h"
void processorders(void);
extern int count_migrants (const struct faction * f);
#if GROWING_TREES
extern attrib_type at_germs;
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -53,7 +53,7 @@
#include <math.h>
#include <stdlib.h>
const int STANDARD_LUCK = 0;
#define STANDARD_LUCK 0
extern struct item_type *i_silver;
@ -87,48 +87,6 @@ lucky_item(const unit *u)
item_type *itype;
int amount;
int luck = fspecial(u->faction, FS_LUCKY);
#if defined(__GNUC__) && !defined(__STDC__)
const int nitems = 35;
/* ordered rougly by value */
item_type *it_list[nitems] = {
olditemtype[I_RUSTY_SWORD],
olditemtype[I_RUSTY_SHIELD],
olditemtype[I_RUSTY_CHAIN_MAIL],
olditemtype[I_BALM],
olditemtype[I_SPICES],
olditemtype[I_MYRRH],
olditemtype[I_OIL],
olditemtype[I_SILK],
olditemtype[I_INCENSE],
olditemtype[I_JEWELERY],
olditemtype[I_IRON],
olditemtype[I_WOOD],
olditemtype[I_MALLORN],
olditemtype[I_STONE],
olditemtype[I_HORSE],
olditemtype[I_SWORD],
olditemtype[I_SPEAR],
olditemtype[I_CROSSBOW],
olditemtype[I_AXE],
olditemtype[I_LANCE],
olditemtype[I_HALBERD],
olditemtype[I_LONGBOW],
olditemtype[I_SHIELD],
olditemtype[I_CHAIN_MAIL],
olditemtype[I_PLATE_ARMOR],
olditemtype[I_WAGON],
olditemtype[I_CATAPULT],
&it_mallornspear,
&it_mallornlance,
&it_mallornbow,
&it_mallorncrossbow,
olditemtype[I_GREATBOW],
olditemtype[I_LAEN],
olditemtype[I_LAENSWORD],
olditemtype[I_LAENSHIELD],
olditemtype[I_LAENCHAIN],
};
#else
/* Das ist schöner so, denke ich... */
static int nitems = 0;
static int maxweight = 0;
@ -144,18 +102,14 @@ lucky_item(const unit *u)
}
/* weight is unused */
r = rand()%nitems;
#endif
do {
r = rand()%nitems;
if(r > max) max = r;
i++;
} while(i <= luck);
#if defined(__GNUC__) && !defined(__STDC__)
itype = it_list[r];
#else
itype = it_find(it_list[r].name);
#endif
if(luck)
amount = 10 + rand()%(luck*40) + rand()%(luck*40);

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -19,5 +19,17 @@
* permission from the authors.
*/
#ifndef H_GC_LUCK
#define H_GC_LUCK
#ifdef __cplusplus
extern "C" {
#endif
extern void check_luck(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -170,7 +170,7 @@ get_money_for_dragon(region * r, unit * u, int wanted)
return true;
}
int
static int
money(region * r)
{
unit *u;
@ -182,7 +182,7 @@ money(region * r)
return m;
}
direction_t
static direction_t
richest_neighbour(region * r, int absolut)
{
@ -216,7 +216,7 @@ richest_neighbour(region * r, int absolut)
return d;
}
boolean
static boolean
room_for_race_in_region(region *r, const race * rc)
{
unit *u;
@ -232,7 +232,7 @@ room_for_race_in_region(region *r, const race * rc)
return true;
}
direction_t
static direction_t
random_neighbour(region * r, unit *u)
{
direction_t i;
@ -283,7 +283,7 @@ random_neighbour(region * r, unit *u)
return NODIRECTION;
}
direction_t
static direction_t
treeman_neighbour(region * r)
{
direction_t i;
@ -327,7 +327,7 @@ treeman_neighbour(region * r)
return NODIRECTION;
}
void
static void
move_monster(region * r, unit * u)
{
direction_t d = NODIRECTION;
@ -365,7 +365,7 @@ move_monster(region * r, unit * u)
#define drand48() (((double)rand()) / RAND_MAX)
#endif
int
static int
dragon_affinity_value(region *r, unit *u)
{
int m = count_all_money(r);
@ -377,7 +377,7 @@ dragon_affinity_value(region *r, unit *u)
}
}
attrib *
static attrib *
set_new_dragon_target(unit * u, region * r, int range)
{
region *r2;
@ -472,7 +472,7 @@ set_movement_order(unit * u, const region * target, int moves, boolean (*allowed
}
/* ------------------------------------------------------------- */
void
static void
monster_seeks_target(region *r, unit *u)
{
direction_t d;
@ -627,7 +627,7 @@ random_attack_by_monster(const region * r, unit * u)
return success;
}
void
static void
eaten_by_monster(unit * u)
{
int n = 0;
@ -690,7 +690,7 @@ absorbed_by_monster(unit * u)
}
}
int
static int
scareaway(region * r, int anzahl)
{
int n, p, d = 0, emigrants[MAXDIRECTIONS];
@ -723,7 +723,7 @@ scareaway(region * r, int anzahl)
return d;
}
void
static void
scared_by_monster(unit * u)
{
int n;
@ -756,7 +756,7 @@ scared_by_monster(unit * u)
}
}
const char *
static const char *
random_growl(void)
{
switch(rand()%5) {
@ -776,7 +776,7 @@ random_growl(void)
extern attrib_type at_direction;
void
static void
make_ponnuki(void)
{
int ponn = atoi36("ponn");
@ -802,7 +802,7 @@ make_ponnuki(void)
} while (u);
}
void ponnuki(unit * u)
static void ponnuki(unit * u)
{
const char* joke[] = {
"Ein Bummerang ist, wenn man ihn wegwirft und er kommt nicht wieder, dann war's keiner.",
@ -859,7 +859,7 @@ void ponnuki(unit * u)
extern void make_ponnuki(void);
void
static void
learn_monster(unit *u)
{
int c = 0;
@ -897,7 +897,7 @@ monsters_kill_peasants(void)
unit *u;
for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) if(!fval(u, FL_MOVED)) {
for (u = r->units; u; u = u->next) if(!fval(u, UFL_MOVED)) {
if(u->race->flags & RCF_SCAREPEASANTS) {
scared_by_monster(u);
}
@ -911,6 +911,21 @@ monsters_kill_peasants(void)
}
}
static boolean
check_overpopulated(unit *u)
{
unit *u2;
int c = 0;
for(u2 = u->region->units; u2; u2 = u2->next) {
if(u2->race == u->race && u != u2) c += u2->number;
}
if(c > u->race->splitsize * 2) return true;
return false;
}
void
plan_monsters(void)
{
@ -1148,7 +1163,7 @@ plan_monsters(void)
}
}
void
static void
age_default(unit *u)
{
}
@ -1171,7 +1186,7 @@ age_unit(region * r, unit * u)
}
}
void
static void
split_unit(region * r, unit *u)
{
unit *u2 = createunit(r, u->faction, 0, u->race);
@ -1185,21 +1200,6 @@ split_unit(region * r, unit *u)
transfermen(u, u2, newsize);
}
boolean
check_overpopulated(unit *u)
{
unit *u2;
int c = 0;
for(u2 = u->region->units; u2; u2 = u2->next) {
if(u2->race == u->race && u != u2) c += u2->number;
}
if(c > u->race->splitsize * 2) return true;
return false;
}
void
check_split(void)
{

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -19,19 +19,23 @@
* permission from the authors.
*/
#ifndef MONSTER_H
#define MONSTER_H
#ifndef H_GC_MONSTER
#define H_GC_MONSTER
#ifdef __cplusplus
extern "C" {
#endif
#define DRAGON_RANGE 20 /* Max. Distanz zum nächsten Drachenziel */
void age_illusion(struct unit *u);
direction_t richest_neighbour(struct region * r, int absolut);
void monsters_kill_peasants(void);
void plan_monsters(void);
void age_unit(struct region * r, struct unit * u);
struct unit *random_unit(const struct region * r);
boolean check_overpopulated(struct unit *u);
void check_split(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -34,7 +34,6 @@
#include "message.h"
#include "race.h"
#include "monster.h"
#include "creation.h"
#include "names.h"
#include "pool.h"
#include "movement.h"
@ -314,7 +313,7 @@ get_unit(region * r, unit * u)
set_string(&newunit->name, "Dorfbewohner");
set_money(newunit, (rand() % 26 + 10) * newunit->number);
fset(newunit, UFL_ISNEW);
if (fval(u, FL_PARTEITARNUNG)) fset(newunit, FL_PARTEITARNUNG);
if (fval(u, UFL_PARTEITARNUNG)) fset(newunit, UFL_PARTEITARNUNG);
switch (rand() % 4) {
case 0:
set_level(newunit, SK_MINING, 1);
@ -467,7 +466,7 @@ get_allies(region * r, unit * u)
if(u->race->flags & RCF_SHAPESHIFT) {
newunit->irace = u->irace;
}
if (fval(u, FL_PARTEITARNUNG)) fset(newunit, FL_PARTEITARNUNG);
if (fval(u, UFL_PARTEITARNUNG)) fset(newunit, UFL_PARTEITARNUNG);
fset(u, UFL_ISNEW);
sprintf(buf, "Plötzlich stolper%c %s über einige %s. Nach kurzem "
@ -1086,6 +1085,32 @@ randomevents(void)
}
}
/* Talentverschiebung: Talente von Dämonen verschieben sich */
for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) {
if (u->race == new_race[RC_DAEMON]) {
skill * sv = u->skills;
while (sv!=u->skills+u->skill_size) {
if (sv->level>0 && rand() % 100 < 25) {
int weeks = 1+rand()%3;
if (rand() % 100 < 40) {
reduce_skill(u, sv, weeks);
} else {
while (weeks--) learn_skill(u, sv->id, 1.0);
}
if (sv->old>sv->level) {
log_printf("%s dropped from %u to %u:%u in %s\n",
unitname(u), sv->old, sv->level,
sv->weeks, skillname(sv->id, NULL));
}
}
++sv;
}
}
}
}
#if RACE_ADJUSTMENTS == 0
/* Orks vermehren sich */
@ -1135,32 +1160,6 @@ randomevents(void)
}
#endif
/* Talentverschiebung: Talente von Dämonen verschieben sich */
for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) {
if (u->race == new_race[RC_DAEMON]) {
skill * sv = u->skills;
while (sv!=u->skills+u->skill_size) {
if (sv->level>0 && rand() % 100 < 25) {
int weeks = 1+rand()%3;
if (rand() % 100 < 40) {
reduce_skill(u, sv, weeks);
} else {
while (weeks--) learn_skill(u, sv->id, 1.0);
}
if (sv->old>sv->level) {
log_printf("%s dropped from %u to %u:%u in %s\n",
unitname(u), sv->old, sv->level,
sv->weeks, skillname(sv->id, NULL));
}
}
++sv;
}
}
}
}
for (r = regions; r; r = r->next) {
#if !RACE_ADJUSTMENTS
/* Elfen generieren Wald */

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -19,10 +19,16 @@
* permission from the authors.
*/
#ifndef RANDENC_H
#define RANDENC_H
#ifndef H_GC_RANDENC
#define H_GC_RANDENC
#ifdef __cplusplus
extern "C" {
#endif
extern void encounters(void);
extern void randomevents(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -32,7 +32,6 @@
#endif
/* gamecode includes */
#include "creation.h"
#include "creport.h"
#include "economy.h"
#include "monster.h"
@ -180,7 +179,10 @@ int
season(int turn)
{
int year,month;
int t = turn - FIRST_TURN;
int t = turn;
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
year = t/(months_per_year * weeks_per_month) + 1;
month = (t - (year-1) * months_per_year * weeks_per_month)/weeks_per_month;
@ -220,7 +222,10 @@ gamedate_season(const struct locale * lang)
{
int year,month,week,r;
static char buf[256];
int t = turn - FIRST_TURN;
int t = turn;
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn;
assert(lang);
@ -244,7 +249,10 @@ gamedate2(const struct locale * lang)
{
int year,month,week,r;
static char buf[256];
int t = turn - FIRST_TURN;
int t = turn;
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn;
@ -265,7 +273,10 @@ gamedate_short(const struct locale * lang)
{
int year,month,week,r;
static char buf[256];
int t = turn - FIRST_TURN;
int t = turn;
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn;
@ -822,10 +833,10 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
marker = '*';
} else {
if(a_otherfaction && f != u->faction && get_otherfaction(a_otherfaction) == f
&& !fval(u, FL_PARTEITARNUNG)) {
&& !fval(u, UFL_PARTEITARNUNG)) {
marker = '!';
} else {
if(dh && !fval(u, FL_PARTEITARNUNG)) {
if(dh && !fval(u, UFL_PARTEITARNUNG)) {
marker = '+';
} else {
marker = '-';
@ -1448,14 +1459,16 @@ statistics(FILE * F, const region * r, const faction * f)
p / RECRUITFRACTION);
rps(F, buf);
if (buildingtype_exists(r, bt_find("caravan"))) {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
(p * 2) / TRADE_FRACTION);
} else {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
p / TRADE_FRACTION);
if (!TradeDisabled()) {
if (buildingtype_exists(r, bt_find("caravan"))) {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
(p * 2) / TRADE_FRACTION);
} else {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
p / TRADE_FRACTION);
}
rps(F, buf);
}
rps(F, buf);
}
/* Info über Einheiten */
@ -1482,7 +1495,7 @@ durchreisende(FILE * F, const region * r, const faction * f)
for (ru = a_find(r->attribs, &at_travelunit); ru; ru = ru->nexttype) {
unit * u = (unit*)ru->data.v;
if (cansee_durchgezogen(f, r, u, 0) > 0 && r!=u->region) {
if (u->ship && !fval(u, FL_OWNER))
if (u->ship && !fval(u, UFL_OWNER))
continue;
wieviele++;
}
@ -1499,7 +1512,7 @@ durchreisende(FILE * F, const region * r, const faction * f)
for (ru = a_find(r->attribs, &at_travelunit); ru; ru = ru->nexttype) {
unit * u = (unit*)ru->data.v;
if (cansee_durchgezogen(f, r, u, 0) > 0 && r!=u->region) {
if (u->ship && !fval(u, FL_OWNER))
if (u->ship && !fval(u, UFL_OWNER))
continue;
counter++;
if (u->ship != (ship *) NULL) {
@ -1589,7 +1602,7 @@ order_template(FILE * F, faction * f)
sprintf(buf, "%s %s; %s [%d,%d$", LOC(u->faction->locale, parameters[P_UNIT]),
unitid(u), u->name, u->number, get_money(u));
if (u->building != NULL && fval(u, FL_OWNER)) {
if (u->building != NULL && fval(u, UFL_OWNER)) {
building * b = u->building;
int cost = buildingmaintenance(b, R_SILVER);
@ -1603,7 +1616,7 @@ order_template(FILE * F, faction * f)
}
#endif
} else if (u->ship) {
if (fval(u, FL_OWNER))
if (fval(u, UFL_OWNER))
scat(",S");
else
scat(",s");
@ -1800,7 +1813,7 @@ guards(FILE * F, const region * r, const faction * see)
f = fv;
}
if (f != see && fval(u, FL_PARTEITARNUNG)) {
if (f != see && fval(u, UFL_PARTEITARNUNG)) {
tarned=true;
} else {
for (i=0;i!=nextguard;++i) if (guardians[i]==f) break;
@ -1923,12 +1936,12 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
print_curses(F, f, b, TYP_BUILDING, 4);
for (u = r->units; u; u = u->next)
if (u->building == b && fval(u, FL_OWNER)) {
if (u->building == b && fval(u, UFL_OWNER)) {
rpunit(F, f, u, 6, mode);
break;
}
for (u = r->units; u; u = u->next)
if (u->building == b && !fval(u, FL_OWNER))
if (u->building == b && !fval(u, UFL_OWNER))
rpunit(F, f, u, 6, mode);
}
@ -2206,7 +2219,7 @@ report(FILE *F, faction * f, const faction_list * addresses,
if (unit_in_region) {
describe(F, r, 0, f);
if (rterrain(r) != T_OCEAN && rpeasants(r)/TRADE_FRACTION > 0) {
if (!TradeDisabled() && rterrain(r) != T_OCEAN && rpeasants(r)/TRADE_FRACTION > 0) {
rnl(F);
prices(F, r, f);
}
@ -2278,7 +2291,7 @@ report(FILE *F, faction * f, const faction_list * addresses,
/* Gewicht feststellen */
for (u = r->units; u; u = u->next)
if (u->ship == sh && fval(u, FL_OWNER)) {
if (u->ship == sh && fval(u, UFL_OWNER)) {
of = u->faction;
break;
}
@ -2330,12 +2343,12 @@ report(FILE *F, faction * f, const faction_list * addresses,
print_curses(F,f,sh,TYP_SHIP,4);
for (u = r->units; u; u = u->next)
if (u->ship == sh && fval(u, FL_OWNER)) {
if (u->ship == sh && fval(u, UFL_OWNER)) {
rpunit(F, f, u, 6, sd->mode);
break;
}
for (u = r->units; u; u = u->next)
if (u->ship == sh && !fval(u, FL_OWNER))
if (u->ship == sh && !fval(u, UFL_OWNER))
rpunit(F, f, u, 6, sd->mode);
}
@ -2841,7 +2854,7 @@ prepare_report(faction * f)
if (u->faction == f) {
if (u->race != new_race[RC_SPELL] || u->number == RS_FARVISION) {
mode = see_unit;
if (fval(u, FL_DISBELIEVES)) {
if (fval(u, UFL_DISBELIEVES)) {
dis = true;
break;
}
@ -3369,7 +3382,7 @@ writemonument(void)
for(i = 0; i<=6; i++) {
if (buildings[i] != NULL) {
fprintf(F, "In %s", rname(buildings[i]->region, NULL));
if ((owner=buildingowner(buildings[i]->region,buildings[i]))!=NULL && !fval(owner,FL_PARTEITARNUNG)) {
if ((owner=buildingowner(buildings[i]->region,buildings[i]))!=NULL && !fval(owner,UFL_PARTEITARNUNG)) {
fprintf(F, ", Eigentümer: %s", factionname(owner->faction));
}
fprintf(F, "\n\n");
@ -3389,7 +3402,7 @@ writemonument(void)
j++;
if(j == ra) {
fprintf(F, "In %s", rname(b->region, NULL));
if ((owner=buildingowner(b->region,b))!=NULL && !fval(owner,FL_PARTEITARNUNG)) {
if ((owner=buildingowner(b->region,b))!=NULL && !fval(owner,UFL_PARTEITARNUNG)) {
fprintf(F, ", Eigentümer: %s", factionname(owner->faction));
}
fprintf(F, "\n\n");
@ -3550,7 +3563,7 @@ report_summary(summary * s, summary * o, boolean full)
FILE * F = NULL;
int i, newplayers = 0;
faction * f;
int nmrs[NMRTIMEOUT+1];
int * nmrs = malloc(sizeof(int)*(NMRTimeout()+1));
{
char zText[MAX_PATH];
@ -3644,7 +3657,7 @@ report_summary(summary * s, summary * o, boolean full)
fprintf(F, "\n\n");
for (i = 0; i != NMRTIMEOUT+1; ++i) {
for (i = 0; i != NMRTimeout()+1; ++i) {
nmrs[i] = 0;
}
@ -3652,12 +3665,12 @@ report_summary(summary * s, summary * o, boolean full)
if (f->age <= 1 && turn - f->lastorders == 1) {
newplayers++;
} else if (f->no != MONSTER_FACTION) {
nmrs[min(NMRTIMEOUT,turn-f->lastorders)]++;
nmrs[min(NMRTimeout(),turn-f->lastorders)]++;
}
}
for (i = 0; i != NMRTIMEOUT+1; ++i) {
if(i == NMRTIMEOUT) {
for (i = 0; i != NMRTimeout()+1; ++i) {
if(i == NMRTimeout()) {
fprintf(F, "+ NMRs:\t\t %d\n", nmrs[i]);
} else {
fprintf(F, "%d %s:\t\t %d\n", i,
@ -3681,12 +3694,11 @@ report_summary(summary * s, summary * o, boolean full)
out_faction(F, f);
}
#if NMRTIMEOUT
if (full) {
if (NMRTimeout() && full) {
fprintf(F, "\n\nFactions with NMRs:\n");
for (i = NMRTIMEOUT; i > 0; --i) {
for (i = NMRTimeout(); i > 0; --i) {
for(f=factions; f; f=f->next) {
if(i == NMRTIMEOUT) {
if(i == NMRTimeout()) {
if(turn - f->lastorders >= i) {
out_faction(F, f);
}
@ -3698,7 +3710,6 @@ report_summary(summary * s, summary * o, boolean full)
}
}
}
#endif
fclose(F);
@ -3739,6 +3750,7 @@ report_summary(summary * s, summary * o, boolean full)
#endif
writemonument();
}
free(nmrs);
}
/******* end summary ******/

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -25,7 +25,6 @@
/* kernel includes */
#include "build.h"
#include "creation.h"
#include "economy.h"
#include "item.h"
#include "karma.h"
@ -210,9 +209,9 @@ setstealth(unit * u, strlist * S)
/* TARNE PARTEI [NICHT|NUMMER abcd] */
s = getstrtoken();
if(!s || *s == 0) {
fset(u, FL_PARTEITARNUNG);
fset(u, UFL_PARTEITARNUNG);
} else if (findparam(s, u->faction->locale) == P_NOT) {
freset(u, FL_PARTEITARNUNG);
freset(u, UFL_PARTEITARNUNG);
} else if (findkeyword(s, u->faction->locale) == K_NUMBER) {
const char *s2 = getstrtoken();
int nr = -1;

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -283,7 +283,7 @@ teach(region * r, unit * u)
teachskill[i++]=sk;
} while (sk!=NOSKILL);
while (teaching && student) {
if (student->faction == u->faction && !fval(student, FL_HUNGER)) {
if (student->faction == u->faction && !fval(student, UFL_HUNGER)) {
if (igetkeyword(student->thisorder, student->faction->locale) == K_STUDY) {
/* Input ist nun von student->thisorder !! */
sk = getskill(student->faction->locale);
@ -300,7 +300,7 @@ teach(region * r, unit * u)
}
#if TEACH_FRIENDS
while (teaching && student) {
if (student->faction != u->faction && !fval(student, FL_HUNGER) && alliedunit(u, student->faction, HELP_GUARD)) {
if (student->faction != u->faction && !fval(student, UFL_HUNGER) && alliedunit(u, student->faction, HELP_GUARD)) {
if (igetkeyword(student->thisorder, student->faction->locale) == K_STUDY) {
/* Input ist nun von student->thisorder !! */
sk = getskill(student->faction->locale);
@ -445,7 +445,7 @@ learn(void)
unit *u;
int p;
magic_t mtyp;
int i, l;
int l;
int warrior_skill;
int studycost;
@ -466,6 +466,7 @@ learn(void)
attrib * a = NULL;
teaching_info * teach = NULL;
int money = 0;
skill_t sk;
int maxalchemy = 0;
if (u->race == new_race[RC_INSECT] && r_insectstalled(r)
&& !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) {
@ -479,28 +480,32 @@ learn(void)
sprintf(buf, "%s können nichts lernen", LOC(default_locale, rc_name(u->race, 1)));
mistake(u, u->thisorder, buf, MSG_EVENT);
continue;
}
}
i = getskill(u->faction->locale);
sk = getskill(u->faction->locale);
if (i < 0) {
if (sk < 0) {
cmistake(u, findorder(u, u->thisorder), 77, MSG_EVENT);
continue;
}
if (SkillCap(sk) && SkillCap(sk) <= effskill(u, sk)) {
cmistake(u, findorder(u, u->thisorder), 77, MSG_EVENT);
continue;
}
/* Hack: Talente mit Malus -99 können nicht gelernt werden */
if (u->race->bonus[i] == -99) {
if (u->race->bonus[sk] == -99) {
cmistake(u, findorder(u, u->thisorder), 77, MSG_EVENT);
continue;
}
/* snotlings können Talente nur bis T8 lernen */
if (u->race == new_race[RC_SNOTLING]){
if (get_level(u, (skill_t)i) >= 8){
if (get_level(u, sk) >= 8){
cmistake(u, findorder(u, u->thisorder), 308, MSG_EVENT);
continue;
}
}
p = studycost = study_cost(u,i);
p = studycost = study_cost(u, sk);
a = a_find(u->attribs, &at_learning);
if (a!=NULL) {
teach = (teaching_info*)a->data.v;
@ -525,7 +530,7 @@ learn(void)
}
}
if (i == SK_MAGIC) {
if (sk == SK_MAGIC) {
if (u->number > 1){
cmistake(u, findorder(u, u->thisorder), 106, MSG_MAGIC);
continue;
@ -588,7 +593,7 @@ learn(void)
}
}
}
if (i == SK_ALCHEMY) {
if (sk == SK_ALCHEMY) {
maxalchemy = eff_skill(u, SK_ALCHEMY, r);
if (has_skill(u, SK_ALCHEMY)==0
&& count_skill(u->faction, SK_ALCHEMY) + u->number >
@ -625,7 +630,7 @@ learn(void)
if (money>0) {
use_pooled(u, r, R_SILVER, money);
add_message(&u->faction->msgs, msg_message("studycost",
"unit region cost skill", u, u->region, money, i));
"unit region cost skill", u, u->region, money, sk));
}
if (get_effect(u, oldpotiontype[P_WISE])) {
@ -641,9 +646,9 @@ learn(void)
warrior_skill = fspecial(u->faction, FS_WARRIOR);
if(warrior_skill > 0) {
if(i == SK_CROSSBOW || i == SK_LONGBOW
|| i == SK_CATAPULT || i == SK_SWORD || i == SK_SPEAR
|| i == SK_AUSDAUER || i == SK_WEAPONLESS)
if(sk == SK_CROSSBOW || sk == SK_LONGBOW
|| sk == SK_CATAPULT || sk == SK_SWORD || sk == SK_SPEAR
|| sk == SK_AUSDAUER || sk == SK_WEAPONLESS)
{
teach->value += u->number * (5+warrior_skill*5);
} else {
@ -664,21 +669,21 @@ learn(void)
}
#ifdef SKILLFIX_SAVE
if (teach && teach->value) {
int skill = get_skill(u, (skill_t)i);
skillfix(u, (skill_t)i, skill,
int skill = get_skill(u, sk);
skillfix(u, sk, skill,
(int)(u->number * 30 * multi), teach->value);
}
#endif
days = (int)((u->number * 30 + teach->value) * multi);
if (fval(u, FL_HUNGER)) days = days / 2;
if (fval(u, UFL_HUNGER)) days = days / 2;
while (days) {
if (days>=u->number*30) {
learn_skill(u, (skill_t)i, 1.0);
learn_skill(u, sk, 1.0);
days -= u->number*30;
} else {
double chance = (double)days/u->number/30;
learn_skill(u, (skill_t)i, chance);
learn_skill(u, sk, chance);
days = 0;
}
}
@ -687,10 +692,10 @@ learn(void)
unit * teacher = teach->teacher;
if (teacher->faction != u->faction) {
add_message(&u->faction->msgs, msg_message("teach_student",
"teacher student skill", teacher, u, (skill_t)i));
"teacher student skill", teacher, u, sk));
add_message(&teacher->faction->msgs, msg_message("teach_teacher",
"teacher student skill level", teacher, u, (skill_t)i,
effskill(u, (skill_t)i)));
"teacher student skill level", teacher, u, sk,
effskill(u, sk)));
}
}
a_remove(&u->attribs, a);
@ -700,7 +705,7 @@ learn(void)
/* Anzeigen neuer Tränke */
/* Spruchlistenaktualiesierung ist in Regeneration */
if (i == SK_ALCHEMY) {
if (sk == SK_ALCHEMY) {
const potion_type * ptype;
faction * f = u->faction;
int skill = eff_skill(u, SK_ALCHEMY, r);
@ -738,7 +743,7 @@ teaching(void)
for (u = r->units; u; u = u->next) {
if (u->race == new_race[RC_SPELL] || fval(u, FL_LONGACTION))
if (u->race == new_race[RC_SPELL] || fval(u, UFL_LONGACTION))
continue;
if (rterrain(r) == T_OCEAN

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,11 +12,22 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_BIRTHDAY
#define H_ITM_BIRTHDAY
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_birthday_firework;
extern struct resource_type rt_birthday_firework;
extern void register_birthday_firework(void);
extern struct item_type it_lebkuchenherz;
extern struct resource_type rt_lebkuchenherz;
extern void register_lebkuchenherz(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,18 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_DEMONSEYE
#define H_ITM_DEMONSEYE
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_demonseye;
extern void register_demonseye(void);
extern boolean give_igjarjuk(const struct unit *, const struct unit *, const struct item_type *, int, const char *);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -14,17 +14,17 @@
#include <eressea.h>
#include "items.h"
#include "birthday_firework.h"
#include "lmsreward.h"
#include "demonseye.h"
#include "weapons.h"
#include "xerewards.h"
#include "catapultammo.h"
#include "weapons.h"
#include "racespoils.h"
#if GROWING_TREES
# include "seed.h"
#endif
#include "birthday_firework.h"
#include "questkeys.h"
#include "catapultammo.h"
void
register_items(void)
@ -39,8 +39,8 @@ register_items(void)
#endif
register_birthday_firework();
register_lebkuchenherz();
register_catapultammo();
register_questkeys();
register_catapultammo();
register_racespoils();
}

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -10,5 +10,16 @@
without prior permission by the authors of Eressea.
*/
#ifndef H_ITM_ITEMS
#define H_ITM_ITEMS
#ifdef __cplusplus
extern "C" {
#endif
extern void register_items(void);
extern void init_items(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,5 +12,15 @@
* prior permission by the authors of Eressea.
*/
extern struct item_type it_lmsreward;
#ifndef H_ITM_LMSREWARD
#define H_ITM_LMSREWARD
#ifdef __cplusplus
extern "C" {
#endif
extern void register_lmsreward(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,7 +12,17 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_QUESTKEYS
#define H_ITM_QUESTKEYS
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_questkey1;
extern struct item_type it_questkey2;
extern void register_questkeys(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,12 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_SPOILS
#define H_ITM_SPOILS
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_elfspoil;
extern struct item_type it_demonspoil;
extern struct item_type it_goblinspoil;
@ -26,3 +32,7 @@ extern struct item_type it_trollspoil;
extern void register_racespoils(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,13 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_SEED
#define H_ITM_SEED
#ifdef __cplusplus
extern "C" {
#endif
#if GROWING_TREES
extern struct item_type it_seed;
extern struct resource_type rt_seed;
@ -23,3 +30,8 @@ extern void register_mallornseed(void);
#else
#error seed.h should not be included when building with GROWING_TREES==0
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -10,8 +10,11 @@
without prior permission by the authors of Eressea.
*/
#ifndef WEAPONS_H
#define WEAPONS_H
#ifndef H_ITM_WEAPONS
#define H_ITM_WEAPONS
#ifdef __cplusplus
extern "C" {
#endif
extern void register_weapons(void);
extern void init_weapons(void);
@ -21,4 +24,7 @@ extern struct item_type it_mallornlance;
extern struct item_type it_mallorncrossbow;
extern struct item_type it_mallornbow;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,6 +12,17 @@
* prior permission by the authors of Eressea.
*/
#ifndef H_ITM_XEREWARDS
#define H_ITM_XEREWARDS
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_skillpotion;
extern struct item_type it_astralcrystal;
extern void register_xerewards(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -143,7 +143,7 @@ use_potion(unit * u, const item_type * itype, int amount, const char * cmd)
if (!a) a = a_add(&r->attribs, a_new(&at_horseluck));
a->data.i+=amount;
} else if (ptype==oldpotiontype[P_WAHRHEIT]) {
fset(u, FL_DISBELIEVES);
fset(u, UFL_DISBELIEVES);
amount=1;
} else if (ptype==oldpotiontype[P_MACHT]) {
/* Verfünffacht die HP von max. 10 Personen in der Einheit */
@ -227,31 +227,6 @@ get_effect(const unit * u, const potion_type * effect)
return 0;
}
int
set_effect (unit * u, const potion_type * effect, int value)
{
attrib ** ap = &u->attribs, * a;
effect_data * data = NULL;
while (*ap && (*ap)->type!=&at_effect) ap=&(*ap)->next;
a = *ap;
while (a) {
data = (effect_data *)a->data.v;
if (data->type==effect) break;
a=a->nexttype;
}
if (!a && value) {
attrib * an = a_add(ap, a_new(&at_effect));
data = (effect_data*)an->data.v;
data->type = effect;
data->value = value;
} else if (a && !value) {
a_remove(ap, a);
} else if (a && value) {
data->value = value;
}
return value;
}
int
change_effect (unit * u, const potion_type * effect, int delta)
{

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -18,8 +18,11 @@
* permission from the authors.
*/
#ifndef ALCHEMY_H
#define ALCHEMY_H
#ifndef H_KRNL_ALCHEMY
#define H_KRNL_ALCHEMY_H
#ifdef __cplusplus
extern "C" {
#endif
enum {
/* Stufe 1 */
@ -83,7 +86,6 @@ void init_potions(void);
extern struct attrib_type at_bauernblut;
extern int get_effect(const struct unit * u, const struct potion_type * effect);
extern int set_effect(struct unit * u, const struct potion_type * , int value);
extern int change_effect(struct unit * u, const struct potion_type * effect, int value);
extern attrib_type at_effect;
@ -93,4 +95,7 @@ typedef struct effect_data {
int value;
} effect_data;
#ifdef __cplusplus
}
#endif
#endif /* ALCHEMY_H */

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -12,8 +12,9 @@
#include <config.h>
#include <eressea.h>
#include "alliance.h"
#ifdef ALLIANCES
#include "alliance.h"
#include "command.h"
/* kernel includes */

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,7 +11,15 @@
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifdef ALLIANCES
#ifndef H_MOD_ALLIANCE
#define H_MOD_ALLIANCE
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ALLIANCES
#error "must define ALLIANCES to use this module"
#endif
struct plane;
struct attrib;
struct unit;
@ -38,4 +46,7 @@ extern void alliancekick(void);
extern void alliancevictory(void);
/* execute commands */
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -56,12 +56,6 @@ typedef enum combatmagic {
#include "building.h"
#include "group.h"
/* util includes */
#include <base36.h>
#include <cvector.h>
#include <rand.h>
#include <log.h>
/* attributes includes */
#include <attributes/key.h>
#include <attributes/fleechance.h>
@ -69,8 +63,19 @@ typedef enum combatmagic {
#include <attributes/otherfaction.h>
#include <attributes/moved.h>
/* items includes */
#include <items/demonseye.h>
/* modules includes */
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* util includes */
#include <base36.h>
#include <cvector.h>
#include <rand.h>
#include <log.h>
/* libc includes */
#include <assert.h>
@ -94,13 +99,12 @@ BZFILE *bdebug;
FILE *bdebug;
#endif
/* TODO: header cleanup */
extern int dice_rand(const char *s);
extern item_type it_demonseye;
int obs_count = 0;
/* external variables */
boolean nobattledebug = false;
/* globals */
static int obs_count = 0;
#define TACTICS_MALUS
#undef MAGIC_TURNS
@ -372,14 +376,14 @@ select_corpse(battle * b, fighter * af)
fighter *df;
side *side;
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
if (!af || (!enemy(af->side, side) && allysf(af->side, side->bf->faction)))
maxcasualties += side->casualties;
}
next(side);
cv_next(side);
di = rand() % maxcasualties;
for_each(df, b->fighters) {
cv_foreach(df, b->fighters) {
/* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt
* werden! */
int dead = df->unit->number - (df->alive + df->run.number);
@ -394,7 +398,7 @@ select_corpse(battle * b, fighter * af)
}
di -= dead;
}
next(df);
cv_next(df);
return dt;
}
@ -416,11 +420,11 @@ countallies(side * as)
side *s;
int count = 0;
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (!helping(as, s)) continue;
count += s->size[SUM_ROW];
}
next(s);
cv_next(s);
return count;
}
@ -440,7 +444,7 @@ tactics_bonus(troop at, troop dt, boolean attacking)
side *s;
int abest = 0, dbest = 0;
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (!enemy(s, as) && allysf(s, as->bf->faction)) {
if (rand() % countallies(as) < support(&as->leader))
abest = max(s->leader.value, abest);
@ -449,7 +453,7 @@ tactics_bonus(troop at, troop dt, boolean attacking)
dbest = max(s->leader.value, dbest);
}
}
next(s);
cv_next(s);
if (abest > dbest)
return attacking;
return 0;
@ -814,7 +818,7 @@ select_armor(troop t)
/* Drachen benutzen keine Rüstungen */
if (!(t.fighter->unit->race->battle_flags & BF_EQUIPMENT))
return AR_NONE;
/* ... und Werwölfe auch nicht */
if(fval(t.fighter->unit, UFL_WERE)) {
return AR_NONE;
@ -1035,7 +1039,7 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
int ar, an, am;
int armor = select_armor(dt);
int shield = select_shield(dt);
const weapon_type *dwtype = NULL;
const weapon_type *awtype = NULL;
const weapon * weapon;
@ -1405,7 +1409,7 @@ fighters(battle *b, fighter *af, int minrow, int maxrow, int mask)
fightervp = malloc(sizeof(cvector));
cv_init(fightervp);
for_each(fig, b->fighters) {
cv_foreach(fig, b->fighters) {
if (!fig->alive) continue;
row = get_unitrow(fig);
@ -1426,7 +1430,7 @@ fighters(battle *b, fighter *af, int minrow, int maxrow, int mask)
}
}
} next(fig);
} cv_next(fig);
return fightervp;
}
@ -1479,7 +1483,7 @@ do_combatmagic(battle *b, combatmagic_t was)
if (sp == NULL)
continue;
snprintf(cmd, 128, "%s \"%s\"",
snprintf(cmd, 128, "%s \"%s\"",
LOC(lang, keywords[K_CAST]), spell_name(sp, lang));
if (cancast(mage, sp, 1, 1, cmd) == false)
@ -1637,10 +1641,6 @@ skilldiff(troop at, troop dt, int dist)
weapon * awp = select_weapon(at, true, dist>1);
weapon * dwp = select_weapon(dt, false, dist>1);
/* Effekte von Alchemie */
if (get_effect(au, oldpotiontype[P_BERSERK]) > at.index)
++skdiff;
if (df->person[dt.index].flags & FL_SLEEPING)
skdiff += 2;
@ -1908,7 +1908,7 @@ damage_building(battle *b, building *bldg, int damage_abs)
bldg->sizeleft = bldg->size;
for_each(fi, b->fighters) {
cv_foreach(fi, b->fighters) {
if (fi->building == bldg) {
if (bldg->sizeleft >= fi->unit->number) {
fi->building = bldg;
@ -1917,7 +1917,7 @@ damage_building(battle *b, building *bldg, int damage_abs)
fi->building = NULL;
}
}
} next(fi);
} cv_next(fi);
}
}
@ -2354,24 +2354,24 @@ aftermath(battle * b)
* zurück. Nicht logisch, aber die einzige Lösung, den Verlust der
* Aura durch Dummy-Angriffe zu verhindern. */
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (s->bf->lastturn+(b->has_tactics_turn?1:0)<=1) continue;
/* Prüfung, ob faction angegriffen hat. Geht nur über die Faction */
if (!s->bf->attacker) {
fighter *fig;
for_each(fig, s->fighters) {
cv_foreach(fig, s->fighters) {
sc_mage * mage = get_mage(fig->unit);
if (mage)
mage->spellpoints += mage->precombataura;
} next(fig);
} cv_next(fig);
}
/* Alle Fighter durchgehen, Mages suchen, Precombataura zurück */
} next(s);
} cv_next(s);
/* POSTCOMBAT */
do_combatmagic(b, DO_POSTCOMBATSPELL);
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
fighter *df;
boolean relevant = false; /* Kampf relevant für dieses Heer? */
if (s->bf->lastturn+(b->has_tactics_turn?1:0)>1) {
@ -2380,7 +2380,7 @@ aftermath(battle * b)
s->flee = 0;
s->dead = 0;
for_each(df, s->fighters) {
cv_foreach(df, s->fighters) {
unit *du = df->unit;
int dead = du->number - df->alive - df->run.number;
int sum_hp = 0;
@ -2389,9 +2389,9 @@ aftermath(battle * b)
ship * sh = du->ship?du->ship:leftship(du);
if (sh) fset(sh, SF_DAMAGED);
fset(du, FL_LONGACTION);
fset(du, UFL_LONGACTION);
/* TODO: das sollte hier weg sobald anderswo üb
* erall FL_LONGACTION getestet wird. */
* erall UFL_LONGACTION getestet wird. */
set_string(&du->thisorder, "");
}
for (n = 0; n != df->alive; ++n) {
@ -2425,7 +2425,7 @@ aftermath(battle * b)
du->hp = df->run.hp;
set_string(&du->thisorder, "");
setguard(du, GUARD_NONE);
fset(du, FL_MOVED);
fset(du, UFL_MOVED);
leave(du->region, du);
if (df->run.region) {
travel(r, du, df->run.region, 1);
@ -2487,8 +2487,8 @@ aftermath(battle * b)
itoa36(du->no), du->hp, du->number));
du->hp=du->no;
}
} next(df);
} next(s);
} cv_next(df);
} cv_next(s);
dead_peasants = min(rpeasants(r), (is*BATTLE_KILLS_PEASANTS)/100);
deathcounts(r, dead_peasants + is);
chaoscounts(r, dead_peasants / 2);
@ -2497,7 +2497,7 @@ aftermath(battle * b)
for (bf=b->factions;bf;bf=bf->next) {
faction * f = bf->faction;
fbattlerecord(f, r, " ");
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (seematrix(f, s)) {
sprintf(buf, "Heer %2d(%s): %d Tote, %d Geflohene, %d Überlebende",
s->index, sideabkz(s,false), s->dead, s->flee, s->alive);
@ -2506,7 +2506,7 @@ aftermath(battle * b)
s->index, s->dead, s->flee, s->alive);
}
fbattlerecord(f, r, buf);
} next(s);
} cv_next(s);
}
/* Wir benutzen drifted, um uns zu merken, ob ein Schiff
* schonmal Schaden genommen hat. (moved und drifted
@ -2586,7 +2586,7 @@ print_fighters(battle * b, cvector * fighters)
fighter *df;
int lastrow = -1;
for_each(df, *fighters) {
cv_foreach(df, *fighters) {
unit *du = df->unit;
int row = get_unitrow(df);
@ -2599,7 +2599,7 @@ print_fighters(battle * b, cvector * fighters)
}
battle_punit(du, b);
}
next(df);
cv_next(df);
}
static void
@ -2648,7 +2648,7 @@ print_stats(battle * b)
side *s2;
side *side;
int i = 0;
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
bfaction *bf;
char *k;
boolean komma;
@ -2664,7 +2664,7 @@ print_stats(battle * b)
fbattlerecord(f, b->region, buf);
strcpy(buf, LOC(f->locale, "battle_opponents"));
komma = false;
for_each(s2, b->sides) {
cv_foreach(s2, b->sides) {
if (enemy(s2, side))
{
if (seematrix(f, s2) == true) {
@ -2676,11 +2676,11 @@ print_stats(battle * b)
}
}
}
next(s2);
cv_next(s2);
fbattlerecord(f, b->region, buf);
strcpy(buf, "Attacke gegen:");
komma = false;
for_each(s2, b->sides) {
cv_foreach(s2, b->sides) {
if (side->enemy[s2->index] & E_ATTACKING) {
if (seematrix(f, s2) == true) {
sprintf(buf, "%s%s Heer %d(%s)", buf, komma++ ? "," : "",
@ -2691,7 +2691,7 @@ print_stats(battle * b)
}
}
}
next(s2);
cv_next(s2);
fbattlerecord(f, b->region, buf);
}
buf[77] = (char)0;
@ -2708,7 +2708,7 @@ print_stats(battle * b)
}
print_fighters(b, &side->fighters);
}
next(side);
cv_next(side);
battlerecord(b, " ");
@ -2716,24 +2716,24 @@ print_stats(battle * b)
b->max_tactics = 0;
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
if (cv_size(&side->leader.fighters))
b->max_tactics = max(b->max_tactics, side->leader.value);
} next(side);
} cv_next(side);
if (b->max_tactics > 0) {
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
if (side->leader.value == b->max_tactics) {
fighter *tf;
for_each(tf, side->leader.fighters) {
cv_foreach(tf, side->leader.fighters) {
unit *u = tf->unit;
if (!fval(tf, FIG_ATTACKED))
battlemsg(b, u, "überrascht den Gegner.");
else
battlemsg(b, u, "konnte dem Gegner eine Falle stellen.");
} next(tf);
} cv_next(tf);
}
} next(side);
} cv_next(side);
}
}
@ -2764,7 +2764,7 @@ make_fighter(battle * b, unit * u, boolean attack)
int strongmen;
int speeded = 0, speed = 1;
boolean pr_aid = false;
boolean stealth = (boolean)((fval(u, FL_PARTEITARNUNG)!=0)?true:false);
boolean stealth = (boolean)((fval(u, UFL_PARTEITARNUNG)!=0)?true:false);
int rest;
const attrib * a = a_find(u->attribs, &at_group);
const group * g = a?(const group*)a->data.v:NULL;
@ -2775,7 +2775,7 @@ make_fighter(battle * b, unit * u, boolean attack)
if (fval(u->race, RCF_ILLUSIONARY) || idle(u->faction))
return NULL;
for_each(s2, b->sides) {
cv_foreach(s2, b->sides) {
if (s2->bf->faction == u->faction
&& s2->stealth==stealth
&& s2->stealthfaction == stealthfaction
@ -2785,7 +2785,7 @@ make_fighter(battle * b, unit * u, boolean attack)
break;
}
}
} next(s2);
} cv_next(s2);
/* aliances are moved out of make_fighter and will be handled later */
if (!s1) s1 = make_side(b, u->faction, g, stealth, stealthfaction);
@ -2822,7 +2822,7 @@ make_fighter(battle * b, unit * u, boolean attack)
rest = u->hp % u->number;
/* Effekte von Sprüchen */
{
static const curse_type * speed_ct;
speed_ct = ct_find("speed");
@ -3035,14 +3035,14 @@ join_battle(battle * b, unit * u, boolean attack)
fighter *c = NULL;
fighter *fig;
for_each(fig, b->fighters) {
cv_foreach(fig, b->fighters) {
if (fig->unit == u) {
c = fig;
if (attack) fset(fig, FIG_ATTACKED);
break;
}
}
next(fig);
cv_next(fig);
if (!c) c = make_fighter(b, u, attack);
return c;
}
@ -3162,22 +3162,22 @@ free_battle(battle * b)
max_fac_no = max(max_fac_no, f->no);
}
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
free_side(side);
free(side);
}
next(side);
cv_next(side);
cv_kill(&b->sides);
for_each(fighter, b->fighters) {
cv_foreach(fighter, b->fighters) {
free_fighter(fighter);
free(fighter);
}
next(fighter);
cv_next(fighter);
cv_kill(&b->fighters);
for_each(meffect, b->meffects) {
cv_foreach(meffect, b->meffects) {
free(meffect);
}
next(meffect);
cv_next(meffect);
cv_kill(&b->meffects);
/*
cv_kill(&b->factions);
@ -3190,10 +3190,10 @@ get_alive(battle * b, side * s, faction * vf, boolean see)
static int alive[NUMROWS];
fighter *f;
memset(alive, 0, NUMROWS * sizeof(int));
for_each(f, s->fighters) {
cv_foreach(f, s->fighters) {
if (f->alive && seematrix(vf, s)==see)
alive[get_unitrow(f)] += f->alive;
} next(f);
} cv_next(f);
return alive;
}
@ -3208,16 +3208,16 @@ battle_report(battle * b)
buf[0] = 0;
for_each(s, b->sides) {
for_each(s2, b->sides) {
cv_foreach(s, b->sides) {
cv_foreach(s2, b->sides) {
if (s->alive-s->removed > 0 && s2->alive-s2->removed > 0 && enemy(s, s2))
{
cont = true;
s->bf->lastturn = b->turn;
s2->bf->lastturn = b->turn;
}
} next(s2);
} next(s);
} cv_next(s2);
} cv_next(s);
printf(" %d", b->turn);
fflush(stdout);
@ -3233,7 +3233,7 @@ battle_report(battle * b)
fbattlerecord(fac, b->region, buf2);
buf2[0] = 0;
komma = false;
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (s->alive) {
int r, k = 0, * alive = get_alive(b, s, fac, seematrix(fac, s));
if (!seematrix(fac, s)) {
@ -3261,7 +3261,7 @@ battle_report(battle * b)
komma = true;
}
}
} next(s);
} cv_next(s);
fbattlerecord(fac, b->region, buf2);
}
return cont;
@ -3279,7 +3279,7 @@ join_allies(battle * b)
int size = cv_size(&b->sides);
for (u=r->units;u;u=u->next)
/* Was ist mit Schiffen? */
if (u->status != ST_FLEE && u->status != ST_AVOID && !fval(u, FL_MOVED) && u->number > 0)
if (u->status != ST_FLEE && u->status != ST_AVOID && !fval(u, UFL_MOVED) && u->number > 0)
{
int si;
faction * f = u->faction;
@ -3287,8 +3287,8 @@ join_allies(battle * b)
for (si = 0; si != size; ++si) {
int se;
side *s = b->sides.begin[si];
/* Wenn alle attackierten noch FL_NOAIDF haben, dann kämpfe nicht mit. */
if (fval(s->bf->faction, FL_NOAIDF)) continue;
/* Wenn alle attackierten noch FFL_NOAID haben, dann kämpfe nicht mit. */
if (fval(s->bf->faction, FFL_NOAID)) continue;
if (s->bf->faction!=f) {
/* Wenn wir attackiert haben, kommt niemand mehr hinzu: */
if (s->bf->attacker) continue;
@ -3342,7 +3342,7 @@ join_allies(battle * b)
extern struct item_type * i_silver;
void
static void
flee(const troop dt)
{
fighter * fig = dt.fighter;
@ -3384,7 +3384,6 @@ flee(const troop dt)
/* we will take money with us */
money = get_money(u);
/* nur ganzgeflohene/resttote Einheiten verlassen die Region */
/* money = min(money, MAINTENANCE); */
if (money > carry) money = carry;
if (money > 0) {
i_change(&u->items, i_silver, -money);
@ -3426,12 +3425,12 @@ do_battle(void)
building *bu;
for (u = r->units; u != NULL; u = u->next) {
fset(u->faction, FL_NOAIDF);
fset(u->faction, FFL_NOAID);
}
/* list_foreach geht nicht, wegen flucht */
for (u = r->units; u != NULL; u = u->next) {
if (fval(u, FL_LONGACTION)) continue;
if (fval(u, UFL_LONGACTION)) continue;
if (u->number > 0) {
strlist *sl;
@ -3462,7 +3461,7 @@ do_battle(void)
msg_message("no_attack_after_advance", "unit region command", u, u->region, sl->s));
}
#endif
if (fval(u, FL_HUNGER)) {
if (fval(u, UFL_HUNGER)) {
cmistake(u, sl->s, 225, MSG_BATTLE);
list_continue(sl);
}
@ -3473,7 +3472,7 @@ do_battle(void)
}
/* ist ein Flüchtling aus einem andern Kampf */
if (fval(u, FL_MOVED)) list_continue(sl);
if (fval(u, UFL_MOVED)) list_continue(sl);
if (peace_ct && curse_active(get_curse(r->attribs, peace_ct))) {
sprintf(buf, "Hier ist es so schön friedlich, %s möchte "
@ -3507,7 +3506,7 @@ do_battle(void)
/* Beginn Fehlerbehandlung */
/* Fehler: "Die Einheit wurde nicht gefunden" */
if (!u2 || fval(u2, FL_MOVED) || u2->number == 0
if (!u2 || fval(u2, UFL_MOVED) || u2->number == 0
|| !cansee(u->faction, u->region, u2, 0)) {
cmistake(u, sl->s, 63, MSG_BATTLE);
list_continue(sl);
@ -3549,7 +3548,7 @@ do_battle(void)
/* Hat die attackierte Einheit keinen Noaid-Status,
* wird das Flag von der Faction genommen, andere
* Einheiten greifen ein. */
if (!fval(u2, FL_NOAID)) freset(u2->faction, FL_NOAIDF);
if (!fval(u2, UFL_NOAID)) freset(u2->faction, FFL_NOAID);
if (c1 && c2) {
/* Merken, wer Angreifer ist, für die Rückzahlung der
@ -3621,10 +3620,10 @@ do_battle(void)
* nach der Kampfreihe sortiert */
v_scramble(b->fighters.begin, b->fighters.end);
v_sort(b->fighters.begin, b->fighters.end, (v_sort_fun) sort_fighterrow);
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
v_sort(s->fighters.begin, s->fighters.end, (v_sort_fun) sort_fighterrow);
}
next(side);
cv_next(side);
print_stats(b); /* gibt die Kampfaufstellung aus */
printf("%s (%d, %d) : ", rname(r, NULL), r->x, r->y);
@ -3738,7 +3737,7 @@ do_battle(void)
side *side;
boolean yes = false;
for_each(side, b->sides) {
cv_foreach(side, b->sides) {
if (b->max_tactics > 0
&& side->leader.value == b->max_tactics
&& helping(side, fig->side))
@ -3746,7 +3745,7 @@ do_battle(void)
yes = true;
break;
}
} next(side);
} cv_next(side);
if (!yes)
continue;
}
@ -3789,7 +3788,7 @@ do_battle(void)
/* ------------------------------------------------------------- */
/* Funktionen, die außerhalb von battle.c verwendet werden. */
int
static int
nb_armor(unit *u, int index)
{
int a, av = 0;

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,8 +11,11 @@
* prior permission by the authors of Eressea.
*/
#ifndef BATTLE_H
#define BATTLE_H
#ifndef H_KRNL_BATTLE
#define H_KRNL_BATTLE
#ifdef __cplusplus
extern "C" {
#endif
/** new code defines **/
#define FAST_GETUNITROW
@ -221,14 +224,16 @@ extern struct cvector * fighters(struct battle *b, struct fighter *af, int minro
extern int countallies(struct side * as);
extern int get_unitrow(struct fighter * af);
extern boolean helping(struct side * as, struct side * ds);
extern void rmtroop(struct troop dt);
extern void rmfighter(fighter *df, int i);
extern struct region * fleeregion(const struct unit * u);
extern boolean enemy (const struct side * a, const struct side * b);
extern struct troop select_corpse(struct battle * b, struct fighter * af);
extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack);
extern int statusrow(int status);
extern void flee(const troop dt);
extern void drain_exp(struct unit *u, int d);
extern void rmtroop(troop dt);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -128,7 +128,6 @@ read_borders(FILE * f)
assert(bid<=nextborder);
if (type->read) type->read(b, f);
a_read(f, &b->attribs);
}
}

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -12,8 +12,11 @@
* prior permission by the authors of Eressea.
*/
#ifndef BORDER_H
#define BORDER_H
#ifndef H_KRNL_BORDER
#define H_KRNL_BORDER
#ifdef __cplusplus
extern "C" {
#endif
#define BMAXHASH 8191
@ -116,4 +119,7 @@ extern border_type bt_questportal;
extern attrib_type at_countdown;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -130,7 +130,7 @@ can_contact(const region * r, const unit * u, const unit * u2)
static void
set_contact(const region * r, unit * u, boolean try)
set_contact(const region * r, unit * u, boolean tries)
{
/* unit u kontaktiert unit u2. Dies setzt den contact einfach auf 1 -
@ -144,7 +144,7 @@ set_contact(const region * r, unit * u, boolean try)
if (u2) {
if (!can_contact(r, u, u2)) {
if(try) cmistake(u, findorder(u, u->thisorder), 23, MSG_EVENT);
if (tries) cmistake(u, findorder(u, u->thisorder), 23, MSG_EVENT);
return;
}
usetcontact(u, u2);
@ -279,7 +279,7 @@ do_siege(void)
}
/* ------------------------------------------------------------- */
void
static void
destroy_road(unit *u, int n, const char *cmd)
{
direction_t d = getdirection(u->faction->locale);
@ -336,7 +336,7 @@ destroy(region * r, unit * u, const char * cmd)
return;
}
if (!fval(u, FL_OWNER)) {
if (!fval(u, UFL_OWNER)) {
cmistake(u, cmd, 138, MSG_PRODUCE);
return;
}
@ -367,7 +367,7 @@ destroy(region * r, unit * u, const char * cmd)
for (u2 = r->units; u2; u2 = u2->next)
if (u2->building == b) {
u2->building = 0;
freset(u2, FL_OWNER);
freset(u2, UFL_OWNER);
}
add_message(&u->faction->msgs, new_message(
u->faction, "destroy%b:building%u:unit", b, u));
@ -396,7 +396,7 @@ destroy(region * r, unit * u, const char * cmd)
for (u2 = r->units; u2; u2 = u2->next)
if (u2->ship == sh) {
u2->ship = 0;
freset(u2, FL_OWNER);
freset(u2, UFL_OWNER);
}
add_message(&u->faction->msgs, new_message(
u->faction, "shipdestroy%u:unit%r:region%h:ship", u, r, sh));
@ -627,8 +627,7 @@ build(unit * u, const construction * ctype, int completed, int want)
break; /* completed */
}
/* ??? Was soll das (Stefan) ???
* Hier ist entweder maxsize == -1, oder completed < maxsize.
/* Hier ist entweder maxsize == -1, oder completed < maxsize.
* Andernfalls ist das Datenfile oder sonstwas kaputt...
* (enno): Nein, das ist für Dinge, bei denen die nächste Ausbaustufe
* die gleiche wie die vorherige ist. z.b. gegenstände.
@ -862,7 +861,7 @@ build_building(unit * u, const building_type * btype, int want)
/* Die Einheit befindet sich automatisch im Inneren der neuen Burg. */
leave(r, u);
u->building = b;
fset(u, FL_OWNER);
fset(u, UFL_OWNER);
newbuilding = 1;
}
@ -965,7 +964,7 @@ create_ship(region * r, unit * u, const struct ship_type * newtype, int want)
leave(r, u);
u->ship = sh;
fset(u, FL_OWNER);
fset(u, UFL_OWNER);
sprintf(buffer, "%s %s %s",
locale_string(u->faction->locale, keywords[K_MAKE]), locale_string(u->faction->locale, parameters[P_SHIP]), shipid(sh));
u->lastorder = set_string(&u->lastorder, buffer);
@ -1034,8 +1033,7 @@ mayenter(region * r, unit * u, building * b)
static int
mayboard(const unit * u, const ship * sh)
{
unit *u2;
u2 = shipowner(sh->region, sh);
unit *u2 = shipowner(sh->region, sh);
return (!u2
|| ucontact(u2, u)
@ -1138,7 +1136,7 @@ entership(unit * u, ship * sh, const char * cmd, boolean lasttry)
u->ship = sh;
if (shipowner(u->region, sh) == 0) {
fset(u, FL_OWNER);
fset(u, UFL_OWNER);
}
return true;
}
@ -1222,7 +1220,7 @@ do_misc(boolean lasttry)
leave(r, u);
u->building = b;
if (buildingowner(r, b) == 0) {
fset(u, FL_OWNER);
fset(u, UFL_OWNER);
}
break;

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -18,8 +18,11 @@
* permission from the authors.
*/
#ifndef BUILD_H
#define BUILD_H
#ifndef H_KRNL_BUILD
#define H_KRNL_BUILD
#ifdef __cplusplus
extern "C" {
#endif
/* Die enums fuer Gebauede werden nie gebraucht, nur bei der Bestimmung
* des Schutzes durch eine Burg wird die Reihenfolge und MAXBUILDINGS
@ -72,7 +75,7 @@ struct ship *getship(const struct region * r);
void remove_contacts(void);
void do_leave(void);
void do_misc(boolean try);
void do_misc(boolean tries);
void reportevent(struct region * r, char *s);
@ -92,5 +95,8 @@ extern void xml_readrequirement(const struct xml_tag * tag, construction * con);
#define ECOMPLETE -3
#define ENOMATERIALS -4
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -70,7 +70,7 @@ bt_find(const char* name)
return btl?btl->type:NULL;
}
void
static void
bt_register(building_type * type)
{
struct building_typelist * btl = malloc(sizeof(building_type));
@ -427,77 +427,6 @@ register_buildings(void)
bt_register(&bt_castle);
}
void
bt_write(FILE * F, const building_type * bt)
{
fprintf(F, "BUILDINGTYPE %s\n", bt->_name);
a_write(F, bt->attribs); /* scheisse, weil nicht CR-Format */
fputs("\n", F);
fprintf(F, "\"%s\";name\n", bt->_name);
fprintf(F, "%d;flags\n", bt->flags);
fprintf(F, "%d;capacity\n", bt->capacity);
fprintf(F, "%d;maxcapacity\n", bt->maxcapacity);
fprintf(F, "%d;maxsize\n", bt->maxsize);
if (bt->maintenance!=NULL) assert(!"not implemented");
if (bt->construction!=NULL) assert(!"not implemented");
if (bt->construction!=NULL) assert(!"not implemented");
if (bt->name!=NULL) assert(!"not implemented");
fputs("END BUILDINGTYPE\n", F);
}
building_type *
bt_read(FILE * F)
/* this function is pretty picky */
{
building_type * bt = calloc(sizeof(building_type), 1);
int i = fscanf(F, "%s\n", buf);
if (i==0 || i==EOF) {
free(bt);
return NULL;
}
bt->_name = strdup(buf);
a_read(F, &bt->attribs); /* scheisse, weil nicht CR. */
for (;;) {
char * semi = buf;
fgets(buf, sizeof(buf), F);
if (strlen(buf)==1) continue;
buf[strlen(buf)-1]=0;
for(;;) {
char * s = strchr(semi, ';');
if (s==NULL) break;
semi = s + 1;
}
if (semi==buf) {
assert(!strcmp(buf, "END BUILDINGTYPE"));
break;
}
*(semi-1)=0;
if (buf[0]=='\"') {
char * s = buf+1;
assert(*(semi-2)=='\"');
*(semi-2)=0;
if (!strcmp(semi, "name") && !bt->_name) bt->_name = strdup(s);
}
else {
int j = atoi(buf);
switch (semi[0]) {
case 'c':
if (!strcmp(semi, "capacity")) bt->capacity=j;
break;
case 'f':
if (!strcmp(semi, "flags")) bt->flags=j;
break;
case 'm':
if (!strcmp(semi, "maxcapacity")) bt->maxcapacity=j;
else if (!strcmp(semi, "maxsize")) bt->maxsize=j;
break;
}
}
}
bt_register(bt);
return bt;
}
building_type *
bt_make(const char * name, int flags, int capacity, int maxcapacity, int maxsize)
{
@ -633,10 +562,10 @@ buildingowner(const region * r, const building * b)
if (u->building == b) {
if (!first && u->number > 0)
first = u;
if (fval(u, FL_OWNER) && u->number > 0)
if (fval(u, UFL_OWNER) && u->number > 0)
return u;
if (u->number == 0)
freset(u, FL_OWNER);
freset(u, UFL_OWNER);
}
}
@ -644,7 +573,7 @@ buildingowner(const region * r, const building * b)
* nehmen. */
if (first)
fset(first, FL_OWNER);
fset(first, UFL_OWNER);
return first;
}

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -11,8 +11,11 @@
* prior permission by the authors of Eressea.
*/
#ifndef BUILDING_H
#define BUILDING_H
#ifndef H_KRNL_BUILDING
#define H_KRNL_BUILDING
#ifdef __cplusplus
extern "C" {
#endif
/* maintenance::flags */
#define MTF_NONE 0x00
@ -55,7 +58,6 @@ typedef struct building_type {
} building_type;
extern const building_type * bt_find(const char* name);
extern void bt_register(building_type * type);
extern void register_buildings(void);
typedef struct building_typelist {
@ -115,8 +117,6 @@ void destroy_building(struct building * b);
const struct building_type * findbuildingtype(const char * name, const struct locale * lang);
extern struct building_type * bt_read(FILE * F);
extern void bt_write(FILE * F, const building_type * bt);
extern struct building_type * bt_make(const char * name, int flags, int capacity, int maxcapacity, int maxsize);
#include "build.h"
@ -130,4 +130,7 @@ extern struct building *findbuilding(int n);
extern struct unit * buildingowner(const struct region * r, const struct building * b);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,7 +2,7 @@
+-------------------+ 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 - 2001 | Henning Peters <faroul@beyond.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>
@ -423,7 +423,7 @@ select_ally_in_row(fighter * af, int minrow, int maxrow)
return dt;
allies = rand() % allies;
for_each(df, b->fighters) {
cv_foreach(df, b->fighters) {
side *ds = df->side;
int dr = get_unitrow(df);
@ -436,7 +436,7 @@ select_ally_in_row(fighter * af, int minrow, int maxrow)
allies -= df->alive;
}
}
next(df);
cv_next(df);
return dt;
}
@ -735,8 +735,8 @@ sp_shadowcall(fighter * fi, int level, int power, spell * sp)
set_level(u, SK_AUSDAUER, power/2);
u->hp = u->number * unit_max_hp(u);
if (fval(mage, FL_PARTEITARNUNG))
fset(u, FL_PARTEITARNUNG);
if (fval(mage, UFL_PARTEITARNUNG))
fset(u, UFL_PARTEITARNUNG);
a = a_new(&at_unitdissolve);
a->data.ca[0] = 0;
@ -768,8 +768,8 @@ sp_wolfhowl(fighter * fi, int level, int power, spell * sp)
set_level(u, SK_AUSDAUER, power/3);
u->hp = u->number * unit_max_hp(u);
if (fval(mage, FL_PARTEITARNUNG))
fset(u, FL_PARTEITARNUNG);
if (fval(mage, UFL_PARTEITARNUNG))
fset(u, UFL_PARTEITARNUNG);
a = a_new(&at_unitdissolve);
a->data.ca[0] = 0;
@ -802,8 +802,8 @@ sp_shadowknights(fighter * fi, int level, int power, spell * sp)
set_string(&u->name, "Schattenritter");
u->hp = u->number * unit_max_hp(u);
if (fval(mage, FL_PARTEITARNUNG))
fset(u, FL_PARTEITARNUNG);
if (fval(mage, UFL_PARTEITARNUNG))
fset(u, UFL_PARTEITARNUNG);
a = a_new(&at_unitdissolve);
a->data.ca[0] = 0;
@ -1364,7 +1364,7 @@ sp_denyattack(fighter * fi, int level, int power, spell * sp)
return level;
}
void
static void
do_meffect(fighter * af, int typ, int effect, int duration)
{
battle *b = af->side->battle;
@ -1473,11 +1473,11 @@ count_healable(battle *b, fighter *df)
side *s;
int healable = 0;
for_each(s, b->sides) {
cv_foreach(s, b->sides) {
if (helping(df->side, s)) {
healable += s->casualties;
}
} next(s);
} cv_next(s);
return healable;
}
@ -1726,8 +1726,8 @@ sp_undeadhero(fighter * fi, int level, int force, spell * sp)
du->race = new_race[RC_UNDEAD];
setguard(du, GUARD_NONE);
u_setfaction(du,mage->faction);
if (fval(mage, FL_PARTEITARNUNG))
fset(du, FL_PARTEITARNUNG);
if (fval(mage, UFL_PARTEITARNUNG))
fset(du, UFL_PARTEITARNUNG);
df->alive = du->number;
/* den Toten wieder volle Hitpoints geben */
for (nr = 0; nr != df->alive; ++nr) {
@ -1746,8 +1746,8 @@ sp_undeadhero(fighter * fi, int level, int force, spell * sp)
set_string(&u->display, buf);
u->status = du->status;
setguard(u, GUARD_NONE);
if (fval(mage, FL_PARTEITARNUNG))
fset(u, FL_PARTEITARNUNG);
if (fval(mage, UFL_PARTEITARNUNG))
fset(u, UFL_PARTEITARNUNG);
set_string(&u->lastorder, du->lastorder);
/* den Toten volle Hitpoints geben */
u->hp = u->number * unit_max_hp(u);

View file

@ -1,7 +1,7 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -54,10 +54,44 @@
/* ------------------------------------------------------------- */
direction_t
dirmirror(direction_t dir)
#define MAXENTITYHASH 8191
curse *cursehash[MAXENTITYHASH];
void
chash(curse *c)
{
return (direction_t)((dir+MAXDIRECTIONS/2) % MAXDIRECTIONS);
curse *old = cursehash[c->no %MAXENTITYHASH];
cursehash[c->no %MAXENTITYHASH] = c;
c->nexthash = old;
}
static void
cunhash(curse *c)
{
curse **show;
for (show = &cursehash[c->no % MAXENTITYHASH]; *show; show = &(*show)->nexthash) {
if ((*show)->no == c->no)
break;
}
if (*show) {
assert(*show == c);
*show = (*show)->nexthash;
c->nexthash = 0;
}
}
curse *
cfindhash(int i)
{
curse *old;
for (old = cursehash[i % MAXENTITYHASH]; old; old = old->nexthash)
if (old->no == i)
return old;
return NULL;
}
/* ------------------------------------------------------------- */
@ -91,6 +125,89 @@ curse_done(attrib * a) {
free(c);
}
/* ------------------------------------------------------------- */
int
curse_read(attrib * a, FILE * f) {
int mageid;
curse * c = (curse*)a->data.v;
const curse_type * ct;
if (global.data_version >= CURSETYPE_VERSION) {
char cursename[64];
fscanf(f, "%d %s %d %d %d %d %d ", &c->no, cursename, &c->flag,
&c->duration, &c->vigour, &mageid, &c->effect.i);
ct = ct_find(cursename);
} else {
int cspellid;
if (global.data_version < CURSE_NO_VERSION) {
fscanf(f, "%d %d %d %d %d %d ",&cspellid, &c->flag, &c->duration,
&c->vigour, &mageid, &c->effect.i);
c->no = newunitid();
} else {
fscanf(f, "%d %d %d %d %d %d %d ", &c->no, &cspellid, &c->flag,
&c->duration, &c->vigour, &mageid, &c->effect.i);
}
ct = ct_find(oldcursename(cspellid));
}
assert(ct!=NULL);
#ifdef CONVERT_DBLINK
if (global.data_version<DBLINK_VERSION) {
static const curse_type * cmonster = NULL;
if (!cmonster) cmonster=ct_find("calmmonster");
if (ct==cmonster) {
c->effect.v = uniquefaction(c->effect.i);
}
}
#endif
c->type = ct;
/* beim Einlesen sind noch nicht alle units da, muss also
* zwischengespeichert werden. */
if (mageid == -1){
c->magician = (unit *)NULL;
} else {
ur_add((void*)mageid, (void**)&c->magician, resolve_unit);
}
if (c->type->read) c->type->read(f, c);
else if (c->type->typ==CURSETYP_UNIT) {
curse_unit * cc = calloc(1, sizeof(curse_unit));
c->data = cc;
fscanf(f, "%d ", &cc->cursedmen);
}
chash(c);
return AT_READ_OK;
}
void
curse_write(const attrib * a, FILE * f) {
int flag;
int mage_no;
curse * c = (curse*)a->data.v;
const curse_type * ct = c->type;
flag = (c->flag & ~(CURSE_ISNEW));
if (c->magician){
mage_no = c->magician->no;
} else {
mage_no = -1;
}
fprintf(f, "%d %s %d %d %d %d %d ", c->no, ct->cname, flag,
c->duration, c->vigour, mage_no, c->effect.i);
if (c->type->write) c->type->write(f, c);
else if (c->type->typ == CURSETYP_UNIT) {
curse_unit * cc = (curse_unit*)c->data;
fprintf(f, "%d ", cc->cursedmen);
}
}
attrib_type at_curse =
{
"curse",
@ -101,49 +218,6 @@ attrib_type at_curse =
curse_read,
ATF_CURSE
};
/* ------------------------------------------------------------- */
#define MAXENTITYHASH 8191
curse *cursehash[MAXENTITYHASH];
void
chash(curse *c)
{
curse *old = cursehash[c->no %MAXENTITYHASH];
cursehash[c->no %MAXENTITYHASH] = c;
c->nexthash = old;
}
void
cunhash(curse *c)
{
curse **show;
for (show = &cursehash[c->no % MAXENTITYHASH]; *show; show = &(*show)->nexthash) {
if ((*show)->no == c->no)
break;
}
if (*show) {
assert(*show == c);
*show = (*show)->nexthash;
c->nexthash = 0;
}
}
curse *
cfindhash(int i)
{
curse *old;
for (old = cursehash[i % MAXENTITYHASH]; old; old = old->nexthash)
if (old->no == i)
return old;
return NULL;
}
/* ------------------------------------------------------------- */
/* Spruch identifizieren */
@ -186,30 +260,6 @@ ct_find(const char *c)
return NULL;
}
/* ------------------------------------------------------------- */
boolean
is_normalcurse(const curse_type * ct)
{
if (!ct) return false;
if (ct->typ == CURSETYP_NORM)
return true;
return false;
}
boolean
is_curseunit(const curse_type * ct)
{
if (!ct) return false;
if (ct->typ == CURSETYP_UNIT)
return true;
return false;
}
/* ------------------------------------------------------------- */
/* get_curse identifiziert eine Verzauberung über die ID und gibt
* einen pointer auf die struct zurück.
@ -282,17 +332,6 @@ findcurse(int cid)
}
/* ------------------------------------------------------------- */
/* Normalerweise ist alles ausser der Id eines curse und dem
* verzauberten Objekt nicht bekannt. Um den Zauber eindeutig zu
* identifizieren benötigt man je nach Typ einen weiteren Identifier.
*/
void
remove_cursetype(attrib **ap, const curse_type *ct)
{
attrib *a = a_select(*ap, ct, cmp_cursetype);
if (a) a_remove(ap, a);
}
void
remove_curse(attrib **ap, const curse *c)
{
@ -357,7 +396,7 @@ curse_geteffect(const curse *c)
}
/* ------------------------------------------------------------- */
void
static void
set_curseingmagician(struct unit *magician, struct attrib *ap_target, const curse_type *ct)
{
curse * c = get_curse(ap_target, ct);
@ -366,35 +405,7 @@ set_curseingmagician(struct unit *magician, struct attrib *ap_target, const curs
}
}
unit *
get_cursingmagician(struct attrib *ap, const curse_type *ct)
{
curse *c = get_curse(ap, ct);
if( !c )
return NULL;
return c->magician;
}
/* Wichtig! Alle struct curse<typ>, die den Verweis auf den zaubenden
* Magier enthalten, müssen sie hier mit abgeprüft werden
*/
void
remove_cursemagepointer(unit *magician, attrib *ap_target)
{
const attrib * a;
a = a_find(ap_target, &at_curse);
while (a) {
curse *c = (curse*)a->data.v;
if(c->magician == magician)
c->magician = (unit*)NULL;
a = a->nexttype;
}
}
/* ------------------------------------------------------------- */
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
int
@ -426,25 +437,6 @@ set_cursedmen(curse *c, int cursedmen)
}
}
int
change_cursedmen(attrib **ap, curse *c, int cursedmen)
{
if (!c) return 0;
/* je nach curse_type andere data struct */
if (c->type->typ == CURSETYP_UNIT) {
curse_unit * cc = (curse_unit*)c->data;
cursedmen += cc->cursedmen;
}
if (cursedmen <= 0) {
remove_curse(ap, c);
} else {
set_cursedmen(c, cursedmen);
}
return cursedmen;
}
/* ------------------------------------------------------------- */
void
curse_setflag(curse *c, int flag)

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -13,7 +13,10 @@
#ifndef CURSE_H
#define CURSE_H
/* ------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#endif
/* Sprueche in der struct region und auf Einheiten, Schiffen oder Burgen
* (struct attribute)
*/
@ -241,7 +244,7 @@ extern int curse_read(struct attrib * a,FILE * f);
*/
curse * create_curse(struct unit *magician, struct attrib**ap, const curse_type * ctype,
int vigour, int duration, int effect, int men);
int vigour, int duration, int ceffect, int men);
/* Verzweigt automatisch zum passenden struct-typ. Sollte es schon
* einen Zauber dieses Typs geben, so wird der neue dazuaddiert. Die
* Zahl der verzauberten Personen sollte beim Aufruf der Funktion
@ -251,10 +254,6 @@ curse * create_curse(struct unit *magician, struct attrib**ap, const curse_type
boolean is_cursed_internal(struct attrib *ap, const curse_type * ctype);
/* ignoriert CURSE_ISNEW */
void remove_allcurse(struct attrib **ap, const void * data, boolean(*compare)(const attrib *, const void *));
/* löscht alle Curse dieses Typs */
void remove_cursetype(struct attrib **ap, const curse_type *ct);
/* löscht den curse c, wenn dieser in ap steht */
extern void remove_curse(struct attrib **ap, const curse * c);
/* löscht einen konkreten Spruch auf einem Objekt.
*/
@ -273,8 +272,6 @@ extern int curse_changevigour(struct attrib **ap, curse * c, int i);
extern int get_cursedmen(struct unit *u, struct curse *c);
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
extern int change_cursedmen(struct attrib **ap, curse * c, int cursedmen);
/* verändert die Anzahl der betroffenen Personen um cursedmen */
extern void curse_setflag(curse * c, int flag);
/* setzt Spezialflag einer Verzauberung (zB 'dauert ewig') */
@ -284,10 +281,6 @@ void transfer_curse(struct unit * u, struct unit * u2, int n);
* korrekt gehandhabt werden. Je nach internen Flag kann dies
* unterschiedlich gewünscht sein
* */
void remove_cursemagepointer(struct unit *magician, attrib *ap_target);
/* wird von remove_empty_units verwendet um alle Verweise auf
* gestorbene Magier zu löschen.
* */
extern curse * get_cursex(attrib *ap, const curse_type * ctype, void * data,
boolean(*compare)(const curse *, const void *));
@ -300,17 +293,12 @@ extern curse * get_curse(struct attrib *ap, const curse_type * ctype);
* */
struct unit * get_tracingunit(struct attrib **ap, const curse_type * ct);
struct unit * get_cursingmagician(struct attrib *ap, const curse_type * ctype);
/* gibt struct unit-pointer auf Magier zurück, oder einen Nullpointer
* */
int find_cursebyname(const char *c);
const curse_type * ct_find(const char *c);
void ct_register(const curse_type *);
/* Regionszauber */
curse * cfindhash(int i);
void chash(curse *c);
void cunhash(curse *c);
curse * findcurse(int curseid);
@ -323,11 +311,6 @@ extern boolean cmp_cursetype(const attrib * a, const void * data);
extern boolean cmp_curseeffect(const curse * c, const void * data);
extern boolean cmp_cursedata(const curse * c, const void * data);
/* compatibility mode für katjas curses:
extern boolean cmp_oldcurse(const attrib * a, const void * data);
extern struct twoids * packids(int id, int id2);
*/
extern void * resolve_curse(void * data);
extern boolean is_cursed_with(attrib *ap, curse *c);
@ -345,4 +328,7 @@ extern void register_curses(void);
#define get_curseeffect(a, id, id2) \
curse_geteffect(get_curse(a, ct_find(oldcursename(id))))
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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)
@ -84,6 +84,57 @@ FILE *logfile;
FILE *updatelog;
const struct race * new_race[MAXRACES];
boolean sqlpatch = false;
int turn;
static attrib_type at_creator = {
"creator"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
static int
MaxAge() {
static int value = -1;
if (value<0) {
value = atoi(get_param(global.parameters, "MaxAge"));
}
return value;
}
int
LongHunger() {
static int value = -1;
if (value<0) {
value = atoi(get_param(global.parameters, "hunger.long"));
}
return value;
}
int
SkillCap(skill_t sk) {
static int value = -1;
if (sk==SK_MAGIC) return 0; /* no caps on magic */
if (value<0) {
value = atoi(get_param(global.parameters, "skill.maxlevel"));
}
return value;
}
boolean
TradeDisabled() {
static int value = -1;
if (value<0) {
value = (boolean)atoi(get_param(global.parameters, "trade.disabled"));
}
return value;
}
int
NMRTimeout() {
static int value = -1;
if (value<0) {
value = atoi(get_param(global.parameters, "nmr.timeout"));
}
return value;
}
race_t
old_race(const struct race * rc)
@ -120,12 +171,6 @@ dbrace(const struct race * rc)
return zText;
}
const char *gr_prefix[3] = {
"einem",
"einer",
"einem"
};
const char *parameters[MAXPARAMS] =
{
"LOCALE",
@ -791,7 +836,7 @@ alliedunit(const unit * u, const faction * f2, int mode)
boolean
seefaction(const faction * f, const region * r, const unit * u, int modifier)
{
if (((f == u->faction) || !fval(u, FL_PARTEITARNUNG)) && cansee(f, r, u, modifier))
if (((f == u->faction) || !fval(u, UFL_PARTEITARNUNG)) && cansee(f, r, u, modifier))
return true;
return false;
}
@ -982,7 +1027,7 @@ strcheck (const char *s, size_t maxlen)
}
#endif
attrib_type at_lighthouse = {
static attrib_type at_lighthouse = {
"lighthouse"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
@ -1330,7 +1375,7 @@ getnewunit (const region * r, const faction * f)
return findnewunit (r, f, n);
}
int
static int
read_newunitid (const faction * f, const region * r)
{
int n;
@ -1548,7 +1593,7 @@ xunitid(const unit *u)
extern faction * dfindhash(int i);
const char* forbidden[] = { "t", "te", "tem", "temp", NULL };
static const char* forbidden[] = { "t", "te", "tem", "temp", NULL };
int
forbiddenid(int id)
@ -1613,7 +1658,7 @@ newcontainerid(void)
return random_no;
}
void
static void
createunitid(unit *u, int id)
{
if (id<=0 || id > MAX_UNIT_NR || ufindhash(id) || dfindhash(id) || forbiddenid(id))
@ -1629,11 +1674,6 @@ createunit(region * r, faction * f, int number, const struct race * rc)
return create_unit(r, f, number, rc, 0, NULL, NULL);
}
attrib_type at_creator = {
"creator"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */
};
unit *
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
{
@ -1686,8 +1726,8 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
}
/* Temps von parteigetarnten Einheiten sind wieder parteigetarnt */
if (fval(creator, FL_PARTEITARNUNG))
fset(u, FL_PARTEITARNUNG);
if (fval(creator, UFL_PARTEITARNUNG))
fset(u, UFL_PARTEITARNUNG);
/* Daemonentarnung */
set_racename(&u->attribs, get_racename(creator->attribs));
@ -1710,7 +1750,7 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
a->data.v = creator;
}
/* Monster sind grundsätzlich parteigetarnt */
if(f->no <= 0) fset(u, FL_PARTEITARNUNG);
if(f->no <= 0) fset(u, UFL_PARTEITARNUNG);
return u;
}
@ -1850,7 +1890,7 @@ void ** blk_list[1024];
int list_index;
int blk_index;
void
static void
gc_done(void)
{
int i, k;
@ -1968,16 +2008,49 @@ init_tokens(const struct locale * lang)
}
for (i=0;i!=MAXPARAMS;++i)
addtoken(&lnames->tokens[UT_PARAM], LOC(lang, parameters[i]), (void*)i);
for (i=0;i!=MAXSKILLS;++i)
addtoken(&lnames->skillnames, skillname((skill_t)i, lang), (void*)i);
for (i=0;i!=MAXSKILLS;++i) {
if (i!=SK_TRADE || !TradeDisabled()) {
addtoken(&lnames->skillnames, skillname((skill_t)i, lang), (void*)i);
}
}
for (i=0;i!=MAXKEYWORDS;++i)
addtoken(&lnames->keywords, LOC(lang, keywords[i]), (void*)i);
for (i=0;i!=MAXOPTIONS;++i)
addtoken(&lnames->options, LOC(lang, options[i]), (void*)i);
#if 0
for (i=0;umlaut[i].txt;++i)
addtoken(&lnames->tokens[umlaut[i].typ], umlaut[i].txt, (void*)umlaut[i].id);
#endif
}
typedef struct param {
struct param * next;
char * name;
char * data;
} param;
const char *
get_param(const struct param * p, const char * key)
{
while (p!=NULL) {
if (strcmp(p->name, key)==0) return p->data;
p = p->next;
}
return "0";
}
void
set_param(struct param ** p, const char * key, const char * data)
{
while (*p!=NULL) {
if (strcmp((*p)->name, key)==0) {
free((*p)->data);
(*p)->data = strdup(data);
return;
}
p=&(*p)->next;
}
*p = malloc(sizeof(param));
(*p)->name = strdup(key);
(*p)->data = strdup(data);
(*p)->next = NULL;
}
void
@ -2024,6 +2097,10 @@ parse_tagbegin(struct xml_stack *stack)
if (maxunits!=0) {
global.maxunits = maxunits;
}
} else if (strcmp(tag->name, "param")==0) {
const char * name = xml_value(tag, "name");
const char * value = xml_value(tag, "value");
set_param(&global.parameters, name, value);
} else if (strcmp(tag->name, "order")==0) {
const char * name = xml_value(tag, "name");
if (xml_bvalue(tag, "disable")) {
@ -2056,7 +2133,7 @@ read_xml(const char * filename, xml_stack * stack)
return XML_USERERROR;
}
i = xml_read(F, stack);
i = xml_read(F, filename, stack);
fclose(F);
return i;
}
@ -2099,105 +2176,10 @@ attrib_type at_germs = {
ATF_UNIQUE
};
void
attrib_init(void)
{
/* Alle speicherbaren Attribute müssen hier registriert werden */
at_register(&at_unitdissolve);
at_register(&at_traveldir_new);
at_register(&at_familiar);
at_register(&at_familiarmage);
at_register(&at_clone);
at_register(&at_clonemage);
at_register(&at_eventhandler);
at_register(&at_stealth);
at_register(&at_mage);
at_register(&at_bauernblut);
at_register(&at_countdown);
at_register(&at_showitem);
at_register(&at_curse);
at_register(&at_cursewall);
at_register(&at_seenspell);
at_register(&at_reportspell);
at_register(&at_deathcloud);
/* neue REGION-Attribute */
at_register(&at_direction);
at_register(&at_moveblock);
#if AT_SALARY
at_register(&at_salary);
#endif
at_register(&at_horseluck);
at_register(&at_peasantluck);
at_register(&at_deathcount);
at_register(&at_chaoscount);
at_register(&at_woodcount);
at_register(&at_road);
/* neue UNIT-Attribute */
at_register(&at_alias);
at_register(&at_siege);
at_register(&at_target);
at_register(&at_potion);
at_register(&at_potionuser);
at_register(&at_contact);
at_register(&at_effect);
at_register(&at_private);
at_register(&at_icastle);
at_register(&at_guard);
at_register(&at_lighthouse);
at_register(&at_group);
at_register(&at_faction_special);
at_register(&at_prayer_timeout);
at_register(&at_prayer_effect);
at_register(&at_wyrm);
at_register(&at_building_generic_type);
/* border-typen */
register_bordertype(&bt_noway);
register_bordertype(&bt_fogwall);
register_bordertype(&bt_wall);
register_bordertype(&bt_illusionwall);
register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps);
register_bordertype(&bt_road);
register_bordertype(&bt_questportal);
at_register(&at_jihad);
at_register(&at_skillmod);
#if GROWING_TREES
at_register(&at_germs);
#endif
at_register(&at_laen); /* required for old datafiles */
at_register(&at_xontormiaexpress); /* required for old datafiles */
}
void
kernel_init(void)
{
char zBuffer[MAX_PATH];
skill_init();
attrib_init();
translation_init();
init_messages();
if (!turn) turn = lastturn();
if (turn == 0)
srand(time((time_t *) NULL));
else
srand(turn);
if (sqlpatch) {
sprintf(zBuffer, "%s/patch-%d.sql", datapath(), turn);
sql_init(zBuffer);
}
}
/*********************/
/* at_guard */
/*********************/
attrib_type at_guard = {
static attrib_type at_guard = {
"guard",
DEFAULT_INIT,
DEFAULT_FINALIZE,
@ -2307,12 +2289,13 @@ void
remove_empty_units_in_region(region *r)
{
unit **up = &r->units;
while (*up) {
unit * u = *up;
#ifdef MAXAGE
faction * f = u->faction;
if (!fval(f, FFL_NOTIMEOUT) && f->age > MAXAGE) set_number(u, 0);
#endif
if (MaxAge()>0) {
faction * f = u->faction;
if (!fval(f, FFL_NOTIMEOUT) && f->age > MaxAge()) set_number(u, 0);
}
if ((u->number <= 0 && u->race != new_race[RC_SPELL])
|| (u->age <= 0 && u->race == new_race[RC_SPELL])
|| u->number < 0) {
@ -2679,8 +2662,6 @@ fwage(const region *r, const faction *f, boolean img)
return wage;
}
static region *
findspecialdirection(const region *r, const char *token)
{
@ -2803,9 +2784,11 @@ int months_per_year;
int
month(int offset)
{
int t = turn - FIRST_TURN + offset;
int t = turn + offset;
int year, r, month;
#ifdef FIRST_TURN
t -= FIRST_TURN;
#endif
if (t<0) t = turn;
year = t/(months_per_year * weeks_per_month) + 1;
@ -2833,12 +2816,12 @@ reorder_owners(region * r)
unit * u = *useek;
if (u->building==b) {
unit ** insert;
if (fval(u, FL_OWNER)) {
if (fval(u, UFL_OWNER)) {
unit * nu = *ubegin;
insert=ubegin;
if (nu!=u && nu->building==u->building && fval(nu, FL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit FL_OWNER.\n", buildingname(nu->building)));
freset(nu, FL_OWNER);
if (nu!=u && nu->building==u->building && fval(nu, UFL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit UFL_OWNER.\n", buildingname(nu->building)));
freset(nu, UFL_OWNER);
}
}
else insert = uend;
@ -2859,9 +2842,9 @@ reorder_owners(region * r)
unit * u = *useek;
assert(!u->building);
if (u->ship==NULL) {
if (fval(u, FL_OWNER)) {
if (fval(u, UFL_OWNER)) {
log_warning(("[reorder_owners] Einheit %s war Besitzer von nichts.\n", unitname(u)));
freset(u, FL_OWNER);
freset(u, UFL_OWNER);
}
if (useek!=up) {
*useek = u->next; /* raus aus der liste */
@ -2882,12 +2865,12 @@ reorder_owners(region * r)
unit * u = *useek;
if (u->ship==sh) {
unit ** insert;
if (fval(u, FL_OWNER)) {
if (fval(u, UFL_OWNER)) {
unit * nu = *ubegin;
insert = ubegin;
if (nu!=u && nu->ship==u->ship && fval(nu, FL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit FL_OWNER.\n", shipname(nu->ship)));
freset(nu, FL_OWNER);
if (nu!=u && nu->ship==u->ship && fval(nu, UFL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit UFL_OWNER.\n", shipname(nu->ship)));
freset(nu, UFL_OWNER);
}
}
else insert = uend;
@ -2926,4 +2909,96 @@ teure_talente (const struct unit * u)
return false;
}
}
void
attrib_init(void)
{
/* Alle speicherbaren Attribute müssen hier registriert werden */
at_register(&at_unitdissolve);
at_register(&at_traveldir_new);
at_register(&at_familiar);
at_register(&at_familiarmage);
at_register(&at_clone);
at_register(&at_clonemage);
at_register(&at_eventhandler);
at_register(&at_stealth);
at_register(&at_mage);
at_register(&at_bauernblut);
at_register(&at_countdown);
at_register(&at_showitem);
at_register(&at_curse);
at_register(&at_cursewall);
at_register(&at_seenspell);
at_register(&at_reportspell);
at_register(&at_deathcloud);
/* neue REGION-Attribute */
at_register(&at_direction);
at_register(&at_moveblock);
#if AT_SALARY
at_register(&at_salary);
#endif
at_register(&at_horseluck);
at_register(&at_peasantluck);
at_register(&at_deathcount);
at_register(&at_chaoscount);
at_register(&at_woodcount);
at_register(&at_road);
/* neue UNIT-Attribute */
at_register(&at_alias);
at_register(&at_siege);
at_register(&at_target);
at_register(&at_potionuser);
at_register(&at_contact);
at_register(&at_effect);
at_register(&at_private);
at_register(&at_icastle);
at_register(&at_guard);
at_register(&at_lighthouse);
at_register(&at_group);
at_register(&at_faction_special);
at_register(&at_prayer_timeout);
at_register(&at_prayer_effect);
at_register(&at_wyrm);
at_register(&at_building_generic_type);
/* border-typen */
register_bordertype(&bt_noway);
register_bordertype(&bt_fogwall);
register_bordertype(&bt_wall);
register_bordertype(&bt_illusionwall);
register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps);
register_bordertype(&bt_road);
register_bordertype(&bt_questportal);
at_register(&at_jihad);
at_register(&at_skillmod);
#if GROWING_TREES
at_register(&at_germs);
#endif
at_register(&at_laen); /* required for old datafiles */
at_register(&at_xontormiaexpress); /* required for old datafiles */
}
void
kernel_init(void)
{
char zBuffer[MAX_PATH];
skill_init();
attrib_init();
translation_init();
init_messages();
if (!turn) turn = lastturn();
if (turn == 0)
srand(time((time_t *) NULL));
else
srand(turn);
if (sqlpatch) {
sprintf(zBuffer, "%s/patch-%d.sql", datapath(), turn);
sql_init(zBuffer);
}
}

Some files were not shown because too many files have changed in this diff Show more