Planeshift

psconst.h

Go to the documentation of this file.
00001 /*
00002  * psconst.h
00003  *
00004  * Copyright (C) 2003 PlaneShift Team ([email protected],
00005  * http://www.planeshift.it)
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  *
00019  */
00020 
00021 #ifndef PSCONST_HEADER
00022 #define PSCONST_HEADER
00023 
00024 // FIXME: This is not so great, but we need to be able to show and compute
00025 // hashes for our new integral types.  Those probably shouldn't be here either.
00026 #include <csutil/csstring.h>
00027 #include <csutil/hash.h>
00028 #include "psstdint.h" //Added to fix msvc build
00029 
00030 #include <math.h> // To include HUGE_VALF for INFINITY_DISTANCE
00031 
00037 #define SOCKET_CLOSE_FORCED  true
00038 
00039 
00040 #define DEFAULT_ATTACKQUEUE_SIZE 5 ///< this is the default attack queue size of players, currently it is static among all players
00041 
00042 
00044 #define MAX_COMBAT_EVENT_RANGE 30
00045 
00046 #define DEFAULT_ATTACK_NAME "default" ///< temporary constant
00047 #define DEF_PROX_DIST   100        ///< 100m is trial distance here
00048 #define DEF_UPDATE_DIST   5        ///<  30m is trial (default) delta to update
00049 #define PROX_LIST_ANY_RANGE 0.0      ///< range of 0 means all members of proxlist in multicast.
00050 
00057 #define PROX_LIST_SHRINK_THRESHOLD  50   ///< 50 players in range - start radius shrink
00058 #define PROX_LIST_REGROW_THRESHOLD  30   ///< 30 players in range - start radius grow
00059 #define PROX_LIST_STEP_SIZE         10   ///< grow by this much each attempt
00060 //@
00061 
00062 
00063 #define DEFAULT_INSTANCE             0   ///< Instance 0 is where 99% of things happen
00064 typedef uint32 InstanceID;
00065 #define INSTANCE_ALL 0xffffffff
00066 
00067 #define ASSIST_MAX_DIST 25   ///< Maximum distance that the /assist command will work
00068 
00069 #define EXCHANGE_SLOT_COUNT         9
00070 #define INVENTORY_BULK_COUNT        32
00071 #define INVENTORY_EQUIP_COUNT       16
00072 
00073 #define GLYPH_WAYS               6
00074 #define GLYPH_ASSEMBLER_SLOTS    4
00075 
00076 #define MAX_NPC_DIALOG_DIST 10
00077 #define RANGE_TO_SEE_ACTOR_LABELS 14
00078 #define RANGE_TO_SEE_ITEM_LABELS 7
00079 #define RANGE_TO_SELECT 5
00080 #define RANGE_TO_LOOT 4
00081 #define RANGE_TO_RECV_LOOT 100
00082 #define RANGE_TO_USE 4
00083 #define RANGE_TO_STACK 0.5  ///< Range to stack like items when dropping/creating in the world
00084 #define DROP_DISTANCE 0.55   ///< Distance in front of player to drop items (just more then RANGE_TO_STACK)
00085 #define MAX_DROP_DISTANCE 5 ///< Maximum distance at which a player may drop an item
00086 #define RANGE_TO_GUARD 6 ///< Range in which you can guard an item - should be slightly bigger than drop range
00087 
00088 // The defined max value to rank skills.
00089 #define SKILL_MAX_RANK 5000
00090 
00091 // Used to fire item/owner/player sensed
00092 #define LONG_RANGE_PERCEPTION  30
00093 // Used to fire item/owner/player nearby
00094 #define SHORT_RANGE_PERCEPTION 10
00095 // Used to fire item/owner/player adjacent
00096 #define PERSONAL_RANGE_PERCEPTION  4
00097 
00098 #define IS_CONTAINER true
00099 
00100 #define GAME_MINUTE_IN_SECONDS 10 ///< Number of seconds for each game minute, 10sec real time for 1 minute game time
00101 #define GAME_MINUTE_IN_TICKS (GAME_MINUTE_IN_SECONDS*1000) ///< Number of ticks for each game minute, 10sec real time for 1 minute game time
00102 
00106 #define GUILD_FEE 20000
00107 #define GUILD_MIN_MEMBERS 1
00108 #define GUILD_KICK_GRACE 5 ///< minutes
00109 
00110 #define GUILD_NAME_CHANGE_LIMIT 24 * 60 * 60000 ///< Minimum number of ticks between name change of guild
00111 #define MAX_GUILD_LEVEL    9
00112 #define DEFAULT_MAX_GUILD_POINTS 100
00113 #define MAX_GUILD_POINTS_LIMIT 99999
00114 
00115 
00116 #define SIZET_NOT_FOUND ((size_t)-1)
00117 
00118 // This is needed to 64bit code, some functions break on 32bit Linux, but we need them on 32bit windows
00119 #ifdef _WIN32
00120 #define _LP64
00121 #endif
00122 
00123 #define WEATHER_MAX_RAIN_DROPS  8000
00124 #define WEATHER_MAX_SNOW_FALKES 6000
00125 
00126 enum SPELL_TYPE
00127 {
00128     BUFF,
00129     DEBUFF
00130 };
00131 
00136 #define MAKE_ID_TYPE(name)                                               \
00137 class name                                                               \
00138 {                                                                        \
00139 public:                                                                  \
00140     name()           : id(0) {}                                          \
00141     name(uint32_t i) : id(i) {}                                          \
00142     uint32_t Unbox() const { return id; }                                \
00143     bool IsValid() const { return id != 0; }                             \
00144     csString Show() const                                                \
00145     {                                                                    \
00146         csString str(#name":");                                          \
00147         str.Append((unsigned int) id);                                         \
00148         return str;                                                      \
00149     }                                                                    \
00150     bool operator==(const name & other) const { return id == other.id; } \
00151     bool operator!=(const name & other) const { return id != other.id; } \
00152     bool operator< (const name & other) const { return id <  other.id; } \
00153 private:                                                                 \
00154     uint32_t id;                                                         \
00155 };                                                                       \
00156 template<>                                                               \
00157 class csHashComputer<name>                                               \
00158 {                                                                        \
00159 public:                                                                  \
00160     static uint ComputeHash(name key)                                    \
00161     {                                                                    \
00162         return key.Unbox();                                              \
00163     }                                                                    \
00164 }
00165 // Note: The < operator allows us to use these as keys for sets and trees.
00166 //       The csHashComputer allows us to use them as keys in csHash.
00167 
00171 #define ShowID(id) id.Show().GetData()
00172 
00173 MAKE_ID_TYPE(EID);         
00174 MAKE_ID_TYPE(PID);         
00175 MAKE_ID_TYPE(AccountID);   
00176 
00180 typedef int32_t ContainerID;
00181 
00182 // This is just a large number, may be changed to infinity.
00183 #ifdef HUGE_VALF
00184 #define INFINITY_DISTANCE HUGE_VALF
00185 #else
00186 #define INFINITY_DISTANCE 9999999.99f
00187 #endif
00188 
00189 
00192 #endif