Pol
Revision:cb584c9
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
baseobject.h
Go to the documentation of this file.
1
#ifndef BASEOBJECT_H
2
#define BASEOBJECT_H
3
4
#include "../clib/rawtypes.h"
5
6
namespace
Pol
7
{
8
namespace
Realms
9
{
10
class
Realm
;
11
}
12
namespace
Core
13
{
21
enum class
UOBJ_CLASS
:
u8
22
{
23
CLASS_ITEM
,
24
CLASS_CONTAINER
,
25
CLASS_CHARACTER
,
26
CLASS_NPC
,
27
CLASS_WEAPON
,
28
CLASS_ARMOR
,
29
CLASS_MULTI
,
30
31
INVALID
= 0xff,
32
};
33
34
// ULWObject: Lightweight object.
35
// Should contain minimal data structures (and no virtuals)
36
// can also be created with arbritary data check los.h
37
class
ULWObject
38
{
39
protected
:
40
ULWObject
(
UOBJ_CLASS
uobj_class );
41
ULWObject
(
const
ULWObject
& ) =
delete
;
42
ULWObject
& operator=(
const
ULWObject
& ) =
delete
;
43
~
ULWObject
() =
default
;
44
45
public
:
46
bool
orphan()
const
;
47
48
bool
isa(
UOBJ_CLASS
uobj_class )
const
;
49
bool
ismobile()
const
;
50
bool
isitem()
const
;
51
bool
ismulti()
const
;
52
53
u8
look_height()
const
;
// where you're looking from, or to
54
55
public
:
56
Realms::Realm
*
realm
;
57
u32
serial
;
58
u16
graphic
;
59
u16
x
;
60
u16
y
;
61
s8
z
;
62
u8
height
;
63
64
protected
:
65
const
UOBJ_CLASS
uobj_class_
;
66
};
67
68
inline
ULWObject::ULWObject(
UOBJ_CLASS
uobj_class )
69
: realm( nullptr ),
70
serial( 0 ),
71
graphic( 0 ),
72
x( 0 ),
73
y( 0 ),
74
z( 0 ),
75
height( 0 ),
76
uobj_class_( uobj_class )
77
{
78
}
79
80
inline
u8
ULWObject::look_height
()
const
81
{
82
switch
(
uobj_class_
)
83
{
84
case
UOBJ_CLASS::CLASS_ITEM
:
85
case
UOBJ_CLASS::CLASS_CONTAINER
:
86
case
UOBJ_CLASS::CLASS_WEAPON
:
87
case
UOBJ_CLASS::CLASS_ARMOR
:
88
case
UOBJ_CLASS::CLASS_MULTI
:
89
return
height
/ 2;
90
91
case
UOBJ_CLASS::CLASS_CHARACTER
:
92
case
UOBJ_CLASS::CLASS_NPC
:
93
case
UOBJ_CLASS::INVALID
:
94
return
height
;
95
}
96
return
0;
97
}
98
99
inline
bool
ULWObject::isa
(
UOBJ_CLASS
uobj_class )
const
100
{
101
return
uobj_class_
== uobj_class;
102
}
103
104
inline
bool
ULWObject::ismobile
()
const
105
{
106
return
(
uobj_class_
==
UOBJ_CLASS::CLASS_CHARACTER
||
uobj_class_
==
UOBJ_CLASS::CLASS_NPC
);
107
}
108
109
inline
bool
ULWObject::isitem
()
const
110
{
111
return
!
ismobile
();
112
}
113
114
inline
bool
ULWObject::ismulti
()
const
115
{
116
return
(
uobj_class_
==
UOBJ_CLASS::CLASS_MULTI
);
117
}
118
119
inline
bool
ULWObject::orphan
()
const
120
{
121
return
(
serial
== 0 );
122
}
123
124
125
}
// namespace Core
126
}
// namespace Pol
127
128
#endif
u8
unsigned char u8
Definition:
rawtypes.h:25
Pol::Core::ULWObject::z
s8 z
Definition:
baseobject.h:61
Pol::Realms::Realm
Definition:
realm.h:58
Pol::Core::ULWObject::y
u16 y
Definition:
baseobject.h:60
Pol::Core::ULWObject::ismobile
bool ismobile() const
Definition:
baseobject.h:104
Pol::Core::UOBJ_CLASS
UOBJ_CLASS
Definition:
baseobject.h:21
u16
unsigned short u16
Definition:
rawtypes.h:26
u32
unsigned int u32
Definition:
rawtypes.h:27
Pol::Core::UOBJ_CLASS::CLASS_ARMOR
Pol::Core::UOBJ_CLASS::CLASS_MULTI
Pol::Core::ULWObject::orphan
bool orphan() const
Definition:
baseobject.h:119
Pol::Core::ULWObject::serial
u32 serial
Definition:
baseobject.h:57
Pol::Core::ULWObject::isitem
bool isitem() const
Definition:
baseobject.h:109
s8
signed char s8
Definition:
rawtypes.h:29
Pol::Core::UOBJ_CLASS::CLASS_CONTAINER
Pol::Core::UOBJ_CLASS::CLASS_WEAPON
Pol::Core::ULWObject::look_height
u8 look_height() const
Definition:
baseobject.h:80
Pol::Core::ULWObject::uobj_class_
const UOBJ_CLASS uobj_class_
Definition:
baseobject.h:65
Pol::Core::ULWObject::realm
Realms::Realm * realm
Definition:
baseobject.h:56
Pol::Core::UOBJ_CLASS::INVALID
Pol::Core::ULWObject::isa
bool isa(UOBJ_CLASS uobj_class) const
Definition:
baseobject.h:99
Pol::Core::ULWObject
Definition:
baseobject.h:37
Pol::Core::ULWObject::height
u8 height
Definition:
baseobject.h:62
Pol::Core::ULWObject::x
u16 x
Definition:
baseobject.h:59
Pol::Core::UOBJ_CLASS::CLASS_ITEM
Pol::Core::ULWObject::ismulti
bool ismulti() const
Definition:
baseobject.h:114
Pol::Core::UOBJ_CLASS::CLASS_NPC
Pol
Definition:
berror.cpp:12
Pol::Core::UOBJ_CLASS::CLASS_CHARACTER
Pol::Core::ULWObject::graphic
u16 graphic
Definition:
baseobject.h:58
pol
baseobject.h
Generated on Wed Oct 10 2018 02:41:54 for Pol by
1.8.11