Atrinik Server 2.5
types/beacon.c
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00030 #include <global.h>
00031 
00033 static objectlink *beacons_list;
00034 
00038 void beacon_add(object *ob)
00039 {
00040     objectlink *ol = get_objectlink();
00041 
00042     ol->objlink.ob = ob;
00043     ol->id = ob->count;
00044     objectlink_link(&beacons_list, NULL, NULL, beacons_list, ol);
00045 }
00046 
00050 void beacon_remove(object *ob)
00051 {
00052     objectlink *ol;
00053 
00054     for (ol = beacons_list; ol; ol = ol->next)
00055     {
00056         if (ol->objlink.ob == ob)
00057         {
00058             objectlink_unlink(&beacons_list, NULL, ol);
00059             return_poolchunk(ol, pool_objectlink);
00060             break;
00061         }
00062     }
00063 }
00064 
00069 object *beacon_locate(const char *name)
00070 {
00071     objectlink *ol;
00072 
00073     for (ol = beacons_list; ol; ol = ol->next)
00074     {
00075         if (ol->objlink.ob->name == name)
00076         {
00077             return ol->objlink.ob;
00078         }
00079     }
00080 
00081     return NULL;
00082 }