forked from github/server
remote the item_type.use funpointer.
This commit is contained in:
parent
9e239c88f4
commit
49d8a03eca
|
@ -54,30 +54,22 @@
|
|||
<!-- museum items -->
|
||||
<resource name="questkey1" appearance="key">
|
||||
<!-- Key for an old quest. placeholder item -->
|
||||
<item notlost="yes" weight="0" >
|
||||
<function name="use" value="use_museumkey"/>
|
||||
</item>
|
||||
<item notlost="yes" weight="0" use="yes" />
|
||||
</resource>
|
||||
|
||||
<resource name="questkey2" appearance="key">
|
||||
<!-- Key for an old quest. placeholder item -->
|
||||
<item notlost="yes" weight="0" >
|
||||
<function name="use" value="use_museumkey"/>
|
||||
</item>
|
||||
<item notlost="yes" weight="0" use="yes" />
|
||||
</resource>
|
||||
|
||||
<resource name="museumexitticket">
|
||||
<!-- you get your stuff back when leaving the museum -->
|
||||
<item notlost="yes" weight="0">
|
||||
<function name="use" value="use_museumexitticket"/>
|
||||
</item>
|
||||
<item notlost="yes" weight="0" use="yes" />
|
||||
</resource>
|
||||
|
||||
<resource name="museumticket">
|
||||
<!-- you get your stuff back when leaving the museum -->
|
||||
<item weight="0">
|
||||
<function name="use" value="use_museumticket"/>
|
||||
</item>
|
||||
<item weight="0" use="yes" />
|
||||
</resource>
|
||||
|
||||
<!-- gimmicks, etc. -->
|
||||
|
|
|
@ -529,9 +529,6 @@ use_item_lua(unit *u, const item_type *itype, int amount, struct order *ord)
|
|||
} else {
|
||||
log_error("no such callout: %s", fname);
|
||||
}
|
||||
if (itype->use) {
|
||||
return itype->use(u, itype, amount, ord);
|
||||
}
|
||||
log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
|
|
@ -126,8 +126,6 @@ extern "C" {
|
|||
/* --- functions --- */
|
||||
bool(*canuse) (const struct unit * user,
|
||||
const struct item_type * itype);
|
||||
int(*use) (struct unit * user, const struct item_type * itype, int amount,
|
||||
struct order * ord);
|
||||
int(*give) (struct unit * src, struct unit * dest,
|
||||
const struct item_type * itm, int number, struct order * ord);
|
||||
int score;
|
||||
|
@ -310,8 +308,6 @@ extern "C" {
|
|||
const struct item_type *, int, struct order *), const char *name);
|
||||
void register_item_use(int(*foo) (struct unit *,
|
||||
const struct item_type *, int, struct order *), const char *name);
|
||||
void register_item_useonother(int(*foo) (struct unit *, int,
|
||||
const struct item_type *, int, struct order *), const char *name);
|
||||
|
||||
void free_resources(void);
|
||||
|
||||
|
|
|
@ -854,13 +854,6 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
|||
(int(*)(struct unit *, struct unit *, const struct item_type *, int,
|
||||
struct order *))fun;
|
||||
}
|
||||
else if (strcmp((const char *)propValue, "use") == 0) {
|
||||
log_error("%s has a use function", rtype->_name);
|
||||
itype->flags |= ITF_CANUSE;
|
||||
itype->use =
|
||||
(int(*)(struct unit *, const struct item_type *, int,
|
||||
struct order *))fun;
|
||||
}
|
||||
else if (strcmp((const char *)propValue, "canuse") == 0) {
|
||||
itype->canuse =
|
||||
(bool(*)(const struct unit *, const struct item_type *))fun;
|
||||
|
|
|
@ -497,9 +497,10 @@ void register_museum(void)
|
|||
at_register(&at_museumgivebackcookie);
|
||||
at_register(&at_museumgiveback);
|
||||
|
||||
register_item_use(use_museumticket, "use_museumticket");
|
||||
register_item_use(use_museumkey, "use_museumkey");
|
||||
register_item_use(use_museumexitticket, "use_museumexitticket");
|
||||
register_item_use(use_museumticket, "use_museumticket");
|
||||
register_item_use(use_museumkey, "use_questkey1");
|
||||
register_item_use(use_museumkey, "use_questkey2");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue