forked from github/server
commit
eadad871ec
|
@ -105,11 +105,6 @@ int handle_triggers(trigger ** triggers, void *param)
|
||||||
** at_eventhandler
|
** at_eventhandler
|
||||||
**/
|
**/
|
||||||
|
|
||||||
typedef struct handler_info {
|
|
||||||
char *event;
|
|
||||||
trigger *triggers;
|
|
||||||
} handler_info;
|
|
||||||
|
|
||||||
static void init_handler(variant *var)
|
static void init_handler(variant *var)
|
||||||
{
|
{
|
||||||
var->v = calloc(1, sizeof(handler_info));
|
var->v = calloc(1, sizeof(handler_info));
|
||||||
|
|
|
@ -37,6 +37,11 @@ extern "C" {
|
||||||
variant data;
|
variant data;
|
||||||
} event_arg;
|
} event_arg;
|
||||||
|
|
||||||
|
typedef struct handler_info {
|
||||||
|
char *event;
|
||||||
|
trigger *triggers;
|
||||||
|
} handler_info;
|
||||||
|
|
||||||
trigger *t_new(trigger_type * ttype);
|
trigger *t_new(trigger_type * ttype);
|
||||||
void t_free(trigger * t);
|
void t_free(trigger * t);
|
||||||
void t_add(trigger ** tlist, trigger * t);
|
void t_add(trigger ** tlist, trigger * t);
|
||||||
|
|
|
@ -374,6 +374,26 @@ static void write_skills(gamedata *data, const unit *u) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fix_smurfication(unit *u) {
|
||||||
|
if (u->attribs) {
|
||||||
|
attrib *a;
|
||||||
|
for (a = a_find(u->attribs, &at_eventhandler); a && a->type == &at_eventhandler; a = a->next) {
|
||||||
|
handler_info *info = (handler_info *)a->data.v;
|
||||||
|
if (0 == strcmp("timer", info->event)) {
|
||||||
|
trigger *t;
|
||||||
|
for (t = info->triggers; t; t = t->next) {
|
||||||
|
if (t->type == &tt_changerace) {
|
||||||
|
/* is a smurf, but will change back */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log_error("%s was a %s in a %s faction", unitname(u), u->_race->_name, u->faction->race->_name);
|
||||||
|
u->_race = u->faction->race;
|
||||||
|
}
|
||||||
|
|
||||||
unit *read_unit(gamedata *data)
|
unit *read_unit(gamedata *data)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -532,10 +552,7 @@ unit *read_unit(gamedata *data)
|
||||||
if (rc_demon) {
|
if (rc_demon) {
|
||||||
const struct race *rc = u_race(u);
|
const struct race *rc = u_race(u);
|
||||||
if (rc == rc_smurf) {
|
if (rc == rc_smurf) {
|
||||||
if (!u->attribs) {
|
fix_smurfication(u);
|
||||||
log_error("%s was a %s in a %s faction", unitname(u), rc->_name, u->faction->race->_name);
|
|
||||||
u->_race = u->faction->race;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (rc == rc_demon) {
|
if (rc == rc_demon) {
|
||||||
if (data->version < FIX_SHAPESHIFT_VERSION) {
|
if (data->version < FIX_SHAPESHIFT_VERSION) {
|
||||||
|
|
Loading…
Reference in New Issue