forked from github/server
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:
parent
ac64278080
commit
812c41c220
|
@ -10,6 +10,7 @@ SOURCES =
|
||||||
creation.c
|
creation.c
|
||||||
creport.c
|
creport.c
|
||||||
economy.c
|
economy.c
|
||||||
|
items.c
|
||||||
laws.c
|
laws.c
|
||||||
luck.c
|
luck.c
|
||||||
monster.c
|
monster.c
|
||||||
|
|
|
@ -183,6 +183,9 @@
|
||||||
<File
|
<File
|
||||||
RelativePath=".\economy.h">
|
RelativePath=".\economy.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\items.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\laws.h">
|
RelativePath=".\laws.h">
|
||||||
</File>
|
</File>
|
||||||
|
@ -205,6 +208,9 @@
|
||||||
<File
|
<File
|
||||||
RelativePath=".\economy.c">
|
RelativePath=".\economy.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\items.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\laws.c">
|
RelativePath=".\laws.c">
|
||||||
</File>
|
</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");
|
||||||
|
}
|
|
@ -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
|
|
@ -12,7 +12,7 @@ SOURCES =
|
||||||
birthday_firework.c
|
birthday_firework.c
|
||||||
catapultammo.c
|
catapultammo.c
|
||||||
demonseye.c
|
demonseye.c
|
||||||
items.c
|
itemtypes.c
|
||||||
questkeys.c
|
questkeys.c
|
||||||
racespoils.c
|
racespoils.c
|
||||||
seed.c
|
seed.c
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
RelativePath=".\demonseye.h">
|
RelativePath=".\demonseye.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\items.h">
|
RelativePath=".\itemtypes.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\questkeys.h">
|
RelativePath=".\questkeys.h">
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
RelativePath=".\demonseye.c">
|
RelativePath=".\demonseye.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\items.c">
|
RelativePath=".\itemtypes.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\questkeys.c">
|
RelativePath=".\questkeys.c">
|
||||||
|
@ -175,18 +175,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath=".\seed.c">
|
RelativePath=".\seed.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\speedsail.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\speedsail.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\studypotion.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\studypotion.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\weapons.c">
|
RelativePath=".\weapons.c">
|
||||||
</File>
|
</File>
|
||||||
|
|
|
@ -12,15 +12,13 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <eressea.h>
|
#include <eressea.h>
|
||||||
#include "items.h"
|
#include "itemtypes.h"
|
||||||
|
|
||||||
#include "birthday_firework.h"
|
#include "birthday_firework.h"
|
||||||
#include "demonseye.h"
|
#include "demonseye.h"
|
||||||
#include "xerewards.h"
|
#include "xerewards.h"
|
||||||
#include "artrewards.h"
|
#include "artrewards.h"
|
||||||
#include "weapons.h"
|
#include "weapons.h"
|
||||||
#include "speedsail.h"
|
|
||||||
#include "studypotion.h"
|
|
||||||
#include "racespoils.h"
|
#include "racespoils.h"
|
||||||
#if GROWING_TREES
|
#if GROWING_TREES
|
||||||
# include "seed.h"
|
# include "seed.h"
|
||||||
|
@ -29,7 +27,7 @@
|
||||||
#include "catapultammo.h"
|
#include "catapultammo.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
register_items(void)
|
register_itemtypes(void)
|
||||||
{
|
{
|
||||||
register_weapons();
|
register_weapons();
|
||||||
register_demonseye();
|
register_demonseye();
|
||||||
|
@ -44,12 +42,10 @@ register_items(void)
|
||||||
register_catapultammo();
|
register_catapultammo();
|
||||||
register_racespoils();
|
register_racespoils();
|
||||||
register_artrewards();
|
register_artrewards();
|
||||||
register_speedsail();
|
|
||||||
register_studypotion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init_items(void)
|
init_itemtypes(void)
|
||||||
{
|
{
|
||||||
init_weapons();
|
init_weapons();
|
||||||
}
|
}
|
|
@ -16,8 +16,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void register_items(void);
|
extern void register_itemtypes(void);
|
||||||
extern void init_items(void);
|
extern void init_itemtypes(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@
|
||||||
#include <attributes/attributes.h>
|
#include <attributes/attributes.h>
|
||||||
#include <spells/spells.h>
|
#include <spells/spells.h>
|
||||||
#include <triggers/triggers.h>
|
#include <triggers/triggers.h>
|
||||||
#include <items/items.h>
|
#include <items/itemtypes.h>
|
||||||
|
|
||||||
/* modules includes */
|
/* modules includes */
|
||||||
#include <modules/score.h>
|
#include <modules/score.h>
|
||||||
|
@ -54,10 +54,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
#include <economy.h>
|
#include <gamecode/economy.h>
|
||||||
#include <goodies.h>
|
#include <gamecode/items.h>
|
||||||
#include <monster.h>
|
#include <gamecode/laws.h>
|
||||||
#include <laws.h>
|
#include <gamecode/monster.h>
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/xmlreader.h>
|
#include <kernel/xmlreader.h>
|
||||||
|
@ -83,6 +83,7 @@
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <rand.h>
|
#include <rand.h>
|
||||||
#include <util/xml.h>
|
#include <util/xml.h>
|
||||||
|
#include <util/goodies.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <sql.h>
|
#include <sql.h>
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
|
@ -168,7 +169,8 @@ game_init(void)
|
||||||
register_resources();
|
register_resources();
|
||||||
register_buildings();
|
register_buildings();
|
||||||
register_ships();
|
register_ships();
|
||||||
register_items();
|
register_itemimplementations();
|
||||||
|
register_itemtypes();
|
||||||
register_spells();
|
register_spells();
|
||||||
#ifdef DUNGEON_MODULE
|
#ifdef DUNGEON_MODULE
|
||||||
register_dungeon();
|
register_dungeon();
|
||||||
|
@ -181,7 +183,7 @@ game_init(void)
|
||||||
init_locales();
|
init_locales();
|
||||||
init_attributes();
|
init_attributes();
|
||||||
init_races();
|
init_races();
|
||||||
init_items();
|
init_itemtypes();
|
||||||
init_races();
|
init_races();
|
||||||
init_economy();
|
init_economy();
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <attributes/attributes.h>
|
#include <attributes/attributes.h>
|
||||||
#include <spells/spells.h>
|
#include <spells/spells.h>
|
||||||
#include <triggers/triggers.h>
|
#include <triggers/triggers.h>
|
||||||
#include <items/items.h>
|
#include <items/itemtypes.h>
|
||||||
|
|
||||||
/* modules includes */
|
/* modules includes */
|
||||||
#include <modules/score.h>
|
#include <modules/score.h>
|
||||||
|
@ -56,9 +56,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
#include <gamecode/economy.h>
|
|
||||||
#include <gamecode/laws.h>
|
|
||||||
#include <gamecode/creport.h>
|
#include <gamecode/creport.h>
|
||||||
|
#include <gamecode/economy.h>
|
||||||
|
#include <gamecode/items.h>
|
||||||
|
#include <gamecode/laws.h>
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/border.h>
|
#include <kernel/border.h>
|
||||||
|
@ -165,7 +166,8 @@ game_init(void)
|
||||||
register_resources();
|
register_resources();
|
||||||
register_buildings();
|
register_buildings();
|
||||||
register_ships();
|
register_ships();
|
||||||
register_items();
|
register_itemimplementations();
|
||||||
|
register_itemtypes();
|
||||||
register_spells();
|
register_spells();
|
||||||
#ifdef DUNGEON_MODULE
|
#ifdef DUNGEON_MODULE
|
||||||
register_dungeon();
|
register_dungeon();
|
||||||
|
@ -189,7 +191,7 @@ game_init(void)
|
||||||
|
|
||||||
init_attributes();
|
init_attributes();
|
||||||
init_races();
|
init_races();
|
||||||
init_items();
|
init_itemtypes();
|
||||||
init_economy();
|
init_economy();
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
init_rawmaterials();
|
init_rawmaterials();
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#include <spells/spells.h>
|
#include <spells/spells.h>
|
||||||
#include <attributes/attributes.h>
|
#include <attributes/attributes.h>
|
||||||
#include <triggers/triggers.h>
|
#include <triggers/triggers.h>
|
||||||
#include <items/weapons.h>
|
#include <items/itemtypes.h>
|
||||||
#include <items/items.h>
|
|
||||||
|
|
||||||
#include <modules/gmcmd.h>
|
#include <modules/gmcmd.h>
|
||||||
#include <modules/xmas.h>
|
#include <modules/xmas.h>
|
||||||
|
@ -1687,7 +1686,7 @@ main(int argc, char *argv[])
|
||||||
register_resources();
|
register_resources();
|
||||||
register_buildings();
|
register_buildings();
|
||||||
register_ships();
|
register_ships();
|
||||||
register_items();
|
register_itemtypes();
|
||||||
register_spells();
|
register_spells();
|
||||||
#ifdef MUSEUM_MODULE
|
#ifdef MUSEUM_MODULE
|
||||||
register_museum();
|
register_museum();
|
||||||
|
|
Loading…
Reference in New Issue