Move quest objects to the module that uses them (museum portals).

This commit is contained in:
Enno Rehling 2014-07-21 11:34:57 +02:00
parent d7803eb318
commit 13165f2354
3 changed files with 330 additions and 323 deletions

View File

@ -2769,7 +2769,6 @@ void attrib_init(void)
register_bordertype(&bt_wall);
register_bordertype(&bt_illusionwall);
register_bordertype(&bt_road);
register_bordertype(&bt_questportal);
register_function((pf_generic) & minimum_wage, "minimum_wage");

View File

@ -458,58 +458,6 @@ border_type bt_illusionwall = {
b_uvisible, /* uvisible */
};
/***
* special quest door
***/
bool b_blockquestportal(const connection * b, const unit * u,
const region * r)
{
if (b->data.i > 0)
return true;
return false;
}
static const char *b_namequestportal(const connection * b, const region * r,
const struct faction *f, int gflags)
{
const char *bname;
int lock = b->data.i;
unused_arg(b);
unused_arg(r);
if (gflags & GF_ARTICLE) {
if (lock > 0) {
bname = "a_gate_locked";
} else {
bname = "a_gate_open";
}
} else {
if (lock > 0) {
bname = "gate_locked";
} else {
bname = "gate_open";
}
}
if (gflags & GF_PURE)
return bname;
return LOC(f->locale, mkname("border", bname));
}
border_type bt_questportal = {
"questportal", VAR_INT,
b_opaque,
NULL, /* init */
NULL, /* destroy */
b_read, /* read */
b_write, /* write */
b_blockquestportal, /* block */
b_namequestportal, /* name */
b_rvisible, /* rvisible */
b_fvisible, /* fvisible */
b_uvisible, /* uvisible */
};
/***
* roads. meant to replace the old at_road or r->road attribute
***/

View File

@ -25,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* kernel includes */
#include <kernel/building.h>
#include <kernel/connection.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/move.h>
@ -42,6 +43,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/base36.h>
#include <util/functions.h>
#include <util/goodies.h>
#include <util/language.h>
#include <storage.h>
@ -157,7 +159,8 @@ void warden_add_give(unit * src, unit * u, const item_type * itype, int n)
gbc->cookie = aw->data.i;
assert(aw->data.i < INT_MAX);
aw->data.i++;
} else {
}
else {
gbc = (museumgivebackcookie *)(a->data.v);
}
@ -397,8 +400,65 @@ use_museumticket(unit * u, const struct item_type *itype, int amount,
return 0;
}
/***
* special quest door
***/
bool b_blockquestportal(const connection * b, const unit * u,
const region * r)
{
if (b->data.i > 0)
return true;
return false;
}
static const char *b_namequestportal(const connection * b, const region * r,
const struct faction *f, int gflags)
{
const char *bname;
int lock = b->data.i;
unused_arg(b);
unused_arg(r);
if (gflags & GF_ARTICLE) {
if (lock > 0) {
bname = "a_gate_locked";
}
else {
bname = "a_gate_open";
}
}
else {
if (lock > 0) {
bname = "gate_locked";
}
else {
bname = "gate_open";
}
}
if (gflags & GF_PURE)
return bname;
return LOC(f->locale, mkname("border", bname));
}
border_type bt_questportal = {
"questportal", VAR_INT,
b_opaque,
NULL, /* init */
NULL, /* destroy */
b_read, /* read */
b_write, /* write */
b_blockquestportal, /* block */
b_namequestportal, /* name */
b_rvisible, /* rvisible */
b_fvisible, /* fvisible */
b_uvisible, /* uvisible */
};
void register_museum(void)
{
register_bordertype(&bt_questportal);
at_register(&at_warden);
at_register(&at_museumexit);
at_register(&at_museumgivebackcookie);