-rw-r--r-- | noncore/games/kcheckers/kcheckers.cpp | 1 | ||||
-rw-r--r-- | noncore/todayplugins/stockticker/libstocks/currency.c | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/games/kcheckers/kcheckers.cpp b/noncore/games/kcheckers/kcheckers.cpp index a27dd18..433c68f 100644 --- a/noncore/games/kcheckers/kcheckers.cpp +++ b/noncore/games/kcheckers/kcheckers.cpp | |||
@@ -385,96 +385,97 @@ void KCheckers::help() | |||
385 | "the board becomes a king.\n" | 385 | "the board becomes a king.\n" |
386 | "The kings move forward or\n" | 386 | "The kings move forward or\n" |
387 | "backward:\n" | 387 | "backward:\n" |
388 | "- to one square only (english rules);\n" | 388 | "- to one square only (english rules);\n" |
389 | "- to any number of squares (russian\n" | 389 | "- to any number of squares (russian\n" |
390 | " rules).\n" | 390 | " rules).\n" |
391 | "The kings capture by jumping\n" | 391 | "The kings capture by jumping\n" |
392 | "forward or backward.\n" | 392 | "forward or backward.\n" |
393 | "Whenever a player is able to make a\n" | 393 | "Whenever a player is able to make a\n" |
394 | "capture he must do so.", | 394 | "capture he must do so.", |
395 | QMessageBox::Ok|QMessageBox::Default); | 395 | QMessageBox::Ok|QMessageBox::Default); |
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | void KCheckers::about() | 399 | void KCheckers::about() |
400 | { | 400 | { |
401 | QMessageBox::about(this,"About KCheckers", | 401 | QMessageBox::about(this,"About KCheckers", |
402 | "KCheckers, a board game. Ver 0.3\n" | 402 | "KCheckers, a board game. Ver 0.3\n" |
403 | "(C) 2002, A. Peredri <andi@ukr.net>\n\n" | 403 | "(C) 2002, A. Peredri <andi@ukr.net>\n\n" |
404 | "http://kcheckers.tuxfamily.org\n\n" | 404 | "http://kcheckers.tuxfamily.org\n\n" |
405 | "Contributors:\n" | 405 | "Contributors:\n" |
406 | "S. Rosen <srosen@erols.com>\n\n" | 406 | "S. Rosen <srosen@erols.com>\n\n" |
407 | "Qtopia version: S.Prud'homme\n" | 407 | "Qtopia version: S.Prud'homme\n" |
408 | "<prudhomme@laposte.net>\n\n" | 408 | "<prudhomme@laposte.net>\n\n" |
409 | "This program is distributed under the\n" | 409 | "This program is distributed under the\n" |
410 | "terms of the GNU General Public\n" | 410 | "terms of the GNU General Public\n" |
411 | "License."); | 411 | "License."); |
412 | } | 412 | } |
413 | 413 | ||
414 | 414 | ||
415 | void KCheckers::aboutQt() | 415 | void KCheckers::aboutQt() |
416 | { | 416 | { |
417 | QMessageBox::aboutQt(this); | 417 | QMessageBox::aboutQt(this); |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | void KCheckers::newGame() | 421 | void KCheckers::newGame() |
422 | { | 422 | { |
423 | if(game) delete game; | 423 | if(game) delete game; |
424 | 424 | ||
425 | switch(rules) | 425 | switch(rules) |
426 | { | 426 | { |
427 | case ENGLISH: | 427 | case ENGLISH: |
428 | game=new ECheckers(skill); | 428 | game=new ECheckers(skill); |
429 | CHECK_PTR(game); | 429 | CHECK_PTR(game); |
430 | break; | 430 | break; |
431 | 431 | ||
432 | case RUSSIAN: | 432 | case RUSSIAN: |
433 | default: | ||
433 | game=new RCheckers(skill); | 434 | game=new RCheckers(skill); |
434 | CHECK_PTR(game); | 435 | CHECK_PTR(game); |
435 | } | 436 | } |
436 | 437 | ||
437 | unselect(); | 438 | unselect(); |
438 | gameOver=false; | 439 | gameOver=false; |
439 | 440 | ||
440 | gameMenu->setItemEnabled(undoID,false); | 441 | gameMenu->setItemEnabled(undoID,false); |
441 | undoButton->setEnabled(false); | 442 | undoButton->setEnabled(false); |
442 | 443 | ||
443 | colorChange(); | 444 | colorChange(); |
444 | 445 | ||
445 | for(int i=0;i<32;i++) drawBoard(i); | 446 | for(int i=0;i<32;i++) drawBoard(i); |
446 | if(optionsMenu->isItemChecked(numID)) drawNumeration(); | 447 | if(optionsMenu->isItemChecked(numID)) drawNumeration(); |
447 | 448 | ||
448 | if(!userFirst) compGo(); | 449 | if(!userFirst) compGo(); |
449 | 450 | ||
450 | statusLabel->setText(tr("Go!")); | 451 | statusLabel->setText(tr("Go!")); |
451 | } | 452 | } |
452 | 453 | ||
453 | 454 | ||
454 | // Undo the last computer and user moves | 455 | // Undo the last computer and user moves |
455 | 456 | ||
456 | void KCheckers::undoMove() | 457 | void KCheckers::undoMove() |
457 | { | 458 | { |
458 | for(int i=0;i<32;i++) | 459 | for(int i=0;i<32;i++) |
459 | { | 460 | { |
460 | game->board[t[i]]=undoBoard[i]; | 461 | game->board[t[i]]=undoBoard[i]; |
461 | drawBoard(i); | 462 | drawBoard(i); |
462 | } | 463 | } |
463 | 464 | ||
464 | unselect(); | 465 | unselect(); |
465 | gameOver=false; | 466 | gameOver=false; |
466 | 467 | ||
467 | gameMenu->setItemEnabled(undoID,false); | 468 | gameMenu->setItemEnabled(undoID,false); |
468 | undoButton->setEnabled(false); | 469 | undoButton->setEnabled(false); |
469 | 470 | ||
470 | statusLabel->setText(tr("Go!")); | 471 | statusLabel->setText(tr("Go!")); |
471 | } | 472 | } |
472 | 473 | ||
473 | 474 | ||
474 | void KCheckers::colorChange() | 475 | void KCheckers::colorChange() |
475 | { | 476 | { |
476 | userFirst=!userFirst; | 477 | userFirst=!userFirst; |
477 | 478 | ||
478 | QImage* image; | 479 | QImage* image; |
479 | image=imageMan1; | 480 | image=imageMan1; |
480 | imageMan1=imageMan2; | 481 | imageMan1=imageMan2; |
diff --git a/noncore/todayplugins/stockticker/libstocks/currency.c b/noncore/todayplugins/stockticker/libstocks/currency.c index e0090e2..82cd654 100644 --- a/noncore/todayplugins/stockticker/libstocks/currency.c +++ b/noncore/todayplugins/stockticker/libstocks/currency.c | |||
@@ -11,57 +11,56 @@ | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. | 13 | * Library General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU Library General Public | 15 | * You should have received a copy of the GNU Library General Public |
16 | * License along with this library; if not, write to the | 16 | * License along with this library; if not, write to the |
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | * Boston, MA 02111-1307, USA. | 18 | * Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define __CURRENCY_C__ | 21 | #define __CURRENCY_C__ |
22 | 22 | ||
23 | 23 | ||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include <malloc.h> | 26 | #include <malloc.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | 28 | ||
29 | #include "stocks.h" | 29 | #include "stocks.h" |
30 | 30 | ||
31 | /*****************************************************************************/ | 31 | /*****************************************************************************/ |
32 | /* returns the currency exchange rate of "from" currency into */ | 32 | /* returns the currency exchange rate of "from" currency into */ |
33 | /* "into" currency. */ | 33 | /* "into" currency. */ |
34 | /*****************************************************************************/ | 34 | /*****************************************************************************/ |
35 | libstocks_return_code get_currency_exchange(char *from, | 35 | libstocks_return_code get_currency_exchange(char *from, |
36 | char *into, | 36 | char *into, |
37 | float *exchange) | 37 | float *exchange) |
38 | { | 38 | { |
39 | char *symbol; | 39 | char *symbol; |
40 | stock *data; | 40 | stock *data; |
41 | libstocks_return_code error; | 41 | libstocks_return_code error; |
42 | 42 | ||
43 | if((symbol = (char *)malloc(strlen(from)+strlen(into)+3))==NULL) | 43 | if((symbol = (char *)malloc(strlen(from)+strlen(into)+3))==NULL) |
44 | { | 44 | { |
45 | fprintf(stderr,"Memory allocating error (%s line %d)\n" | 45 | fprintf(stderr,"Memory allocating error (%s line %d)\n" |
46 | ,__FILE__, __LINE__); | 46 | ,__FILE__, __LINE__); |
47 | exit(1); | 47 | exit(1); |
48 | } | 48 | } |
49 | 49 | ||
50 | strcpy(symbol, from); | 50 | strcpy(symbol, from); |
51 | strcat(symbol, into); | 51 | strcat(symbol, into); |
52 | strcat(symbol, "=X"); | 52 | strcat(symbol, "=X"); |
53 | 53 | ||
54 | error = get_stocks(symbol, &data); | 54 | error = get_stocks(symbol, &data); |
55 | free(symbol); | 55 | free(symbol); |
56 | if (error) | 56 | if (error) |
57 | { | 57 | { |
58 | *exchange = 0; | 58 | *exchange = 0; |
59 | return(error); | 59 | return error; |
60 | } | 60 | } |
61 | 61 | ||
62 | free_stocks(data); | ||
63 | |||
64 | *exchange = data->CurrentPrice; | 62 | *exchange = data->CurrentPrice; |
65 | return(error); | 63 | free_stocks(data); |
64 | return error; | ||
66 | 65 | ||
67 | } | 66 | } |