summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 18:47:53 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 18:47:53 +0000
commit95edabf40aaa4b14c46d5e085360998f54c4dc69 (patch)
tree532b7c6da2de511b6e4bee3e29d0f9e90c248010
parent3c8999edce9e1f0d5c0dee3ff8311e781d64c684 (diff)
downloadhercules-95edabf40aaa4b14c46d5e085360998f54c4dc69.tar.gz
hercules-95edabf40aaa4b14c46d5e085360998f54c4dc69.tar.bz2
hercules-95edabf40aaa4b14c46d5e085360998f54c4dc69.tar.xz
hercules-95edabf40aaa4b14c46d5e085360998f54c4dc69.zip
- Updated svn-revision reading, now it can read the new svn file system
- Fixed a bug with homunc which could spawn on a non-walkable cell git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8500 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/common/core.c45
-rw-r--r--src/map/mercenary.c13
3 files changed, 49 insertions, 12 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ca6f33a92..2907aff2f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2006/08/27
+ * Updated svn-revision reading, now it can read the new svn file system [Toms]
+ * Fixed a bug with homunc which could spawn on a non-walkable cell [Toms]
2006/08/26
* Optional macro MEMSET_TURBO for faster low-level memory initializations. [Lance]
* Small bug fix in read_homunculus_expdb (a warning was always displayed) [Toms]
diff --git a/src/common/core.c b/src/common/core.c
index fe16d26a9..6f9bb4548 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -8,6 +8,7 @@
#endif
#include <signal.h>
#include <string.h>
+#include <ctype.h>
#include "core.h"
#include "../common/db.h"
@@ -32,6 +33,7 @@ char **arg_v = NULL;
char *SERVER_NAME = NULL;
char SERVER_TYPE = ATHENA_SERVER_NONE;
static void (*term_func)(void) = NULL;
+static char eA_svn_version[10];
/*======================================
* CORE : Set function
@@ -130,23 +132,45 @@ void signals_init (void)
#else
const char* get_svn_revision(void)
{
- static char version[10];
FILE *fp;
- if ((fp = fopen(".svn/entries", "r")) != NULL) {
+ if(*eA_svn_version)
+ return eA_svn_version;
+
+ if ((fp = fopen(".svn/entries", "r")))
+ {
char line[1024];
int rev;
- while (fgets(line,1023,fp))
- if (strstr(line,"revision=")) break;
- fclose(fp);
- if (sscanf(line," %*[^\"]\"%d%*[^\n]", &rev) == 1) {
- sprintf(version, "%d", rev);
- return version;
+ // Check the version
+ if (fgets(line,sizeof(line),fp))
+ {
+ if(!isdigit(line[0]))
+ {
+ // XML File format
+ while (fgets(line,sizeof(line),fp))
+ if (strstr(line,"revision=")) break;
+ fclose(fp);
+ if (sscanf(line," %*[^\"]\"%d%*[^\n]", &rev) == 1) {
+ snprintf(eA_svn_version, sizeof(eA_svn_version), "%d", rev);
+ }
+ }
+ else
+ {
+ // Bin File format
+ fgets(line,sizeof(line),fp); // Get the name
+ fgets(line,sizeof(line),fp); // Get the entries kind
+ if(fgets(line,sizeof(line),fp)) // Get the rev numver
+ {
+ snprintf(eA_svn_version, sizeof(eA_svn_version), "%d", atoi(line));
+ }
+ }
}
}
- // if getting revision has failed
- return "Unknown";
+ if(!(*eA_svn_version))
+ snprintf(eA_svn_version, sizeof(eA_svn_version), "Unknown");
+
+ return eA_svn_version;
}
#endif
@@ -207,6 +231,7 @@ int main (int argc, char **argv)
SERVER_NAME = ++p;
arg_c = argc;
arg_v = argv;
+ *eA_svn_version = '\0';
}
set_server_type();
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 5ba260c18..4ff2c34b5 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -588,7 +588,8 @@ int search_homunculusDB_index(int key,int type)
int merc_hom_alloc(struct map_session_data *sd)
{
struct homun_data *hd;
- int i = 0 ;
+ int i = 0;
+ short x,y;
nullpo_retr(1, sd);
@@ -605,8 +606,16 @@ int merc_hom_alloc(struct map_session_data *sd)
hd->master = sd;
hd->bl.m = sd->bl.m;
+
+ // Find a random valid pos around the player
hd->bl.x = sd->bl.x;
- hd->bl.y = sd->bl.y - 1 ;
+ hd->bl.y = sd->bl.y;
+ x = sd->bl.x + 1;
+ y = sd->bl.y + 1;
+ map_random_dir(&hd->bl, &x, &y);
+ hd->bl.x = x;
+ hd->bl.y = y;
+
hd->bl.subtype = MONS;
hd->bl.type = BL_HOM;
hd->bl.id = npc_get_new_npc_id();