summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-02 13:46:11 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-02 13:46:11 +0000
commit37cc17c1b9a2dd29e1623a46cfc332e1aeb76751 (patch)
tree6f8dd05942422f043ef2df9e9364dd954a826bb3 /src/map/map.c
parent5758d3649f0bf74677b3f470acb4e17a98910100 (diff)
downloadhercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.gz
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.bz2
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.tar.xz
hercules-37cc17c1b9a2dd29e1623a46cfc332e1aeb76751.zip
* Some source code cleaning
- Fixed the badly worded messages during mapserver startup - Cleaned up socket config reading - Split resolve_hostbyname() into 2 separate functions for clarity - Moved the probably obsolete LOWER/UPPER macros to db.c (TODO: remove) - Moved the badly placed compare_item() function to storage.c (see r779) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10119 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 9cf047d56..a28ac20c5 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3228,13 +3228,14 @@ void map_versionscreen(int flag) {
/*======================================================
* Map-Server Init and Command-line Arguments [Valaris]
- *------------------------------------------------------
- */
+ *------------------------------------------------------*/
void set_server_type(void)
{
SERVER_TYPE = ATHENA_SERVER_MAP;
}
-int do_init(int argc, char *argv[]) {
+
+int do_init(int argc, char *argv[])
+{
int i;
#ifdef GCOLLECT
@@ -3284,24 +3285,22 @@ int do_init(int argc, char *argv[]) {
chrif_checkdefaultlogin();
if (!map_ip_set || !char_ip_set) {
- // The map server should know what IP address it is running on
- // - MouseJstr
- int localaddr = ntohl(addr_[0]);
- unsigned char *ptr = (unsigned char *) &localaddr;
- char buf[16];
- if (naddr_ == 0) {
- ShowError("\nUnable to determine your IP address... please edit the map_athena.conf file and set it.\n");
- ShowError("(127.0.0.1 is valid if you have no network interface)\n");
- }
- sprintf(buf, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);;
- if (naddr_ != 1)
- ShowNotice("Multiple interfaces detected.. using %s as our IP address\n", buf);
- else
- ShowInfo("Defaulting to %s as our IP address\n", buf);
+ char ip_str[16];
+ ip2str(addr_[0], ip_str);
+
+ ShowError("\nNot all IP addresses in map_athena.conf configured, autodetecting...\n");
+
+ if (naddr_ == 0)
+ ShowError("Unable to determine your IP address...\n");
+ else if (naddr_ > 1)
+ ShowNotice("Multiple interfaces detected...\n");
+
+ ShowInfo("Defaulting to %s as our IP address\n", ip_str);
+
if (!map_ip_set)
- clif_setip(buf);
+ clif_setip(ip_str);
if (!char_ip_set)
- chrif_setip(buf);
+ chrif_setip(ip_str);
}
if (SHOW_DEBUG_MSG)
@@ -3375,17 +3374,3 @@ int do_init(int argc, char *argv[]) {
return 0;
}
-
-int compare_item(struct item *a, struct item *b) {
-
- if (a->nameid == b->nameid &&
- a->identify == b->identify &&
- a->refine == b->refine &&
- a->attribute == b->attribute)
- {
- int i;
- for (i = 0; i < MAX_SLOTS && (a->card[i] == b->card[i]); i++);
- return (i == MAX_SLOTS);
- }
- return 0;
-}