Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Map.cpp

Go to the documentation of this file.
00001 00006 /* 00007 Copyright (C) 2004 Anders Hedstrom 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 */ 00023 #include <stdincl.h> 00024 00025 #include "events/Map.h" 00026 #include "Map.h" 00027 00028 00029 00030 00031 Map::Map() 00032 { 00033 memset(m_h, 0, MAPSIZE * MAPSIZE); 00034 memset(m_terrain_left, 0, MAPSIZE * MAPSIZE); 00035 memset(m_terrain_up, 0, MAPSIZE * MAPSIZE); 00036 } 00037 00038 00039 Map::~Map() 00040 { 00041 } 00042 00043 00044 void Map::Populate(Event::Map *pclMap) 00045 { 00046 size_t l = MAPSIZE * MAPSIZE; 00047 00048 memmove(m_h, pclMap -> Get_h(), l); 00049 memmove(m_terrain_left, pclMap -> Get_t_left(), l); 00050 memmove(m_terrain_up, pclMap -> Get_t_up(), l); 00051 } 00052 00053 00054 unsigned char Map::Get_h(long x,long y) 00055 { 00056 int index = (y % MAPSIZE) * MAPSIZE + (x % MAPSIZE); 00057 return m_h[index]; 00058 } 00059 00060 00061 unsigned char Map::Get_t_left(long x,long y) 00062 { 00063 int index = (y % MAPSIZE) * MAPSIZE + (x % MAPSIZE); 00064 return m_terrain_left[index]; 00065 } 00066 00067 00068 unsigned char Map::Get_t_up(long x,long y) 00069 { 00070 int index = (y % MAPSIZE) * MAPSIZE + (x % MAPSIZE); 00071 return m_terrain_up[index]; 00072 } 00073 00074

Generated for SDL C++ GUI by doxygen 1.3.6