fix deprecation warnings from latest dmd
[SmugglerRL.git] / src / item.d
blobc1c9e846b9a0880a579631877ae954e621422bb0
1 module item;
3 import colour;
4 import glyph;
5 import graphix;
6 import map;
7 import util;
8 import being;
9 import stdlib;
11 alias ob_cb = void delegate(ref Item self, ref Being pickerupper, ref list!Being monsters, ref Map map);
13 enum Item_type {
14 Weapon,
15 Armour,
16 Fooood,
17 Tooool,
18 Shiiit,
19 Otherr,
23 struct Item {
24 Itemspec spec;
25 alias spec this;
27 this(Itemspec spec) {
28 this.spec = spec;
31 Vector2n loc;
32 uint wear;
35 class Itemspec {
36 Item_type type;
37 string name, description;
38 Glyph glyph;
39 ob_cb _on_pick_up;
40 ob_cb _on_drop;
42 @disable this();
43 this(Item_type type, string name, string description, Glyph glyph, ob_cb pickup, ob_cb drop) {
44 this.type = type;
45 this.name = name;
46 this.description = description;
47 this.glyph = glyph;
48 this._on_pick_up = pickup;
49 this._on_drop = drop;
53 mixin funcwrapper!_on_pick_up;
54 mixin funcwrapper!_on_drop;
57 class Toolspec: Itemspec {
58 this(string name, string description, Glyph glyph, ob_cb pickup, ob_cb drop = null) {
59 super(Item_type.Weapon, name, description, glyph, pickup, drop);
65 Itemspec[] all_items;
67 shared static this() {
68 all_items = [
69 new Toolspec("Lamp", "What more do you want, it's a fucking lamp", Glyph.paren_left, (ref Item self, ref Being pickerupper, ref list!Being monsters, ref Map map) { pickerupper.light_dist += 4; }),