diff --git a/src/common/gamecode/Jamfile b/src/common/gamecode/Jamfile
index 08f74cf9b..606287d77 100644
--- a/src/common/gamecode/Jamfile
+++ b/src/common/gamecode/Jamfile
@@ -10,6 +10,7 @@ SOURCES =
creation.c
creport.c
economy.c
+ items.c
laws.c
luck.c
monster.c
diff --git a/src/common/gamecode/gamecode.vcproj b/src/common/gamecode/gamecode.vcproj
index 94e793854..68365ba2a 100644
--- a/src/common/gamecode/gamecode.vcproj
+++ b/src/common/gamecode/gamecode.vcproj
@@ -183,6 +183,9 @@
+
+
@@ -205,6 +208,9 @@
+
+
diff --git a/src/common/gamecode/items.c b/src/common/gamecode/items.c
new file mode 100644
index 000000000..05cc3a7a1
--- /dev/null
+++ b/src/common/gamecode/items.c
@@ -0,0 +1,94 @@
+#include
+#include
+#include "items.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+/* 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");
+}
diff --git a/src/common/gamecode/items.h b/src/common/gamecode/items.h
new file mode 100644
index 000000000..2b401499b
--- /dev/null
+++ b/src/common/gamecode/items.h
@@ -0,0 +1,25 @@
+/* vi: set ts=2:
++-------------------+ Christian Schlittchen
+| | Enno Rehling
+| Eressea PBEM host | Katja Zedel
+| (c) 1998 - 2003 | Henning Peters
+| | Ingo Wilken
++-------------------+ Stefan Reich
+
+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
diff --git a/src/common/items/Jamfile b/src/common/items/Jamfile
index 397fdccc3..29a6b2de4 100644
--- a/src/common/items/Jamfile
+++ b/src/common/items/Jamfile
@@ -12,7 +12,7 @@ SOURCES =
birthday_firework.c
catapultammo.c
demonseye.c
- items.c
+ itemtypes.c
questkeys.c
racespoils.c
seed.c
diff --git a/src/common/items/items.vcproj b/src/common/items/items.vcproj
index 9eb578d04..30ef11f8a 100644
--- a/src/common/items/items.vcproj
+++ b/src/common/items/items.vcproj
@@ -133,7 +133,7 @@
RelativePath=".\demonseye.h">
+ RelativePath=".\itemtypes.h">
@@ -164,7 +164,7 @@
RelativePath=".\demonseye.c">
+ RelativePath=".\itemtypes.c">
@@ -175,18 +175,6 @@
-
-
-
-
-
-
-
-
diff --git a/src/common/items/items.c b/src/common/items/itemtypes.c
similarity index 88%
rename from src/common/items/items.c
rename to src/common/items/itemtypes.c
index 9fb6fb280..527db9aca 100644
--- a/src/common/items/items.c
+++ b/src/common/items/itemtypes.c
@@ -12,15 +12,13 @@
#include
#include
-#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();
}
diff --git a/src/common/items/items.h b/src/common/items/itemtypes.h
similarity index 90%
rename from src/common/items/items.h
rename to src/common/items/itemtypes.h
index 7ce4f2d17..a5237e77e 100644
--- a/src/common/items/items.h
+++ b/src/common/items/itemtypes.h
@@ -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
}
diff --git a/src/eressea/main.c b/src/eressea/main.c
index b756ae9a8..9e48634ae 100644
--- a/src/eressea/main.c
+++ b/src/eressea/main.c
@@ -33,7 +33,7 @@
#include
#include
#include
-#include
+#include
/* modules includes */
#include
@@ -54,10 +54,10 @@
#endif
/* gamecode includes */
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
/* kernel includes */
#include
@@ -83,6 +83,7 @@
/* util includes */
#include
#include
+#include
#include
#include
#include
@@ -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
diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp
index 19a503505..5eecb6609 100644
--- a/src/eressea/server.cpp
+++ b/src/eressea/server.cpp
@@ -35,7 +35,7 @@
#include
#include
#include
-#include
+#include
/* modules includes */
#include
@@ -56,9 +56,10 @@
#endif
/* gamecode includes */
-#include
-#include
#include
+#include
+#include
+#include
/* kernel includes */
#include
@@ -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();
diff --git a/src/mapper/mapper.c b/src/mapper/mapper.c
index 491ada4e6..3e075b632 100644
--- a/src/mapper/mapper.c
+++ b/src/mapper/mapper.c
@@ -27,8 +27,7 @@
#include
#include
#include
-#include
-#include
+#include
#include
#include
@@ -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();