summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-20 20:33:32 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-20 20:33:32 +0000
commit44d7606656a650dc43018b5c63bb56ad1f70e77c (patch)
treea34a45286714803911fe2bf55315c611a444e605 /src/map
parenta02514bc54c044f141520118ffd7e0b6ff5ecae2 (diff)
downloadhercules-44d7606656a650dc43018b5c63bb56ad1f70e77c.tar.gz
hercules-44d7606656a650dc43018b5c63bb56ad1f70e77c.tar.bz2
hercules-44d7606656a650dc43018b5c63bb56ad1f70e77c.tar.xz
hercules-44d7606656a650dc43018b5c63bb56ad1f70e77c.zip
Merged TXT removal branch back to trunk.
* TXT save engine is removed and no longer supported. * See also tid:53926, tid:57717. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15503 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/CMakeLists.txt2
-rw-r--r--src/map/Makefile.in8
-rw-r--r--src/map/atcommand.c10
-rw-r--r--src/map/chrif.c14
-rw-r--r--src/map/clif.c9
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/intif.c7
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/itemdb.c4
-rw-r--r--src/map/log.c23
-rw-r--r--src/map/mail.c4
-rw-r--r--src/map/map.c16
-rw-r--r--src/map/map.h4
-rw-r--r--src/map/mapreg_txt.c202
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/script.c26
-rw-r--r--src/map/txt/CMakeLists.txt108
18 files changed, 9 insertions, 448 deletions
diff --git a/src/map/CMakeLists.txt b/src/map/CMakeLists.txt
index 1d82fc2ca..51c3538ef 100644
--- a/src/map/CMakeLists.txt
+++ b/src/map/CMakeLists.txt
@@ -3,12 +3,10 @@
# setup
#
set( MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
-set( TXT_MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
set( SQL_MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
#
# targets
#
-add_subdirectory( txt )
add_subdirectory( sql )
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index 3f64942e0..dc0e48bf9 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -25,8 +25,6 @@ MAP_OBJ = map.o chrif.o clif.o pc.o status.o npc.o \
intif.o trade.o party.o vending.o guild.o pet.o \
log.o mail.o date.o unit.o homunculus.o mercenary.o quest.o instance.o \
buyingstore.o searchstore.o duel.o
-MAP_TXT_OBJ = $(MAP_OBJ:%=obj_txt/%) \
- obj_txt/mapreg_txt.o
MAP_SQL_OBJ = $(MAP_OBJ:%=obj_sql/%) \
obj_sql/mapreg_sql.o
MAP_H = map.h chrif.h clif.h pc.h status.h npc.h \
@@ -95,22 +93,18 @@ obj_sql:
-mkdir obj_sql
# executables
-map-server: obj_txt $(MAP_TXT_OBJ) $(COMMON_OBJ)
- @CC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_TXT_OBJ) $(COMMON_OBJ) $(MT19937AR_OBJ) @LIBS@ @PCRE_LIBS@
map-server_sql: obj_sql $(MAP_SQL_OBJ) $(COMMON_OBJ) $(COMMON_SQL_OBJ)
@CC@ @LDFLAGS@ -o ../../map-server_sql@EXEEXT@ $(MAP_SQL_OBJ) $(COMMON_OBJ) $(COMMON_SQL_OBJ) $(MT19937AR_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@
# map object files
-obj_txt/%.o: %.c $(MAP_H) $(COMMON_H) $(MT19937AR_H)
- @CC@ @CFLAGS@ $(MT19937AR_INCLUDE) $(PCRE_CFLAGS) -DTXT_ONLY @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
obj_sql/%.o: %.c $(MAP_H) $(COMMON_H) $(COMMON_SQL_H) $(MT19937AR_H)
@CC@ @CFLAGS@ $(MT19937AR_INCLUDE) $(PCRE_CFLAGS) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
../common/obj_all/%.o:
- @$(MAKE) -C ../common txt
+ @$(MAKE) -C ../common sql
../common/obj_sql/%.o:
@$(MAKE) -C ../common sql
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ab5d632ff..de5d4549b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -30,6 +30,7 @@
#include "npc.h"
#include "pet.h"
#include "homunculus.h"
+#include "mail.h"
#include "mercenary.h"
#include "party.h"
#include "guild.h"
@@ -38,9 +39,6 @@
#include "trade.h"
#include "unit.h"
-#ifndef TXT_ONLY
-#include "mail.h"
-#endif
#include <stdio.h>
#include <stdlib.h>
@@ -4333,9 +4331,7 @@ ACMD_FUNC(reloadbattleconf)
)
{ // Exp or Drop rates changed.
mob_reload(); //Needed as well so rate changes take effect.
-#ifndef TXT_ONLY
chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
-#endif
}
clif_displaymessage(fd, msg_txt(255));
return 0;
@@ -7112,9 +7108,7 @@ ACMD_FUNC(misceffect)
ACMD_FUNC(mail)
{
nullpo_ret(sd);
-#ifndef TXT_ONLY
mail_openmail(sd);
-#endif
return 0;
}
@@ -8434,9 +8428,7 @@ ACMD_FUNC(auction)
{
nullpo_ret(sd);
-#ifndef TXT_ONLY
clif_Auction_openwindow(sd);
-#endif
return 0;
}
diff --git a/src/map/chrif.c b/src/map/chrif.c
index ebafdf0da..03b4baeb0 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -225,11 +225,7 @@ void chrif_checkdefaultlogin(void)
{
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowError("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
-#ifdef TXT_ONLY
- ShowNotice("Please edit your save/account.txt file to create a proper inter-server user/password (gender 'S')\n");
-#else
ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
-#endif
ShowNotice("and then edit your user/password in conf/map_athena.conf (or conf/import/map_conf.txt)\n");
}
}
@@ -312,10 +308,8 @@ int chrif_save(struct map_session_data *sd, int flag)
merc_save(sd->hd);
if( sd->md && mercenary_get_lifetime(sd->md) > 0 )
mercenary_save(sd->md);
-#ifndef TXT_ONLY
if( sd->save_quest )
intif_quest_save(sd);
-#endif
return 0;
}
@@ -1536,16 +1530,12 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
chrif_connect(char_fd);
chrif_connected = (chrif_state == 2);
-#ifndef TXT_ONLY
srvinfo = 0;
-#endif /* not TXT_ONLY */
} else {
-#ifndef TXT_ONLY
if (srvinfo == 0) {
chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
srvinfo = 1;
}
-#endif /* not TXT_ONLY */
}
if (chrif_isconnected()) displayed = 0;
return 0;
@@ -1555,7 +1545,7 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
* Asks char server to remove friend_id from the friend list of char_id
*------------------------------------------*/
int chrif_removefriend(int char_id, int friend_id) {
-#ifndef TXT_ONLY
+
chrif_check(-1);
WFIFOHEAD(char_fd,10);
@@ -1563,7 +1553,7 @@ int chrif_removefriend(int char_id, int friend_id) {
WFIFOL(char_fd,2) = char_id;
WFIFOL(char_fd,6) = friend_id;
WFIFOSET(char_fd,10);
-#endif
+
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 48aca796d..e102fc169 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8137,9 +8137,7 @@ void clif_refresh(struct map_session_data *sd)
// unlike vending, resuming buyingstore crashes the client.
buyingstore_close(sd);
-#ifndef TXT_ONLY
mail_clear(sd);
-#endif
}
@@ -9205,9 +9203,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
sd->state.changemap = false;
}
-#ifndef TXT_ONLY
mail_clear(sd);
-#endif
if(map[sd->bl.m].flag.loadevent) // Lance
npc_script_event(sd, NPCE_LOADMAP);
@@ -13425,7 +13421,6 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
}
-#ifndef TXT_ONLY
/// MAIL SYSTEM
/// By Zephyrus
@@ -14205,8 +14200,6 @@ void clif_parse_Auction_buysell(int fd, struct map_session_data* sd)
intif_Auction_requestlist(sd->status.char_id, type, 0, "", 1);
}
-#endif
-
/// CASH/POINT SHOP
///
@@ -16515,7 +16508,6 @@ static int packetdb_readdb(void)
{clif_parse_Check,"check"},
{clif_parse_Adopt_request,"adoptrequest"},
{clif_parse_Adopt_reply,"adoptreply"},
-#ifndef TXT_ONLY
// MAIL SYSTEM
{clif_parse_Mail_refreshinbox,"mailrefresh"},
{clif_parse_Mail_read,"mailread"},
@@ -16536,7 +16528,6 @@ static int packetdb_readdb(void)
{clif_parse_Auction_bid,"auctionbid"},
// Quest Log System
{clif_parse_questStateAck,"queststate"},
-#endif
{clif_parse_cashshop_buy,"cashshopbuy"},
{clif_parse_ViewPlayerEquip,"viewplayerequip"},
{clif_parse_EquipTick,"equiptickbox"},
diff --git a/src/map/clif.h b/src/map/clif.h
index efe85cefc..206b7d68e 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -641,7 +641,6 @@ void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, b
int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type);
int do_init_clif(void);
-#ifndef TXT_ONLY
// MAIL SYSTEM
void clif_Mail_window(int fd, int flag);
void clif_Mail_read(struct map_session_data *sd, int mail_id);
@@ -657,7 +656,6 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages,
void clif_Auction_message(int fd, unsigned char flag);
void clif_Auction_close(int fd, unsigned char flag);
void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd);
-#endif
void clif_bossmapinfo(int fd, struct mob_data *md, short flag);
void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd);
diff --git a/src/map/intif.c b/src/map/intif.c
index 20623a146..51002f027 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1412,8 +1412,6 @@ int intif_quest_save(TBL_PC *sd)
return 0;
}
-#ifndef TXT_ONLY
-
/*==========================================
* MAIL SYSTEM
* By Zephyrus
@@ -1888,8 +1886,6 @@ static void intif_parse_Auction_message(int fd)
clif_Auction_message(sd->fd, result);
}
-#endif
-
/*==========================================
* Mercenary's System
*------------------------------------------*/
@@ -2049,7 +2045,6 @@ int intif_parse(int fd)
case 0x3860: intif_parse_questlog(fd); break;
case 0x3861: intif_parse_questsave(fd); break;
-#ifndef TXT_ONLY
// Mail System
case 0x3848: intif_parse_Mail_inboxreceived(fd); break;
case 0x3849: intif_parse_Mail_new(fd); break;
@@ -2064,7 +2059,7 @@ int intif_parse(int fd)
case 0x3853: intif_parse_Auction_close(fd); break;
case 0x3854: intif_parse_Auction_message(fd); break;
case 0x3855: intif_parse_Auction_bid(fd); break;
-#endif
+
// Mercenary System
case 0x3870: intif_parse_mercenary_received(fd); break;
case 0x3871: intif_parse_mercenary_deleted(fd); break;
diff --git a/src/map/intif.h b/src/map/intif.h
index 1df990108..88e1f1ce7 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -83,7 +83,6 @@ int intif_mercenary_request(int merc_id, int char_id);
int intif_mercenary_delete(int merc_id);
int intif_mercenary_save(struct s_mercenary *merc);
-#ifndef TXT_ONLY
// MAIL SYSTEM
int intif_Mail_requestinbox(int char_id, unsigned char flag);
int intif_Mail_read(int mail_id);
@@ -97,7 +96,6 @@ int intif_Auction_register(struct auction_data *auction);
int intif_Auction_cancel(int char_id, unsigned int auction_id);
int intif_Auction_close(int char_id, unsigned int auction_id);
int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, int bid);
-#endif
int CheckForCharServer(void);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 3c2e75810..8043c965d 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -984,7 +984,6 @@ static int itemdb_readdb(void)
return 0;
}
-#ifndef TXT_ONLY
/*======================================
* item_db table reading
*======================================*/
@@ -1034,18 +1033,15 @@ static int itemdb_read_sqldb(void)
return 0;
}
-#endif /* not TXT_ONLY */
/*====================================
* read all item-related databases
*------------------------------------*/
static void itemdb_read(void)
{
-#ifndef TXT_ONLY
if (db_use_sqldbs)
itemdb_read_sqldb();
else
-#endif
itemdb_readdb();
itemdb_read_itemgroup();
diff --git a/src/map/log.c b/src/map/log.c
index fb1aa11a1..76497db3c 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -136,7 +136,6 @@ void log_branch(struct map_session_data* sd)
if( !log_config.branch )
return;
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
SqlStmt* stmt;
@@ -152,7 +151,6 @@ void log_branch(struct map_session_data* sd)
SqlStmt_Free(stmt);
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -179,7 +177,6 @@ void log_pick(int id, int m, e_log_pick_type type, int amount, struct item* itm)
if( !should_log_item(itm->nameid, amount, itm->refine) )
return; //we skip logging this item set - it doesn't meet our logging conditions [Lupus]
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')",
@@ -190,7 +187,6 @@ void log_pick(int id, int m, e_log_pick_type type, int amount, struct item* itm)
}
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -228,7 +224,6 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess
if( !log_config.zeny || ( log_config.zeny != 1 && abs(amount) < log_config.zeny ) )
return;
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%c', '%d', '%s')",
@@ -239,7 +234,6 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess
}
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -263,7 +257,6 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
if( !log_config.mvpdrop )
return;
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
@@ -274,7 +267,6 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
}
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -298,7 +290,6 @@ void log_atcommand(struct map_session_data* sd, int cmdlvl, const char* message)
if( cmdlvl < log_config.gm )
return;
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
SqlStmt* stmt;
@@ -316,7 +307,6 @@ void log_atcommand(struct map_session_data* sd, int cmdlvl, const char* message)
SqlStmt_Free(stmt);
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -340,7 +330,6 @@ void log_npc(struct map_session_data* sd, const char* message)
if( !log_config.npc )
return;
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
SqlStmt* stmt;
@@ -357,7 +346,6 @@ void log_npc(struct map_session_data* sd, const char* message)
SqlStmt_Free(stmt);
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -386,7 +374,6 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
return;
}
-#ifndef TXT_ONLY
if( log_config.sql_logs )
{
SqlStmt* stmt;
@@ -404,7 +391,6 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
SqlStmt_Free(stmt);
}
else
-#endif
{
char timestring[255];
time_t curtime;
@@ -457,16 +443,7 @@ int log_config_read(const char* cfgName)
if( strcmpi(w1, "enable_logs") == 0 )
log_config.enable_logs = (e_log_pick_type)config_switch(w2);
else if( strcmpi(w1, "sql_logs") == 0 )
- {
log_config.sql_logs = (bool)config_switch(w2);
-#ifdef TXT_ONLY
- if( log_config.sql_logs )
- {
- ShowWarning("log_config_read: SQL logging is not supported on this server.\n");
- log_config.sql_logs = false;
- }
-#endif
- }
//start of common filter settings
else if( strcmpi(w1, "rare_items_log") == 0 )
log_config.rare_items_log = atoi(w2);
diff --git a/src/map/mail.c b/src/map/mail.c
index d410faf28..bb1063fbf 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -1,8 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#ifndef TXT_ONLY
-
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -194,5 +192,3 @@ bool mail_invalid_operation(struct map_session_data *sd)
return false;
}
-
-#endif
diff --git a/src/map/map.c b/src/map/map.c
index fee813241..841e95df1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -44,9 +44,7 @@
#include "mercenary.h"
#include "atcommand.h"
#include "log.h"
-#ifndef TXT_ONLY
#include "mail.h"
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -56,7 +54,6 @@
#include <unistd.h>
#endif
-#ifndef TXT_ONLY
char default_codepage[32] = "";
int map_server_port = 3306;
@@ -83,8 +80,6 @@ char log_db_pw[32] = "ragnarok";
char log_db_db[32] = "log";
Sql* logmysql_handle;
-#endif /* not TXT_ONLY */
-
// This param using for sending mainchat
// messages like whispers to this nick. [LuzZza]
char main_chat_nick[16] = "Main";
@@ -3240,8 +3235,6 @@ int inter_config_read(char *cfgName)
if(strcmpi(w1, "main_chat_nick")==0)
safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick));
-
- #ifndef TXT_ONLY
else
if(strcmpi(w1,"item_db_db")==0)
strcpy(item_db_db,w2);
@@ -3295,7 +3288,6 @@ int inter_config_read(char *cfgName)
else
if(strcmpi(w1,"log_db_db")==0)
strcpy(log_db_db, w2);
- #endif
else
if( mapreg_config_read(w1,w2) )
continue;
@@ -3309,7 +3301,6 @@ int inter_config_read(char *cfgName)
return 0;
}
-#ifndef TXT_ONLY
/*=======================================
* MySQL Init
*---------------------------------------*/
@@ -3363,8 +3354,6 @@ int log_sql_init(void)
return 0;
}
-#endif /* not TXT_ONLY */
-
int map_db_final(DBKey k,void *d,va_list ap)
{
struct map_data_other_server *mdos = (struct map_data_other_server*)d;
@@ -3498,9 +3487,8 @@ void do_final(void)
iwall_db->destroy(iwall_db, NULL);
regen_db->destroy(regen_db, NULL);
-#ifndef TXT_ONLY
map_sql_close();
-#endif /* not TXT_ONLY */
+
ShowStatus("Finished.\n");
}
@@ -3762,11 +3750,9 @@ int do_init(int argc, char *argv[])
iwall_db = strdb_alloc(DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1); // [Zephyrus] Invisible Walls
-#ifndef TXT_ONLY
map_sql_init();
if (log_config.sql_logs)
log_sql_init();
-#endif /* not TXT_ONLY */
mapindex_init();
if(enable_grf)
diff --git a/src/map/map.h b/src/map/map.h
index afd7aa883..2dece688d 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -709,8 +709,6 @@ typedef struct mercenary_data TBL_MER;
extern char main_chat_nick[16];
-#ifndef TXT_ONLY
-
#include "../common/sql.h"
extern int db_use_sqldbs;
@@ -726,8 +724,6 @@ extern char mob_db2_db[32];
extern char mob_skill_db_db[32];
extern char mob_skill_db2_db[32];
-#endif /* not TXT_ONLY */
-
void do_shutdown(void);
#endif /* _MAP_H_ */
diff --git a/src/map/mapreg_txt.c b/src/map/mapreg_txt.c
deleted file mode 100644
index 95be201e2..000000000
--- a/src/map/mapreg_txt.c
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include "../common/cbasetypes.h"
-#include "../common/db.h"
-#include "../common/lock.h"
-#include "../common/malloc.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/timer.h"
-#include "script.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static DBMap* mapreg_db = NULL; // int var_id -> int value
-static DBMap* mapregstr_db = NULL; // int var_id -> char* value
-
-static char mapreg_txt[256] = "save/mapreg.txt";
-static bool mapreg_dirty = false;
-#define MAPREG_AUTOSAVE_INTERVAL (300*1000)
-
-
-/// Looks up the value of an integer variable using its uid.
-int mapreg_readreg(int uid)
-{
- return (int)idb_get(mapreg_db, uid);
-}
-
-/// Looks up the value of a string variable using its uid.
-char* mapreg_readregstr(int uid)
-{
- return (char*)idb_get(mapregstr_db, uid);
-}
-
-/// Modifies the value of an integer variable.
-bool mapreg_setreg(int uid, int val)
-{
- if( val != 0 )
- idb_put(mapreg_db,uid,(void*)val);
- else
- idb_remove(mapreg_db,uid);
-
- mapreg_dirty = true;
- return true;
-}
-
-/// Modifies the value of a string variable.
-bool mapreg_setregstr(int uid, const char* str)
-{
- if( str == NULL || *str == 0 )
- idb_remove(mapregstr_db,uid);
- else
- idb_put(mapregstr_db,uid,aStrdup(str));
-
- mapreg_dirty = true;
- return true;
-}
-
-/// Loads permanent variables from savefile
-static void script_load_mapreg(void)
-{
- FILE* fp;
- char line[1024];
-
- fp = fopen(mapreg_txt,"rt");
- if( fp == NULL )
- return;
-
- while( fgets(line,sizeof(line),fp) )
- {
- char varname[32+1];
- char value[255+1];
- int n,s,i;
-
- // read name and index
- if( sscanf(line, "%32[^,],%d\t%n", varname,&i,&n) != 2 &&
- (i = 0, sscanf(line,"%[^\t]\t%n", varname,&n) != 1) )
- continue;
-
- // read value
- if( sscanf(line + n, "%[^\n\r]", value) != 1 )
- {
- ShowError("%s: %s broken data !\n", mapreg_txt, varname);
- continue;
- }
-
- s = add_str(varname);
- if( varname[strlen(varname)-1] == '$' )
- idb_put(mapregstr_db, (i<<24)|s, aStrdup(value));
- else
- idb_put(mapreg_db, (i<<24)|s, (void*)atoi(value));
- }
- fclose(fp);
-
- mapreg_dirty = false;
-}
-
-/// Saves permanent variables to savefile
-static void script_save_mapreg(void)
-{
- FILE *fp;
- int lock;
- DBIterator* iter;
- void* data;
- DBKey key;
-
- fp = lock_fopen(mapreg_txt,&lock);
- if( fp == NULL )
- {
- ShowError("script_save_mapreg: Unable to lock-open file [%s]!\n", mapreg_txt);
- return;
- }
-
- iter = mapreg_db->iterator(mapreg_db);
- for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
- {
- int num = (key.i & 0x00ffffff);
- int i = (key.i & 0xff000000) >> 24;
- const char* name = get_str(num);
-
- if( name[1] == '@' )
- continue;
-
- if( i == 0 )
- fprintf(fp, "%s\t%d\n", name, (int)data);
- else
- fprintf(fp, "%s,%d\t%d\n", name, i, (int)data);
- }
- iter->destroy(iter);
-
- iter = mapregstr_db->iterator(mapregstr_db);
- for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
- {
- int num = (key.i & 0x00ffffff);
- int i = (key.i & 0xff000000) >> 24;
- const char* name = get_str(num);
-
- if( name[1] == '@' )
- continue;
-
- if( i == 0 )
- fprintf(fp, "%s\t%s\n", name, (char *)data);
- else
- fprintf(fp, "%s,%d\t%s\n", name, i, (char *)data);
- }
- iter->destroy(iter);
-
- lock_fclose(fp,mapreg_txt,&lock);
-
- mapreg_dirty = false;
-}
-
-static int script_autosave_mapreg(int tid, unsigned int tick, int id, intptr_t data)
-{
- if( mapreg_dirty )
- script_save_mapreg();
-
- return 0;
-}
-
-
-void mapreg_reload(void)
-{
- if( mapreg_dirty )
- script_save_mapreg();
-
- mapreg_db->clear(mapreg_db, NULL);
- mapregstr_db->clear(mapregstr_db, NULL);
-
- script_load_mapreg();
-}
-
-void mapreg_final(void)
-{
- if( mapreg_dirty )
- script_save_mapreg();
-
- mapreg_db->destroy(mapreg_db,NULL);
- mapregstr_db->destroy(mapregstr_db,NULL);
-}
-
-void mapreg_init(void)
-{
- mapreg_db = idb_alloc(DB_OPT_BASE);
- mapregstr_db = idb_alloc(DB_OPT_RELEASE_DATA);
-
- script_load_mapreg();
-
- add_timer_func_list(script_autosave_mapreg, "script_autosave_mapreg");
- add_timer_interval(gettick() + MAPREG_AUTOSAVE_INTERVAL, script_autosave_mapreg, 0, 0, MAPREG_AUTOSAVE_INTERVAL);
-}
-
-bool mapreg_config_read(const char* w1, const char* w2)
-{
- if(!strcmpi(w1, "mapreg_txt"))
- safestrncpy(mapreg_txt, w2, sizeof(mapreg_txt));
- else
- return false;
-
- return true;
-}
diff --git a/src/map/mob.c b/src/map/mob.c
index 6f0bd859d..acdfd5049 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3719,7 +3719,6 @@ static void mob_readdb(void)
}
}
-#ifndef TXT_ONLY
/*==========================================
* mob_db table reading
*------------------------------------------*/
@@ -3774,7 +3773,6 @@ static int mob_read_sqldb(void)
}
return 0;
}
-#endif /* not TXT_ONLY */
/*==========================================
* MOB display graphic change data reading
@@ -4301,7 +4299,6 @@ static void mob_readskilldb(void) {
}
}
-#ifndef TXT_ONLY
/**
* mob_skill_db table reading [CalciumKid]
* not overly sure if this is all correct
@@ -4358,7 +4355,6 @@ static int mob_read_sqlskilldb(void)
}
return 0;
}
-#endif /* not TXT_ONLY */
/*==========================================
* mob_race2_db.txt reading
@@ -4393,14 +4389,12 @@ static bool mob_readdb_race2(char* fields[], int columns, int current)
*/
static void mob_load(void)
{
-#ifndef TXT_ONLY
if (db_use_sqldbs)
{
mob_read_sqldb();
mob_read_sqlskilldb();
}
else
-#endif
{
mob_readdb();
mob_readskilldb();
diff --git a/src/map/pc.c b/src/map/pc.c
index 17a695fff..3155484dd 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1188,10 +1188,8 @@ int pc_reg_received(struct map_session_data *sd)
status_calc_pc(sd,1);
chrif_scdata_request(sd->status.account_id, sd->status.char_id);
-#ifndef TXT_ONLY
intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
intif_request_questlog(sd);
-#endif
if (sd->state.connect_new == 0 && sd->fd)
{ //Character already loaded map! Gotta trigger LoadEndAck manually.
@@ -1199,9 +1197,8 @@ int pc_reg_received(struct map_session_data *sd)
clif_parse_LoadEndAck(sd->fd, sd);
}
-#ifndef TXT_ONLY
pc_inventory_rentals(sd);
-#endif
+
return 1;
}
@@ -7962,15 +7959,10 @@ int pc_divorce(struct map_session_data *sd)
if( (p_sd = map_charid2sd(sd->status.partner_id)) == NULL )
{ // Lets char server do the divorce
-#ifndef TXT_ONLY
if( chrif_divorce(sd->status.char_id, sd->status.partner_id) )
return -1; // No char server connected
return 0;
-#else
- ShowError("pc_divorce: p_sd nullpo\n");
- return -1;
-#endif
}
// Both players online, lets do the divorce manually
diff --git a/src/map/script.c b/src/map/script.c
index c06a69a60..d9f2bc2e0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13543,7 +13543,6 @@ BUILDIN_FUNC(setd)
return 0;
}
-#ifndef TXT_ONLY
int buildin_query_sql_sub(struct script_state* st, Sql* handle)
{
int i, j;
@@ -13643,22 +13642,14 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
script_pushint(st, i);
return 0;
}
-#endif
BUILDIN_FUNC(query_sql)
{
-#ifndef TXT_ONLY
return buildin_query_sql_sub(st, mmysql_handle);
-#else
- //for TXT version, we always return -1
- script_pushint(st,-1);
- return 0;
-#endif
}
BUILDIN_FUNC(query_logsql)
{
-#ifndef TXT_ONLY
if( !log_config.sql_logs )
{// logmysql_handle == NULL
ShowWarning("buildin_query_logsql: SQL logs are disabled, query '%s' will not be executed.\n", script_getstr(st,2));
@@ -13667,11 +13658,6 @@ BUILDIN_FUNC(query_logsql)
}
return buildin_query_sql_sub(st, logmysql_handle);
-#else
- //for TXT version, we always return -1
- script_pushint(st,-1);
- return 0;
-#endif
}
//Allows escaping of a given string.
@@ -13684,11 +13670,7 @@ BUILDIN_FUNC(escape_sql)
str = script_getstr(st,2);
len = strlen(str);
esc_str = (char*)aMallocA(len*2+1);
-#if defined(TXT_ONLY)
- jstrescapecpy(esc_str, str);
-#else
Sql_EscapeStringLen(mmysql_handle, esc_str, str, len);
-#endif
script_pushstr(st, esc_str);
return 0;
}
@@ -14709,9 +14691,8 @@ BUILDIN_FUNC(openmail)
if( sd == NULL )
return 0;
-#ifndef TXT_ONLY
mail_openmail(sd);
-#endif
+
return 0;
}
@@ -14723,9 +14704,8 @@ BUILDIN_FUNC(openauction)
if( sd == NULL )
return 0;
-#ifndef TXT_ONLY
clif_Auction_openwindow(sd);
-#endif
+
return 0;
}
@@ -14778,7 +14758,6 @@ BUILDIN_FUNC(setcell)
*------------------------------------------*/
BUILDIN_FUNC(mercenary_create)
{
-#ifndef TXT_ONLY
struct map_session_data *sd;
int class_, contract_time;
@@ -14792,7 +14771,6 @@ BUILDIN_FUNC(mercenary_create)
contract_time = script_getnum(st,3);
merc_create(sd, class_, contract_time);
-#endif
return 0;
}
diff --git a/src/map/txt/CMakeLists.txt b/src/map/txt/CMakeLists.txt
deleted file mode 100644
index b2634000a..000000000
--- a/src/map/txt/CMakeLists.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#
-# map txt
-#
-if( BUILD_TXT_SERVERS )
-message( STATUS "Creating target map-server" )
-set( TXT_MAP_HEADERS
- "${TXT_MAP_SOURCE_DIR}/atcommand.h"
- "${TXT_MAP_SOURCE_DIR}/battle.h"
- "${TXT_MAP_SOURCE_DIR}/battleground.h"
- "${TXT_MAP_SOURCE_DIR}/buyingstore.h"
- "${TXT_MAP_SOURCE_DIR}/chat.h"
- "${TXT_MAP_SOURCE_DIR}/chrif.h"
- "${TXT_MAP_SOURCE_DIR}/clif.h"
- "${TXT_MAP_SOURCE_DIR}/date.h"
- "${TXT_MAP_SOURCE_DIR}/duel.h"
- "${TXT_MAP_SOURCE_DIR}/guild.h"
- "${TXT_MAP_SOURCE_DIR}/homunculus.h"
- "${TXT_MAP_SOURCE_DIR}/instance.h"
- "${TXT_MAP_SOURCE_DIR}/intif.h"
- "${TXT_MAP_SOURCE_DIR}/itemdb.h"
- "${TXT_MAP_SOURCE_DIR}/log.h"
- "${TXT_MAP_SOURCE_DIR}/mail.h"
- "${TXT_MAP_SOURCE_DIR}/map.h"
- "${TXT_MAP_SOURCE_DIR}/mapreg.h"
- "${TXT_MAP_SOURCE_DIR}/mercenary.h"
- "${TXT_MAP_SOURCE_DIR}/mob.h"
- "${TXT_MAP_SOURCE_DIR}/npc.h"
- "${TXT_MAP_SOURCE_DIR}/party.h"
- "${TXT_MAP_SOURCE_DIR}/path.h"
- "${TXT_MAP_SOURCE_DIR}/pc.h"
- "${TXT_MAP_SOURCE_DIR}/pet.h"
- "${TXT_MAP_SOURCE_DIR}/quest.h"
- "${TXT_MAP_SOURCE_DIR}/script.h"
- "${TXT_MAP_SOURCE_DIR}/searchstore.h"
- "${TXT_MAP_SOURCE_DIR}/skill.h"
- "${TXT_MAP_SOURCE_DIR}/status.h"
- "${TXT_MAP_SOURCE_DIR}/storage.h"
- "${TXT_MAP_SOURCE_DIR}/trade.h"
- "${TXT_MAP_SOURCE_DIR}/unit.h"
- "${TXT_MAP_SOURCE_DIR}/vending.h"
- )
-set( TXT_MAP_SOURCES
- "${TXT_MAP_SOURCE_DIR}/atcommand.c"
- "${TXT_MAP_SOURCE_DIR}/battle.c"
- "${TXT_MAP_SOURCE_DIR}/battleground.c"
- "${TXT_MAP_SOURCE_DIR}/buyingstore.c"
- "${TXT_MAP_SOURCE_DIR}/chat.c"
- "${TXT_MAP_SOURCE_DIR}/chrif.c"
- "${TXT_MAP_SOURCE_DIR}/clif.c"
- "${TXT_MAP_SOURCE_DIR}/date.c"
- "${TXT_MAP_SOURCE_DIR}/duel.c"
- "${TXT_MAP_SOURCE_DIR}/guild.c"
- "${TXT_MAP_SOURCE_DIR}/homunculus.c"
- "${TXT_MAP_SOURCE_DIR}/instance.c"
- "${TXT_MAP_SOURCE_DIR}/intif.c"
- "${TXT_MAP_SOURCE_DIR}/itemdb.c"
- "${TXT_MAP_SOURCE_DIR}/log.c"
- "${TXT_MAP_SOURCE_DIR}/mail.c"
- "${TXT_MAP_SOURCE_DIR}/map.c"
- "${TXT_MAP_SOURCE_DIR}/mapreg_txt.c"
- "${TXT_MAP_SOURCE_DIR}/mercenary.c"
- "${TXT_MAP_SOURCE_DIR}/mob.c"
- "${TXT_MAP_SOURCE_DIR}/npc.c"
- "${TXT_MAP_SOURCE_DIR}/npc_chat.c"
- "${TXT_MAP_SOURCE_DIR}/party.c"
- "${TXT_MAP_SOURCE_DIR}/path.c"
- "${TXT_MAP_SOURCE_DIR}/pc.c"
- "${TXT_MAP_SOURCE_DIR}/pet.c"
- "${TXT_MAP_SOURCE_DIR}/quest.c"
- "${TXT_MAP_SOURCE_DIR}/script.c"
- "${TXT_MAP_SOURCE_DIR}/searchstore.c"
- "${TXT_MAP_SOURCE_DIR}/skill.c"
- "${TXT_MAP_SOURCE_DIR}/status.c"
- "${TXT_MAP_SOURCE_DIR}/storage.c"
- "${TXT_MAP_SOURCE_DIR}/trade.c"
- "${TXT_MAP_SOURCE_DIR}/unit.c"
- "${TXT_MAP_SOURCE_DIR}/vending.c"
- )
-set( DEPENDENCIES common_base )
-set( LIBRARIES ${GLOBAL_LIBRARIES} )
-set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} )
-set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DTXT_ONLY" )
-if( WITH_PCRE )
- message( STATUS "Enabled PCRE code" )
- set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} )
- set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} )
- set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" )
-else()
- message( STATUS "Disabled PCRE code" )
-endif()
-set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} )
-source_group( common FILES ${COMMON_BASE_HEADERS} )
-source_group( map FILES ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} )
-include_directories( ${INCLUDE_DIRS} )
-add_executable( map-server ${SOURCE_FILES} )
-add_dependencies( map-server ${DEPENDENCIES} )
-target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} )
-set_target_properties( map-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
-if( INSTALL_COMPONENT_RUNTIME )
- cpack_add_component( Runtime_mapserver_txt DESCRIPTION "map-server (txt version)" DISPLAY_NAME "map-server" GROUP Runtime )
- install( TARGETS map-server
- DESTINATION "."
- COMPONENT Runtime_mapserver_txt )
-endif( INSTALL_COMPONENT_RUNTIME )
-set( TARGET_LIST ${TARGET_LIST} map-server CACHE INTERNAL "" )
-message( STATUS "Creating target map-server - done" )
-endif( BUILD_TXT_SERVERS )