summaryrefslogtreecommitdiff
path: root/src/common/core.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-10 19:23:04 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-10 19:23:04 +0000
commit8bf35af0e6d7aba3c619507e53cab3f9584807e1 (patch)
tree0a6d5396e27ea45c28857257ddf88ae22b97f89a /src/common/core.c
parent91d42beda228772338cecadda47c7fd50217c60f (diff)
downloadhercules-8bf35af0e6d7aba3c619507e53cab3f9584807e1.tar.gz
hercules-8bf35af0e6d7aba3c619507e53cab3f9584807e1.tar.bz2
hercules-8bf35af0e6d7aba3c619507e53cab3f9584807e1.tar.xz
hercules-8bf35af0e6d7aba3c619507e53cab3f9584807e1.zip
- Added more helpfull error messages when packet_ver=-1. (no more "clif_parse: Disconnecting session #XX for not having latest client version (has version -1)." messages)
- Joined normal and MINICORE's main function. - Put malloc_init() first and malloc_final() last as it's needed for Show* in display_title(). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9446 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/core.c')
-rw-r--r--src/common/core.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/src/common/core.c b/src/common/core.c
index 7b977632d..e8fd48923 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -11,15 +11,17 @@
#include <ctype.h>
#include "core.h"
-#include "../common/db.h"
#include "../common/mmo.h"
+#include "../common/version.h"
+#include "../common/showmsg.h"
#include "../common/malloc.h"
+#ifndef MINICORE
+#include "../common/db.h"
#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/graph.h"
#include "../common/plugins.h"
-#include "../common/version.h"
-#include "../common/showmsg.h"
+#endif
#ifndef _WIN32
#include "svnversion.h"
@@ -129,7 +131,7 @@ void signals_init (void)
{
return xstringify(SVNVERSION);
}
-#else
+#else// not SVNVERSION
const char* get_svn_revision(void)
{
FILE *fp;
@@ -178,7 +180,6 @@ const char* get_svn_revision(void)
* CORE : Display title
*--------------------------------------
*/
-
static void display_title(void)
{
//The clearscreeen is usually more of an annoyance than anything else... [Skotlex]
@@ -220,13 +221,9 @@ void usercheck(void){
* CORE : MAINROUTINE
*--------------------------------------
*/
-#ifndef MINICORE // minimalist Core
int main (int argc, char **argv)
{
- int next;
-
- // initialise program arguments
- {
+ {// initialize program arguments
char *p1 = SERVER_NAME = argv[0];
char *p2 = p1;
while ((p1 = strchr(p2, '/')) != NULL || (p1 = strchr(p2, '\\')) != NULL)
@@ -241,11 +238,18 @@ int main (int argc, char **argv)
#endif
}
+ malloc_init();// needed for Show* in display_title() [FlavioJS]
+
+#ifdef MINICORE // minimalist Core
+ display_title();
+ usercheck();
+ do_init(argc,argv);
+ do_final();
+#else// not MINICORE
set_server_type();
display_title();
- usercheck();
+ usercheck();
- malloc_init(); /* 一番最初に実行する必要がある */
db_init();
signals_init();
@@ -257,12 +261,15 @@ int main (int argc, char **argv)
graph_init();
plugin_event_trigger("Athena_Init");
- while (runflag) {
- next = do_timer(gettick_nocache());
- do_sendrecv(next);
-#ifndef TURBO
- do_parsepacket();
-#endif
+ {// Main runtime cycle
+ int next;
+ while (runflag) {
+ next = do_timer(gettick_nocache());
+ do_sendrecv(next);
+ #ifndef TURBO
+ do_parsepacket();
+ #endif
+ }
}
plugin_event_trigger("Athena_Final");
@@ -273,30 +280,12 @@ int main (int argc, char **argv)
plugins_final();
socket_final();
db_final();
- malloc_final();
-
- return 0;
-}
-#else
-int main (int argc, char **argv)
-{
- // initialise program arguments
- {
- char *p = SERVER_NAME = argv[0];
- while ((p = strchr(p, '/')) != NULL)
- SERVER_NAME = ++p;
- arg_c = argc;
- arg_v = argv;
- }
+#endif
- display_title();
- usercheck();
- do_init(argc,argv);
- do_final();
+ malloc_final();
return 0;
}
-#endif
#ifdef BCHECK
unsigned int __invalid_size_argument_for_IOC;