summaryrefslogtreecommitdiff
path: root/noncore/games/buzzword/buzzword.cpp
Unidiff
Diffstat (limited to 'noncore/games/buzzword/buzzword.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/buzzword/buzzword.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/games/buzzword/buzzword.cpp b/noncore/games/buzzword/buzzword.cpp
index b870a59..97a17a1 100644
--- a/noncore/games/buzzword/buzzword.cpp
+++ b/noncore/games/buzzword/buzzword.cpp
@@ -1,14 +1,14 @@
1/* 1/*
2 * Copyright (C) 2002 Martin Imobersteg <imm@gmx.ch> 2 * Copyright (C) 2002 Martin Imobersteg <imm@gmx.ch>
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public 5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License,Life or (at your option) any later version. 7 * version 2 of the License,Life or (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
@@ -93,51 +93,51 @@ void BuzzWord::drawGrid()
93 return; 93 return;
94 94
95 QTextStream t( &f ); 95 QTextStream t( &f );
96 96
97 while (!t.atEnd()) 97 while (!t.atEnd())
98 { 98 {
99 l << t.readLine(); 99 l << t.readLine();
100 } 100 }
101 101
102 f.close(); 102 f.close();
103 103
104 grid = new QGrid(gridVal, this); 104 grid = new QGrid(gridVal, this);
105 grid->setFixedSize(240,240); 105 //grid->setFixedSize( 480, 480 );
106 106
107 for( int c = 0 ; c < gridVal ; c++ ) 107 for( int c = 0 ; c < gridVal ; c++ )
108 { 108 {
109 for( int r = 0 ; r < gridVal ; r++ ) 109 for( int r = 0 ; r < gridVal ; r++ )
110 { 110 {
111 uint pos = rand() % l. count(); 111 uint pos = rand() % l. count();
112 112
113 QString word = QStringList::split(" ", l[pos]).join("\n"); 113 QString word = QStringList::split(" ", l[pos]).join("\n");
114 BuzzItem* bi = new BuzzItem( c, r, word, grid ); 114 BuzzItem* bi = new BuzzItem( c, r, word, grid );
115 connect( bi, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)) ); 115 connect( bi, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)) );
116 map[c][r] = 0; 116 map[c][r] = 0;
117 117
118 l.remove( l.at( pos )); 118 l.remove( l.at( pos ));
119 } 119 }
120 } 120 }
121} 121}
122 122
123void BuzzWord::clicked(int row, int column) 123void BuzzWord::clicked(int row, int column)
124{ 124{
125 if ( ! gameOver ) 125 if ( ! gameOver )
126 { 126 {
127 int rowTotal = 0; 127 int rowTotal = 0;
128 int columnTotal = 0; 128 int columnTotal = 0;
129 129
130 map[column][row] = 1; 130 map[column][row] = 1;
131 131
132 for( int c = 0 ; c < gridVal ; c++ ) 132 for( int c = 0 ; c < gridVal ; c++ )
133 { 133 {
134 for( int r = 0 ; r < gridVal ; r++ ) 134 for( int r = 0 ; r < gridVal ; r++ )
135 { 135 {
136 if ( map[c][r] == 1 ) 136 if ( map[c][r] == 1 )
137 rowTotal++; 137 rowTotal++;
138 138
139 if ( rowTotal == 4 ) 139 if ( rowTotal == 4 )
140 { 140 {
141 bingo(); 141 bingo();
142 } 142 }
143 } 143 }