00001 00002 /*************************************************************************** 00003 gamemap.cpp - description 00004 ------------------- 00005 begin : Tue May 21 2005 00006 copyright : (C) 2005 by Martin Bickel 00007 email : bickel@asc-hq.org 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 00019 #include <algorithm> 00020 #include <ctime> 00021 #include <cmath> 00022 00023 #include "global.h" 00024 #include "misc.h" 00025 #include "typen.h" 00026 #include "vehicletype.h" 00027 #include "buildingtype.h" 00028 #include "itemrepository.h" 00029 #include "graphics/blitter.h" 00030 #include "iconrepository.h" 00031 #include "objects.h" 00032 #include "graphics/blitter.h" 00033 00034 #include "spfst.h" 00035 #include "gamemap.h" 00036 00037 00038 00039 00040 bool Mine :: attacksunit ( const Vehicle* veh ) 00041 { 00042 #ifndef converter 00043 if (!( ( veh->typ->hasFunction( ContainerBaseType::ImmuneToMines ) ) || 00044 ( veh->height > chfahrend ) || 00045 ( veh->getMap()->getPlayer(player).diplomacy.getState(veh->getOwner()) >= PEACE ) || 00046 ( (veh->typ->movemalustyp == cmm_trooper) && (type != cmantipersonnelmine)) || 00047 ( veh->height <= chgetaucht && type != cmmooredmine ) || 00048 ( veh->height == chschwimmend && type != cmfloatmine ) || 00049 ( veh->height == chfahrend && type != cmantipersonnelmine && type != cmantitankmine ) 00050 )) 00051 return true; 00052 #endif 00053 return false; 00054 } 00055 00056 00057 00058 void Mine::paint( Surface& surf, SPoint pos ) 00059 { 00060 MineType::paint( type, player, surf, pos ); 00061 } 00062 00063 00064 00065 Mine::Mine( MineTypes type, int strength, int player, GameMap* gamemap ) 00066 { 00067 this->type = type; 00068 this->strength = strength; 00069 this->player = player; 00070 #ifndef converter 00071 lifetimer = gamemap->getgameparameter( GameParameter(cgp_antipersonnelmine_lifetime + type - 1)); 00072 #endif 00073 } 00074
1.4.2