ENet.cpp 329 B

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