Atrinik Server 2.5
types/map_info.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 
00035 void map_info_init(object *info)
00036 {
00037     int x, y;
00038     MapSpace *msp;
00039 
00040     if (!info->map)
00041     {
00042         LOG(llevBug, "Map info object not on map.\n");
00043         return;
00044     }
00045 
00046     for (x = info->x; x <= info->x + info->stats.hp; x++)
00047     {
00048         for (y = info->y; y <= info->y + info->stats.sp; y++)
00049         {
00050             if (OUT_OF_REAL_MAP(info->map, x, y))
00051             {
00052                 LOG(llevBug, "Map info object (%d, %d) spans invalid area.\n", info->x, info->y);
00053                 return;
00054             }
00055 
00056             msp = GET_MAP_SPACE_PTR(info->map, x, y);
00057             msp->map_info = info;
00058             msp->map_info_count = info->count;
00059 
00060             if (QUERY_FLAG(info, FLAG_NO_MAGIC))
00061             {
00062                 msp->extra_flags |= MSP_EXTRA_NO_MAGIC;
00063             }
00064 
00065             if (QUERY_FLAG(info, FLAG_NO_CLERIC))
00066             {
00067                 msp->extra_flags |= MSP_EXTRA_NO_CLERIC;
00068             }
00069 
00070             if (QUERY_FLAG(info, FLAG_NO_PVP))
00071             {
00072                 msp->extra_flags |= MSP_EXTRA_NO_PVP;
00073             }
00074 
00075             if (QUERY_FLAG(info, FLAG_STAND_STILL))
00076             {
00077                 msp->extra_flags |= MSP_EXTRA_NO_HARM;
00078             }
00079         }
00080     }
00081 }