00001 /********************************************************************** 00002 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of Qtopia Environment. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00015 ** 00016 ** Contact info@trolltech.com if any conditions of this licensing are 00017 ** not clear to you. 00018 ** 00019 **********************************************************************/ 00020 #include "cardgamelayout.h" 00021 00022 00023 CardGameLayout::~CardGameLayout() 00024 { 00025 // Should I just do setAutoDelete( TRUE ); ? 00026 for (CardPile *p = first(); p != NULL; p = next()) 00027 delete p; 00028 } 00029 00030 00031 CardPile *CardGameLayout::closestPile(int x, int y, int maxDistance) 00032 { 00033 int closestDistance = maxDistance * maxDistance; 00034 CardPile *closestPile = NULL; 00035 00036 for (CardPile *p = first(); p != NULL; p = next()) { 00037 int d = p->distanceFromNextPos(x, y); 00038 if (d < closestDistance) { 00039 closestDistance = d; 00040 closestPile = p; 00041 } 00042 } 00043 00044 return closestPile; 00045 } 00046 00047 00048 void CardGameLayout::beginDealing() 00049 { 00050 for (CardPile *p = first(); p != NULL; p = next()) 00051 p->beginDealing(); 00052 } 00053 00054 00055 void CardGameLayout::endDealing() 00056 { 00057 for (CardPile *p = first(); p != NULL; p = next()) 00058 p->endDealing(); 00059 } 00060 00061
1.4.2