12345678910111213141516171819202122 |
- #define ENET_IMPLEMENTATION
- #include "network/ENet.h"
- static int enetCounter = 0;
- bool ENet::add() {
- if(enetCounter == 0 && enet_initialize() != 0) {
- return true;
- }
- enetCounter++;
- return false;
- }
- void ENet::remove() {
- if(enetCounter > 0 && --enetCounter == 0) {
- enet_deinitialize();
- }
- }
- bool ENet::hasError() {
- return enetCounter <= 0;
- }
|