Rev 1805 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1805 | Rev 4652 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #ifndef AUTOBUILD |
|
- | 2 | #include "lang.h" |
|
- | 3 | #endif |
|
- | 4 | //#define BUILD_RUS |
|
1 | #define BUILD_RUS |
5 | #ifndef __MENUET__ |
2 | #ifndef __MENUET__ |
6 | #include |
3 | #include |
7 | #include |
4 | #include |
8 | #include |
5 | #include |
9 | #include |
6 | #include |
10 | #include |
Line 289... | Line 293... | ||
289 | static int ReadTheText(FILE *f, const char *s); |
293 | #endif |
290 | #endif |
294 | }; |
291 | }; |
295 | |
Line 292... | Line 296... | ||
292 | 296 | #ifndef __MENUET__ |
|
- | 297 | #if LANG_RUS //Pending Russian Translations |
|
- | 298 | #define CHECKERS_CANT_OPEN_STR "\n 誨: ¥ ¬®£ã ®âªàëâì ä ©« \"%s\".\n" |
|
- | 299 | #define CHECKERS_FILE_EMPTY_STR "\n 誨: ©« \"%s\" ¯ãáâ.\n" |
|
- | 300 | #define CHECKERS_INVALID_FILE_STR "\n 誨: ©« \"%s\" ®è¨¡®çë©.\n" |
|
- | 301 | #define FILE_WRONG_TYPE_STR "\n 誨: ©« \"%s\" ¨¬¥¥â ¥¢¥àë© â¨¯.\n" |
|
- | 302 | #define ERROR_OPENING_FILE_STR "\n 誨: 訡ª ®âªàëâ¨ï ä ©« \"%s\".\n" |
|
- | 303 | #define FILE_HAS_NO_GAMES_STR "\n 誨: ©« \"%s\" ¥ ᮤ¥à¦¨â ¨£à.\n" |
|
- | 304 | #define CANT_OPEN_FILE_STR "\n 誨: ¥ ¬®£ã ®âªàëâì ä ©« \"%s\" § ¯¨áì.\n" |
|
- | 305 | #define CHECKERS_STR " 誨" |
|
- | 306 | #define FILE_SAVED_STR "\n 誨: ©« \"%s\" á®åà ñ.\n" |
|
- | 307 | #define ERROR_SAVING_FILE_STR "\n 誨: 訡ª á®åà ¥¨ï ä ©« \"%s\".\n" |
|
- | 308 | #define NOT_ENOUGH_MEM_STR "\n 誨: ¥ ¤®áâ â®ç® ¯ ¬ï⨠¤«ï á®åà ¥¨ï ä ©« \"%s\".\n" |
|
- | 309 | #define KIND_EQ2 "kind = 2\n" |
|
- | 310 | #define END_STR "[end]" |
|
- | 311 | #define PLAYV11_STR "[play_v1.1]" |
|
- | 312 | #define CHECKERS_PLAY_STR "checkers-play:text\n" |
|
- | 313 | #define CHECKERS_BIN_STR "checkers-play:bin_1.0\n" |
|
- | 314 | #define BLUE_STR "blue: " |
|
- | 315 | #define RED_STR "red: " |
|
- | 316 | #define INPUT_STR "input" |
|
- | 317 | #define COMPUTER_STR "computer" |
|
- | 318 | #define NEW_GAME_STR "new game" |
|
- | 319 | #define LIST_STR "list" |
|
- | 320 | #define DELETE_STR "delete" |
|
- | 321 | #define CLEAR_STR "clear" |
|
- | 322 | #define SAVE_STR "save" |
|
- | 323 | #define ROTATE_BOARD_STR "rotate board" |
|
- | 324 | #define EXIT_STR "exit" |
|
- | 325 | #define CHECKERS_INVALID_STR "Checkers: Invalid key %s\n" |
|
- | 326 | ||
- | 327 | const char *const TPlayArray::search[] = |
|
- | 328 | {"checkers-", "play:", "text", "bin_1.0\n", "history_", "1.0", "1.1"}; |
|
- | 329 | ||
- | 330 | #else /*For all other languages except RUS*/ |
|
- | 331 | #define CHECKERS_CANT_OPEN_STR "\nCheckers: Can't open the file \"%s\".\n" |
|
- | 332 | #define CHECKERS_FILE_EMPTY_STR "\nCheckers: The file \"%s\" is empty.\n" |
|
- | 333 | #define CHECKERS_INVALID_FILE_STR "\nCheckers: Invalid file \"%s\".\n" |
|
- | 334 | #define FILE_WRONG_TYPE_STR "\nCheckers: The file \"%s\" has the wrong type.\n" |
|
- | 335 | #define ERROR_OPENING_FILE_STR "\nCheckers: Error opening the file \"%s\".\n" |
|
- | 336 | #define FILE_HAS_NO_GAMES_STR "\nCheckers: File \"%s\" doesn't contain games.\n" |
|
- | 337 | #define CANT_OPEN_FILE_STR "\nCheckers: Can't open the file \"%s\" to write.\n" |
|
- | 338 | #define NOT_ENOUGH_MEM_STR "\nCheckers: Not enough memory to save the file \"%s\".\n" |
|
- | 339 | #define ERROR_SAVING_FILE_STR "\nCheckers: Error saving the file \"%s\".\n" |
|
- | 340 | #define FILE_SAVED_STR "\nCheckers: File \"%s\" saved.\n" |
|
- | 341 | #define CHECKERS_STR "Checkers" |
|
- | 342 | #define KIND_EQ2 "kind = 2\n" |
|
- | 343 | #define END_STR "[end]" |
|
- | 344 | #define PLAYV11_STR "[Play_v1.1]" |
|
- | 345 | #define CHECKERS_PLAY_STR "checkers-play:text\n" |
|
- | 346 | #define CHECKERS_BIN_STR "checkers-play:bin_1.0\n" |
|
- | 347 | #define BLUE_STR "blue: " |
|
- | 348 | #define RED_STR "red: " |
|
- | 349 | #define INPUT_STR "input" |
|
- | 350 | #define COMPUTER_STR "computer" |
|
- | 351 | #define NEW_GAME_STR "new game" |
|
- | 352 | #define LIST_STR "list" |
|
- | 353 | #define DELETE_STR "delete" |
|
- | 354 | #define CLEAR_STR "clear" |
|
- | 355 | #define SAVE_STR "save" |
|
- | 356 | #define ROTATE_BOARD_STR "rotate board" |
|
- | 357 | #define EXIT_STR "exit" |
|
- | 358 | #define CHECKERS_INVALID_STR "Checkers: Invalid key %s\n" |
|
293 | #ifndef __MENUET__ |
359 | const char *const TPlayArray::search[] = |
294 | const char *const TPlayArray::search[] = |
360 | {"checkers-", "play:", "text", "bin_1.0\n", "history_", "1.0", "1.1"}; |
295 | {"checkers-", "play:", "text", "bin_1.0\n", "history_", "1.0", "1.1"}; |
- | |
Line -... | Line 361... | ||
- | 361 | ||
- | 362 | #endif |
|
296 | #endif |
363 | #endif |
297 | 364 | void TPlayArray::Clear() |
|
298 | void TPlayArray::Clear() |
365 | { |
299 | { |
366 | if (play) delete[] play; |
300 | if (play) delete[] play; |
367 | play = 0; nplay = 0; mplay = 0; |
Line 453... | Line 520... | ||
453 | fclose(f); |
520 | return 1; |
454 | return 1; |
521 | } |
455 | } |
522 | if (kind == 2) |
456 | if (kind == 2) |
523 | { |
457 | { |
524 | printf(KIND_EQ2); |
458 | printf("kind = 2\n"); |
525 | unsigned char ch; |
459 | unsigned char ch; |
526 | do |
460 | do |
527 | { |
461 | { |
528 | if (fread(&ch, 1, 1, f) != 1) {fclose(f); return -10;} |
462 | if (fread(&ch, 1, 1, f) != 1) {fclose(f); return -10;} |
529 | } |
463 | } |
530 | while(!isspace(ch)); |
Line 470... | Line 537... | ||
470 | do |
537 | { |
471 | { |
538 | if (fread(&ch, 1, 1, f) != 1) break; |
472 | if (fread(&ch, 1, 1, f) != 1) break; |
539 | } |
473 | } |
540 | while(ch == 0 || isspace(ch)); |
474 | while(ch == 0 || isspace(ch)); |
541 | if (feof(f)) strcpy(word, END_STR); |
475 | if (feof(f)) strcpy(word, "[end]"); |
542 | else |
476 | else |
543 | { |
477 | { |
544 | i = 0; |
478 | i = 0; |
545 | while(ch != 0 && !isspace(ch)) |
479 | while(ch != 0 && !isspace(ch)) |
546 | { |
480 | { |
547 | if (i < 100) word[i++] = ch; |
Line 514... | Line 581... | ||
514 | } |
581 | } |
515 | } |
582 | } |
516 | } |
583 | else |
517 | else |
584 | { |
518 | { |
585 | char end_literal[] = END_STR; |
- | 586 | char playv11_literal[] = PLAYV11_STR; |
|
- | 587 | ||
- | 588 | if (kind == 2 || kind == 3) |
|
519 | if (kind == 2 || kind == 3) |
589 | { |
520 | { |
590 | if (pl.GetN() > 0) Add(pl); |
521 | if (pl.GetN() > 0) Add(pl); |
591 | pl.Clear(); |
522 | pl.Clear(); |
592 | } |
523 | } |
593 | kind = 0; |
524 | kind = 0; |
594 | for (i = 0; word[i]; i++) |
525 | for (i = 0; word[i]; i++) |
595 | { |
526 | { |
596 | word[i] = (char)tolower((unsigned char)word[i]); |
527 | word[i] = (char)tolower((unsigned char)word[i]); |
597 | } |
528 | } |
598 | if (strskipref(word, end_literal)) break; |
529 | if (strskipref(word, "[end]")) break; |
599 | else if (strskipref(word, playv11_literal)) kind = 1; |
530 | else if (strskipref(word, "[play_v1.1]")) kind = 1; |
600 | } |
531 | } |
601 | } |
532 | } |
602 | fclose(f); |
533 | fclose(f); |
603 | return 1; |
534 | return 1; |
604 | } |
535 | } |
605 | if (kind == 3) |
Line 586... | Line 656... | ||
586 | int r = OpenFile(name, kind); |
656 | if (r <= 0) |
587 | if (r <= 0) |
657 | { |
588 | { |
658 | if (r == -1) |
589 | if (r == -1) |
659 | { |
590 | { |
660 | printf(CHECKERS_CANT_OPEN_STR, name); |
591 | #ifdef BUILD_RUS |
- | |
592 | printf("\n 誨: ¥ ¬®£ã ®âªàëâì ä ©« \"%s\".\n", name); |
- | |
593 | #else |
- | |
594 | printf("\nCheckers: Can't open the file \"%s\".\n", name); |
661 | return 0; |
595 | #endif |
- | |
596 | return 0; |
662 | } |
597 | } |
663 | else if (r == -2) |
598 | else if (r == -2) |
664 | { |
599 | { |
665 | printf(CHECKERS_FILE_EMPTY_STR, name); |
600 | #ifdef BUILD_RUS |
- | |
601 | printf("\n 誨: ©« \"%s\" ¯ãáâ.\n", name); |
- | |
602 | #else |
- | |
603 | printf("\nCheckers: The file \"%s\" is empty.\n", name); |
666 | return 0; |
604 | #endif |
- | |
605 | return 0; |
667 | } |
606 | } |
668 | else if (r == -3) |
607 | else if (r == -3) |
669 | { |
608 | { |
670 | printf(CHECKERS_INVALID_FILE_STR, name); |
609 | #ifdef BUILD_RUS |
- | |
610 | printf("\n 誨: ©« \"%s\" ®è¨¡®çë©.\n", name); |
- | |
611 | #else |
- | |
612 | printf("\nCheckers: Invalid file \"%s\".\n", name); |
671 | return 0; |
613 | #endif |
- | |
614 | return 0; |
672 | } |
615 | } |
673 | else if (r == -4) no_games = 1; |
616 | else if (r == -4) no_games = 1; |
674 | else if (r == -10) |
617 | else if (r == -10) |
675 | { |
618 | { |
676 | printf(FILE_WRONG_TYPE_STR, name); |
619 | #ifdef BUILD_RUS |
- | |
620 | printf("\n 誨: ©« \"%s\" ¨¬¥¥â ¥¢¥àë© â¨¯.\n", name); |
- | |
621 | #else |
- | |
622 | printf("\nCheckers: The file \"%s\" has wrong type.\n", name); |
677 | return 0; |
623 | #endif |
- | |
624 | return 0; |
678 | } |
625 | } |
679 | else |
626 | else |
680 | { |
627 | { |
681 | printf(ERROR_OPENING_FILE_STR, name); |
628 | #ifdef BUILD_RUS |
- | |
629 | printf("\n 誨: 訡ª ®âªàëâ¨ï ä ©« \"%s\".\n", name); |
- | |
630 | #else |
- | |
631 | printf("\nCheckers: Error openning the file \"%s\".\n", name); |
682 | return 0; |
632 | #endif |
- | |
633 | return 0; |
683 | } |
634 | } |
684 | } |
635 | } |
685 | if (!no_games && nplay > n0) return 1; |
636 | if (!no_games && nplay > n0) return 1; |
686 | else |
637 | else |
687 | { |
638 | { |
688 | printf(FILE_HAS_NO_GAMES_STR, name); |
639 | #ifdef BUILD_RUS |
- | |
640 | printf("\n 誨: ©« \"%s\" ¥ ᮤ¥à¦¨â ¨£à.\n", name); |
- | |
641 | #else |
- | |
642 | printf("\nCheckers: File \"%s\" don't contains games.\n", name); |
689 | return 0; |
643 | #endif |
- | |
644 | return 0; |
690 | } |
645 | } |
691 | } |
646 | } |
692 | |
Line 647... | Line 693... | ||
647 | 693 | int TPlayArray::SaveFile(const char *name, int num, int kind) |
|
Line 650... | Line 696... | ||
650 | FILE *f = 0; |
696 | if (kind == 0 || kind == 1 || kind == 2) |
651 | if (kind == 0 || kind == 1 || kind == 2) |
697 | { |
652 | { |
698 | f = fopen(name, "wt"); |
653 | f = fopen(name, "wt"); |
699 | if (!f) return -1; |
654 | if (!f) return -1; |
700 | |
- | 701 | fprintf(f, CHECKERS_PLAY_STR); |
|
655 | fprintf(f, "checkers-play:text\n"); |
702 | int i0 = num, i; |
656 | int i0 = num, i; |
703 | if (num < 0) {i0 = 0; num = nplay-1;} |
657 | if (num < 0) {i0 = 0; num = nplay-1;} |
704 | for (i = i0; i <= num; i++) if (play[i].GetN() > 0) |
658 | for (i = i0; i <= num; i++) if (play[i].GetN() > 0) |
705 | { |
659 | { |
706 | PlayWrite::PMv pmv; |
660 | PlayWrite::PMv pmv; |
707 | if (play[i].GetPos(pmv.pos, 0) < 0) return -9; |
661 | if (play[i].GetPos(pmv.pos, 0) < 0) return -9; |
708 | char *str = new char[10 + NUM_CELL]; |
662 | char *str = new char[10 + NUM_CELL]; |
709 | if (!str) return -5; |
663 | if (!str) return -5; |
710 | pmv.pos.Write(str, 1); |
664 | pmv.pos.Write(str, 1); |
711 | fprintf(f, "\n"PLAYV11_STR"#%d %s\n", i - i0 + 1, str); |
665 | fprintf(f, "\n[Play_v1.1]#%d %s\n", i - i0 + 1, str); |
712 | delete[] str; |
666 | delete[] str; |
713 | int j; |
667 | int j; |
714 | for (j = 1; j < play[i].GetN(); j++) |
668 | for (j = 1; j < play[i].GetN(); j++) |
715 | { |
669 | { |
716 | if (play[i].GetPos(pmv.pos, j - 1) < 0) return -9; |
670 | if (play[i].GetPos(pmv.pos, j - 1) < 0) return -9; |
717 | if (play[i].GetMove(pmv.mv, j) < 0) return -9; |
Line 688... | Line 735... | ||
688 | } |
735 | else if (kind == -1 || kind == 3) |
689 | else if (kind == -1 || kind == 3) |
736 | { |
690 | { |
737 | f = fopen(name, "wb"); |
691 | f = fopen(name, "wb"); |
738 | if (!f) return -1; |
692 | if (!f) return -1; |
739 | if (kind == 3) fprintf(f, CHECKERS_BIN_STR); |
693 | if (kind == 3) fprintf(f, "checkers-play:bin_1.0\n"); |
740 | |
- | 741 | int i = num; |
|
694 | int i = num; |
742 | if (num < 0) {i = 0; num = nplay-1;} |
695 | if (num < 0) {i = 0; num = nplay-1;} |
743 | for (; i <= num; i++) |
696 | for (; i <= num; i++) |
744 | { |
697 | { |
745 | char ch[LEN_WPOS]; |
698 | char ch[LEN_WPOS]; |
746 | Position pos; |
Line 726... | Line 774... | ||
726 | int r = SaveFile(name, num, kind); |
774 | if (r <= 0) |
727 | if (r <= 0) |
775 | { |
728 | { |
776 | if (r == -1) |
729 | if (r == -1) |
777 | { |
730 | { |
778 | printf(CANT_OPEN_FILE_STR, name); |
731 | #ifdef BUILD_RUS |
- | |
732 | printf("\n 誨: ¥ ¬®£ã ®âªàëâì ä ©« \"%s\" § ¯¨áì.\n", name); |
- | |
733 | #else |
- | |
734 | printf("\nCheckers: Can't open the file \"%s\" to write.\n", name); |
779 | } |
735 | #endif |
- | |
736 | } |
780 | else if (r == -5) |
737 | else if (r == -5) |
781 | { |
738 | { |
782 | printf(NOT_ENOUGH_MEM_STR, name); |
739 | #ifdef BUILD_RUS |
- | |
740 | printf("\n 誨: ¥ ¤®áâ â®ç® ¯ ¬ï⨠¤«ï á®åà ¥¨ï ä ©« \"%s\".\n", name); |
- | |
741 | #else |
- | |
742 | printf("\nCheckers: Not enough memory to save the file \"%s\".\n", name); |
783 | } |
743 | #endif |
- | |
744 | } |
784 | else if (r == -10) |
745 | else if (r == -10) |
785 | { |
746 | { |
786 | printf(FILE_WRONG_TYPE_STR, name); |
747 | #ifdef BUILD_RUS |
- | |
748 | printf("\n 誨: ©« \"%s\" ¨¬¥¥â ¥¢¥àë© â¨¯.\n", name); |
- | |
749 | #else |
- | |
750 | printf("\nCheckers: The file \"%s\" has wrong type.\n", name); |
787 | } |
751 | #endif |
- | |
752 | } |
788 | else |
753 | else |
789 | { |
754 | { |
790 | printf(ERROR_SAVING_FILE_STR, name); |
755 | #ifdef BUILD_RUS |
- | |
756 | printf("\n 誨: 訡ª á®åà ¥¨ï ä ©« \"%s\".\n", name); |
- | |
757 | #else |
- | |
758 | printf("\nCheckers: Error saving the file \"%s\".\n", name); |
791 | } |
759 | #endif |
- | |
760 | } |
792 | return 0; |
761 | return 0; |
793 | } |
762 | } |
794 | else |
763 | else |
795 | { |
764 | { |
796 | printf(FILE_SAVED_STR, name); |
765 | #ifdef BUILD_RUS |
- | |
766 | printf("\n 誨: ©« \"%s\" á®åà ñ.\n", name); |
- | |
767 | #else |
- | |
768 | printf("\nCheckers: File \"%s\" saved.\n", name); |
797 | return 1; |
769 | #endif |
- | |
770 | return 1; |
798 | } |
771 | } |
799 | } |
772 | } |
800 | #endif |
773 | #endif |
801 | |
Line 783... | Line 811... | ||
783 | } |
811 | |
Line 784... | Line 812... | ||
784 | 812 | ||
785 | 813 | void SetPlayerString(char *str, int c, TChPlayer *p) |
|
786 | void SetPlayerString(char *str, int c, TChPlayer *p) |
814 | { |
787 | { |
815 | strcpy(str, c ? BLUE_STR : RED_STR); |
788 | strcpy(str, c ? "blue: " : "red: "); |
816 | if (!p) strcat(str, INPUT_STR); |
789 | if (!p) strcat(str, "input"); |
817 | else strcat(str, COMPUTER_STR); |
Line 790... | Line 818... | ||
790 | else strcat(str, "computer"); |
818 | } |
791 | } |
819 | |
792 | 820 | class TMainDraw : public TSomeDraw |
|
- | 821 | { |
|
793 | class TMainDraw : public TSomeDraw |
822 | public: |
794 | { |
823 | |
Line 795... | Line 824... | ||
795 | public: |
824 | TMainDraw() : undo_redo(0), ur_type(-1), cur_play(0), |
796 | TMainDraw() : undo_redo(0), ur_type(-1), cur_play(0), |
825 | def_savefile("save.che"), def_savekind(2) {InitButton();} |
Line 849... | Line 878... | ||
849 | int ur_type; |
878 | }; |
850 | }; |
879 | |
Line 851... | Line 880... | ||
851 | 880 | void TMainDraw::InitButton() |
|
852 | void TMainDraw::InitButton() |
881 | { |
- | 882 | char newgame_literal[] = NEW_GAME_STR; |
|
- | 883 | char list_literal[] = LIST_STR; |
|
- | 884 | char delete_literal[] = DELETE_STR; |
|
- | 885 | char clear_literal[] = CLEAR_STR; |
|
- | 886 | char save_literal[] = SAVE_STR; |
|
- | 887 | char rotateboard_literal[] = ROTATE_BOARD_STR; |
|
- | 888 | char exit_literal[] = EXIT_STR; |
|
- | 889 | ||
- | 890 | char one_literal[] = "1"; |
|
- | 891 | char dash_literal[] = "-"; |
|
- | 892 | char plus_literal[] = "+"; |
|
- | 893 | char leftshift_literal[] = "<<"; |
|
- | 894 | char rightshift_literal[] = ">>"; |
|
- | 895 | char lessthan_literal[] = "<"; |
|
- | 896 | char greaterthan_literal[] = ">"; |
|
- | 897 | char xor_literal[] = "^"; |
|
- | 898 | ||
853 | { |
899 | button.Add(1, 80, 22, newgame_literal); |
854 | button.Add(1, 80, 22, "new game"); |
900 | button.Add(6, 60, 22, list_literal); |
855 | button.Add(6, 60, 22, "list"); |
901 | button.Add(7, 60, 22, delete_literal); |
856 | button.Add(7, 60, 22, "delete"); |
902 | play_list = new TMultiButton(20); |
857 | play_list = new TMultiButton(20); |
903 | play_list->a.Add(26, 20, 22, one_literal); |
858 | play_list->a.Add(26, 20, 22, "1"); |
904 | play_list->a.Add(21, 20, 22, dash_literal); |
859 | play_list->a.Add(21, 20, 22, "-"); |
905 | play_list->a.Add(23, 37, 22, play_num[0], -2); |
860 | play_list->a.Add(23, 37, 22, play_num[0], -2); |
906 | play_list->a.Add(22, 20, 22, plus_literal); |
861 | play_list->a.Add(22, 20, 22, "+"); |
907 | play_list->a.Add(27, 37, 22, play_num[1]); |
862 | play_list->a.Add(27, 37, 22, play_num[1]); |
908 | play_list->SetDefW(); |
863 | play_list->SetDefW(); |
909 | button.Add(play_list); |
864 | button.Add(play_list); |
910 | button.Add(24, 50, 22, clear_literal); |
865 | button.Add(24, 50, 22, "clear"); |
911 | #ifndef __MENUET__ |
866 | #ifndef __MENUET__ |
912 | button.Add(25, 50, 22, save_literal); |
867 | button.Add(25, 50, 22, "save"); |
913 | #endif |
868 | #endif |
914 | button.Add(2, 120, 22, player_str[0]); |
869 | button.Add(2, 120, 22, player_str[0]); |
915 | button.Add(3, 120, 22, player_str[1]); |
870 | button.Add(3, 120, 22, player_str[1]); |
916 | button.Add(4, 110, 22, rotateboard_literal); |
871 | button.Add(4, 110, 22, "rotate board"); |
917 | undo_redo = new TMultiButton(10); |
872 | undo_redo = new TMultiButton(10); |
918 | undo_redo->a.Add(11, 27, 22, leftshift_literal); |
873 | undo_redo->a.Add(11, 27, 22, "<<"); |
919 | undo_redo->a.Add(12, 20, 22, lessthan_literal); |
874 | undo_redo->a.Add(12, 20, 22, "<"); |
920 | undo_redo->a.Add(15, 20, 22, xor_literal); |
875 | undo_redo->a.Add(15, 20, 22, "^"); |
921 | undo_redo->a.Add(13, 20, 22, greaterthan_literal); |
876 | undo_redo->a.Add(13, 20, 22, ">"); |
922 | undo_redo->a.Add(14, 27, 22, rightshift_literal); |
877 | undo_redo->a.Add(14, 27, 22, ">>"); |
923 | undo_redo->SetDefW(); |
878 | undo_redo->SetDefW(); |
924 | button.Add(undo_redo); |
879 | button.Add(undo_redo); |
925 | button.Add(5, 60, 22, exit_literal); |
880 | button.Add(5, 60, 22, "exit"); |
926 | } |
Line 881... | Line 927... | ||
881 | } |
927 | |
882 | 928 | void TMainDraw::SetButtonKind(const TChBoard &board) |
|
883 | void TMainDraw::SetButtonKind(const TChBoard &board) |
929 | { |
Line 1323... | Line 1369... | ||
1323 | if (argv[i][j] != '=' || !argv[i][j+1]) continue; |
1369 | } |
1324 | } |
1370 | data.main_draw.def_savefile = argv[i] + j + 1; |
1325 | data.main_draw.def_savefile = argv[i] + j + 1; |
1371 | } |
1326 | } |
1372 | } |
1327 | } |
1373 | |
- | 1374 | else printf(CHECKERS_INVALID_STR, argv[i]); |
|
1328 | else printf("Checkers: Invalid key %s\n", argv[i]); |
1375 | } |
1329 | } |
1376 | else if (kx == 0 || kx == 1) |
1330 | else if (kx == 0 || kx == 1) |
1377 | { |
1331 | { |
1378 | data.main_draw.play.MsgOpenFile(argv[i], -1); |
1332 | data.main_draw.play.MsgOpenFile(argv[i], -1); |
1379 | } |
1333 | } |
1380 | } |
1334 | } |
1381 | } |
1335 | } |
1382 | data.InitDef(); |
1336 | data.InitDef(); |
1383 | TMainGraphDraw graph(CHECKERS_STR); |
1337 | TMainGraphDraw graph( |
1384 | TTimerDraw timer_draw(&data.board, &graph); |
1338 | #ifdef BUILD_RUS |
- | |
1339 | " 誨" |
- | |
1340 | #else |
- | |
1341 | "Checkers" |
- | |
1342 | #endif |
- | |
1343 | ); |
- | |
1344 | TTimerDraw timer_draw(&data.board, &graph); |
1385 | data.player.draw = TTimerDraw::draw; data.player.data = &timer_draw; |
1345 | data.player.draw = TTimerDraw::draw; data.player.data = &timer_draw; |
1386 | graph.evfunc = TMainData::EventFunction; graph.data = &data; |
1346 | graph.evfunc = TMainData::EventFunction; graph.data = &data; |
1387 | graph.SetAboutInfo(1); |
1347 | graph.SetAboutInfo(1); |
1388 | graph.Run(TGraphDraw::button_down_mask | TGraphDraw::button_up_mask | |
1348 | graph.Run(TGraphDraw::button_down_mask | TGraphDraw::button_up_mask | |
1389 | TGraphDraw::key_down_mask | TGraphDraw::mouse_drag_mask, |
Line 1362... | Line 1403... | ||
1362 | randomize(); |
1403 | mdata->InitDef(); |
1363 | mdata->InitDef(); |
1404 | static TTimerDraw timer_draw(&mdata->board, graph); |
1364 | static TTimerDraw timer_draw(&mdata->board, graph); |
1405 | mdata->player.draw = TTimerDraw::draw; mdata->player.data = &timer_draw; |
1365 | mdata->player.draw = TTimerDraw::draw; mdata->player.data = &timer_draw; |
1406 | graph->data = mdata; |
1366 | graph->data = mdata; |
1407 | me_start.WinData.Title = CHECKERS_STR; |
1367 | me_start.WinData.Title = |
1408 | me_start.Width = 450 + 100*ssf; |
1368 | #ifdef BUILD_RUS |
- | |
1369 | " 誨" |
- | |
1370 | #else |
- | |
1371 | "Checkers" |
- | |
1372 | #endif |
- | |
1373 | ; |
- | |
1374 | me_start.Width = 450 + 100*ssf; |
1409 | me_start.Height = 528; |
1375 | me_start.Height = 528; |
1410 | return true; |
1376 | return true; |
1411 | } |
1377 | } |
1412 | bool MenuetOnClose(TThreadData) |
1378 | bool MenuetOnClose(TThreadData) |
1413 | { |