summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/moveengine.cpp
Unidiff
Diffstat (limited to 'noncore/games/backgammon/moveengine.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index 7de7147..a4145cc 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -436,49 +436,49 @@ int MoveEngine::getPossibleMoves()
436 else 436 else
437 moves[field].weight[b]=0; //default. 437 moves[field].weight[b]=0; //default.
438 } 438 }
439 439
440 440
441 441
442 else 442 else
443 moves[field].weight[b]=0; //dice already used or field not used by player 443 moves[field].weight[b]=0; //dice already used or field not used by player
444 } 444 }
445 445
446 446
447 447
448 } 448 }
449 449
450 int total=0; 450 int total=0;
451 for(int field=0;field<26;field++) 451 for(int field=0;field<26;field++)
452 { 452 {
453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3]; 453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3];
454 } 454 }
455 return total; 455 return total;
456} 456}
457 457
458void MoveEngine::move(const int& from, int to, const int& dice) 458void MoveEngine::move(const int& from, int to, const int& dice)
459{ 459{
460 //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice); 460 //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl;
461 461
462 if(player==1 && to==25) 462 if(player==1 && to==25)
463 to=26; 463 to=26;
464 if(player==2 && to==0) 464 if(player==2 && to==0)
465 to=27; 465 to=27;
466 466
467 //if space is occupied by enemy move pieces to startzone 467 //if space is occupied by enemy move pieces to startzone
468 if(fieldColor(to)==otherplayer) 468 if(fieldColor(to)==otherplayer)
469 { 469 {
470 population[to].total=0; 470 population[to].total=0;
471 if(otherplayer==1) 471 if(otherplayer==1)
472 population[0].total++; 472 population[0].total++;
473 else 473 else
474 population[25].total--; 474 population[25].total--;
475 } 475 }
476 476
477 if(player==1) 477 if(player==1)
478 { 478 {
479 population[from].total--; 479 population[from].total--;
480 population[to].total++; 480 population[to].total++;
481 } 481 }
482 else //player=2 482 else //player=2
483 { 483 {
484 population[from].total++; 484 population[from].total++;