- knowlegdeg in #define USE_KNOWLEDGEgeklammert (ist noch kaum angefangen)

- ugroups in #define USE_UGROUPS geklammert (im makefile definieren, bis die ganz durchgetestet sind)
This commit is contained in:
Enno Rehling 2001-04-29 19:27:42 +00:00
parent 1dbaf7ffcd
commit 63f0c81ebd
11 changed files with 66 additions and 29 deletions

View File

@ -28,7 +28,9 @@
#include "overrideroads.h"
#include "otherfaction.h"
#include "racename.h"
#include "ugroup.h"
#ifdef USE_UGROUPS
# include "ugroup.h"
#endif
#ifdef AT_OPTION
# include "option.h"
#endif
@ -64,5 +66,7 @@ init_attributes(void)
#ifdef AT_OPTION
init_option();
#endif
#ifdef USE_UGROUPS
init_ugroup();
#endif
}

View File

@ -8,13 +8,16 @@
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
$Id: ugroup.c,v 1.1 2001/04/28 12:03:12 corwin Exp $
$Id: ugroup.c,v 1.2 2001/04/29 19:27:41 enno Exp $
*/
#include <config.h>
#include "ugroup.h"
#include <attrib.h>
#ifdef USE_UGROUPS
attrib_type at_ugroup = {
"ugroup", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE
};
@ -24,3 +27,5 @@ init_ugroup(void)
{
at_register(&at_ugroup);
}
#endif

View File

@ -58,8 +58,9 @@
#include <pool.h>
#include <building.h>
#include <group.h>
#include <ugroup.h>
#ifdef USE_UGROUPS
# include <ugroup.h>
#endif
/* attributes includes */
#include <attributes/racename.h>
@ -3035,8 +3036,10 @@ processorders (void)
puts(" - Jihads setzen");
set_jihad();
#ifdef USE_UGROUPS
puts(" - Verbände bilden");
ugroups();
#endif
puts(" - Einheiten Sortieren");
reorder();

View File

@ -58,7 +58,9 @@
#include <skill.h>
#include <teleport.h>
#include <unit.h>
#include <ugroup.h>
#ifdef USE_UGROUPS
# include <ugroup.h>
#endif
/* util includes */
#include <goodies.h>
@ -682,10 +684,12 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
strlist *S;
int dh;
boolean isbattle = (boolean)(mode == see_battle);
#ifdef USE_UGROUPS
ugroup *ug = findugroup(u);
#endif
if(u->race == RC_SPELL) return;
#ifdef USE_UGROUPS
if(isbattle || ug) {
if(is_ugroupleader(u, ug)) {
rnl(F);
@ -693,23 +697,27 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
} else {
return;
}
} else {
} else
#endif
{
rnl(F);
dh = bufunit(f, u, indent, mode);
}
rparagraph(F, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-')));
if(!isbattle){
#ifdef USE_UGROUPS
if(ug) {
int i;
for(i=0; i<ug->members; i++) {
print_curses(F, u, TYP_UNIT, ug->unit_array[i]->attribs, (u->faction == f)? 1 : 0, indent);
}
} else {
print_curses(F, u, TYP_UNIT, u->attribs, (u->faction == f)? 1 : 0, indent);
}
} else
#endif /* USE_UGROUPS */
print_curses(F, u, TYP_UNIT, u->attribs, (u->faction == f)? 1 : 0, indent);
}
#ifdef USE_UGROUPS
if(ug) {
int i;
for(i=0; i<ug->members; i++) {
@ -720,14 +728,14 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
}
}
}
} else {
} else
#endif
if (mode==see_unit && u->faction == f && u->botschaften) {
for (S = u->botschaften; S; S = S->next) {
rnl(F);
rparagraph(F, S->s, indent, 0);
}
}
}
}
static void

View File

@ -204,8 +204,10 @@ const char *keywords[MAXKEYWORDS] =
"JIHAD",
"GM",
"INFO",
#ifdef USE_UGROUPS
"JOINVERBAND",
"LEAVEVERBAND"
#endif
};
const char *report_options[MAX_MSG] =

View File

@ -412,8 +412,10 @@ enum {
K_SETJIHAD,
K_GM, /* perform GM commands */
K_INFO, /* set player-info */
#ifdef USE_UGROUPS
K_JOINUGROUP,
K_LEAVEUGROUP,
#endif
MAXKEYWORDS,
NOKEYWORD = (keyword_t) - 1
};

View File

@ -41,7 +41,9 @@ typedef struct faction {
int options;
int no_units;
int karma;
#ifdef USE_UGROUPS
struct ugroup *ugroups;
#endif
struct warning * warnings;
struct msglevel * msglevels;
struct ally *allies;

View File

@ -32,7 +32,9 @@
#include "ship.h"
#include "race.h"
#include "magic.h"
#include "ugroup.h"
#ifdef USE_UGROUPS
# include "ugroup.h"
#endif
/* util includes */
#include <base36.h>
@ -440,7 +442,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
* bekommen, alles andere ist darstellungsteschnisch kompliziert.
*/
int
#ifdef USE_UGROUPS
int
bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode)
{
int i, dh;
@ -587,7 +590,7 @@ bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode)
}
return dh;
}
#endif
void
spskill(const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days)
@ -656,6 +659,7 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden
int mode)
{
int dh;
#ifdef USE_UGROUPS
ugroup *ug = findugroup(u);
if(ug) {
@ -664,9 +668,9 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden
} else {
return;
}
} else {
} else
#endif
dh = bufunit(f, u, indent, mode);
}
lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-')));
}

View File

@ -107,7 +107,9 @@ extern int months_per_year;
extern void report_item(const struct unit * owner, const struct item * i, const struct faction * viewer, const char ** name, const char ** basename, int * number, boolean singular);
extern void report_building(FILE *F, const struct region * r, const struct building * b, const struct faction * f, int mode);
extern int bufunit(const struct faction * f, const struct unit * u, int indent, int mode);
#ifdef USE_UGROUPS
extern int bufunit_ugroupleader(const struct faction * f, const struct unit * u, int indent, int mode);
#endif
extern const char *neue_gebiete[];
extern const char *coasts[];

View File

@ -8,17 +8,22 @@
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
$Id: ugroup.c,v 1.2 2001/04/28 15:39:13 corwin Exp $
$Id: ugroup.c,v 1.3 2001/04/29 19:27:42 enno Exp $
*/
#include <config.h>
#include "eressea.h"
/* kernel includes */
#include "unit.h"
#include "region.h"
#include "faction.h"
#include <kernel/ugroup.h>
#include "ugroup.h"
/* attributes includes */
#include <attributes/ugroup.h>
/* libc includes */
#include <stdlib.h>
/* TODO:
@ -31,15 +36,16 @@
/* Nur die erste Einheit in der Liste
(ugroup->unit_array[0] == u) kann NACH ausführen. */
#ifdef USE_UGROUPS
boolean
is_ugroupleader(unit *u, ugroup *ug)
is_ugroupleader(const unit *u, const ugroup *ug)
{
if(ug->unit_array[0] == u) return true;
return false;
}
ugroup *
findugroupid(faction *f, int id)
findugroupid(const faction *f, int id)
{
ugroup *ug;
@ -50,7 +56,7 @@ findugroupid(faction *f, int id)
}
ugroup *
findugroup(unit *u)
findugroup(const unit *u)
{
attrib *a = a_find(u->attribs, &at_ugroup);
if(!a) return NULL;
@ -58,13 +64,11 @@ findugroup(unit *u)
}
static int
ugroupfreeid(ugroup *ug)
ugroupfreeid(const ugroup *ug)
{
ugroup *ug2;
const ugroup *ug2 = ug;
int id = 0;
ug2 = ug;
while(ug2) {
if(ug2->id == id) {
id++;
@ -194,3 +198,4 @@ ugroups(void)
}
}
#endif /* USE_UGROUPS */

View File

@ -8,7 +8,7 @@
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
$Id: ugroup.h,v 1.2 2001/04/28 15:39:13 corwin Exp $
$Id: ugroup.h,v 1.3 2001/04/29 19:27:42 enno Exp $
*/
#ifndef UGROUP_H
@ -26,8 +26,8 @@ typedef struct ugroup {
struct unit **unit_array;
} ugroup;
boolean is_ugroupleader(struct unit *u, struct ugroup *ug);
ugroup *findugroup(struct unit *u);
boolean is_ugroupleader(const struct unit *u, const struct ugroup *ug);
ugroup *findugroup(const struct unit *u);
void ugroups(void);
#endif