00001 00005 /* 00006 This file is part of Advanced Strategic Command; http://www.asc-hq.de 00007 Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger 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; see the file COPYING. If not, write to the 00021 Free Software Foundation, Inc., 59 Temple Place, Suite 330, 00022 Boston, MA 02111-1307 USA 00023 */ 00024 00025 #include <stdio.h> 00026 #include "typen.h" 00027 #include "misc.h" 00028 #include "loaders.h" 00029 #include "spfst.h" 00030 #include "mappolygons.h" 00031 #include "dlg_box.h" 00032 #include "itemrepository.h" 00033 00034 00035 00036 void PolygonPainterSquareCoordinate::setpoint ( int x, int y ) 00037 { 00038 if ( (x & 1) == (y & 1) ) 00039 setpointabs ( x / 2, y); 00040 } 00041 00042 bool PolygonPainterSquareCoordinate::paintPolygon ( const Poly_gon& poly ) 00043 { 00044 Poly_gon poly1; 00045 for ( int i=0; i< poly.vertex.size() ; i++ ) 00046 poly1.vertex.push_back ( MapCoordinate( poly.vertex[i].x * 2 + (poly.vertex[i].y & 1), poly.vertex[i].y )); 00047 00048 return PolygonPainter<Poly_gon>::paintPolygon ( poly1 ); 00049 } 00050 00051 00052 00053 void Poly_gon::read ( tnstream& stream ) 00054 { 00055 int version = stream.readInt(); 00056 if ( version != 100 ) 00057 throw tinvalidversion( stream.getLocation(), 100, version ); 00058 readClassContainer ( vertex, stream ); 00059 } 00060 00061 00062 void Poly_gon::write ( tnstream& stream ) const 00063 { 00064 stream.writeInt( 100 ); 00065 writeClassContainer ( vertex, stream ); 00066 } 00067 00068 00069 00070
1.5.1