File indexing completed on 2024-04-21 15:07:59

0001 // Copyright (c) 2002 Rob Kaper <cap@capsi.com>
0002 //
0003 // This library is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU Lesser General Public
0005 // License version 2.1 as published by the Free Software Foundation.
0006 //
0007 // This library is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // Lesser General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU Lesser General Public License
0013 // along with this library; see the file COPYING.LIB.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #include "auction.h"
0018 #include "player.h"
0019 #include "estate.h"
0020 
0021 Auction::Auction(int auctionId, Estate *estate)
0022     : QObject()
0023     , m_changed(false)
0024     , m_auctionId(auctionId)
0025     , m_status(0)
0026     , m_estate(estate)
0027 {
0028 }
0029 
0030 Auction::~Auction()
0031 {
0032     Q_EMIT completed();
0033 }
0034 
0035 void Auction::setStatus(int status)
0036 {
0037     if (m_status != status)
0038     {
0039         m_status = status;
0040         m_changed = true;
0041     }
0042 }
0043 
0044 void Auction::newBid(Player *player, int amount)
0045 {
0046     Q_EMIT updateBid(player, amount);
0047 }
0048 
0049 void Auction::update(bool force)
0050 {
0051     if (m_changed || force)
0052     {
0053         Q_EMIT changed();
0054         m_changed = false;
0055     }
0056 }
0057 
0058 #include "moc_auction.cpp"