diff --git a/src/spells.c b/src/spells.c index 0bb6df5af..e936a46a2 100644 --- a/src/spells.c +++ b/src/spells.c @@ -95,7 +95,6 @@ #include #include #include -#include /* attributes includes */ #include diff --git a/src/triggers/CMakeLists.txt b/src/triggers/CMakeLists.txt index d6670a95b..e123698d6 100644 --- a/src/triggers/CMakeLists.txt +++ b/src/triggers/CMakeLists.txt @@ -11,7 +11,6 @@ killunit.c shock.c timeout.c triggers.c -unitmessage.c ) FOREACH(_FILE ${_FILES}) LIST(APPEND _SOURCES ${PROJECT_NAME}/${_FILE}) diff --git a/src/triggers/triggers.c b/src/triggers/triggers.c index 433201abd..8826fcba2 100644 --- a/src/triggers/triggers.c +++ b/src/triggers/triggers.c @@ -28,7 +28,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include /* util includes */ @@ -47,7 +46,6 @@ void register_triggers(void) tt_register(&tt_giveitem); tt_register(&tt_killunit); tt_register(&tt_shock); - tt_register(&tt_unitmessage); tt_register(&tt_timeout); tt_register(&tt_clonedied); } diff --git a/src/triggers/unitmessage.c b/src/triggers/unitmessage.c deleted file mode 100644 index 7ba97d9bc..000000000 --- a/src/triggers/unitmessage.c +++ /dev/null @@ -1,124 +0,0 @@ -/* -+-------------------+ Enno Rehling -| Eressea PBEM host | Christian Schlittchen -| (c) 1998 - 2008 | Katja Zedel -+-------------------+ -This program may not be used, modified or distributed -without prior permission by the authors of Eressea. -*/ - -#include -#include "unitmessage.h" - -/* kernel includes */ -#include -#include -#include - -/* util includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* ansi includes */ -#include -#include -#include -#include - -/*** -** give an item to someone -**/ - -typedef struct unitmessage_data { - struct unit *target; - char *string; - int type; - int level; -} unitmessage_data; - -static void unitmessage_init(trigger * t) -{ - t->data.v = calloc(sizeof(unitmessage_data), 1); -} - -static void unitmessage_free(trigger * t) -{ - unitmessage_data *sd = (unitmessage_data *)t->data.v; - free(sd->string); - free(t->data.v); -} - -static int unitmessage_handle(trigger * t, void *data) -{ - /* call an event handler on unitmessage. - * data.v -> ( variant event, int timer ) - */ - unitmessage_data *td = (unitmessage_data *)t->data.v; - if (td->target && td->target->no) { - struct faction *f = td->target->faction; - const char * str = LOC(f->locale, td->string); - /* bug found in turn 733: sometimes, alps have f*cked up messages */ - if (td->string && td->string[0]) { - addmessage(td->target->region, f, str, td->type, - td->level); - } - } - UNUSED_ARG(data); - return 0; -} - -static void unitmessage_write(const trigger * t, struct storage *store) -{ - unitmessage_data *td = (unitmessage_data *)t->data.v; - write_unit_reference(td->target, store); - WRITE_TOK(store, td->string); - WRITE_INT(store, td->type); - WRITE_INT(store, td->level); -} - -static int unitmessage_read(trigger * t, gamedata *data) -{ - unitmessage_data *td = (unitmessage_data *)t->data.v; - char zText[256]; - - int result = read_reference(&td->target, data, read_unit_reference, - resolve_unit); - READ_TOK(data->store, zText, sizeof(zText)); - td->string = strdup(zText); - READ_INT(data->store, &td->type); - READ_INT(data->store, &td->level); - - if (result == 0 && td->target == NULL) { - return AT_READ_FAIL; - } - return AT_READ_OK; -} - -trigger_type tt_unitmessage = { - "unitmessage", - unitmessage_init, - unitmessage_free, - unitmessage_handle, - unitmessage_write, - unitmessage_read -}; - -trigger *trigger_unitmessage(unit * target, const char *string, int type, - int level) -{ - trigger *t = t_new(&tt_unitmessage); - unitmessage_data *td = (unitmessage_data *)t->data.v; - td->target = target; - td->string = strdup(string); - td->type = type; - td->level = level; - return t; -} diff --git a/src/triggers/unitmessage.h b/src/triggers/unitmessage.h deleted file mode 100644 index 5b5b0793b..000000000 --- a/src/triggers/unitmessage.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 1998-2015, Enno Rehling -Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -**/ - -#ifndef UNITMESSAGE_H -#define UNITMESSAGE_H -#ifdef __cplusplus -extern "C" { -#endif - - /* all types we use are defined here to reduce dependencies */ - struct trigger_type; - struct trigger; - struct unit; - - extern struct trigger_type tt_unitmessage; - extern struct trigger *trigger_unitmessage(struct unit *target, - const char *string, int type, int level); - -#ifdef __cplusplus -} -#endif -#endif