Planeshift
psconst.h
Go to the documentation of this file.
1 /*
2  * psconst.h
3  *
4  * Copyright (C) 2003 PlaneShift Team (info@planeshift.it,
5  * http://www.planeshift.it)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  *
19  */
20 
21 #ifndef PSCONST_HEADER
22 #define PSCONST_HEADER
23 
24 // FIXME: This is not so great, but we need to be able to show and compute
25 // hashes for our new integral types. Those probably shouldn't be here either.
26 #include <csutil/csstring.h>
27 #include <csutil/hash.h>
28 #include "psstdint.h" //Added to fix msvc build
29 
30 #include <math.h> // To include HUGE_VALF for INFINITY_DISTANCE
31 
37 #define SOCKET_CLOSE_FORCED true
38 
39 
40 #define DEFAULT_ATTACKQUEUE_SIZE 5
41 
42 
44 #define MAX_COMBAT_EVENT_RANGE 30
45 
46 #define DEFAULT_ATTACK_NAME "default"
47 #define DEF_PROX_DIST 100
48 #define DEF_UPDATE_DIST 5
49 #define PROX_LIST_ANY_RANGE 0.0
50 
57 #define PROX_LIST_SHRINK_THRESHOLD 50
58 #define PROX_LIST_REGROW_THRESHOLD 30
59 #define PROX_LIST_STEP_SIZE 10
60 //@
61 
62 
63 #define DEFAULT_INSTANCE 0
64 typedef uint32 InstanceID;
65 #define INSTANCE_ALL 0xffffffff
66 
67 #define ASSIST_MAX_DIST 25
68 
69 #define EXCHANGE_SLOT_COUNT 9
70 #define INVENTORY_BULK_COUNT 32
71 #define INVENTORY_EQUIP_COUNT 16
72 
73 #define GLYPH_WAYS 6
74 #define GLYPH_ASSEMBLER_SLOTS 4
75 
76 #define MAX_NPC_DIALOG_DIST 10
77 #define RANGE_TO_SEE_ACTOR_LABELS 14
78 #define RANGE_TO_SEE_ITEM_LABELS 7
79 #define RANGE_TO_SELECT 5
80 #define RANGE_TO_LOOT 4
81 #define RANGE_TO_RECV_LOOT 100
82 #define RANGE_TO_USE 4
83 #define RANGE_TO_STACK 0.5
84 #define DROP_DISTANCE 0.55
85 #define MAX_DROP_DISTANCE 5
86 #define RANGE_TO_GUARD 6
87 
88 // The defined max value to rank skills.
89 #define SKILL_MAX_RANK 5000
90 
91 // Used to fire item/owner/player sensed
92 #define LONG_RANGE_PERCEPTION 30
93 // Used to fire item/owner/player nearby
94 #define SHORT_RANGE_PERCEPTION 10
95 // Used to fire item/owner/player adjacent
96 #define PERSONAL_RANGE_PERCEPTION 4
97 
98 #define IS_CONTAINER true
99 
100 #define GAME_MINUTE_IN_SECONDS 10
101 #define GAME_MINUTE_IN_TICKS (GAME_MINUTE_IN_SECONDS*1000)
102 
103 
106 #define GUILD_FEE 20000
107 #define GUILD_MIN_MEMBERS 1
108 #define GUILD_KICK_GRACE 5
109 
110 #define GUILD_NAME_CHANGE_LIMIT 24 * 60 * 60000
111 #define MAX_GUILD_LEVEL 9
112 #define DEFAULT_MAX_GUILD_POINTS 100
113 #define MAX_GUILD_POINTS_LIMIT 99999
114 
115 
116 #define SIZET_NOT_FOUND ((size_t)-1)
117 
118 // This is needed to 64bit code, some functions break on 32bit Linux, but we need them on 32bit windows
119 #ifdef _WIN32
120 #define _LP64
121 #endif
122 
123 #define WEATHER_MAX_RAIN_DROPS 8000
124 #define WEATHER_MAX_SNOW_FALKES 6000
125 
127 {
130 };
131 
136 #define MAKE_ID_TYPE(name) \
137 class name \
138 { \
139 public: \
140  name() : id(0) {} \
141  name(uint32_t i) : id(i) {} \
142  uint32_t Unbox() const { return id; } \
143  bool IsValid() const { return id != 0; } \
144  csString Show() const \
145  { \
146  csString str(#name":"); \
147  str.Append((unsigned int) id); \
148  return str; \
149  } \
150  bool operator==(const name & other) const { return id == other.id; } \
151  bool operator!=(const name & other) const { return id != other.id; } \
152  bool operator< (const name & other) const { return id < other.id; } \
153 private: \
154  uint32_t id; \
155 }; \
156 template<> \
157 class csHashComputer<name> \
158 { \
159 public: \
160  static uint ComputeHash(name key) \
161  { \
162  return key.Unbox(); \
163  } \
164 }
165 // Note: The < operator allows us to use these as keys for sets and trees.
166 // The csHashComputer allows us to use them as keys in csHash.
167 
171 #define ShowID(id) id.Show().GetData()
172 
173 MAKE_ID_TYPE(EID);
174 MAKE_ID_TYPE(PID);
175 MAKE_ID_TYPE(AccountID);
176 
180 typedef int32_t ContainerID;
181 
182 // This is just a large number, may be changed to infinity.
183 #ifdef HUGE_VALF
184 #define INFINITY_DISTANCE HUGE_VALF
185 #else
186 #define INFINITY_DISTANCE 9999999.99f
187 #endif
188 
189 
192 #endif
int32_t ContainerID
Container IDs are either EIDs (if > 100) or inventory slot IDs.
Definition: psconst.h:180
Definition: psconst.h:128
SPELL_TYPE
Definition: psconst.h:126
#define MAKE_ID_TYPE(name)
Make unique integer types for various types of IDs.
Definition: psconst.h:136