summaryrefslogtreecommitdiffstats
path: root/kfouleggs/field.cpp
blob: ae9bcdce196bb4835332e92f88dc55ad0771b22a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "field.h"
#include "field.moc"

#include <tqwhatsthis.h>

#include <klocale.h>
#include <kgamelcd.h>

#include "common/commonprefs.h"
#include "board.h"


FEField::FEField(TQWidget *parent)
    : Field(parent)
{
    Board *b = static_cast<Board *>(board);
    TQWhatsThis::add(b->giftPool(), i18n("Display the amount of foul eggs sent by your opponent."));
}

void FEField::removedUpdated()
{
    Field::removedUpdated();
    const FEBoard *feb = static_cast<const FEBoard *>(board);
    KGameLCD *lcd = static_cast<KGameLCD *>(removedList->lcd(0));
    lcd->displayInt(feb->nbPuyos());
    if ( feb->nbPuyos() ) lcd->highlight();
    if ( CommonPrefs::showDetailedRemoved() )
      for (uint i=0; i<4; i++) {
        if ( !(feb->lastChained() & 2<<i) ) continue;
        lcd = static_cast<KGameLCD *>(removedList->lcd(i+1));
        lcd->displayInt(feb->nbChainedPuyos(i));
        if ( feb->nbChainedPuyos(i) ) lcd->highlight();
      }
}

void FEField::settingsChanged()
{
    Field::settingsChanged();

    removedList->clear();
    KGameLCD *lcd = new KGameLCD(6, removedList);
    removedList->append(i18n("Total:"), lcd);
    uint nb = static_cast<const FEBoard *>(board)->nbPuyos();
    lcd->displayInt(nb);
    lcd->show();
        
    if ( CommonPrefs::showDetailedRemoved() ) {
      TQWhatsThis::add(removedList,
                      i18n("Display the number of removed groups (\"puyos\") classified by the number of chained removal."));
      for (uint i=0; i<4; i++) {
          KGameLCD *lcd = new KGameLCD(6, removedList);
          TQString s = (i==3 ? ">3" : TQString::number(i));
          removedList->append(s, lcd);
          uint nb = static_cast<const FEBoard *>(board)->nbChainedPuyos(i);
          lcd->displayInt(nb);
          lcd->show();
      }
    } else 
      TQWhatsThis::add(removedList,
                    i18n("Display the number of removed groups (\"puyos\")."));
}