/[eliot]/eliot/utils/eliottxt.cpp
ViewVC logotype

Diff of /eliot/utils/eliottxt.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by ipkiss, Sun Oct 23 14:53:44 2005 UTC revision 1.7.2.1 by afrab, Sun Oct 23 17:16:24 2005 UTC
# Line 37  Line 37 
37  #include "duplicate.h"  #include "duplicate.h"
38  #include "freegame.h"  #include "freegame.h"
39    
40    using namespace std;
41    
42  /* A static variable for holding the line. */  /* A static variable for holding the line. */
43  static char *line_read = NULL;  static char *line_read = NULL;
# Line 296  display_data(const Game &iGame, const ch Line 297  display_data(const Game &iGame, const ch
297              }              }
298              break;              break;
299          case 'j':          case 'j':
300              cout << "Joueur " << iGame.currPlayer() << endl;              cout << "Joueur " << iGame.getCurrentPlayerNum() << endl;
301              break;              break;
302          case 'l':          case 'l':
303              GameIO::printNonPlayed(cout, iGame);              GameIO::printNonPlayed(cout, iGame);
# Line 322  display_data(const Game &iGame, const ch Line 323  display_data(const Game &iGame, const ch
323              GameIO::printAllPoints(cout, iGame);              GameIO::printAllPoints(cout, iGame);
324              break;              break;
325          case 't':          case 't':
326              GameIO::printPlayedRack(cout, iGame, iGame.getNRounds());              GameIO::printPlayedRack(cout, iGame, iGame.getHistory().getSize());
327              break;              break;
328          case 'T':          case 'T':
329              GameIO::printAllRacks(cout, iGame);              GameIO::printAllRacks(cout, iGame);
# Line 383  loop_training(Training &iGame) Line 384  loop_training(Training &iGame)
384                              help_training();                              help_training();
385                              break;                              break;
386                          }                          }
387                          if ((res = iGame.play(coord, token)) != 0)  #if 0
388                            if ((res = iGame.play(0, std::string(coord), std::string(token))) != 0)
389                          {                          {
390                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",
391                                      res);                                      res);
392                              break;                              break;
393                          }                          }
394    #endif
395                      }                      }
396                      break;                      break;
397                  case 'n':                  case 'n':
# Line 411  loop_training(Training &iGame) Line 414  loop_training(Training &iGame)
414                      iGame.search();                      iGame.search();
415                      break;                      break;
416                  case 't':                  case 't':
417    #if 0
418                      token = next_token_alphaplusjoker(NULL, delim);                      token = next_token_alphaplusjoker(NULL, delim);
419                      if (token == NULL)                      if (token == NULL)
420                          help_training();                          help_training();
421                      else                      else
422                          if (iGame.setRackManual(0, token))                          if (iGame.setRackManual(0, false, token))
423                              printf("le sac ne contient pas assez de lettres\n");                              printf("le sac ne contient pas assez de lettres\n");
424    #endif
425                      break;                      break;
426                  case 'x':                  case 'x':
427                      token = next_token_cross(NULL, delim);                      token = next_token_cross(NULL, delim);
# Line 426  loop_training(Training &iGame) Line 431  loop_training(Training &iGame)
431                          eliottxt_get_cross(iGame.getDic(), token);                          eliottxt_get_cross(iGame.getDic(), token);
432                      break;                      break;
433                  case '*':                  case '*':
434                      iGame.setRackRandom(0, false, Game::RACK_ALL);                    //iGame.getPlayer(0).getCurrentRack().set(PlayedRack::RACK_ALL);
435                      break;                    break;
436                  case '+':                  case '+':
437                      iGame.setRackRandom(0, false, Game::RACK_NEW);                    //iGame.getPlayer(0).getCurrentRack().set(PlayedRack::RACK_NEW);
438                      break;                    break;
439                  case 's':                  case 's':
440                      token = next_token_filename(NULL, delim);                      token = next_token_filename(NULL, delim);
441                      if (token != NULL)                      if (token != NULL)
# Line 507  loop_freegame(FreeGame &iGame) Line 512  loop_freegame(FreeGame &iGame)
512                              help_freegame();                              help_freegame();
513                              break;                              break;
514                          }                          }
515                          if ((res = iGame.play(coord, token)) != 0)  #if 0
516                            if ((res = iGame.play(0, std::string(coord), std::string(token))) != 0)
517                          {                          {
518                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",
519                                      res);                                      res);
520                              break;                              break;
521                          }                          }
522    #endif
523                      }                      }
524                      break;                      break;
525                 case 'p':                 case 'p':
# Line 521  loop_freegame(FreeGame &iGame) Line 528  loop_freegame(FreeGame &iGame)
528                      if (token == NULL)                      if (token == NULL)
529                          token = "";                          token = "";
530    
531    #if 0
532                      if (iGame.pass(token, iGame.currPlayer()) != 0)                      if (iGame.pass(token, iGame.currPlayer()) != 0)
533                          break;                          break;
534    #endif
535                      break;                      break;
536                  case 's':                  case 's':
537                      token = next_token_filename(NULL, delim);                      token = next_token_filename(NULL, delim);
# Line 600  loop_duplicate(Duplicate &iGame) Line 609  loop_duplicate(Duplicate &iGame)
609                              help_duplicate();                              help_duplicate();
610                              break;                              break;
611                          }                          }
612                          if ((res = iGame.play(coord, token)) != 0)  #if 0
613                            if ((res = iGame.play(0, std::string(coord), std::string(token))) != 0)
614                          {                          {
615                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",                              fprintf(stderr, "Mot incorrect ou mal placé (%i)\n",
616                                      res);                                      res);
617                              break;                              break;
618                          }                          }
619    #endif
620                      }                      }
621                      break;                      break;
622                  case 'n':                  case 'n':
# Line 614  loop_duplicate(Duplicate &iGame) Line 625  loop_duplicate(Duplicate &iGame)
625                          help_duplicate();                          help_duplicate();
626                      else                      else
627                      {                      {
628    #if 0
629                          int res = iGame.setPlayer(atoi(token));                          int res = iGame.setPlayer(atoi(token));
630                          if (res == 1)                          if (res == 1)
631                              fprintf(stderr, "Numéro de joueur invalide\n");                              fprintf(stderr, "Numéro de joueur invalide\n");
632                          else if (res == 2)                          else if (res == 2)
633                              fprintf(stderr, "Impossible de choisir un joueur non humain\n");                              fprintf(stderr, "Impossible de choisir un joueur non humain\n");
634    #endif
635                      }                      }
636                      break;                      break;
637                  case 's':                  case 's':
# Line 717  main_loop(const Dictionary &iDic) Line 730  main_loop(const Dictionary &iDic)
730                          help();                          help();
731                          break;                          break;
732                      }                      }
733    #if 0
734                      Duplicate *game = GameFactory::Instance()->createDuplicate(iDic);                      Duplicate *game = GameFactory::Instance()->createDuplicate(iDic);
735                      for (i = 0; i < atoi(token); i++)                      for (i = 0; i < atoi(token); i++)
736                          game->addHumanPlayer();                          game->addHumanPlayer();
# Line 731  main_loop(const Dictionary &iDic) Line 745  main_loop(const Dictionary &iDic)
745                      game->start();                      game->start();
746                      loop_duplicate(*game);                      loop_duplicate(*game);
747                      GameFactory::Instance()->releaseGame(*game);                      GameFactory::Instance()->releaseGame(*game);
748    #endif
749                      break;                      break;
750                  }                  }
751                  case 'l':                  case 'l':
# Line 743  main_loop(const Dictionary &iDic) Line 758  main_loop(const Dictionary &iDic)
758                          help();                          help();
759                          break;                          break;
760                      }                      }
761    #if 0
762                      FreeGame *game = GameFactory::Instance()->createFreeGame(iDic);                      FreeGame *game = GameFactory::Instance()->createFreeGame(iDic);
763                      for (i = 0; i < atoi(token); i++)                      for (i = 0; i < atoi(token); i++)
764                          game->addHumanPlayer();                          game->addHumanPlayer();
# Line 757  main_loop(const Dictionary &iDic) Line 773  main_loop(const Dictionary &iDic)
773                      game->start();                      game->start();
774                      loop_freegame(*game);                      loop_freegame(*game);
775                      GameFactory::Instance()->releaseGame(*game);                      GameFactory::Instance()->releaseGame(*game);
776    #endif
777                      break;                      break;
778                  }                  }
779                  case 'D':                  case 'D':
780                  {                  {
781                      // New duplicate game                      // New duplicate game
782    #if 0
783                      Duplicate *game = GameFactory::Instance()->createDuplicate(iDic);                      Duplicate *game = GameFactory::Instance()->createDuplicate(iDic);
784                      game->addHumanPlayer();                      game->addHumanPlayer();
785                      game->addAIPlayer();                      game->addAIPlayer();
786                      game->start();                      game->start();
787                      loop_duplicate(*game);                      loop_duplicate(*game);
788                      GameFactory::Instance()->releaseGame(*game);                      GameFactory::Instance()->releaseGame(*game);
789    #endif
790                      break;                      break;
791                  }                  }
792                  case 'L':                  case 'L':
793                  {                  {
794                      // New free game                      // New free game
795    #if 0
796                      FreeGame *game = GameFactory::Instance()->createFreeGame(iDic);                      FreeGame *game = GameFactory::Instance()->createFreeGame(iDic);
797                      game->addHumanPlayer();                      game->addHumanPlayer();
798                      game->addAIPlayer();                      game->addAIPlayer();
799                      game->start();                      game->start();
800                      loop_freegame(*game);                      loop_freegame(*game);
801                      GameFactory::Instance()->releaseGame(*game);                      GameFactory::Instance()->releaseGame(*game);
802    #endif
803                      break;                      break;
804                  }                  }
805                  case 'q':                  case 'q':

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.7.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26