move chaosgate to borders.c

This commit is contained in:
Enno Rehling 2017-08-25 21:07:23 +02:00
parent faefaf2523
commit 612cd1158a
3 changed files with 42 additions and 41 deletions

View File

@ -3116,46 +3116,6 @@ static int sp_summonshadowlords(castorder * co)
return cast_level; return cast_level;
} }
static bool chaosgate_valid(const connection * b)
{
const attrib *a = a_find(b->from->attribs, &at_direction);
if (!a)
a = a_find(b->to->attribs, &at_direction);
if (!a)
return false;
return true;
}
static struct region *chaosgate_move(const connection * b, struct unit *u,
struct region *from, struct region *to, bool routing)
{
UNUSED_ARG(from);
UNUSED_ARG(b);
if (!routing) {
int maxhp = u->hp / 4;
if (maxhp < u->number)
maxhp = u->number;
u->hp = maxhp;
}
return to;
}
border_type bt_chaosgate = {
"chaosgate", VAR_NONE,
b_transparent, /* transparent */
NULL, /* init */
NULL, /* destroy */
NULL, /* read */
NULL, /* write */
b_blocknone, /* block */
NULL, /* name */
b_rinvisible, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
chaosgate_valid,
chaosgate_move
};
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Chaossog /* Name: Chaossog
* Stufe: 14 * Stufe: 14

View File

@ -1,6 +1,7 @@
#include <platform.h> #include <platform.h>
#include "borders.h" #include "borders.h"
#include "vortex.h"
#include <kernel/connection.h> #include <kernel/connection.h>
#include <kernel/curse.h> #include <kernel/curse.h>
@ -198,6 +199,46 @@ border_type bt_wisps = { /* only here for reading old data */
0 0
}; };
static bool chaosgate_valid(const connection * b)
{
const attrib *a = a_find(b->from->attribs, &at_direction);
if (!a)
a = a_find(b->to->attribs, &at_direction);
if (!a)
return false;
return true;
}
static struct region *chaosgate_move(const connection * b, struct unit *u,
struct region *from, struct region *to, bool routing)
{
UNUSED_ARG(from);
UNUSED_ARG(b);
if (!routing) {
int maxhp = u->hp / 4;
if (maxhp < u->number)
maxhp = u->number;
u->hp = maxhp;
}
return to;
}
border_type bt_chaosgate = {
"chaosgate", VAR_NONE,
b_transparent, /* transparent */
NULL, /* init */
NULL, /* destroy */
NULL, /* read */
NULL, /* write */
b_blocknone, /* block */
NULL, /* name */
b_rinvisible, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
chaosgate_valid,
chaosgate_move
};
void register_borders(void) void register_borders(void)
{ {
border_convert_cb = &convert_firewall_timeouts; border_convert_cb = &convert_firewall_timeouts;

View File

@ -15,6 +15,7 @@ extern "C" {
**/ **/
extern struct border_type bt_chaosgate; extern struct border_type bt_chaosgate;
extern struct border_type bt_firewall; extern struct border_type bt_firewall;
extern const struct curse_type ct_firewall;
typedef struct wall_data { typedef struct wall_data {
struct unit *mage; struct unit *mage;
@ -23,7 +24,6 @@ extern "C" {
int countdown; int countdown;
} wall_data; } wall_data;
extern const struct curse_type ct_firewall;
#ifdef __cplusplus #ifdef __cplusplus
} }