1/* TileObject.m 2 * Object managing batch production 3 * 4 * Copyright (C) 1996-2002 by vhf interservice GmbH 5 * Author: Georg Fleischmann 6 * 7 * Created: 1996-03-07 8 * Modified: 2002-07-15 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the vhf Public License as 12 * published by vhf interservice GmbH. Among other things, the 13 * License requires that the copyright notices and this notice 14 * be preserved on all copies. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 * See the vhf Public License for more details. 20 * 21 * You should have received a copy of the vhf Public License along 22 * with this program; see the file LICENSE. If not, write to vhf. 23 * 24 * vhf interservice GmbH, Im Marxle 3, 72119 Altingen, Germany 25 * eMail: info@vhf.de 26 * http://www.vhf.de 27 */ 28 29#include <AppKit/AppKit.h> 30#include <VHFShared/types.h> 31#include "TileObject.h" 32#include "messages.h" 33 34@implementation TileObject 35 36/* 37 * This sets the class version so that we can compatibly read 38 * old VGraphic objects out of an archive. 39 */ 40+ (void)initialize 41{ 42 [TileObject setVersion:1]; 43 return; 44} 45 46- init 47{ 48 return [super init]; 49} 50 51- (void)setPosition:(NSPoint)p 52{ 53 position = p; 54} 55 56- (NSPoint)position 57{ 58 return position; 59} 60 61- (void)setAngle:(float)a 62{ 63 angle = a; 64} 65 66- (float)angle 67{ 68 return angle; 69} 70 71- (void)dealloc 72{ 73 [super dealloc]; 74} 75 76- (id)initWithCoder:(NSCoder *)aDecoder 77{ int version; 78 79 version = [aDecoder versionForClassName:@"TileObject"]; 80 if ( version < 1 ) 81 [aDecoder decodeValuesOfObjCTypes:"{ff}f", &position, &angle]; 82 else 83 [aDecoder decodeValuesOfObjCTypes:"{NSPoint=ff}f", &position, &angle]; 84 85 return self; 86} 87 88- (void)encodeWithCoder:(NSCoder *)aCoder 89{ 90 [aCoder encodeValuesOfObjCTypes:"{NSPoint=ff}f", &position, &angle]; 91} 92 93@end 94