home *** CD-ROM | disk | FTP | other *** search
/ Total Meltdown / dukenukemtotalmeltdown.img / util / dukenet / network.c < prev    next >
C/C++ Source or Header  |  1996-02-12  |  2KB  |  100 lines

  1. // sample network.c file
  2.  
  3. #include <conio.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <dos.h>
  7. #include <string.h>
  8. #include <process.h>
  9. #include <stdarg.h>
  10. #include <bios.h>
  11. #include <time.h>
  12.  
  13. #include "gamecom.h"
  14. #include "commit.h"
  15.  
  16. static boolean NetworkStarted=false;
  17. /*
  18. =================
  19. =
  20. = ShutdownNetwork
  21. =
  22. =================
  23. */
  24.  
  25. void ShutdownNetwork ( void )
  26.    {
  27.     if (NetworkStarted == true)
  28.         {
  29.         NetworkStarted = false;
  30.       //*****************************
  31.       // Put shutdown code here
  32.       //*****************************
  33.         }
  34.     }
  35.  
  36. /*
  37. =================
  38. =
  39. = StartupNetwork
  40. =
  41. =================
  42. */
  43.  
  44. boolean StartupNetwork ( void )
  45.     {
  46.     if (NetworkStarted == false)
  47.       {
  48.       NetworkStarted = true;
  49.       //*****************************
  50.       // Put startup code here
  51.       //*****************************
  52.       }
  53.    //*****************************
  54.    // Put Find other people code here
  55.    //     playernumbers should be sorted identically on every players computer
  56.    //     i.e. everyone's player 1 should be the same etc.
  57.    //     Player 0 is always the local address of this machine
  58.    //     Player 1 is usually the master in most games
  59.    //*****************************
  60.     return true;
  61.     }
  62.  
  63. /*
  64. =================
  65. =
  66. = SendNetworkPacket
  67. =
  68. =================
  69. */
  70.  
  71. void SendNetworkPacket ( void )
  72.     {
  73.    //*****************************
  74.    // Put Send code here:
  75.    //    gamecom.remotenode contains destination address
  76.    //    gamecom.data holds data to send
  77.    //    gamecom.datalength holds amount of data to send
  78.    //*****************************
  79.     }
  80.  
  81. /*
  82. =================
  83. =
  84. = GetNetworkPacket
  85. =
  86. =================
  87. */
  88.  
  89. void GetNetworkPacket ( void )
  90.     {
  91.    //*****************************
  92.    // Put Get code here:
  93.    //    gamecom.remotenode should be set to -1 if no packet is ready,
  94.    //                       otherwise it should be set to the address of
  95.    //                       the packet sender
  96.    //    gamecom.data       copy your data to this buffer
  97.    //    gamecom.datalength fill in how much of it is there
  98.    //*****************************
  99.     }
  100.