00001 00005 /* 00006 This file is part of Advanced Strategic Command; http://www.asc-hq.de 00007 Copyright (C) 1994-2005 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 "newfont.h" 00029 #include "loaders.h" 00030 #include "spfst.h" 00031 #include "mappolygons.h" 00032 #include "dlg_box.h" 00033 #include "itemrepository.h" 00034 00035 00036 00037 void PolygonPainterSquareCoordinate::setpoint ( int x, int y ) 00038 { 00039 if ( (x & 1) == (y & 1) ) 00040 setpointabs ( x / 2, y); 00041 } 00042 00043 bool PolygonPainterSquareCoordinate::paintPolygon ( const Poly_gon& poly ) 00044 { 00045 Poly_gon poly1; 00046 for ( int i=0; i< poly.vertex.size() ; i++ ) 00047 poly1.vertex.push_back ( MapCoordinate( poly.vertex[i].x * 2 + (poly.vertex[i].y & 1), poly.vertex[i].y )); 00048 00049 return PolygonPainter<Poly_gon>::paintPolygon ( poly1 ); 00050 } 00051 00052 00053 00054 void Poly_gon::read ( tnstream& stream ) 00055 { 00056 int version = stream.readInt(); 00057 if ( version != 100 ) 00058 throw tinvalidversion( stream.getLocation(), 100, version ); 00059 readClassContainer ( vertex, stream ); 00060 } 00061 00062 00063 void Poly_gon::write ( tnstream& stream ) const 00064 { 00065 stream.writeInt( 100 ); 00066 writeClassContainer ( vertex, stream ); 00067 } 00068 00069 00070 00071
1.4.2