viewing paste ra_config-init | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/lighta/Documents/Myscript/RO/Servs/rathena/src
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: char/char.c
--- char/char.c Base (BASE)
+++ char/char.c Locally Modified (Based On LOCAL)
@@ -30,9 +30,10 @@
 #include <stdlib.h>
 
 // private declarations
-#define CHAR_CONF_NAME "conf/char_athena.conf"
-#define LAN_CONF_NAME  "conf/subnet_athena.conf"
-#define SQL_CONF_NAME  "conf/inter_athena.conf"
+char* CHAR_CONF_NAME;
+char* LAN_CONF_NAME;
+char* SQL_CONF_NAME;
+char* MSG_CONF_NAME;
 
 char char_db[256] = "char";
 char scdata_db[256] = "sc_data";
@@ -4701,6 +4702,7 @@
 
    flush_fifos();
 
+   do_final_msg();
    do_final_mapif();
    do_final_loginif();
 
@@ -4755,15 +4757,106 @@
 }
 
 
+/*======================================================
+ * Login-Server help option info
+ *------------------------------------------------------*/
+static void char_helpscreen(bool do_exit)
+{
+   ShowInfo("Usage: %s [options]\n", SERVER_NAME);
+   ShowInfo("\n");
+   ShowInfo("Options:\n");
+   ShowInfo("  -?, -h [--help]\t\tDisplays this help screen.\n");
+   ShowInfo("  -v [--version]\t\tDisplays the server's version.\n");
+   ShowInfo("  --run-once\t\t\tCloses server after loading (testing).\n");
+   ShowInfo("  --char-config <file>\t\tAlternative char-server configuration.\n");
+   ShowInfo("  --lan-config <file>\tAlternative lag configuration.\n");
+   ShowInfo("  --inter-config <file>\t\tAlternative inter-server configuration.\n");
+   ShowInfo("  --msg-config <file>\t\tAlternative message configuration.\n");
+   if( do_exit )
+       exit(EXIT_SUCCESS);
+}
+
 int do_init(int argc, char **argv)
 {
+   int i=0;
    //Read map indexes
    mapindex_init();
    start_point.map = mapindex_name2id("new_zone01");
 
-   char_config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]);
-   char_lan_config_read((argc > 3) ? argv[3] : LAN_CONF_NAME);
+   CHAR_CONF_NAME = "conf/char_athena.conf";
+   LAN_CONF_NAME = "conf/subnet_athena.conf";
+   SQL_CONF_NAME = "conf/inter_athena.conf";
+   MSG_CONF_NAME = "conf/msg_conf/char_msg.conf";
+
+   for( i = 1; i < argc ; i++ )
+   {
+       const char* arg = argv[i];
+
+       if( arg[0] != '-' && ( arg[0] != '/' || arg[1] == '-' ) )
+       {// -, -- and /
+           ShowError("Unknown option '%s'.\n", argv[i]);
+           exit(EXIT_FAILURE);
+       }
+       else if( (++arg)[0] == '-' )
+       {// long option
+           arg++;
+
+           if( strcmp(arg, "help") == 0 )
+           {
+               char_helpscreen(true);
+           }
+           else if( strcmp(arg, "version") == 0 )
+           {
+               display_versionscreen(true);
+           }
+           else if( strcmp(arg, "char-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   CHAR_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "lan-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   LAN_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "inter-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   SQL_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "msg-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   MSG_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "run-once") == 0 ) // close the login-server as soon as its done.. for testing [Celest]
+           {
+               runflag = CORE_ST_STOP;
+           }
+           else
+           {
+               ShowError("Unknown option '%s'.\n", argv[i]);
+               exit(EXIT_FAILURE);
+           }
+       }
+       else switch( arg[0] )
+       {// short option
+           case '?':
+           case 'h':
+               char_helpscreen(true);
+               break;
+           case 'v':
+               display_versionscreen(true);
+               break;
+           default:
+               ShowError("Unknown option '%s'.\n", argv[i]);
+               exit(EXIT_FAILURE);
+       }
+   }
+   char_config_read(CHAR_CONF_NAME);
+   char_lan_config_read(LAN_CONF_NAME);
    sql_config_read(SQL_CONF_NAME);
+   msg_config_read(MSG_CONF_NAME);
 
    if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
        ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
Index: char/char.h
--- char/char.h Base (BASE)
+++ char/char.h Locally Modified (Based On LOCAL)
@@ -6,6 +6,7 @@
 
 #include "../config/core.h"
 #include "../common/core.h" // CORE_ST_LAST
+#include "../common/msg_conf.h"
 
 enum E_CHARSERVER_ST
 {
Index: char/int_auction.c
--- char/int_auction.c Base (BASE)
+++ char/int_auction.c Locally Modified (Based On LOCAL)
@@ -145,12 +145,12 @@
    {
        if( auction->buyer_id )
        {
-           mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Thanks, you won the auction!.", 0, &auction->item);
+           mail_sendmail(0, msg_txt(523), auction->buyer_id, auction->buyer_name, "Auction", msg_txt(520), 0, &auction->item);
            mapif_Auction_message(auction->buyer_id, 6); // You have won the auction
-           mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->price, NULL);
+           mail_sendmail(0, msg_txt(523), auction->seller_id, auction->seller_name, "Auction", msg_txt(521), auction->price, NULL);
        }
        else
-           mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "No buyers have been found for your auction.", 0, &auction->item);
+           mail_sendmail(0, msg_txt(523), auction->seller_id, auction->seller_name, "Auction", msg_txt(522), 0, &auction->item);
        
        ShowInfo("Auction End: id %u.\n", auction->auction_id);
 
Index: char/inter.c
--- char/inter.c Base (BASE)
+++ char/inter.c Locally Modified (Based On LOCAL)
@@ -67,70 +67,6 @@
 static DBMap* wis_db = NULL; // int wis_id -> struct WisData*
 static int wis_dellist[WISDELLIST_MAX], wis_delnum;
 
-#define MAX_JOB_NAMES 106
-static char* msg_table[MAX_JOB_NAMES]; //  messages 550 ~ 655 are job names
-
-const char* msg_txt(int msg_number) {
-   msg_number -= 550;
-   if (msg_number >= 0 && msg_number < MAX_JOB_NAMES &&
-       msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0')
-       return msg_table[msg_number];
-
-   return "Unknown";
-}
-
-/*==========================================
- * Read Message Data -- at char server we only keep job names.
- *------------------------------------------*/
-int msg_config_read(const char* cfgName) {
-   int msg_number;
-   char line[1024], w1[1024], w2[1024];
-   FILE *fp;
-   static int called = 1;
-
-   if ((fp = fopen(cfgName, "r")) == NULL) {
-       ShowError("Messages file not found: %s\n", cfgName);
-       return 1;
-   }
-
-   if ((--called) == 0)
-       memset(msg_table, 0, sizeof(msg_table[0]) * MAX_JOB_NAMES);
-
-   while(fgets(line, sizeof(line), fp) ) {
-       if (line[0] == '/' && line[1] == '/')
-           continue;
-       if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
-           continue;
-
-       if (strcmpi(w1, "import") == 0)
-           msg_config_read(w2);
-       else {
-           msg_number = atoi(w1);
-           if( msg_number < 550 || msg_number > (550+MAX_JOB_NAMES) )
-               continue;
-           msg_number -= 550;
-           if (msg_number >= 0 && msg_number < MAX_JOB_NAMES) {
-               if (msg_table[msg_number] != NULL)
-                   aFree(msg_table[msg_number]);
-               msg_table[msg_number] = (char *)aMalloc((strlen(w2) + 1)*sizeof (char));
-               strcpy(msg_table[msg_number],w2);
-           }
-       }
-   }
-
-   fclose(fp);
-
-   return 0;
-}
-
-/*==========================================
- * Cleanup Message Data
- *------------------------------------------*/
-void do_final_msg(void) {
-   int i;
-   for (i = 0; i < MAX_JOB_NAMES; i++)
-       aFree(msg_table[i]);
-}
 /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */
 const char* job_name(int class_) {
    switch (class_) {
@@ -791,7 +727,6 @@
    inter_auction_sql_init();
 
    geoip_readdb();
-   msg_config_read("conf/msg_athena.conf");
    return 0;
 }
 
@@ -812,7 +747,6 @@
 
    if (accreg_pt) aFree(accreg_pt);
 
-   do_final_msg();
    return;
 }
 
Index: common/Makefile.in
--- common/Makefile.in Base (BASE)
+++ common/Makefile.in Locally Modified (Based On LOCAL)
@@ -3,7 +3,8 @@
    obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \
    obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \
    obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o obj_all/des.o \
-   obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o
+   obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o \
+   obj_all/msg_conf.o
 
 COMMON_H = $(shell ls ../common/*.h)
 
Index: common/core.c
--- common/core.c Base (BASE)
+++ common/core.c Locally Modified (Based On LOCAL)
@@ -1,17 +1,19 @@
 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
 // For more information, see LICENCE in the main folder
 
-#include "../common/mmo.h"
-#include "../common/showmsg.h"
-#include "../common/malloc.h"
+#include "mmo.h"
+#include "showmsg.h"
+#include "malloc.h"
 #include "core.h"
 #ifndef MINICORE
-#include "../common/db.h"
-#include "../common/socket.h"
-#include "../common/timer.h"
-#include "../common/thread.h"
-#include "../common/mempool.h"
-#include "../common/sql.h"
+#include "db.h"
+#include "socket.h"
+#include "timer.h"
+#include "thread.h"
+#include "mempool.h"
+#include "sql.h"
+#include "cbasetypes.h"
+#include "msg_conf.h"
 #endif
 
 #include <stdio.h>
@@ -258,6 +260,30 @@
 }
 #endif
 
+
+bool opt_has_next_value(const char* option, int i, int argc)
+{
+   if( i >= argc-1 )
+   {
+       ShowWarning("Missing value for option '%s'.\n", option);
+       return false;
+   }
+
+   return true;
+}
+
+/*======================================================
+ * Servers Version Screen [MC Cameri]
+ *------------------------------------------------------*/
+void display_versionscreen(bool do_exit)
+{
+   ShowInfo(CL_WHITE"rAthena SVN version: %s" CL_RESET"\n", get_svn_revision());
+   ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://rathena.org/\n");
+   ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rathena.net/#rathena\n");
+   ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
+   if( do_exit )
+       exit(EXIT_SUCCESS);
+}
 /*======================================
  * CORE : Display title
  *  ASCII By CalciumKid 1/12/2011
@@ -324,7 +350,6 @@
    mempool_init();
    db_init();
    signals_init();
-
 #ifdef _WIN32
    cevents_init();
 #endif
Index: common/core.h
--- common/core.h Base (BASE)
+++ common/core.h Locally Modified (Based On LOCAL)
@@ -4,6 +4,8 @@
 #ifndef    _CORE_H_
 #define    _CORE_H_
 
+#include "cbasetypes.h"
+
 /* so that developers with --enable-debug can raise signals from any section of the code they'd like */
 #ifdef DEBUG
    #include <signal.h>
@@ -31,6 +33,8 @@
 extern char SERVER_TYPE;
 
 extern int parse_console(const char* buf);
+bool opt_has_next_value(const char* option, int i, int argc);
+void display_versionscreen(bool do_exit);
 extern const char *get_svn_revision(void);
 extern int do_init(int,char**);
 extern void set_server_type(void);
Index: common/msg_conf.c
--- common/msg_conf.c No Base Revision
+++ common/msg_conf.c Locally New
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "malloc.h"
+#include "msg_conf.h"
+#include "showmsg.h"
+
+#define MAX_MSG 1500
+#define MSG_CONF_NAME "conf/msg_athena.conf"
+
+static char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
+
+void msg_init(void){
+    msg_config_read(MSG_CONF_NAME);
+}
+//-----------------------------------------------------------
+// Return the message string of the specified number by [Yor]
+//-----------------------------------------------------------
+
+const char* msg_txt(int msg_number)
+{
+    if (msg_number >= 0 && msg_number < MAX_MSG &&
+       msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0')
+   return msg_table[msg_number];
+
+    return "??";
+}
+
+/*==========================================
+ * Read Message Data
+ *------------------------------------------*/
+int msg_config_read(const char* cfgName)
+{
+    int msg_number;
+    char line[1024], w1[1024], w2[1024];
+    FILE *fp;
+    static int called = 1;
+
+    if ((fp = fopen(cfgName, "r")) == NULL) {
+   ShowError("Messages file not found: %s\n", cfgName);
+   return 1;
+    }
+
+    if ((--called) == 0)
+   memset(msg_table, 0, sizeof (msg_table[0]) * MAX_MSG);
+
+    while (fgets(line, sizeof (line), fp)) {
+   if (line[0] == '/' && line[1] == '/')
+       continue;
+   if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
+       continue;
+
+   if (strcmpi(w1, "import") == 0)
+       msg_config_read(w2);
+   else {
+       msg_number = atoi(w1);
+       if (msg_number >= 0 && msg_number < MAX_MSG) {
+       if (msg_table[msg_number] != NULL)
+           aFree(msg_table[msg_number]);
+       msg_table[msg_number] = (char *) aMalloc((strlen(w2) + 1) * sizeof (char));
+       strcpy(msg_table[msg_number], w2);
+       }
+   }
+    }
+
+    fclose(fp);
+    ShowInfo("Finished reading %s.\n",cfgName);
+
+    return 0;
+}
+
+/*==========================================
+ * Cleanup Message Data
+ *------------------------------------------*/
+void do_final_msg(void){
+    int i;
+    for (i = 0; i < MAX_MSG; i++)
+   aFree(msg_table[i]);
+}
\ No newline at end of file
Index: common/msg_conf.h
--- common/msg_conf.h No Base Revision
+++ common/msg_conf.h Locally New
@@ -0,0 +1,20 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef MSG_CONF_H
+#define    MSG_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char* msg_txt(int msg_number);
+int msg_config_read(const char* cfgName);
+void do_final_msg(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MSG_CONF_H */
+
Index: common/sql.c
--- common/sql.c Base (BASE)
+++ common/sql.c Locally Modified (Based On LOCAL)
@@ -15,6 +15,8 @@
 #include <string.h>// strlen/strnlen/memcpy/memset
 #include <stdlib.h>// strtoul
 
+#define SQL_CONF_NAME "conf/inter_athena.conf"
+
 void ra_mysql_error_handler(unsigned int ecode);
 
 int mysql_reconnect_type;
@@ -1020,5 +1022,5 @@
 }
 
 void Sql_Init(void) {
-   Sql_inter_server_read("conf/inter_athena.conf",true);
+   Sql_inter_server_read(SQL_CONF_NAME,true);
 }
Index: login/login.c
--- login/login.c Base (BASE)
+++ login/login.c Locally Modified (Based On LOCAL)
@@ -10,6 +10,7 @@
 #include "../common/socket.h"
 #include "../common/strlib.h"
 #include "../common/timer.h"
+#include "../common/msg_conf.h"
 #include "account.h"
 #include "ipban.h"
 #include "login.h"
@@ -19,6 +20,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+char* LOGIN_CONF_NAME;
+char* LAN_CONF_NAME;
+char* MSG_CONF_NAME;
+
 struct Login_Config login_config;
 
 int login_fd; // login server socket
@@ -1744,6 +1749,7 @@
    if( login_config.log_login )
        loginlog_final();
 
+   do_final_msg();
    ipban_final();
 
    for( i = 0; account_engines[i].constructor; ++i )
@@ -1802,6 +1808,24 @@
 }
 
 
+/*======================================================
+ * Login-Server help option info
+ *------------------------------------------------------*/
+static void login_helpscreen(bool do_exit)
+{
+   ShowInfo("Usage: %s [options]\n", SERVER_NAME);
+   ShowInfo("\n");
+   ShowInfo("Options:\n");
+   ShowInfo("  -?, -h [--help]\t\tDisplays this help screen.\n");
+   ShowInfo("  -v [--version]\t\tDisplays the server's version.\n");
+   ShowInfo("  --run-once\t\t\tCloses server after loading (testing).\n");
+   ShowInfo("  --login-config <file>\t\tAlternative login-server configuration.\n");
+   ShowInfo("  --lan-config <file>\tAlternative lag configuration.\n");
+   ShowInfo("  --msg-config <file>\t\tAlternative message configuration.\n");
+   if( do_exit )
+       exit(EXIT_SUCCESS);
+}
+
 //------------------------------
 // Login server initialization
 //------------------------------
@@ -1815,9 +1839,75 @@
 
    // read login-server configuration
    login_set_defaults();
-   login_config_read((argc > 1) ? argv[1] : LOGIN_CONF_NAME);
-   login_lan_config_read((argc > 2) ? argv[2] : LAN_CONF_NAME);
 
+   LOGIN_CONF_NAME = "conf/login_athena.conf";
+   LAN_CONF_NAME = "conf/subnet_athena.conf";
+   MSG_CONF_NAME = "conf/msg_conf/map_msg.conf";
+
+   for( i = 1; i < argc ; i++ )
+   {
+       const char* arg = argv[i];
+
+       if( arg[0] != '-' && ( arg[0] != '/' || arg[1] == '-' ) )
+       {// -, -- and /
+           ShowError("Unknown option '%s'.\n", argv[i]);
+           exit(EXIT_FAILURE);
+       }
+       else if( (++arg)[0] == '-' )
+       {// long option
+           arg++;
+
+           if( strcmp(arg, "help") == 0 )
+           {
+               login_helpscreen(true);
+           }
+           else if( strcmp(arg, "version") == 0 )
+           {
+               display_versionscreen(true);
+           }
+           else if( strcmp(arg, "login-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   LOGIN_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "lan-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   LAN_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "msg-config") == 0 )
+           {
+               if( opt_has_next_value(arg, i, argc) )
+                   MSG_CONF_NAME = argv[++i];
+           }
+           else if( strcmp(arg, "run-once") == 0 ) // close the login-server as soon as its done.. for testing [Celest]
+           {
+               runflag = CORE_ST_STOP;
+           }
+           else
+           {
+               ShowError("Unknown option '%s'.\n", argv[i]);
+               exit(EXIT_FAILURE);
+           }
+       }
+       else switch( arg[0] )
+       {// short option
+           case '?':
+           case 'h':
+               login_helpscreen(true);
+               break;
+           case 'v':
+               display_versionscreen(true);
+               break;
+           default:
+               ShowError("Unknown option '%s'.\n", argv[i]);
+               exit(EXIT_FAILURE);
+       }
+   }
+   login_config_read(LOGIN_CONF_NAME);
+   login_lan_config_read(LAN_CONF_NAME);
+   msg_config_read(MSG_CONF_NAME);
+
    rnd_init();
    
    for( i = 0; i < ARRAYLENGTH(server); ++i )
@@ -1883,3 +1973,5 @@
 
    return 0;
 }
+
+
Index: login/login.h
--- login/login.h Base (BASE)
+++ login/login.h Locally Modified (Based On LOCAL)
@@ -14,9 +14,6 @@
    LOGINSERVER_ST_LAST
 };
 
-#define LOGIN_CONF_NAME "conf/login_athena.conf"
-#define LAN_CONF_NAME "conf/subnet_athena.conf"
-
 // supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both
 #define PASSWORDENC 3
 
Index: map/atcommand.c
--- map/atcommand.c Base (BASE)
+++ map/atcommand.c Locally Modified (Based On LOCAL)
@@ -100,73 +100,6 @@
    return ( i < atcmd_binding_count ) ? atcmd_binding[i] : NULL;
 }
 
-//-----------------------------------------------------------
-// Return the message string of the specified number by [Yor]
-//-----------------------------------------------------------
-const char* msg_txt(int msg_number)
-{
-   if (msg_number >= 0 && msg_number < MAX_MSG &&
-       msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0')
-       return msg_table[msg_number];
-
-   return "??";
-}
-
-/*==========================================
- * Read Message Data
- *------------------------------------------*/
-int msg_config_read(const char* cfgName)
-{
-   int msg_number;
-   char line[1024], w1[1024], w2[1024];
-   FILE *fp;
-   static int called = 1;
-
-   if ((fp = fopen(cfgName, "r")) == NULL) {
-       ShowError("Messages file not found: %s\n", cfgName);
-       return 1;
-   }
-
-   if ((--called) == 0)
-       memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG);
-
-   while(fgets(line, sizeof(line), fp))
-   {
-       if (line[0] == '/' && line[1] == '/')
-           continue;
-       if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
-           continue;
-
-       if (strcmpi(w1, "import") == 0)
-           msg_config_read(w2);
-       else
-       {
-           msg_number = atoi(w1);
-           if (msg_number >= 0 && msg_number < MAX_MSG)
-           {
-               if (msg_table[msg_number] != NULL)
-                   aFree(msg_table[msg_number]);
-               msg_table[msg_number] = (char *)aMalloc((strlen(w2) + 1)*sizeof (char));
-               strcpy(msg_table[msg_number],w2);
-           }
-       }
-   }
-
-   fclose(fp);
-
-   return 0;
-}
-
-/*==========================================
- * Cleanup Message Data
- *------------------------------------------*/
-void do_final_msg(void)
-{
-   int i;
-   for (i = 0; i < MAX_MSG; i++)
-       aFree(msg_table[i]);
-}
-
 /**
  * retrieves the help string associated with a given command.
  *
Index: map/atcommand.h
--- map/atcommand.h Base (BASE)
+++ map/atcommand.h Locally Modified (Based On LOCAL)
@@ -30,10 +30,6 @@
 
 bool atcommand_exists(const char* name);
 
-const char* msg_txt(int msg_number);
-int msg_config_read(const char* cfgName);
-void do_final_msg(void);
-
 extern int atcmd_binding_count;
 
 // @commands (script based)
Index: map/map.c
--- map/map.c Base (BASE)
+++ map/map.c Locally Modified (Based On LOCAL)
@@ -3666,7 +3666,7 @@
 }
 
 /*======================================================
- * Map-Server Version Screen [MC Cameri]
+ * Map-Server help options screen
  *------------------------------------------------------*/
 static void map_helpscreen(bool do_exit)
 {
@@ -3689,19 +3689,6 @@
 }
 
 /*======================================================
- * Map-Server Version Screen [MC Cameri]
- *------------------------------------------------------*/
-static void map_versionscreen(bool do_exit)
-{
-   ShowInfo(CL_WHITE"rAthena SVN version: %s" CL_RESET"\n", get_svn_revision());
-   ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://rathena.org/\n");
-   ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rathena.net/#rathena\n");
-   ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
-   if( do_exit )
-       exit(EXIT_SUCCESS);
-}
-
-/*======================================================
  * Map-Server Init and Command-line Arguments [Valaris]
  *------------------------------------------------------*/
 void set_server_type(void)
@@ -3729,17 +3716,6 @@
    }
 }
 
-static bool map_arg_next_value(const char* option, int i, int argc)
-{
-   if( i >= argc-1 )
-   {
-       ShowWarning("Missing value for option '%s'.\n", option);
-       return false;
-   }
-
-   return true;
-}
-
 int do_init(int argc, char *argv[])
 {
    int i;
@@ -3754,11 +3730,9 @@
    BATTLE_CONF_FILENAME = "conf/battle_athena.conf";
    ATCOMMAND_CONF_FILENAME = "conf/atcommand_athena.conf";
    SCRIPT_CONF_NAME = "conf/script_athena.conf";
-   MSG_CONF_NAME = "conf/msg_athena.conf";
+   MSG_CONF_NAME = "conf/msg_conf/map_msg.conf";
    GRF_PATH_FILENAME = "conf/grf-files.txt";
 
-   rnd_init();
-
    for( i = 1; i < argc ; i++ )
    {
        const char* arg = argv[i];
@@ -3778,46 +3752,46 @@
            }
            else if( strcmp(arg, "version") == 0 )
            {
-               map_versionscreen(true);
+               display_versionscreen(true);
            }
            else if( strcmp(arg, "map-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    MAP_CONF_NAME = argv[++i];
            }
            else if( strcmp(arg, "battle-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    BATTLE_CONF_FILENAME = argv[++i];
            }
            else if( strcmp(arg, "atcommand-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    ATCOMMAND_CONF_FILENAME = argv[++i];
            }
            else if( strcmp(arg, "script-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    SCRIPT_CONF_NAME = argv[++i];
            }
            else if( strcmp(arg, "msg-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    MSG_CONF_NAME = argv[++i];
            }
            else if( strcmp(arg, "grf-path-file") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    GRF_PATH_FILENAME = argv[++i];
            }
            else if( strcmp(arg, "inter-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    INTER_CONF_NAME = argv[++i];
            }
            else if( strcmp(arg, "log-config") == 0 )
            {
-               if( map_arg_next_value(arg, i, argc) )
+               if( opt_has_next_value(arg, i, argc) )
                    LOG_CONF_NAME = argv[++i];
            }
            else if( strcmp(arg, "run-once") == 0 ) // close the map-server as soon as its done.. for testing [Celest]
@@ -3837,7 +3811,7 @@
                map_helpscreen(true);
                break;
            case 'v':
-               map_versionscreen(true);
+               display_versionscreen(true);
                break;
            default:
                ShowError("Unknown option '%s'.\n", argv[i]);
@@ -3845,6 +3819,7 @@
        }
    }
 
+   rnd_init();
    map_config_read(MAP_CONF_NAME);
    /* only temporary until sirius's datapack patch is complete  */
 
Index: map/map.h
--- map/map.h Base (BASE)
+++ map/map.h Locally Modified (Based On LOCAL)
@@ -9,6 +9,7 @@
 #include "../common/mmo.h"
 #include "../common/mapindex.h"
 #include "../common/db.h"
+#include "../common/msg_conf.h"
 
 /**
  * [rAthena.org]
Viewed 1045 times, submitted by lighta.