Diffstat (limited to 'noncore/games/wordgame/wordgame.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/wordgame/wordgame.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp index d3160f4..d46e824 100644 --- a/noncore/games/wordgame/wordgame.cpp +++ b/noncore/games/wordgame/wordgame.cpp | |||
@@ -269,73 +269,73 @@ void WordGame::startGame(const QStringList& playerlist) | |||
269 | for (QStringList::ConstIterator it=playerlist.begin(); it!=playerlist.end(); ++it) | 269 | for (QStringList::ConstIterator it=playerlist.begin(); it!=playerlist.end(); ++it) |
270 | addPlayer(*it); | 270 | addPlayer(*it); |
271 | scoreinfo->init(namelist); | 271 | scoreinfo->init(namelist); |
272 | 272 | ||
273 | if ( nplayers ) { | 273 | if ( nplayers ) { |
274 | player=0; | 274 | player=0; |
275 | readyRack(player); | 275 | readyRack(player); |
276 | } | 276 | } |
277 | 277 | ||
278 | board->show(); | 278 | board->show(); |
279 | racks->show(); | 279 | racks->show(); |
280 | } | 280 | } |
281 | 281 | ||
282 | bool WordGame::loadRules(const QString &name) | 282 | bool WordGame::loadRules(const QString &name) |
283 | { | 283 | { |
284 | QString filename = Global::applicationFileName( "wordgame", name ); | 284 | QString filename = Global::applicationFileName( "wordgame", name ); |
285 | QFile file( filename ); | 285 | QFile file( filename ); |
286 | if ( !file.open( IO_ReadOnly ) ) | 286 | if ( !file.open( IO_ReadOnly ) ) |
287 | return FALSE; | 287 | return FALSE; |
288 | 288 | ||
289 | QTextStream ts( &file ); | 289 | QTextStream ts( &file ); |
290 | 290 | ||
291 | QString title = name; | 291 | QString title = name; |
292 | title.truncate( title.length() - 6 ); | 292 | title.truncate( title.length() - 6 ); |
293 | setCaption( title ); | 293 | //setCaption( title ); |
294 | 294 | ||
295 | QString shapepixmap; | 295 | QString shapepixmap; |
296 | ts >> shapepixmap; | 296 | ts >> shapepixmap; |
297 | int htiles,vtiles; | 297 | int htiles,vtiles; |
298 | ts >> htiles >> vtiles; | 298 | ts >> htiles >> vtiles; |
299 | 299 | ||
300 | if ( htiles < 3 || vtiles < 3 ) | 300 | if ( htiles < 3 || vtiles < 3 ) |
301 | return FALSE; | 301 | return FALSE; |
302 | 302 | ||
303 | QString rule_shapes; | 303 | QString rule_shapes; |
304 | for (int i=0; i<vtiles; i++) { | 304 | for (int i=0; i<vtiles; i++) { |
305 | QString line; | 305 | QString line; |
306 | ts >> line; | 306 | ts >> line; |
307 | rule_shapes += line; | 307 | rule_shapes += line; |
308 | } | 308 | } |
309 | static int rule_effects[12]; | 309 | static int rule_effects[12]; |
310 | int re=0,e; | 310 | int re=0,e; |
311 | ts >> e; | 311 | ts >> e; |
312 | while ( e && re < 10 ) { | 312 | while ( e && re < 10 ) { |
313 | rule_effects[re] = e; | 313 | rule_effects[re] = e; |
314 | if ( re++ < 10 ) ts >> e; | 314 | if ( re++ < 10 ) ts >> e; |
315 | } | 315 | } |
316 | 316 | ||
317 | QImage shim = Resource::loadImage("wordgame/wordgame_shapes.xpm"); | 317 | QImage shim = Resource::loadImage("wordgame/wordgame_shapes"); |
318 | shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight()); | 318 | shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight()); |
319 | QPixmap bgshapes; | 319 | QPixmap bgshapes; |
320 | bgshapes.convertFromImage(shim); | 320 | bgshapes.convertFromImage(shim); |
321 | 321 | ||
322 | rule_effects[re++] = 100; // default bonus | 322 | rule_effects[re++] = 100; // default bonus |
323 | board = new Board(bgshapes, htiles, vtiles, vbox); | 323 | board = new Board(bgshapes, htiles, vtiles, vbox); |
324 | board->setRules(rule_shapes, rule_effects); | 324 | board->setRules(rule_shapes, rule_effects); |
325 | connect(board, SIGNAL(temporaryScore(int)), scoreinfo, SLOT(showTemporaryScore(int))); | 325 | connect(board, SIGNAL(temporaryScore(int)), scoreinfo, SLOT(showTemporaryScore(int))); |
326 | 326 | ||
327 | bag = new Bag; | 327 | bag = new Bag; |
328 | 328 | ||
329 | int count; | 329 | int count; |
330 | ts >> count; | 330 | ts >> count; |
331 | while ( count ) { | 331 | while ( count ) { |
332 | QString text; | 332 | QString text; |
333 | int value; | 333 | int value; |
334 | ts >> text >> value; | 334 | ts >> text >> value; |
335 | if ( text == "_" ) | 335 | if ( text == "_" ) |
336 | text = ""; | 336 | text = ""; |
337 | 337 | ||
338 | Tile t(text, value); | 338 | Tile t(text, value); |
339 | for (int n=count; n--; ) | 339 | for (int n=count; n--; ) |
340 | bag->add(t); | 340 | bag->add(t); |
341 | 341 | ||