ENet.cpp 366 B

1234567891011121314151617181920
  1. #define ENET_IMPLEMENTATION
  2. #include "libs/enet/include/enet.h"
  3. #include "network/ENet.h"
  4. static int enetCounter = 0;
  5. bool ENet::add() {
  6. if(enetCounter == 0 && enet_initialize() != 0) {
  7. return true;
  8. }
  9. enetCounter++;
  10. return false;
  11. }
  12. void ENet::remove() {
  13. if(enetCounter > 0 && --enetCounter == 0) {
  14. enet_deinitialize();
  15. }
  16. }