-rw-r--r-- | noncore/games/backgammon/moveengine.cpp | 6 | ||||
-rw-r--r-- | noncore/games/kbill/UI.cpp | 31 | ||||
-rw-r--r-- | noncore/games/kcheckers/echeckers.cpp | 12 | ||||
-rw-r--r-- | noncore/games/kcheckers/rcheckers.cpp | 36 | ||||
-rw-r--r-- | noncore/settings/sysinfo/contrib/fft.c | 2 | ||||
-rw-r--r-- | noncore/styles/theme/othemebase.cpp | 2 |
6 files changed, 51 insertions, 38 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp index a4145cc..b102258 100644 --- a/noncore/games/backgammon/moveengine.cpp +++ b/noncore/games/backgammon/moveengine.cpp @@ -44,25 +44,26 @@ void MoveEngine::position(Pieces& pieces,bool non_qte) int player1_counter=0; int player2_counter=0; //non qte styles are smaller !! int offset=(non_qte) ? 5 : 0; for(int a=0;a<28;a++) { for(int b=0;b<abs(population[a].total);b++) { if(population[a].total>0) //player 1 pieces { - pieces.player1[player1_counter].x=x_coord[a]-offset; + if (a < 26) + pieces.player1[player1_counter].x=x_coord[a]-offset; if(a>=0 && a<13) { pieces.player1[player1_counter].y=yup_coord[b]-offset; pieces.player1[player1_counter].z=z_coord[b]; pieces.player1[player1_counter].side=false; player1_counter++; } else if(a>12 && a<26) { pieces.player1[player1_counter].y=ylow_coord[b]-offset; pieces.player1[player1_counter].z=z_coord[b]; pieces.player1[player1_counter].side=false; @@ -87,25 +88,26 @@ void MoveEngine::position(Pieces& pieces,bool non_qte) pieces.player1[player1_counter].x=x_fin1[2]-offset; pieces.player1[player1_counter].y=y_fin[b-10]-offset; pieces.player1[player1_counter].z=z_fin; } pieces.player1[player1_counter].side=true; player1_counter++; } } else if(population[a].total<0) //player 2 pieces { - pieces.player2[player2_counter].x=x_coord[a]-offset; + if (a < 26) + pieces.player2[player2_counter].x=x_coord[a]-offset; if(a>=0 && a<13) { pieces.player2[player2_counter].y=yup_coord[b]-offset; pieces.player2[player2_counter].z=z_coord[b]; pieces.player2[player2_counter].side=false; player2_counter++; } else if(a>12 && a<26) { pieces.player2[player2_counter].y=ylow_coord[b]-offset; pieces.player2[player2_counter].z=z_coord[b]; pieces.player2[player2_counter].side=false; diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp index 611cebf..a49c3c1 100644 --- a/noncore/games/kbill/UI.cpp +++ b/noncore/games/kbill/UI.cpp @@ -59,46 +59,45 @@ void UI::graph_init() { void UI::make_mainwin() { main = new KBill(); app->showMainWidget(main,true); main->showMaximized(); field = main->getField(); } void UI::popup_dialog (int dialog) { kill_timer(); switch (dialog) { case Game::ENDGAME: - QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); - break; + QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); + break; case Game::HIGHSCORE: - // QMessageBox::message(("HighScore"), highscorestr); - break; - case Game::ENTERNAME: { + break; + case Game::ENTERNAME: + { InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); bool state = b.exec() == 2; - char str[20], *nl; - strcpy(str, b.getText()); - if (!str[0] || state) + char str[20], *nl; + strncpy(str, b.getText(), 19); + if (!str[0] || state) strcpy(str, "Anonymous"); - else if ((nl = strchr(str, '\n'))) + else if ((nl = strchr(str, '\n'))) *nl = '\0'; - if (strlen(str) > 20) - str[20] = 0; /* truncate string if too long */ -// scores.recalc(str); - } - break; + if (strlen(str) > 19) + str[19] = '\0'; /* truncate/terminate the string if it is too long */ + } + break; case Game::SCORE: - QMessageBox::message(("Score"), scorestr); - break; + QMessageBox::message(("Score"), scorestr); + break; } restart_timer(); } /*********************/ /* Graphics routines */ /*********************/ void UI::set_cursor(int cursor) { QCursor *cur; switch (cursor) { case Game::BUCKETC: diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp index 1146059..afe62eb 100644 --- a/noncore/games/kcheckers/echeckers.cpp +++ b/noncore/games/kcheckers/echeckers.cpp @@ -70,27 +70,27 @@ bool ECheckers::checkCapture1() case MAN1: if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; break; case KING1: if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; if(board[i+5]==MAN2 || board[i+5]==KING2) - if(board[i+10]==FREE) return true; + if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; if(board[i+6]==MAN2 || board[i+6]==KING2) - if(board[i+12]==FREE) return true; + if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; } } return false; } // Return TRUE if a course of the user true // Return FALSE if a course of the user incorrect bool ECheckers::manCapture1(int from,int direction,bool &capture) { int i=from+direction; @@ -212,37 +212,37 @@ void ECheckers::kingMove2(int from,int &resMax) board[from]=KING2; } bool ECheckers::checkCapture2() { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i+5]==MAN1 || board[i+5]==KING1) - if(board[i+10]==FREE) return true; + if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) - if(board[i+12]==FREE) return true; + if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; break; case KING2: if(board[i-6]==MAN1 || board[i-6]==KING1) if(board[i-12]==FREE) return true; if(board[i-5]==MAN1 || board[i-5]==KING1) if(board[i-10]==FREE) return true; if(board[i+5]==MAN1 || board[i+5]==KING1) - if(board[i+10]==FREE) return true; + if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) - if(board[i+12]==FREE) return true; + if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; } } return false; } // Return TRUE if it is possible to capture // Return FALSE if it is impossible to capture bool ECheckers::manCapture2(int from,int &resMax) { bool capture=false; diff --git a/noncore/games/kcheckers/rcheckers.cpp b/noncore/games/kcheckers/rcheckers.cpp index a1c7afa..d808780 100644 --- a/noncore/games/kcheckers/rcheckers.cpp +++ b/noncore/games/kcheckers/rcheckers.cpp @@ -103,45 +103,51 @@ bool RCheckers::go1(int from,int field) bool RCheckers::checkCapture1() { for(int i=6;i<48;i++) { switch(board[i]) { case MAN1: if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; if(board[i+5]==MAN2 || board[i+5]==KING2) - if(board[i+10]==FREE) return true; + if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; if(board[i+6]==MAN2 || board[i+6]==KING2) - if(board[i+12]==FREE) return true; + if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; break; case KING1: int k; for(k=i-6;board[k]==FREE;k-=6); if(board[k]==MAN2 || board[k]==KING2) if(board[k-6]==FREE) return true; for(k=i-5;board[k]==FREE;k-=5); if(board[k]==MAN2 || board[k]==KING2) if(board[k-5]==FREE) return true; - for(k=i+5;board[k]==FREE;k+=5); + for(k=i+5;board[k]==FREE;k+=5) { + if (k >= 49) + break; + } if(board[k]==MAN2 || board[k]==KING2) - if(board[k+5]==FREE) return true; + if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true; - for(k=i+6;board[k]==FREE;k+=6); + for(k=i+6;board[k]==FREE;k+=6) { + if (k >=48) + break; + } if(board[k]==MAN2 || board[k]==KING2) - if(board[k+6]==FREE) return true; + if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true; } } return false; } // Return TRUE if a course of the user true // Return FALSE if a course of the user incorrect bool RCheckers::manCapture1(int from,int direction,bool &capture) { int i=from+direction; @@ -277,45 +283,51 @@ void RCheckers::kingMove2(int from,int &resMax) bool RCheckers::checkCapture2() { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i-6]==MAN1 || board[i-6]==KING1) if(board[i-12]==FREE) return true; if(board[i-5]==MAN1 || board[i-5]==KING1) if(board[i-10]==FREE) return true; if(board[i+5]==MAN1 || board[i+5]==KING1) - if(board[i+10]==FREE) return true; + if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) - if(board[i+12]==FREE) return true; + if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; break; case KING2: int k; for(k=i-6;board[k]==FREE;k-=6); if(board[k]==MAN1 || board[k]==KING1) if(board[k-6]==FREE) return true; for(k=i-5;board[k]==FREE;k-=5); if(board[k]==MAN1 || board[k]==KING1) if(board[k-5]==FREE) return true; - for(k=i+5;board[k]==FREE;k+=5); + for(k=i+5;board[k]==FREE;k+=5) { + if (k>=49) + break; + } if(board[k]==MAN1 || board[k]==KING1) - if(board[k+5]==FREE) return true; + if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true; - for(k=i+6;board[k]==FREE;k+=6); + for(k=i+6;board[k]==FREE;k+=6) { + if (k>=48) + break; + } if(board[k]==MAN1 || board[k]==KING1) - if(board[k+6]==FREE) return true; + if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true; } } return false; } // Return TRUE if it is possible to capture // Return FALSE if it is impossible to capture bool RCheckers::manCapture2(int from,int &resMax) { bool capture=false; diff --git a/noncore/settings/sysinfo/contrib/fft.c b/noncore/settings/sysinfo/contrib/fft.c index 01a1b26..60ee27d 100644 --- a/noncore/settings/sysinfo/contrib/fft.c +++ b/noncore/settings/sysinfo/contrib/fft.c @@ -20,25 +20,25 @@ // Author : Satoshi ( af230533@im07.alpha-net.ne.jp ) // ****************************************************************** //*********************************************************************** // ¹â®¥Õ¡¼¥ê¥¨ÊÑ´¹¡Ê£Æ£Æ£Ô¡Ë // ¹¹¤Ë¥¹¥Ô¡¼¥É¡¦¥¢¥Ã¥×¤¹¤ë¤Ë¤Ï£Ã£Ï£Ó¤ò¸ÇÄê¤Ç»ý¤Ä¤³¤È¡ª // // Copyright (C) Satoshi 1994-2002 All rights reserved. // *********************************************************************** #include <math.h> -#define FFT_TEST_COUNT 500 // Bench FFT +#define FFT_TEST_COUNT 332 // Bench FFT // ----------------------------------------------------- FFT #define OBJ_DATA_COUNT 128 #define OBJ_DATA_SISU 7 // 128 = 2 ** 7 #define OBJ_DATA_SLIDE 1 #define FFT_TRN 1 #define IFFT_TRN -1 typedef struct _fft { int N; // ¥Ç¥¸¥¿¥ë¡¦¥Ç¡¼¥¿·ï¿ô int r; // N = 2^r diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp index 4275dd6..7fb12a3 100644 --- a/noncore/styles/theme/othemebase.cpp +++ b/noncore/styles/theme/othemebase.cpp @@ -995,25 +995,25 @@ void OThemeBase::readResourceGroup( int i, QString *copyfrom, QString *pixnames, tmpStr = copyfrom [ i ]; if ( !tmpStr.isEmpty() ) { // Duplicate another widget's config int sIndex; loadArray[ i ] = true; for ( sIndex = 0; sIndex < WIDGETS; ++sIndex ) { if ( tmpStr == widgetEntries[ sIndex ] ) { if ( !loadArray[ sIndex ] ) // hasn't been loaded yet readResourceGroup( sIndex, copyfrom, pixnames, brdnames, loadArray ); break; } } - if ( loadArray[ sIndex ] ) { + if ( sIndex < 54 && loadArray[ sIndex ] ) { copyWidgetConfig( sIndex, i, pixnames, brdnames ); } else odebug << "OThemeBase: Unable to identify source widget for " << widgetEntries[ i ] << oendl; return ; } // special inheritance for disabled arrows (these are tri-state unlike // the rest of what we handle). for ( tmpVal = DisArrowUp; tmpVal <= DisArrowRight; ++tmpVal ) { if ( tmpVal == i ) { tmpStr = pixnames [ i ]; if ( tmpStr.isEmpty() ) { |