home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / top2src.zip / GAMES.ZIP / OLDPOKER.ZIP / OLDPROCM.C < prev   
C/C++ Source or Header  |  1995-04-13  |  30KB  |  834 lines

  1. #include "top.h"
  2.  
  3. XINT process_messages(char delname)
  4. {
  5. XINT d, proc = 0, mused = 0, isaction = 0, res, dn;
  6. msg_typ msgin;
  7. char filnam[256], ttt[10], tstbit[2];
  8. unsigned char allowbits = 0;
  9. unsigned long cdc;
  10. struct ffblk mchg;
  11. poker_game_typ mgame;
  12. poker_player_typ mplyr;
  13. char pokerstack[100], pokcount = 0;
  14. XINT pokstacknode[100];
  15.  
  16. memset(pokerstack, 0, 100); pokcount = 0;
  17. for (d = 0; d < 100; d++)
  18.     {
  19.     pokstacknode[d] = -1;
  20.     }
  21.  
  22. lseek(chgfil, (od_control.od_node), SEEK_SET);
  23. rec_locking(REC_LOCK, chgfil, (od_control.od_node), 1L);
  24. read(chgfil, tstbit, 1L);
  25. rec_locking(REC_UNLOCK, chgfil, (od_control.od_node), 1L);
  26.  
  27. if (!tstbit[0])
  28.     {
  29.     return 0;
  30.     }
  31.  
  32. tstbit[0] = 0;
  33. lseek(chgfil, (od_control.od_node), SEEK_SET);
  34. rec_locking(REC_LOCK, chgfil, (od_control.od_node), 1L);
  35. write(chgfil, tstbit, 1L);
  36. rec_locking(REC_UNLOCK, chgfil, (od_control.od_node), 1L);
  37.  
  38. for (d = 0, dn = delname; d < filelength(midxinfil); d++)
  39.     {
  40.     res = lseek(midxinfil, (long) d, SEEK_SET);
  41.     if (res == -1)
  42.         {
  43.         continue;
  44.         }
  45.     rec_locking(REC_LOCK, midxinfil, d, 1L);
  46.     res = read(midxinfil, tstbit, 1L);
  47.     if (res == -1)
  48.         {
  49.         rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  50.         continue;
  51.         }
  52.     // This needs changing to a large, malloc()ed, buffered array to
  53.     // improve speed
  54.     if (!tstbit[0])
  55.         {
  56.         rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  57.         continue;
  58.         }
  59.     res = lseek(msginfil, (long) d * (long) sizeof(msg_typ), SEEK_SET);
  60.     if (res == -1)
  61.         {
  62.         rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  63.         continue;
  64.         }
  65.     rec_locking(REC_LOCK, msginfil, (long) d * (long) sizeof(msg_typ),
  66.                 (long) sizeof(msg_typ));
  67.     res = read(msginfil, &msgin, sizeof(msg_typ));
  68.     rec_locking(REC_UNLOCK, msginfil, (long) d * (long) sizeof(msg_typ),
  69.                 (long) sizeof(msg_typ));
  70.     if (res == -1)
  71.         {
  72.         rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  73.         continue;
  74.         }
  75.  
  76.     if (msgin.channel != curchannel)
  77.         {
  78.         tstbit[0] = 0;
  79.         lseek(midxinfil, (long) d, SEEK_SET);
  80.         write(midxinfil, tstbit, 1L);
  81.         rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  82.         continue;
  83.         }
  84.  
  85.     isaction = 0;
  86.     fixname(msgin.handle, msgin.handle);
  87.     if (!dn && !(forgetstatus[msgin.from] & FGT_FORGOTTEN) &&
  88.         msgin.type != MSG_FORGET && msgin.type != MSG_REMEMBER)
  89.         {
  90.         top_output(OUT_SCREEN, "\r\n");
  91.         }
  92.     dn = 0;
  93.     cdc = strtoul(msgin.string, NULL, 10);
  94.  
  95.     switch(msgin.type)
  96.         {
  97.         case MSG_TEXT:
  98.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  99.                 {
  100.                 delprompt(delname);
  101.                 top_output(OUT_SCREEN, getlang("MsgPrefix"), msgin.handle,
  102.                            msgin.string);
  103.                 mused++;
  104.                 }
  105.             proc++;
  106.             break;
  107.         case MSG_ENTRY:
  108.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  109.                 {
  110.                 delprompt(delname);
  111.                 if (msgin.string[0])
  112.                     {
  113.                     sprintf(outbuf, "^m%s", msgin.string);
  114.                     top_output(OUT_SCREEN, outbuf);
  115.                     }
  116.                 else
  117.                     {
  118.                     top_output(OUT_SCREEN, getlang("EMessage"), msgin.handle);
  119.                     }
  120.                 mused++;
  121.                 }
  122.             proc++;
  123.             fixname(handles[msgin.from].string, msgin.handle);
  124.             activenodes[msgin.from] = 1;
  125.             forgetstatus[msgin.from] = 0;
  126.             break;
  127.         case MSG_EXIT:
  128.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  129.                 {
  130.                 delprompt(delname);
  131.                 if (msgin.string[0])
  132.                     {
  133.                     sprintf(outbuf, "^m%s", msgin.string);
  134.                     top_output(OUT_SCREEN, outbuf);
  135.                     }
  136.                 else
  137.                     {
  138.                     top_output(OUT_SCREEN, getlang("XMessage"), msgin.handle);
  139.                     }
  140.                 mused++;
  141.                 }
  142.             activenodes[msgin.from] = 0;
  143.             forgetstatus[msgin.from] = 0;
  144.             proc++;
  145.             break;
  146.         case MSG_INEDITOR:
  147.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  148.                 {
  149.                 delprompt(delname);
  150.                 top_output(OUT_SCREEN, getlang("InProf"), msgin.handle);
  151.                 mused++;
  152.                 }
  153.             proc++;
  154.             break;
  155.         case MSG_OUTEDITOR:
  156.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  157.                 {
  158.                 delprompt(delname);
  159.                 top_output(OUT_SCREEN, getlang("OutProf"), msgin.handle);
  160.                 mused++;
  161.                 }
  162.             proc++;
  163.             break;
  164.         case MSG_WHISPER:
  165.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  166.                 {
  167.                 delprompt(delname);
  168.                 top_output(OUT_SCREEN, getlang("WhisperPrefix"), msgin.handle,
  169.                            msgin.string);
  170.                 mused++;
  171.                 }
  172.             proc++;
  173.             break;
  174.         case MSG_GA:
  175.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  176.                 {
  177.                 delprompt(delname);
  178.                 top_output(OUT_SCREEN, getlang("GAPrefix"), msgin.handle,
  179.                            msgin.string);
  180.                 mused++;
  181.                 }
  182.             proc++;
  183.             break;
  184.         case MSG_GA2:
  185.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  186.                 {
  187.                 delprompt(delname);
  188.                 top_output(OUT_SCREEN, getlang("GA2Prefix"), msgin.handle,
  189.                            msgin.string);
  190.                 mused++;
  191.                 }
  192.             proc++;
  193.             break;
  194.         case MSG_ACTIONSIN:
  195.             isaction = 1;
  196.             allowbits = ALLOW_ME | ALLOW_SEX | ALLOW_SLF;
  197.             proc++;
  198.             break;
  199.         case MSG_ACTIONPLU:
  200.             isaction = 1;
  201.             allowbits = ALLOW_ME | ALLOW_YOU | ALLOW_SEX | ALLOW_POS |
  202.                         ALLOW_SLF;
  203.             proc++;
  204.             break;
  205.         case MSG_TLKTYPSIN:
  206.             isaction = 1;
  207.             allowbits = ALLOW_ME | ALLOW_SEX | ALLOW_SLF;
  208.             proc++;
  209.             break;
  210.         case MSG_TLKTYPPLU:
  211.             isaction = 1;
  212.             allowbits = ALLOW_ME | ALLOW_SEX | ALLOW_SLF;
  213.             proc++;
  214.             break;
  215.         case MSG_ACTPLUSEC:
  216.             isaction = 1;
  217.             allowbits = ALLOW_ME | ALLOW_YOU | ALLOW_SEX | ALLOW_POS |
  218.                         ALLOW_SLF;
  219.             proc++;
  220.             break;
  221.         case MSG_HANDLECHG:
  222.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  223.                 {
  224.                 delprompt(delname);
  225.                 if (msgin.gender == 0)
  226.                     {
  227.                     strcpy(ttt, getlang("His"));
  228.                     }
  229.                 if (msgin.gender == 1)
  230.                     {
  231.                     strcpy(ttt, getlang("Her"));
  232.                     }
  233.                 fixname(msgin.string, msgin.string);
  234.                 top_output(OUT_SCREEN, getlang("HandleChangeMsg"),
  235.                            handles[msgin.from].string, ttt, msgin.string);
  236.                 mused++;
  237.                 }
  238.             fixname(handles[msgin.from].string, msgin.string);
  239.             proc++;
  240.             break;
  241.         case MSG_DESCCHG:
  242.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  243.                 {
  244.                 delprompt(delname);
  245.                 if (msgin.gender == 0)
  246.                     {
  247.                     strcpy(ttt, getlang("His"));
  248.                     }
  249.                 if (msgin.gender == 1)
  250.                     {
  251.                     strcpy(ttt, getlang("Her"));
  252.                     }
  253.                 mused++;
  254.                 top_output(OUT_SCREEN, getlang("DescChangeMsg"), msgin.handle,
  255.                            msgin.string);
  256.                 }
  257.             proc++;
  258.             break;
  259.         case MSG_SEXCHG:
  260.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  261.                 {
  262.                 delprompt(delname);
  263.                 top_output(OUT_SCREEN, getlang("SexChangeMsg"), msgin.handle,
  264.                            msgin.string);
  265.                 mused++;
  266.                 }
  267.             proc++;
  268.             break;
  269.         case MSG_PERACTCHG:
  270.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  271.                 {
  272.                 delprompt(delname);
  273.                 if (msgin.gender == 0)
  274.                     {
  275.                     strcpy(ttt, getlang("His"));
  276.                     }
  277.                 if (msgin.gender == 1)
  278.                     {
  279.                     strcpy(ttt, getlang("Her"));
  280.                     }
  281.                 top_output(OUT_SCREEN, getlang("PersActChangeMsg"), msgin.handle, ttt);
  282.                 mused++;
  283.                 }
  284.             proc++;
  285.             break;
  286.         case MSG_TOSSOUT:
  287.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  288.                 {
  289.                 delprompt(delname);
  290.                 top_output(OUT_SCREEN, getlang("TossOut"), msgin.handle);
  291.                 mused++;
  292.                 }
  293.             activenodes[msgin.from] = 0;
  294.             forgetstatus[msgin.from] = 0;
  295.             proc++;
  296.             break;
  297.         case MSG_FORGET:
  298.             forgetstatus[msgin.from] |= FGT_HASFORGOTME;
  299.             proc++;
  300.             break;
  301.         case MSG_REMEMBER:
  302.             forgetstatus[msgin.from] &= (255 - FGT_HASFORGOTME);
  303.             proc++;
  304.             break;
  305.         // these 3 probably need forget mods later on.
  306.         case MSG_LINKUP:
  307.             delprompt(delname);
  308.             top_output(OUT_SCREEN, getlang("LinkOn"), msgin.handle, msgin.string);
  309.             strcpy(handles[msgin.from].string, msgin.string);
  310.             mused++;
  311.             proc++;
  312.             break;
  313.         case MSG_LINKTEXT:
  314.             delprompt(delname);
  315.             top_output(OUT_SCREEN, getlang("LinkPrefix"), msgin.handle, msgin.string);
  316.             mused++;
  317.             proc++;
  318.             break;
  319.         case MSG_UNLINK:
  320.             delprompt(delname);
  321.             top_output(OUT_SCREEN, getlang("LinkOff"), msgin.handle);
  322.             strcpy(handles[msgin.from].string, msgin.string);
  323.             activenodes[msgin.from] = 0;
  324.             forgetstatus[msgin.from] = 0;
  325.             mused++;
  326.             proc++;
  327.             break;
  328.         case MSG_EXMSGCHG:
  329.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  330.                 {
  331.                 delprompt(delname);
  332.                 if (msgin.gender == 0)
  333.                     {
  334.                     strcpy(ttt, getlang("His"));
  335.                     }
  336.                 if (msgin.gender == 1)
  337.                     {
  338.                     strcpy(ttt, getlang("Her"));
  339.                     }
  340.                 top_output(OUT_SCREEN, getlang("EXMsgChange"), msgin.handle, ttt);
  341.                 mused++;
  342.                 }
  343.             proc++;
  344.             break;
  345.         case MSG_TOSSED:
  346.             delprompt(delname);
  347.             top_output(OUT_SCREEN, getlang("HasTossed"), msgin.handle);
  348.             if (msgin.string[0])
  349.                 {
  350.                 top_output(OUT_SCREEN, getlang("TossComment"), msgin.string);
  351.                 }
  352.             top_output(OUT_SCREEN, "\r\n\r\n");
  353.             tstbit[0] = 0;
  354.             lseek(midxinfil, (long) d, SEEK_SET);
  355.             write(midxinfil, tstbit, 1L);
  356.             rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  357.             od_exit(6, FALSE);
  358.             proc++;
  359.             mused++;
  360.             break;
  361.         case MSG_ZAPPED:
  362.             delprompt(delname);
  363.             top_output(OUT_SCREEN, getlang("HasZapped"), msgin.handle);
  364.             if (msgin.string[0])
  365.                 {
  366.                 top_output(OUT_SCREEN, getlang("TossComment"), msgin.string);
  367.                 }
  368.             top_output(OUT_SCREEN, "\r\n\r\n");
  369.             tstbit[0] = 0;
  370.             lseek(midxinfil, (long) d, SEEK_SET);
  371.             write(midxinfil, tstbit, 1L);
  372.             rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  373.             od_exit(7, TRUE);
  374.             proc++;
  375.             mused++;
  376.             break;
  377.         case MSG_CLEARNODE:
  378.             delprompt(delname);
  379.             itoa(cdc, outnum[0], 10);
  380.             top_output(OUT_SCREEN, getlang("NodeCleared"), outnum[0],
  381.                        handles[(XINT) cdc].string, msgin.handle);
  382.             check_nodes_used(0);
  383.             mused++;
  384.             proc++;
  385.             break;
  386.         case MSG_SYSGIVECD:
  387.             delprompt(delname);
  388.             ultoa(cdc, outnum[0], 10);
  389.             top_output(OUT_SCREEN, getlang("CDGive"), msgin.handle, outnum[0],
  390.                        cdc == 1 ? getlang("CDSingular") :
  391.                                   getlang("CDPlural"));
  392.             user.cybercash += cdc;
  393.             save_user_data(user_rec_num, &user);
  394.             mused++;
  395.             proc++;
  396.             break;
  397.         case MSG_SYSTAKECD:
  398.             delprompt(delname);
  399.             ultoa(cdc, outnum[0], 10);
  400.             top_output(OUT_SCREEN, getlang("CDTake"), msgin.handle, outnum[0],
  401.                        cdc == 1 ? getlang("CDSingular") :
  402.                                   getlang("CDPlural"));
  403.             user.cybercash -= cdc;
  404.             save_user_data(user_rec_num, &user);
  405.             mused++;
  406.             proc++;
  407.             break;
  408.         case MSG_SYSSETCD:
  409.             delprompt(delname);
  410.             ultoa(cdc, outnum[0], 10);
  411.             top_output(OUT_SCREEN, getlang("CDSet"), msgin.handle, outnum[0]);
  412.             user.cybercash = cdc;
  413.             save_user_data(user_rec_num, &user);
  414.             mused++;
  415.             proc++;
  416.             break;
  417.         case MSG_POKER:
  418.             if (!stricmp(msgin.string, "WantIn"))
  419.                 {
  420.                 pokstacknode[pokcount] = msgin.from;
  421.                 pokerstack[pokcount++] = POKER_WANTIN;
  422.                 }
  423.             if (!stricmp(msgin.string, "WantOut"))
  424.                 {
  425.                 pokstacknode[pokcount] = msgin.from;
  426.                 pokerstack[pokcount++] = POKER_WANTOUT;
  427.                 }
  428.             if (!stricmp(msgin.string, "Bet"))
  429.                 {
  430.                 pokstacknode[pokcount] = msgin.from;
  431.                 pokerstack[pokcount++] = POKER_BETIN;
  432.                 }
  433.             if (!stricmp(msgin.string, "Discard"))
  434.                 {
  435.                 pokstacknode[pokcount] = msgin.from;
  436.                 pokerstack[pokcount++] = POKER_DISCIN;
  437.                 }
  438.             if (!stricmp(msgin.string, "Fold"))
  439.                 {
  440.                 pokstacknode[pokcount] = msgin.from;
  441.                 pokerstack[pokcount++] = POKER_FOLDIN;
  442.                 }
  443.             if (!stricmp(msgin.string, "Start"))
  444.                 {
  445.                 pokstacknode[pokcount] = msgin.from;
  446.                 pokerstack[pokcount++] = POKER_START;
  447.                 }
  448.             if (!stricmp(msgin.string, "YourBet"))
  449.                 {
  450.                 delprompt(delname);
  451.                 poker_loadgamedata(&mgame);
  452.                 poker_loadplyrdata(od_control.od_node, &mplyr);
  453.                 top_output(OUT_SCREEN, "\a^pIt is your turn to ^kbet^p "
  454.                            "in Poker!\r\n");
  455.                 sprintf(outbuf, "^nYou must bet at least ^l%lu^n "
  456.                         "CyberDollar%s to stay in.",
  457.                         mgame.highbet - mplyr.totalbet,
  458.                         (mgame.highbet - mplyr.totalbet) == 1 ?
  459.                         getlang("CDSingular") : getlang("CDPlural"));
  460.                 top_output(OUT_SCREEN, outbuf);
  461.                 mused++;
  462.                 }
  463.             if (!stricmp(msgin.string, "YourDiscard"))
  464.                 {
  465.                 delprompt(delname);
  466.                 top_output(OUT_SCREEN, "\a^pIt is your turn to ^kdiscard^p "
  467.                            "in Poker!");
  468.                 mused++;
  469.                 }
  470.             if (!stricmp(msgin.string, "HurryBet"))
  471.                 {
  472.                 delprompt(delname);
  473.                 poker_loadgamedata(&mgame);
  474.                 poker_loadplyrdata(od_control.od_node, &mplyr);
  475.  
  476.                 top_output(OUT_SCREEN, "\a^I^pIt is ^mStill^p\a your turn to "
  477.                            "^kbet^p\a in Poker!  \a^lHurry "
  478.                            "Up!!!^A^o\a\r\n");
  479.                 sprintf(outbuf, "^nYou must bet at least ^l%lu^n "
  480.                         "CyberDollar%s to stay in.",
  481.                         mgame.highbet - mplyr.totalbet,
  482.                         (mgame.highbet - mplyr.totalbet) == 1 ?
  483.                         getlang("CDSingular") : getlang("CDPlural"));
  484.                 top_output(OUT_SCREEN, outbuf);
  485.                 mused++;
  486.                 }
  487.             if (!stricmp(msgin.string, "HurryDiscard"))
  488.                 {
  489.                 delprompt(delname);
  490.                 top_output(OUT_SCREEN, "\a^I^pIt is ^mStill^p \ayour turn to "
  491.                            "^kdiscard^p\a in Poker!  \a^lHurry Up!!!^A^o\a");
  492.                 mused++;
  493.                 }
  494.             if (!stricmp(msgin.string, "ForcedOut"))
  495.                 {
  496.                 delprompt(delname);
  497.                 top_output(OUT_SCREEN, "\a\a\a\a\a^I^mYou have been ^pFORCED^m out "
  498.                            "of Poker for taking too long!^A^m\a\a\a\a\a\r\n");
  499.                 top_output(OUT_SCREEN, "When you get back to this universe feel "
  500.                            "free to join in again.");
  501.                 pokstacknode[pokcount] = od_control.od_node;
  502.                 pokerstack[pokcount++] = POKER_WANTOUT;
  503.                 mused++;
  504.                 }
  505.             if (!stricmp(msgin.string, "GameOn"))
  506.                 {
  507.                 delprompt(delname);
  508.                 top_output(OUT_SCREEN, "\a^I^pThe ^kPoker^p game has just "
  509.                            "started!^A^n\r\n");
  510.                 ultoa(cfg.pokerante, outnum[0], 10);
  511.                 top_output(OUT_SCREEN, "The ante of ^l@1^n CyberDollar@2 "
  512.                         "has been automatically deducted from your "
  513.                         "total.", outnum[0], "s");
  514.                 user.cybercash -= cfg.pokerante;
  515.                 save_user_data(user_rec_num, &user);
  516.                 mused++;
  517.                 }
  518.             if (!stricmp(msgin.string, "You'reIn"))
  519.                 {
  520.                 delprompt(delname);
  521.                 top_output(OUT_SCREEN, "^pYou will now be playing in the next "
  522.                            "^kPoker^p game!");
  523.                 mused++;
  524.                 }
  525.             if (!stricmp(msgin.string, "TooManyPeople"))
  526.                 {
  527.                 delprompt(delname);
  528.                 top_output(OUT_SCREEN, "^pThere are too many people playing "
  529.                            "^kPoker^p right now, so you cannot "
  530.                            "join.");
  531.                 mused++;
  532.                 }
  533.             if (!stricmp(msgin.string, "NotEnoughPeople"))
  534.                 {
  535.                 delprompt(delname);
  536.                 top_output(OUT_SCREEN, "^mThere are not enough people playing "
  537.                            "^kPoker^m for a game to start yet.\r\n");
  538.                 top_output(OUT_SCREEN, "Why not invite someone to play?");
  539.                 mused++;
  540.                 }
  541.             if (!stricmp(msgin.string, "GameOver"))
  542.                 {
  543.                 XINT hsd, maxnamlen;
  544.                 poker_player_typ hdplyr;
  545.                 char winin[256]; // Dynam with MAXNODES!
  546.  
  547.                 delprompt(delname);
  548.                 poker_loadgamedata(&mgame);
  549.                 top_output(OUT_SCREEN, "\r\n^pThe ^kPoker^p game has "
  550.                            "ended!\r\n\r\n");
  551.  
  552.                 // Need to enhance to show big fancy cards, etc.
  553.                 poker_loadintable(0, 0, winin);
  554.                 for (hsd = 0, maxnamlen = 0; hsd < MAXNODES; hsd++)
  555.                     {
  556.                     if (winin[hsd] > 1)
  557.                         {
  558.                         if (strlen(handles[hsd].string) > maxnamlen)
  559.                             {
  560.                             maxnamlen = strlen(handles[hsd].string);
  561.                             }
  562.                         }
  563.                     }
  564.                 top_output(OUT_SCREEN, "^nHands:\r\n");
  565.                 for (hsd = 0; hsd < MAXNODES; hsd++)
  566.                     {
  567.                     XINT hse;
  568.  
  569.                     if (winin[hsd] > 1)
  570.                         {
  571.                         XINT xxq;
  572.  
  573.                         char btmp[256]; // Dynam with MAXSTRLEN!
  574.  
  575.                         poker_loadplyrdata(hsd, &hdplyr);
  576.  
  577.                         sprintf(outbuf, "^l%*s  ", maxnamlen,
  578.                                 handles[hsd].string);
  579.                         top_output(OUT_SCREEN, outbuf);
  580.                         for (hse = 0; hse < 5; hse++) // 5 = maxcards
  581.                             {
  582.                             // Line below needs mods to display low ascii
  583.                             // suit if ibmchars on
  584.                             sprintf(outbuf, "^H^%c%c%c^A ",
  585.                                     (hdplyr.cards[hse] % 4) > 1 ? 'm' : 'a',
  586.                                        card_symbols[hdplyr.cards[hse] % 13],
  587.                                     card_suits[hdplyr.cards[hse] % 4]);
  588.                             top_output(OUT_SCREEN, outbuf);
  589.                             }
  590.                         top_output(OUT_SCREEN, " ");
  591.                         xxq = wherex();
  592.                         top_output(OUT_SCREEN, poker_getshortname(&hdplyr));
  593.                         od_repeat(' ', 20 - (wherex() - xxq));
  594.                         if (winin[hsd] == 3)
  595.                             {
  596.                             top_output(OUT_SCREEN, "  ^I^k<-- Winner!^A^h");
  597.                             }
  598.                         top_output(OUT_SCREEN, "\r\n");
  599.                         }
  600.                     }
  601.  
  602.                 sprintf(outbuf, "\r\n^oThe pot was ^l%lu^o "
  603.                         "CyberDollar%s.\r\n", mgame.pot,
  604.                         mgame.pot == 1 ?
  605.                         getlang("CDSingular") : getlang("CDPlural"));
  606.                 top_output(OUT_SCREEN, outbuf);
  607.                 if (winin[od_control.od_node] == 3)
  608.                     {
  609.                     unsigned long winamount;
  610.  
  611.                     assert(mgame.numwinners != 0);
  612.                     winamount = mgame.pot / mgame.numwinners;
  613.                     sprintf(outbuf, "^I^kYou won ^o%lu^k "
  614.                             "CyberDollar%s!!!^A^o", winamount,
  615.                             winamount == 1L ?
  616.                             getlang("CDSingular") : getlang("CDPlural"));
  617.                     top_output(OUT_SCREEN, outbuf);
  618.                     user.cybercash += winamount;
  619.                     save_user_data(user_rec_num, &user);
  620.                     }
  621.                 else
  622.                     {
  623.                     top_output(OUT_SCREEN, "^mSorry, you didn't win!  Better luck "
  624.                                "next time!");
  625.                     }
  626.                 top_output(OUT_SCREEN, "\r\n");
  627.                 mused++;
  628.                 }
  629.             proc++;
  630.             break;
  631.         case MSG_GENERIC:
  632.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  633.                 {
  634.                 delprompt(delname);
  635.                 top_output(OUT_SCREEN, msgin.string);
  636.                 mused++;
  637.                 }
  638.             proc++;
  639.             break;
  640.         case MSG_INCHANNEL:
  641.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  642.                 {
  643.                 delprompt(delname);
  644.                 top_output(OUT_SCREEN, getlang("ChannelIn"),
  645.                            msgin.handle);
  646.                 mused++;
  647.                 }
  648.             proc++;
  649.             break;
  650.         case MSG_OUTCHANNEL:
  651.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  652.                 {
  653.                 delprompt(delname);
  654.                 top_output(OUT_SCREEN, getlang("ChannelOut"),
  655.                            msgin.handle);
  656.                 mused++;
  657.                 }
  658.             proc++;
  659.             break;
  660.         case MSG_KILLCRASH:
  661.             res = atoi(msgin.string);
  662.             if (!(forgetstatus[res] & FGT_FORGOTTEN))
  663.                 {
  664.                 delprompt(delname);
  665.                 top_output(OUT_SCREEN, getlang("CrashToss"), handles[res].string);
  666.                 }
  667.             activenodes[res] = 0;
  668.             forgetstatus[res] = 0;
  669.             mused++;
  670.             proc++;
  671.             break;
  672.         case MSG_DIRECTED:
  673.             if (!(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  674.                 {
  675.                 delprompt(delname);
  676.                 top_output(OUT_SCREEN, getlang("DirectedPrefix"),
  677.                            handles[msgin.from].string,
  678.                            msgin.doneto == od_control.od_node ?
  679.                            getlang("You") : handles[msgin.doneto].string,
  680.                            msgin.string);
  681.                 mused++;
  682.                 }
  683.             proc++;
  684.             break;
  685.         case MSG_SYSUSEREDITED:
  686.             delprompt(delname);
  687.             top_output(OUT_SCREEN, getlang("SysopUserEdited"),
  688.                        msgin.string);
  689.             load_user_data(user_rec_num, &user);
  690.             mused++;
  691.             proc++;
  692.             break;
  693.         }
  694.     if (isaction && !(forgetstatus[msgin.from] & FGT_FORGOTTEN))
  695.         {
  696.         char tmp[356]; // Dynam with MAXSTRLEN!
  697.         XINT c, nxt = 0, proctokon = 1;
  698.  
  699.         delprompt(delname);
  700.         mused++;
  701.         strset(tmp, '\0');
  702.         for (c = 0; c < strlen(msgin.string); c++)
  703.             {
  704.             if (c == msgin.talktypetextstart)
  705.                 {
  706.                 proctokon = 0;
  707.                 }
  708.             if (nxt)
  709.                 {
  710.                 nxt = 2;
  711.                 if (toupper(msgin.string[c]) == 'M' &&
  712.                     (allowbits & ALLOW_ME))
  713.                     {
  714.                     strcat(tmp, "^l");
  715.                     strcat(tmp, msgin.handle);
  716.                     strcat(tmp, "^o");
  717.                     }
  718.                 if (toupper(msgin.string[c]) == 'Y' &&
  719.                     (allowbits & ALLOW_YOU))
  720.                     {
  721.                     strcat(tmp, "^l");
  722.                     if (msgin.doneto == od_control.od_node)
  723.                         {
  724.                         strcat(tmp, getlang("You"));
  725.                         }
  726.                     if (msgin.doneto == -2)
  727.                         {
  728.                         strcat(tmp, "everyone"); ///!
  729.                         }
  730.                     if ((msgin.doneto >= 0) &&
  731.                         (msgin.doneto != od_control.od_node))
  732.                         {
  733.                         strcat(tmp, handles[msgin.doneto].string);
  734.                         }
  735.                     strcat(tmp, "^o");
  736.                     }
  737.                 if (toupper(msgin.string[c]) == 'H' &&
  738.                     (allowbits & ALLOW_SEX))
  739.                     {
  740.                     strcat(tmp, "^p");
  741.                     if (msgin.gender == 0)
  742.                         {
  743.                         strcat(tmp, getlang("His"));
  744.                         }
  745.                     if (msgin.gender == 1)
  746.                         {
  747.                         strcat(tmp, getlang("Her"));
  748.                         }
  749.                     strcat(tmp, "^o");
  750.                     }
  751.                 if (toupper(msgin.string[c]) == 'F' &&
  752.                     (allowbits & ALLOW_SLF))
  753.                     {
  754.                     strcat(tmp, "^p");
  755.                     if (msgin.gender == 0)
  756.                         {
  757.                         strcat(tmp, getlang("Himself"));
  758.                         }
  759.                     if (msgin.gender == 1)
  760.                         {
  761.                         strcat(tmp, getlang("Herself"));
  762.                         }
  763.                     strcat(tmp, "^o");
  764.                     }
  765.                 if (toupper(msgin.string[c]) == 'S' &&
  766.                     (allowbits & ALLOW_POS))
  767.                     {
  768.                     if (msgin.doneto == od_control.od_node)
  769.                         {
  770.                         strcat(tmp, "^l");
  771.                         strcat(tmp, "r");
  772.                         strcat(tmp, "^o");
  773.                         }
  774.                     else
  775.                         {
  776.                         strcat(tmp, "'s");
  777.                         }
  778.                     }
  779.                 }
  780.             if (nxt == 0)
  781.                 {
  782.                 if (msgin.string[c] == '%' && proctokon)
  783.                     {
  784.                     nxt = 1;
  785.                     }
  786.                 else
  787.                     {
  788.                     strncat(tmp, &msgin.string[c], 1);
  789.                     }
  790.                 }
  791.             if (nxt == 2)
  792.                 {
  793.                 nxt = 0;
  794.                 }
  795.             }
  796.         top_output(OUT_SCREEN, tmp);
  797.         if (msgin.type == MSG_ACTPLUSEC)
  798.             {
  799.             top_output(OUT_SCREEN, getlang("Secretly"));
  800.             }
  801.         }
  802.     tstbit[0] = 0;
  803.     lseek(midxinfil, (long) d, SEEK_SET);
  804.     write(midxinfil, tstbit, 1L);
  805.     rec_locking(REC_UNLOCK, midxinfil, d, 1L);
  806.     }
  807.  
  808. for (res = 0; res < pokcount; res++)
  809.     {
  810.     poker_core(pokerstack[res], pokstacknode[res]);
  811.     }
  812.  
  813. if (delname && mused > 0)
  814.     {
  815.     od_printf("\r\n");
  816.     }
  817.  
  818. return mused;
  819. }
  820.  
  821. void delprompt(char dname)
  822. {
  823. XINT dd;
  824.  
  825. if (dname)
  826.     {
  827.     for (dd = 0; dd < strlen(user.handle) + 2; dd++)
  828.         {
  829.         top_output(OUT_SCREEN, "\b \b");
  830.         }
  831.     }
  832.  
  833. }
  834.