summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-06 21:23:31 -0200
committershennetsind <ind@henn.et>2013-11-06 21:23:31 -0200
commitd56017e3d1bf783cfdc67a702d2b70a0a27c8863 (patch)
treea47bd0ef6340ce1d011d198f430c7d96d620afe0 /src/common
parent5c94e76753c0cdb4ffb7dabbd6e135f1f7d42ef2 (diff)
parent3a3d2297068809d25ca43e19fd2977f97b2728f5 (diff)
downloadhercules-d56017e3d1bf783cfdc67a702d2b70a0a27c8863.tar.gz
hercules-d56017e3d1bf783cfdc67a702d2b70a0a27c8863.tar.bz2
hercules-d56017e3d1bf783cfdc67a702d2b70a0a27c8863.tar.xz
hercules-d56017e3d1bf783cfdc67a702d2b70a0a27c8863.zip
Merge remote-tracking branch 'upstream/master'
Signed-off-by: shennetsind <ind@henn.et> Conflicts: src/map/pc.c
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cbasetypes.h12
-rw-r--r--src/common/core.c14
-rw-r--r--src/common/mapindex.c17
-rw-r--r--src/common/mapindex.h3
-rw-r--r--src/common/mmo.h16
5 files changed, 40 insertions, 22 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 1e4fc04c7..d2a0a5dd9 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -37,7 +37,7 @@
#define CYGWIN
#endif
-// __APPLE__ is the only predefined macro on MacOS X
+// __APPLE__ is the only predefined macro on MacOS
#if defined(__APPLE__)
#define __DARWIN__
#endif
@@ -92,9 +92,9 @@
// (-20 >= USHRT_MAX) returns true
#if defined(__FreeBSD__) && defined(__x86_64)
#undef UCHAR_MAX
-#define UCHAR_MAX (unsigned char)0xff
+#define UCHAR_MAX ((unsigned char)0xff)
#undef USHRT_MAX
-#define USHRT_MAX (unsigned short)0xffff
+#define USHRT_MAX ((unsigned short)0xffff)
#endif
// ILP64 isn't supported, so always 32 bits?
@@ -180,7 +180,7 @@ typedef unsigned long int ppuint32;
#if defined(WIN32) && !defined(MINGW) // does not have a signed size_t
//////////////////////////////
-#if defined(_WIN64) // naive 64bit windows platform
+#if defined(_WIN64) // native 64bit windows platform
typedef __int64 ssize_t;
#else
typedef int ssize_t;
@@ -341,8 +341,8 @@ typedef char bool;
#if defined(WIN32)
#define PATHSEP '\\'
#define PATHSEP_STR "\\"
-#elif defined(__APPLE__)
-// FIXME Mac OS X is unix based, is this still correct?
+#elif defined(__APPLE__) && !defined(__MACH__)
+// __MACH__ indicates OS X ( http://sourceforge.net/p/predef/wiki/OperatingSystems/ )
#define PATHSEP ':'
#define PATHSEP_STR ":"
#else
diff --git a/src/common/core.c b/src/common/core.c
index 6a73d2d39..f57cc4c79 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -302,10 +302,20 @@ int main (int argc, char **argv) {
arg_v = argv;
}
core_defaults();
+
+ {
+ int i;
+ for(i = 0; i < argc; i++) {
+ if( strcmp(argv[i], "--script-check") == 0 ) {
+ msg_silent = 0x7; // silence information and status messages
+ }
+ }
+ }
iMalloc->init();// needed for Show* in display_title() [FlavioJS]
-
- console->display_title();
+
+ if (!(msg_silent&0x1))
+ console->display_title();
#ifdef MINICORE // minimalist Core
usercheck();
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 83de21b2b..a95e143c3 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -21,7 +21,12 @@ int max_index = 0;
char mapindex_cfgfile[80] = "db/map_index.txt";
-#define mapindex_exists(id) (indexes[id].name[0] != '\0')
+#define mapindex_exists_sub(id) (indexes[id].name[0] != '\0')
+
+bool mapindex_exists(int id) {
+ return mapindex_exists_sub(id);
+}
+
/// Retrieves the map name from 'string' (removing .gat extension if present).
/// Result gets placed either into 'buf' or in a static local buffer.
const char* mapindex_getmapname(const char* string, char* output) {
@@ -102,7 +107,7 @@ int mapindex_addmap(int index, const char* name) {
return 0;
}
- if (mapindex_exists(index)) {
+ if (mapindex_exists_sub(index)) {
ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);
strdb_remove(mapindex_db, indexes[index].name);
}
@@ -129,18 +134,18 @@ unsigned short mapindex_name2id(const char* name) {
}
const char* mapindex_id2name_sub(unsigned short id,const char *file, int line, const char *func) {
- if (id > MAX_MAPINDEX || !mapindex_exists(id)) {
+ if (id > MAX_MAPINDEX || !mapindex_exists_sub(id)) {
ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line);
return indexes[0].name; // dummy empty string so that the callee doesn't crash
}
return indexes[id].name;
}
-void mapindex_init(void) {
+int mapindex_init(void) {
FILE *fp;
char line[1024];
int last_index = -1;
- int index;
+ int index, total = 0;
char map_name[12];
if( ( fp = fopen(mapindex_cfgfile,"r") ) == NULL ){
@@ -158,6 +163,7 @@ void mapindex_init(void) {
index = last_index+1;
case 2: //Map with ID given
mapindex_addmap(index,map_name);
+ total++;
break;
default:
continue;
@@ -169,6 +175,7 @@ void mapindex_init(void) {
if( !strdb_iget(mapindex_db, MAP_DEFAULT) ) {
ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n",MAP_DEFAULT);
}
+ return total;
}
int mapindex_removemap(int index){
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index 43953a8e0..646f73f18 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -56,12 +56,13 @@ extern char mapindex_cfgfile[80];
#define MAP_MALAYA "malaya"
#define MAP_ECLAGE "eclage"
+bool mapindex_exists(int id);
const char* mapindex_getmapname(const char* string, char* output);
const char* mapindex_getmapname_ext(const char* string, char* output);
unsigned short mapindex_name2id(const char*);
#define mapindex_id2name(n) mapindex_id2name_sub(n,__FILE__, __LINE__, __func__)
const char* mapindex_id2name_sub(unsigned short,const char *file, int line, const char *func);
-void mapindex_init(void);
+int mapindex_init(void);
void mapindex_final(void);
int mapindex_addmap(int index, const char* name);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 603ec7573..b1a1caf24 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -48,18 +48,18 @@
// 20120307 - 2012-03-07aRagexeRE+ - 0x970
#ifndef PACKETVER
- #define PACKETVER 20120418
-#endif
+#define PACKETVER 20120418
+#endif // PACKETVER
+#ifndef DISABLE_PACKETVER_RE
// Comment the following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE).
#define PACKETVER_RE
+#endif // DISABLE_PACKETVER_RE
// Client support for experimental RagexeRE UI present in 2012-04-10 and 2012-04-18
-#ifdef PACKETVER_RE
-#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
- #define PARTY_RECRUIT
-#endif
-#endif
+#if defined(PACKETVER_RE) && ( PACKETVER == 20120410 || PACKETVER == 20120418 )
+#define PARTY_RECRUIT
+#endif // PACKETVER_RE && (PACKETVER == 20120410 || PACKETVER == 10120418)
// Comment the following line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
@@ -107,7 +107,7 @@
//Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
#define MAX_REG_NUM 256
#define DEFAULT_WALK_SPEED 150
-#define MIN_WALK_SPEED 0
+#define MIN_WALK_SPEED 20 /* below 20 clips animation */
#define MAX_WALK_SPEED 1000
#define MAX_STORAGE 600
#define MAX_GUILD_STORAGE 600