Mapper kompilierte nicht mehr, ohne gegen gamecode zu linken:

- gamecode/items.c enthält Funktionalität von items
- items/items.c umbenannt in items/itemtypes.c, enthält item_type Definitionen (to be replaced by xml definitions)

So geht es, glaube ich.
This commit is contained in:
Enno Rehling 2005-01-30 08:57:16 +00:00
parent ac64278080
commit 812c41c220
11 changed files with 152 additions and 39 deletions

View File

@ -10,6 +10,7 @@ SOURCES =
creation.c
creport.c
economy.c
items.c
laws.c
luck.c
monster.c

View File

@ -183,6 +183,9 @@
<File
RelativePath=".\economy.h">
</File>
<File
RelativePath=".\items.h">
</File>
<File
RelativePath=".\laws.h">
</File>
@ -205,6 +208,9 @@
<File
RelativePath=".\economy.c">
</File>
<File
RelativePath=".\items.c">
</File>
<File
RelativePath=".\laws.c">
</File>

View File

@ -0,0 +1,94 @@
#include <config.h>
#include <kernel/eressea.h>
#include "items.h"
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/message.h>
#include <kernel/movement.h>
#include <kernel/order.h>
#include <kernel/plane.h>
#include <kernel/region.h>
#include <kernel/ship.h>
#include <kernel/skill.h>
#include <kernel/study.h>
#include <kernel/unit.h>
#include <util/attrib.h>
#include <util/functions.h>
/* BEGIN studypotion */
#define MAXGAIN 15
static int
use_studypotion(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
{
if (get_keyword(u->thisorder) == K_STUDY) {
skill_t sk;
skill * sv;
init_tokens(u->thisorder);
skip_token();
sk = findskill(getstrtoken(), u->faction->locale);
sv = get_skill(u, sk);
if (sv && sv->level > 2) {
/* TODO: message */
} else if (study_cost(u, sk)>0) {
/* TODO: message */
} else {
attrib * a = a_find(u->attribs, &at_learning);
teaching_info * teach;
if (a==NULL) {
a = a_add(&u->attribs, a_new(&at_learning));
}
teach = (teaching_info*) a->data.v;
if (amount>MAXGAIN) amount = MAXGAIN;
teach->value += amount * 30;
if (teach->value > MAXGAIN * 30) {
teach->value = MAXGAIN * 30;
}
i_change(&u->items, itype, -amount);
return 0;
}
}
return EUNUSABLE;
}
/* END studypotion */
/* BEGIN speedsail */
static int
use_speedsail(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
{
struct plane * p = rplane(u->region);
unused(amount);
unused(itype);
if (p!=NULL) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
} else {
if (u->ship) {
attrib * a = a_find(u->ship->attribs, &at_speedup);
if (a==NULL) {
a = a_add(&u->ship->attribs, a_new(&at_speedup));
a->data.sa[0] = 50; /* speed */
a->data.sa[1] = 50; /* decay */
ADDMSG(&u->faction->msgs, msg_message("use_speedsail", "unit", u));
/* Ticket abziehen */
i_change(&u->items, itype, -1);
return 0;
} else {
cmistake(u, ord, 211, MSG_EVENT);
}
} else {
cmistake(u, ord, 144, MSG_EVENT);
}
}
return EUNUSABLE;
}
/* END speedsail */
void
register_itemimplementations(void)
{
register_function((pf_generic)use_studypotion, "use_studypotion");
register_function((pf_generic)use_speedsail, "use_speedsail");
}

View File

@ -0,0 +1,25 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifndef H_KRNL_ITEMS
#define H_KRNL_ITEMS
#ifdef __cplusplus
extern "C" {
#endif
extern void register_itemimplementations(void);
extern void init_itemimplementations(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -12,7 +12,7 @@ SOURCES =
birthday_firework.c
catapultammo.c
demonseye.c
items.c
itemtypes.c
questkeys.c
racespoils.c
seed.c

View File

@ -133,7 +133,7 @@
RelativePath=".\demonseye.h">
</File>
<File
RelativePath=".\items.h">
RelativePath=".\itemtypes.h">
</File>
<File
RelativePath=".\questkeys.h">
@ -164,7 +164,7 @@
RelativePath=".\demonseye.c">
</File>
<File
RelativePath=".\items.c">
RelativePath=".\itemtypes.c">
</File>
<File
RelativePath=".\questkeys.c">
@ -175,18 +175,6 @@
<File
RelativePath=".\seed.c">
</File>
<File
RelativePath=".\speedsail.c">
</File>
<File
RelativePath=".\speedsail.h">
</File>
<File
RelativePath=".\studypotion.c">
</File>
<File
RelativePath=".\studypotion.h">
</File>
<File
RelativePath=".\weapons.c">
</File>

View File

@ -12,15 +12,13 @@
#include <config.h>
#include <eressea.h>
#include "items.h"
#include "itemtypes.h"
#include "birthday_firework.h"
#include "demonseye.h"
#include "xerewards.h"
#include "artrewards.h"
#include "weapons.h"
#include "speedsail.h"
#include "studypotion.h"
#include "racespoils.h"
#if GROWING_TREES
# include "seed.h"
@ -29,7 +27,7 @@
#include "catapultammo.h"
void
register_items(void)
register_itemtypes(void)
{
register_weapons();
register_demonseye();
@ -44,12 +42,10 @@ register_items(void)
register_catapultammo();
register_racespoils();
register_artrewards();
register_speedsail();
register_studypotion();
}
void
init_items(void)
init_itemtypes(void)
{
init_weapons();
}

View File

@ -16,8 +16,8 @@
extern "C" {
#endif
extern void register_items(void);
extern void init_items(void);
extern void register_itemtypes(void);
extern void init_itemtypes(void);
#ifdef __cplusplus
}

View File

@ -33,7 +33,7 @@
#include <attributes/attributes.h>
#include <spells/spells.h>
#include <triggers/triggers.h>
#include <items/items.h>
#include <items/itemtypes.h>
/* modules includes */
#include <modules/score.h>
@ -54,10 +54,10 @@
#endif
/* gamecode includes */
#include <economy.h>
#include <goodies.h>
#include <monster.h>
#include <laws.h>
#include <gamecode/economy.h>
#include <gamecode/items.h>
#include <gamecode/laws.h>
#include <gamecode/monster.h>
/* kernel includes */
#include <kernel/xmlreader.h>
@ -83,6 +83,7 @@
/* util includes */
#include <rand.h>
#include <util/xml.h>
#include <util/goodies.h>
#include <log.h>
#include <sql.h>
#include <base36.h>
@ -168,7 +169,8 @@ game_init(void)
register_resources();
register_buildings();
register_ships();
register_items();
register_itemimplementations();
register_itemtypes();
register_spells();
#ifdef DUNGEON_MODULE
register_dungeon();
@ -181,7 +183,7 @@ game_init(void)
init_locales();
init_attributes();
init_races();
init_items();
init_itemtypes();
init_races();
init_economy();
#if NEW_RESOURCEGROWTH

View File

@ -35,7 +35,7 @@
#include <attributes/attributes.h>
#include <spells/spells.h>
#include <triggers/triggers.h>
#include <items/items.h>
#include <items/itemtypes.h>
/* modules includes */
#include <modules/score.h>
@ -56,9 +56,10 @@
#endif
/* gamecode includes */
#include <gamecode/economy.h>
#include <gamecode/laws.h>
#include <gamecode/creport.h>
#include <gamecode/economy.h>
#include <gamecode/items.h>
#include <gamecode/laws.h>
/* kernel includes */
#include <kernel/border.h>
@ -165,7 +166,8 @@ game_init(void)
register_resources();
register_buildings();
register_ships();
register_items();
register_itemimplementations();
register_itemtypes();
register_spells();
#ifdef DUNGEON_MODULE
register_dungeon();
@ -189,7 +191,7 @@ game_init(void)
init_attributes();
init_races();
init_items();
init_itemtypes();
init_economy();
#if NEW_RESOURCEGROWTH
init_rawmaterials();

View File

@ -27,8 +27,7 @@
#include <spells/spells.h>
#include <attributes/attributes.h>
#include <triggers/triggers.h>
#include <items/weapons.h>
#include <items/items.h>
#include <items/itemtypes.h>
#include <modules/gmcmd.h>
#include <modules/xmas.h>
@ -1687,7 +1686,7 @@ main(int argc, char *argv[])
register_resources();
register_buildings();
register_ships();
register_items();
register_itemtypes();
register_spells();
#ifdef MUSEUM_MODULE
register_museum();