home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / top2src.zip / GAMES.ZIP / OLDPOKER.ZIP / OLDPKEVT.C < prev    next >
C/C++ Source or Header  |  1995-03-09  |  2KB  |  87 lines

  1. #include "top.h"
  2.  
  3. void poker_event(void)
  4. {
  5. char *whos_in;
  6. poker_game_typ tgame;
  7. poker_player_typ tplyr;
  8.  
  9. check_nodes_used(1);
  10. if (lowestnode != od_control.od_node)
  11.     {
  12.     return;
  13.     }
  14.  
  15. whos_in = farmalloc(MAXNODES);
  16. if (!whos_in)
  17.     {
  18.     dispatch_message(MSG_GENERIC, "^I^mNot enough memory to play Poker!^A^p",
  19.                      od_control.od_node, 0, 0);
  20.     return;
  21.     }
  22.  
  23. poker_loadgamedata(&tgame);
  24. if (!tgame.gameon)
  25.     {
  26.     if (difftime(time(NULL), tgame.eventstarttime) >= 15) // 60!
  27.         {
  28.         poker_loadintable(0, 0, whos_in);
  29.         if (poker_count(whos_in) > 1)
  30.             {
  31.             dispatch_message(MSG_POKER, "Start", lowestnode,
  32.                              1, 0);
  33.             tgame.gameprogress = 0;
  34.             }
  35.         else
  36.             {
  37.             XINT nnd;
  38.  
  39.             for (nnd = 0; nnd < MAXNODES; nnd++)
  40.                 {
  41.                 if (whos_in[nnd])
  42.                     {
  43.                     dispatch_message(MSG_POKER, "NotEnoughPeople", nnd,
  44.                                      1, 0);
  45.                     }
  46.                 }
  47.             }
  48.         time(&tgame.eventstarttime);
  49.         poker_savegamedata(&tgame);
  50.         }
  51.     }
  52. if (tgame.gameon)
  53.     {
  54.     poker_loadplyrdata(tgame.currentturn, &tplyr);
  55.     if (difftime(time(NULL), tgame.eventstarttime) >=
  56.         poker_nagtimes[tplyr.numnags])
  57.         {
  58.         if (tplyr.numnags < 5)
  59.             {
  60.             if (tgame.gameprogress == 50)
  61.                 {
  62.                 dispatch_message(MSG_POKER, "HurryDiscard",
  63.                                  tgame.currentturn, 1, 0);
  64.                 }
  65.             else
  66.                 {
  67.                 dispatch_message(MSG_POKER, "HurryBet", tgame.currentturn,
  68.                                  1, 0);
  69.                 }
  70.             tplyr.numnags++;
  71.             poker_saveplyrdata(tgame.currentturn, &tplyr);
  72.             }
  73.         else
  74.             {
  75.             dispatch_message(MSG_POKER, "ForcedOut", tgame.currentturn,
  76.                              1, 0);
  77.             time(&tgame.eventstarttime);
  78.             poker_savegamedata(&tgame);
  79.             }
  80.         }
  81.     }
  82.  
  83. dofree(whos_in);
  84.  
  85. return;
  86. }
  87.