-
Notifications
You must be signed in to change notification settings - Fork 4
/
tibiamodule.h
53 lines (42 loc) · 1022 Bytes
/
tibiamodule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef TIBIAMODULE_H
#define TIBIAMODULE_H
#include "tibiafile.h"
#include "tibiasprite.h"
class TibiaModule : public TibiaFile
{
public:
TibiaModule( QObject *parent ) : TibiaFile( parent ) {
_usecount = 0;
};
virtual ~TibiaModule() {};
void use( void ) {
QMutexLocker locker( &mutex );
_usecount++;
};
void free( void ) {
QMutexLocker locker( &mutex );
_usecount--;
if( _usecount <= 0 ) {
unload();
if( isOpen() )
close();
deleteLater();
}
};
virtual TibiaModule *getTibiaModule() {
return this;
};
virtual const TibiaModule *getTibiaModule() const {
return this;
};
qint32 getUseCount( void ) const {
return _usecount;
};
virtual TibiaSprite getSprite( qint32, qint32 ) {
return dummy;
}; // Index of item, frame of sprite
private:
mutable QMutex mutex;
qint32 _usecount;
};
#endif // TIBIAMODULE_H