--- deliantra/server/include/plugin.h 2006/08/12 11:51:37 1.9 +++ deliantra/server/include/plugin.h 2007/07/01 05:00:18 1.17 @@ -1,7 +1,25 @@ -/*****************************************************************************/ -/* Crossfire plugin support - (C) 2001 by Yann Chachkoff. */ -/* This code is placed under the GPL. */ -/*****************************************************************************/ +/* + * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. + * + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen + * + * Crossfire TRT is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * The authors can be reached via e-mail to + */ /*****************************************************************************/ /* Headers needed. */ @@ -13,20 +31,9 @@ /*****************************************************************************/ /* This one does not exist under Win32. */ /*****************************************************************************/ -#ifndef WIN32 #include -#endif -#undef MODULEAPI -#ifdef WIN32 -#ifdef PYTHON_PLUGIN_EXPORTS -#define MODULEAPI __declspec(dllexport) -#else -#define MODULEAPI __declspec(dllimport) -#endif -#else #define MODULEAPI -#endif #include #include @@ -41,65 +48,9 @@ /*****************************************************************************/ /* This one does not exist under Win32. */ /*****************************************************************************/ -#ifndef WIN32 #include -#endif -/*****************************************************************************/ -/* Event ID codes. I sorted them to present local events first, but it is */ -/* just a 'cosmetic' thing. */ -/*****************************************************************************/ -/*****************************************************************************/ -/* Local events. Those are always linked to a specific object. */ -/*****************************************************************************/ -// how about making this an enum -#define EVENT_NONE 0 /* No event. This exists only to reserve the "0". */ -#define EVENT_APPLY 1 /* Object applied-unapplied. */ -#define EVENT_ATTACK 2 /* Monster attacked or Scripted Weapon used. */ -#define EVENT_DEATH 3 /* Player or monster dead. */ -#define EVENT_DROP 4 /* Object dropped on the floor. */ -#define EVENT_PICKUP 5 /* Object picked up. */ -#define EVENT_SAY 6 /* Someone speaks. */ -#define EVENT_STOP 7 /* Thrown object stopped. */ -#define EVENT_TIME 8 /* Triggered each time the object can react/move. */ -#define EVENT_THROW 9 /* Object is thrown. */ -#define EVENT_TRIGGER 10 /* Button pushed, lever pulled, etc. */ -#define EVENT_CLOSE 11 /* Container closed. */ -#define EVENT_TIMER 12 /* Timer connected triggered it. */ -#define EVENT_MOVE 28 /* Monster move */ -/*****************************************************************************/ -/* Global events. Those are never linked to a specific object. */ -/*****************************************************************************/ -#define EVENT_BORN 13 /* A new character has been created. */ -#define EVENT_CLOCK 14 /* Global time event. */ -#define EVENT_CRASH 15 /* Triggered when the server crashes. Not recursive*/ -#define EVENT_PLAYER_DEATH 16 /* Global Death event */ -#define EVENT_GKILL 17 /* Triggered when anything got killed by anyone. */ -#define EVENT_LOGIN 18 /* Player login. */ -#define EVENT_LOGOUT 19 /* Player logout. */ -#define EVENT_MAPENTER 20 /* A player entered a map. */ -#define EVENT_MAPLEAVE 21 /* A player left a map. */ -#define EVENT_MAPRESET 22 /* A map is resetting. */ -#define EVENT_REMOVE 23 /* A Player character has been removed. */ -#define EVENT_SHOUT 24 /* A player 'shout' something. */ -#define EVENT_TELL 25 /* A player 'tell' something. */ -#define EVENT_MUZZLE 26 /* A player was Muzzled (no_shout set). */ -#define EVENT_KICK 27 /* A player was Kicked by a DM */ -#define EVENT_FREE_OB 29 /* Object destroyed */ -#define EVENT_MAPLOAD 30 /* Original map has been loaded */ -#define EVENT_MAPOUT 31 /* Map has been swapped out */ -#define EVENT_MAPIN 32 /* Temporary map has been swapped in */ -#define EVENT_MAPCLEAN 33 /* Temporary map will be deleted */ -#define EVENT_PLAYER_LOAD 34 /* Player was just loaded from disk */ -#define EVENT_PLAYER_SAVE 35 /* Player was just saved to disk */ -#define EVENT_PLAYER_USE_SKILL 36 /* player was just trying to use a skill */ -#define EVENT_MONSTER_USE_SKILL 37 /* monster was just trying to use a skill*/ -#define EVENT_FIND_UNARMED_SKILL 38 /* lets a plugin find the unarmed skill */ -#define EVENT_EXTCMD 39 /* Low-Level socket command */ -#define EVENT_CAST_SPELL 40 /* Something successfully casted a spell */ -/* should add FREE_MAP, FREE_PLAYER */ - -#define NR_EVENTS 41 +#define NR_EVENTS 42 #include @@ -123,11 +74,7 @@ typedef int (*f_plug_postinit) (void); typedef int (*f_plug_init)(const char* iversion, f_plug_api gethooksptr); -#ifndef WIN32 #define LIBPTRTYPE void* -#else -#define LIBPTRTYPE HMODULE -#endif typedef struct _crossfire_plugin { @@ -145,19 +92,10 @@ extern int plugin_number; extern crossfire_plugin* plugins_list; -#ifdef WIN32 - -#define plugins_dlopen(fname) LoadLibrary(fname) -#define plugins_dlclose(lib) FreeLibrary(lib) -#define plugins_dlsym(lib,name) GetProcAddress(lib,name) - -#else /*WIN32 */ - #define plugins_dlopen(fname) dlopen(fname,RTLD_NOW|RTLD_GLOBAL) #define plugins_dlclose(lib) dlclose(lib) #define plugins_dlsym(lib,name) dlsym(lib,name) #define plugins_dlerror() dlerror() -#endif /* WIN32 */ /* OBJECT-RELATED HOOKS */