summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c18
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/chrif.c127
-rw-r--r--src/map/chrif.h1
-rw-r--r--src/map/map.c44
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc_chat.c2
-rw-r--r--src/map/party.c1
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c54
-rw-r--r--src/map/pc.h5
-rw-r--r--src/map/pcre.h294
-rw-r--r--src/map/trade.c4
14 files changed, 68 insertions, 487 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 91727695b..dab99cb51 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4188,19 +4188,6 @@ int atcommand_reloadscript(const int fd, struct map_session_data* sd, const char
}
/*==========================================
- * @reloadgmdb - reloads gm levels from where they are stored (gm_account.txt / mysql database)
- *------------------------------------------*/
-int atcommand_reloadgmdb(const int fd, struct map_session_data* sd, const char* command, const char* message)
-{
- nullpo_retr(-1, sd);
- chrif_reloadGMdb();
-
- clif_displaymessage(fd, msg_txt(101)); // Login-server asked to reload GM accounts and their level.
-
- return 0;
-}
-
-/*==========================================
* @mapinfo <map name> [0-3] by MC_Cameri
* => Shows information about the map [map name]
* 0 = no additional information
@@ -6632,7 +6619,7 @@ int atcommand_adjgmlvl(const int fd, struct map_session_data* sd, const char* co
return -1;
}
- pc_set_gm_level(pl_sd->status.account_id, newlev);
+ sd->gmlevel = newlev;
return 0;
}
@@ -8191,7 +8178,7 @@ int atcommand_request(const int fd, struct map_session_data* sd, const char* com
}
sprintf(atcmd_output, msg_txt(278), message); // (@request): %s
- intif_wis_message_to_gm(sd->status.name, lowest_gm_level, atcmd_output);
+ intif_wis_message_to_gm(sd->status.name, battle_config.lowest_gm_level, atcmd_output);
clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output));
clif_displaymessage(sd->fd,msg_txt(279)); // @request sent.
return 0;
@@ -8400,7 +8387,6 @@ AtCommandInfo atcommand_info[] = {
{ "reloadmobdb", 99, atcommand_reloadmobdb },
{ "reloadskilldb", 99, atcommand_reloadskilldb },
{ "reloadscript", 99, atcommand_reloadscript },
- { "reloadgmdb", 99, atcommand_reloadgmdb },
{ "reloadatcommand", 99, atcommand_reloadatcommand },
{ "reloadbattleconf", 99, atcommand_reloadbattleconf },
{ "reloadstatusdb", 99, atcommand_reloadstatusdb },
diff --git a/src/map/battle.c b/src/map/battle.c
index d7bae3c0e..98fc40062 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3395,6 +3395,7 @@ static const struct _battle_data {
{ "guild_max_castles", &battle_config.guild_max_castles, 0, 0, INT_MAX, },
{ "guild_skill_relog_delay", &battle_config.guild_skill_relog_delay, 0, 0, 1, },
{ "emergency_call", &battle_config.emergency_call, 11, 0, 31, },
+ { "lowest_gm_level", &battle_config.lowest_gm_level, 1, 0, 99, },
{ "atcommand_gm_only", &battle_config.atc_gmonly, 0, 0, 1, },
{ "atcommand_spawn_quantity_limit", &battle_config.atc_spawn_quantity_limit, 100, 0, INT_MAX, },
{ "atcommand_slave_clone_limit", &battle_config.atc_slave_clone_limit, 25, 0, INT_MAX, },
diff --git a/src/map/battle.h b/src/map/battle.h
index bb7e53278..cb3b0f265 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -141,6 +141,7 @@ extern struct Battle_Config
int monster_max_aspd;
int view_range_rate;
int chase_range_rate;
+ int lowest_gm_level;
int atc_gmonly;
int atc_spawn_quantity_limit;
int atc_slave_clone_limit;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 725fbcc07..a46186fc1 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -36,7 +36,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
6,-1,18, 7,-1,35,30,-1, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, F->2b07
6,30,-1,-1,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, F->2b0a, F->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f
- 11,10,10, 6,11,-1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17
+ 11,10,10, 6,11,-1,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, F->2b15, U->2b16, U->2b17
2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f
-1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27
};
@@ -71,7 +71,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2b12: Incoming, chrif_divorceack -> 'divorce chars
//2b13: Incoming, chrif_accountdeletion -> 'Delete acc XX, if the player is on, kick ....'
//2b14: Incoming, chrif_accountban -> 'not sure: kick the player with message XY'
-//2b15: Incoming, chrif_recvgmaccounts -> 'receive gm accs from charserver (seems to be incomplete !)'
+//2b15: FREE
//2b16: Outgoing, chrif_ragsrvinfo -> 'sends motd / rates ....'
//2b17: Outgoing, chrif_char_offline -> 'tell the charserver that the char is now offline'
//2b18: Outgoing, chrif_char_reset_offline -> 'set all players OFF!'
@@ -512,56 +512,58 @@ int chrif_scdata_request(int account_id, int char_id)
}
/*==========================================
- * new auth system [Kevin]
+ * Request auth confirmation
*------------------------------------------*/
void chrif_authreq(struct map_session_data *sd)
{
struct auth_node *node= chrif_search(sd->bl.id);
- if(!node) {
- //request data from char server and store current auth info
- WFIFOHEAD(char_fd,19);
- WFIFOW(char_fd,0) = 0x2b26;
- WFIFOL(char_fd,2) = sd->status.account_id;
- WFIFOL(char_fd,6) = sd->status.char_id;
- WFIFOL(char_fd,10) = sd->login_id1;
- WFIFOB(char_fd,14) = sd->status.sex;
- WFIFOL(char_fd,15) = htonl(session[sd->fd]->client_addr);
- WFIFOSET(char_fd,19);
- chrif_sd_to_auth(sd, ST_LOGIN);
+ if( node != NULL )
+ {
+ set_eof(sd->fd);
return;
- } else { //char already online? kick connect request and tell char server that this person is online
- //This case shouldn't happen in an ideal system
- pc_authfail(sd);
- chrif_char_online(sd);
}
- return;
+
+ WFIFOHEAD(char_fd,19);
+ WFIFOW(char_fd,0) = 0x2b26;
+ WFIFOL(char_fd,2) = sd->status.account_id;
+ WFIFOL(char_fd,6) = sd->status.char_id;
+ WFIFOL(char_fd,10) = sd->login_id1;
+ WFIFOB(char_fd,14) = sd->status.sex;
+ WFIFOL(char_fd,15) = htonl(session[sd->fd]->client_addr);
+ WFIFOSET(char_fd,19);
+ chrif_sd_to_auth(sd, ST_LOGIN);
}
-//character selected, insert into auth db
+/*==========================================
+ * Auth confirmation ack
+ *------------------------------------------*/
void chrif_authok(int fd)
{
int account_id;
uint32 login_id1;
- time_t expiration_time;
uint32 login_id2;
+ time_t expiration_time;
+ int gmlevel;
struct mmo_charstatus* status;
int char_id;
struct auth_node *node;
TBL_PC* sd;
//Check if both servers agree on the struct's size
- if( RFIFOW(fd,2) - 20 != sizeof(struct mmo_charstatus) )
+ if( RFIFOW(fd,2) - 24 != sizeof(struct mmo_charstatus) )
{
- ShowError("chrif_authok: Data size mismatch! %d != %d\n", RFIFOW(fd,2) - 20, sizeof(struct mmo_charstatus));
+ ShowError("chrif_authok: Data size mismatch! %d != %d\n", RFIFOW(fd,2) - 24, sizeof(struct mmo_charstatus));
return;
}
account_id = RFIFOL(fd,4);
login_id1 = RFIFOL(fd,8);
- expiration_time = (time_t)(int32)RFIFOL(fd,12);
- login_id2 = RFIFOL(fd,16);
- status = (struct mmo_charstatus*)RFIFOP(fd,20);
+ login_id2 = RFIFOL(fd,12);
+ expiration_time = (time_t)(int32)RFIFOL(fd,16);
+ gmlevel = RFIFOL(fd,20);
+ status = (struct mmo_charstatus*)RFIFOP(fd,24);
+
char_id = status->char_id;
//Check if we don't already have player data in our server
@@ -569,33 +571,35 @@ void chrif_authok(int fd)
if ((sd = map_id2sd(account_id)) != NULL)
return;
- if ((node = chrif_search(account_id)))
- { //Is the character already awaiting authorization?
- if (node->state != ST_LOGIN)
- return; //character in logout phase, do not touch that data.
- if (node->sd)
- {
- sd = node->sd;
- if(node->char_dat == NULL &&
- node->account_id == account_id &&
- node->char_id == char_id &&
- node->login_id1 == login_id1 )
- { //Auth Ok
- if (pc_authok(sd, login_id2, expiration_time, status))
- {
- return;
- }
- } else { //Auth Failed
- pc_authfail(sd);
- }
- chrif_char_offline(sd); //Set client offline
- chrif_auth_delete(account_id, char_id, ST_LOGIN);
- return;
- }
+ if ((node = chrif_search(account_id)) == NULL)
+ return; // should not happen
+
+ if (node->state != ST_LOGIN)
+ return; //character in logout phase, do not touch that data.
+
+ if (node->sd == NULL)
+ {
+ /*
//When we receive double login info and the client has not connected yet,
//discard the older one and keep the new one.
chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
+ */
+ return; // should not happen
+ }
+
+ sd = node->sd;
+ if(node->char_dat == NULL &&
+ node->account_id == account_id &&
+ node->char_id == char_id &&
+ node->login_id1 == login_id1 )
+ { //Auth Ok
+ if (pc_authok(sd, login_id2, expiration_time, gmlevel, status))
+ return;
+ } else { //Auth Failed
+ pc_authfail(sd);
}
+ chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already.
+ chrif_auth_delete(account_id, char_id, ST_LOGIN);
}
// client authentication failed
@@ -1036,30 +1040,6 @@ int chrif_disconnectplayer(int fd)
}
/*==========================================
- * Request to reload GM accounts and their levels: send to char-server by [Yor]
- *------------------------------------------*/
-int chrif_reloadGMdb(void)
-{
- chrif_check(-1);
-
- WFIFOHEAD(char_fd,2);
- WFIFOW(char_fd,0) = 0x2af7;
- WFIFOSET(char_fd,2);
-
- return 0;
-}
-
-/*==========================================
- * Receiving GM accounts and their levels from char-server by [Yor]
- *------------------------------------------*/
-int chrif_recvgmaccounts(int fd)
-{
- int nAccounts = pc_read_gm_account(fd);
- ShowInfo("From login-server: receiving information of '"CL_WHITE"%d"CL_RESET"' GM accounts.\n", nAccounts);
- return 0;
-}
-
-/*==========================================
* Request/Receive top 10 Fame character list
*------------------------------------------*/
@@ -1454,7 +1434,6 @@ int chrif_parse(int fd)
case 0x2b12: chrif_divorceack(RFIFOL(fd,2), RFIFOL(fd,6)); break;
case 0x2b13: chrif_accountdeletion(fd); break;
case 0x2b14: chrif_accountban(fd); break;
- case 0x2b15: chrif_recvgmaccounts(fd); break;
case 0x2b1b: chrif_recvfamelist(fd); break;
case 0x2b1d: chrif_load_scdata(fd); break;
case 0x2b1e: chrif_update_ip(fd); break;
diff --git a/src/map/chrif.h b/src/map/chrif.h
index a8487533c..9ff5b9a0e 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -44,7 +44,6 @@ int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port);
int chrif_searchcharid(int char_id);
int chrif_changeemail(int id, const char *actual_email, const char *new_email);
int chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second);
-int chrif_reloadGMdb(void);
int chrif_updatefamelist(struct map_session_data *sd);
int chrif_buildfamelist(void);
int chrif_save_scdata(struct map_session_data *sd);
diff --git a/src/map/map.c b/src/map/map.c
index 07d353aed..8c80644d0 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -79,8 +79,6 @@ Sql* logmysql_handle;
#endif /* not TXT_ONLY */
-int lowest_gm_level = 1;
-
// This param using for sending mainchat
// messages like whispers to this nick. [LuzZza]
char main_chat_nick[16] = "Main";
@@ -2955,13 +2953,8 @@ int inter_config_read(char *cfgName)
i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
if(i!=2)
continue;
- if(strcmpi(w1,"party_share_level")==0){
- party_share_level = config_switch(w2);
- } else if(strcmpi(w1,"lowest_gm_level")==0){
- lowest_gm_level = atoi(w2);
-
- /* Main chat nick [LuzZza] */
- } else if(strcmpi(w1, "main_chat_nick")==0){
+
+ if(strcmpi(w1, "main_chat_nick")==0){
strcpy(main_chat_nick, w2);
#ifndef TXT_ONLY
@@ -3068,37 +3061,6 @@ int log_sql_init(void)
return 0;
}
-/*=============================================
- * Does a mysql_ping to all connection handles
- *---------------------------------------------*/
-int map_sql_ping(int tid, unsigned int tick, int id, intptr data)
-{
- ShowInfo("Pinging SQL server to keep connection alive...\n");
- Sql_Ping(mmysql_handle);
- if (log_config.sql_logs)
- Sql_Ping(logmysql_handle);
- return 0;
-}
-
-int sql_ping_init(void)
-{
- uint32 connection_timeout, connection_ping_interval;
-
- // set a default value
- connection_timeout = 28800; // 8 hours
-
- // ask the mysql server for the timeout value
- Sql_GetTimeout(mmysql_handle, &connection_timeout);
- if (connection_timeout < 60)
- connection_timeout = 60;
-
- // establish keepalive
- connection_ping_interval = connection_timeout - 30; // 30-second reserve
- add_timer_func_list(map_sql_ping, "map_sql_ping");
- add_timer_interval(gettick() + connection_ping_interval*1000, map_sql_ping, 0, 0, connection_ping_interval*1000);
-
- return 0;
-}
#endif /* not TXT_ONLY */
int map_db_final(DBKey k,void *d,va_list ap)
@@ -3436,8 +3398,6 @@ int do_init(int argc, char *argv[])
#ifndef TXT_ONLY /* mail system [Valaris] */
if (log_config.sql_logs)
log_sql_init();
-
- sql_ping_init();
#endif /* not TXT_ONLY */
npc_event_do_oninit(); // npcのOnInitイベント?行
diff --git a/src/map/map.h b/src/map/map.h
index 2f46c4e3e..429370a95 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -633,7 +633,6 @@ typedef struct homun_data TBL_HOM;
( ((bl) == (struct block_list*)NULL || (bl)->type != (type_)) ? (T ## type_ *)NULL : (T ## type_ *)(bl) )
-extern int lowest_gm_level;
extern char main_chat_nick[16];
#ifndef TXT_ONLY
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 44c9ce82e..d7edf69f0 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -14,7 +14,7 @@
#include "pc.h" // struct map_session_data
#include "script.h" // set_var()
-#include "pcre.h"
+#include <pcre.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/map/party.c b/src/map/party.c
index 28c5154e7..82cecc3ff 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -28,7 +28,6 @@
static DBMap* party_db; // int party_id -> struct party_data*
-int party_share_level = 10;
int party_send_xy_timer(int tid, unsigned int tick, int id, intptr data);
/*==========================================
diff --git a/src/map/party.h b/src/map/party.h
index 65f585b10..9ad729c28 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -31,8 +31,6 @@ struct party_data {
};
-extern int party_share_level;
-
void do_init_party(void);
void do_final_party(void);
struct party_data* party_search(int party_id);
diff --git a/src/map/pc.c b/src/map/pc.c
index 3c9d5756a..bb24b097a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6,7 +6,7 @@
#include "../common/malloc.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
-#include "../common/socket.h" // RFIFO*()
+#include "../common/socket.h" // session[]
#include "../common/strlib.h" // safestrncpy()
#include "../common/timer.h"
#include "../common/utils.h"
@@ -58,9 +58,6 @@ struct fame_list taekwon_fame_list[MAX_FAME_LIST];
static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_AMMO};
-static struct gm_account *gm_account = NULL;
-static int GM_num = 0;
-
#define MOTD_LINE_SIZE 128
char motd_text[MOTD_LINE_SIZE][256]; // Message of the day buffer [Valaris]
@@ -85,34 +82,7 @@ int pc_class2idx(int class_) {
int pc_isGM(struct map_session_data* sd)
{
- int i;
- nullpo_retr(0, sd);
-
- if( sd->bl.type != BL_PC )
- return 99;
-
- ARR_FIND( 0, GM_num, i, gm_account[i].account_id == sd->status.account_id );
- return ( i < GM_num ) ? gm_account[i].level : 0;
-}
-
-int pc_set_gm_level(int account_id, int level)
-{
- int i;
-
- ARR_FIND( 0, GM_num, i, account_id == gm_account[i].account_id );
- if( i < GM_num )
- {
- gm_account[i].level = level;
- }
- else
- {
- gm_account = (struct gm_account *) aRealloc(gm_account, (GM_num + 1) * sizeof(struct gm_account));
- gm_account[GM_num].account_id = account_id;
- gm_account[GM_num].level = level;
- GM_num++;
- }
-
- return 0;
+ return sd->gmlevel;
}
static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr data)
@@ -709,12 +679,13 @@ int pc_isequip(struct map_session_data *sd,int n)
* session idに問題無し
* char鯖から送られてきたステ?タスを設定
*------------------------------------------*/
-bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, struct mmo_charstatus *st)
+bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int gmlevel, struct mmo_charstatus *st)
{
int i;
unsigned long tick = gettick();
sd->login_id2 = login_id2;
+ sd->gmlevel = gmlevel;
memcpy(&sd->status, st, sizeof(*st));
if (st->sex != sd->status.sex) {
@@ -6925,21 +6896,6 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr data)
return 0;
}
-int pc_read_gm_account(int fd)
-{
- //FIXME: this implementation is a total failure (direct reading from RFIFO) [ultramage]
- int i = 0;
- if (gm_account != NULL)
- aFree(gm_account);
- GM_num = 0;
- gm_account = (struct gm_account *) aMallocA(((RFIFOW(fd,2) - 4) / 5)*sizeof(struct gm_account));
- for (i = 4; i < RFIFOW(fd,2); i += 5) {
- gm_account[GM_num].account_id = RFIFOL(fd,i);
- gm_account[GM_num].level = (int)RFIFOB(fd,i+4);
- GM_num++;
- }
- return GM_num;
-}
static int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap)
{
if (sd->state.night != night_flag && map[sd->bl.m].flag.nightenabled)
@@ -7487,8 +7443,6 @@ int pc_read_motd(void)
*------------------------------------------*/
void do_final_pc(void)
{
- if (gm_account)
- aFree(gm_account);
return;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 81a1e9a75..d8dd582c5 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -130,6 +130,7 @@ struct map_session_data {
} special_state;
int login_id1, login_id2;
unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
+ int gmlevel;
int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
struct mmo_charstatus status;
@@ -498,7 +499,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type);
int pc_makesavestatus(struct map_session_data *);
void pc_respawn(struct map_session_data* sd, uint8 clrtype);
int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
-bool pc_authok(struct map_session_data*, int, time_t, struct mmo_charstatus *);
+bool pc_authok(struct map_session_data* sd, int, time_t, int gmlevel, struct mmo_charstatus* status);
void pc_authfail(struct map_session_data *);
int pc_reg_received(struct map_session_data *sd);
@@ -655,7 +656,6 @@ struct map_session_data *pc_get_child(struct map_session_data *sd);
void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick);
void pc_regen (struct map_session_data *sd, unsigned int diff_tick);
-int pc_set_gm_level(int account_id, int level);
void pc_setstand(struct map_session_data *sd);
int pc_candrop(struct map_session_data *sd,struct item *item);
@@ -685,7 +685,6 @@ struct sg_data {
};
extern const struct sg_data sg_info[3];
-int pc_read_gm_account(int fd);
void pc_setinvincibletimer(struct map_session_data* sd, int val);
void pc_delinvincibletimer(struct map_session_data* sd);
diff --git a/src/map/pcre.h b/src/map/pcre.h
deleted file mode 100644
index e973396ba..000000000
--- a/src/map/pcre.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* This is the public header file for the PCRE library, to be #included by
-applications that call the PCRE functions.
-
- Copyright (c) 1997-2006 University of Cambridge
-
------------------------------------------------------------------------------
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of the University of Cambridge nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-*/
-
-#ifndef _PCRE_H
-#define _PCRE_H
-
-/* The current PCRE version information. */
-
-/* NOTES FOR FUTURE MAINTAINERS: Do not use numbers with leading zeros, because
-they may be treated as octal constants. The PCRE_PRERELEASE feature is for
-identifying release candidates. It might be defined as -RC2, for example. In
-real releases, it should be defined empty. Do not change the alignment of these
-statments. The code in ./configure greps out the version numbers by using "cut"
-to get values from column 29 onwards. These are substituted into pcre-config
-and libpcre.pc. The values are not put into configure.ac and substituted here
-(which would simplify this issue) because that makes life harder for those who
-cannot run ./configure. As it now stands, this file need not be edited in that
-circumstance. */
-
-#define PCRE_MAJOR 7
-#define PCRE_MINOR 0
-#define PCRE_PRERELEASE
-#define PCRE_DATE 18-Dec-2006
-
-/* Win32 uses DLL by default; it needs special stuff for exported functions
-when building PCRE. */
-
-#ifdef _WIN32
-# ifdef PCRE_DEFINITION
-# ifdef DLL_EXPORT
-# define PCRE_DATA_SCOPE __declspec(dllexport)
-# endif
-# else
-# ifndef PCRE_STATIC
-# define PCRE_DATA_SCOPE extern __declspec(dllimport)
-# endif
-# endif
-#endif
-
-/* Otherwise, we use the standard "extern". */
-
-#ifndef PCRE_DATA_SCOPE
-# ifdef __cplusplus
-# define PCRE_DATA_SCOPE extern "C"
-# else
-# define PCRE_DATA_SCOPE extern
-# endif
-#endif
-
-/* Have to include stdlib.h in order to ensure that size_t is defined;
-it is needed here for malloc. */
-
-#include <stdlib.h>
-
-/* Allow for C++ users */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Options */
-
-#define PCRE_CASELESS 0x00000001
-#define PCRE_MULTILINE 0x00000002
-#define PCRE_DOTALL 0x00000004
-#define PCRE_EXTENDED 0x00000008
-#define PCRE_ANCHORED 0x00000010
-#define PCRE_DOLLAR_ENDONLY 0x00000020
-#define PCRE_EXTRA 0x00000040
-#define PCRE_NOTBOL 0x00000080
-#define PCRE_NOTEOL 0x00000100
-#define PCRE_UNGREEDY 0x00000200
-#define PCRE_NOTEMPTY 0x00000400
-#define PCRE_UTF8 0x00000800
-#define PCRE_NO_AUTO_CAPTURE 0x00001000
-#define PCRE_NO_UTF8_CHECK 0x00002000
-#define PCRE_AUTO_CALLOUT 0x00004000
-#define PCRE_PARTIAL 0x00008000
-#define PCRE_DFA_SHORTEST 0x00010000
-#define PCRE_DFA_RESTART 0x00020000
-#define PCRE_FIRSTLINE 0x00040000
-#define PCRE_DUPNAMES 0x00080000
-#define PCRE_NEWLINE_CR 0x00100000
-#define PCRE_NEWLINE_LF 0x00200000
-#define PCRE_NEWLINE_CRLF 0x00300000
-#define PCRE_NEWLINE_ANY 0x00400000
-
-/* Exec-time and get/set-time error codes */
-
-#define PCRE_ERROR_NOMATCH (-1)
-#define PCRE_ERROR_NULL (-2)
-#define PCRE_ERROR_BADOPTION (-3)
-#define PCRE_ERROR_BADMAGIC (-4)
-#define PCRE_ERROR_UNKNOWN_OPCODE (-5)
-#define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */
-#define PCRE_ERROR_NOMEMORY (-6)
-#define PCRE_ERROR_NOSUBSTRING (-7)
-#define PCRE_ERROR_MATCHLIMIT (-8)
-#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
-#define PCRE_ERROR_BADUTF8 (-10)
-#define PCRE_ERROR_BADUTF8_OFFSET (-11)
-#define PCRE_ERROR_PARTIAL (-12)
-#define PCRE_ERROR_BADPARTIAL (-13)
-#define PCRE_ERROR_INTERNAL (-14)
-#define PCRE_ERROR_BADCOUNT (-15)
-#define PCRE_ERROR_DFA_UITEM (-16)
-#define PCRE_ERROR_DFA_UCOND (-17)
-#define PCRE_ERROR_DFA_UMLIMIT (-18)
-#define PCRE_ERROR_DFA_WSSIZE (-19)
-#define PCRE_ERROR_DFA_RECURSE (-20)
-#define PCRE_ERROR_RECURSIONLIMIT (-21)
-#define PCRE_ERROR_NULLWSLIMIT (-22)
-#define PCRE_ERROR_BADNEWLINE (-23)
-
-/* Request types for pcre_fullinfo() */
-
-#define PCRE_INFO_OPTIONS 0
-#define PCRE_INFO_SIZE 1
-#define PCRE_INFO_CAPTURECOUNT 2
-#define PCRE_INFO_BACKREFMAX 3
-#define PCRE_INFO_FIRSTBYTE 4
-#define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */
-#define PCRE_INFO_FIRSTTABLE 5
-#define PCRE_INFO_LASTLITERAL 6
-#define PCRE_INFO_NAMEENTRYSIZE 7
-#define PCRE_INFO_NAMECOUNT 8
-#define PCRE_INFO_NAMETABLE 9
-#define PCRE_INFO_STUDYSIZE 10
-#define PCRE_INFO_DEFAULT_TABLES 11
-
-/* Request types for pcre_config(). Do not re-arrange, in order to remain
-compatible. */
-
-#define PCRE_CONFIG_UTF8 0
-#define PCRE_CONFIG_NEWLINE 1
-#define PCRE_CONFIG_LINK_SIZE 2
-#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3
-#define PCRE_CONFIG_MATCH_LIMIT 4
-#define PCRE_CONFIG_STACKRECURSE 5
-#define PCRE_CONFIG_UNICODE_PROPERTIES 6
-#define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7
-
-/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
-these bits, just add new ones on the end, in order to remain compatible. */
-
-#define PCRE_EXTRA_STUDY_DATA 0x0001
-#define PCRE_EXTRA_MATCH_LIMIT 0x0002
-#define PCRE_EXTRA_CALLOUT_DATA 0x0004
-#define PCRE_EXTRA_TABLES 0x0008
-#define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010
-
-/* Types */
-
-struct real_pcre; /* declaration; the definition is private */
-typedef struct real_pcre pcre;
-
-/* When PCRE is compiled as a C++ library, the subject pointer type can be
-replaced with a custom type. For conventional use, the public interface is a
-const char *. */
-
-#ifndef PCRE_SPTR
-#define PCRE_SPTR const char *
-#endif
-
-/* The structure for passing additional data to pcre_exec(). This is defined in
-such as way as to be extensible. Always add new fields at the end, in order to
-remain compatible. */
-
-typedef struct pcre_extra {
- unsigned long int flags; /* Bits for which fields are set */
- void *study_data; /* Opaque data from pcre_study() */
- unsigned long int match_limit; /* Maximum number of calls to match() */
- void *callout_data; /* Data passed back in callouts */
- const unsigned char *tables; /* Pointer to character tables */
- unsigned long int match_limit_recursion; /* Max recursive calls to match() */
-} pcre_extra;
-
-/* The structure for passing out data via the pcre_callout_function. We use a
-structure so that new fields can be added on the end in future versions,
-without changing the API of the function, thereby allowing old clients to work
-without modification. */
-
-typedef struct pcre_callout_block {
- int version; /* Identifies version of block */
- /* ------------------------ Version 0 ------------------------------- */
- int callout_number; /* Number compiled into pattern */
- int *offset_vector; /* The offset vector */
- PCRE_SPTR subject; /* The subject being matched */
- int subject_length; /* The length of the subject */
- int start_match; /* Offset to start of this match attempt */
- int current_position; /* Where we currently are in the subject */
- int capture_top; /* Max current capture */
- int capture_last; /* Most recently closed capture */
- void *callout_data; /* Data passed in with the call */
- /* ------------------- Added for Version 1 -------------------------- */
- int pattern_position; /* Offset to next item in the pattern */
- int next_item_length; /* Length of next item in the pattern */
- /* ------------------------------------------------------------------ */
-} pcre_callout_block;
-
-/* Indirection for store get and free functions. These can be set to
-alternative malloc/free functions if required. Special ones are used in the
-non-recursive case for "frames". There is also an optional callout function
-that is triggered by the (?) regex item. For Virtual Pascal, these definitions
-have to take another form. */
-
-#ifndef VPCOMPAT
-PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
-PCRE_DATA_SCOPE void (*pcre_free)(void *);
-PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
-PCRE_DATA_SCOPE void (*pcre_stack_free)(void *);
-PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *);
-#else /* VPCOMPAT */
-PCRE_DATA_SCOPE void *pcre_malloc(size_t);
-PCRE_DATA_SCOPE void pcre_free(void *);
-PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
-PCRE_DATA_SCOPE void pcre_stack_free(void *);
-PCRE_DATA_SCOPE int pcre_callout(pcre_callout_block *);
-#endif /* VPCOMPAT */
-
-/* Exported PCRE functions */
-
-PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *,
- const unsigned char *);
-PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **,
- int *, const unsigned char *);
-PCRE_DATA_SCOPE int pcre_config(int, void *);
-PCRE_DATA_SCOPE int pcre_copy_named_substring(const pcre *, const char *,
- int *, int, const char *, char *, int);
-PCRE_DATA_SCOPE int pcre_copy_substring(const char *, int *, int, int, char *,
- int);
-PCRE_DATA_SCOPE int pcre_dfa_exec(const pcre *, const pcre_extra *,
- const char *, int, int, int, int *, int , int *, int);
-PCRE_DATA_SCOPE int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
- int, int, int, int *, int);
-PCRE_DATA_SCOPE void pcre_free_substring(const char *);
-PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
-PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int,
- void *);
-PCRE_DATA_SCOPE int pcre_get_named_substring(const pcre *, const char *,
- int *, int, const char *, const char **);
-PCRE_DATA_SCOPE int pcre_get_stringnumber(const pcre *, const char *);
-PCRE_DATA_SCOPE int pcre_get_stringtable_entries(const pcre *, const char *,
- char **, char **);
-PCRE_DATA_SCOPE int pcre_get_substring(const char *, int *, int, int,
- const char **);
-PCRE_DATA_SCOPE int pcre_get_substring_list(const char *, int *, int,
- const char ***);
-PCRE_DATA_SCOPE int pcre_info(const pcre *, int *, int *);
-PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
-PCRE_DATA_SCOPE int pcre_refcount(pcre *, int);
-PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_DATA_SCOPE const char *pcre_version(void);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* End of pcre.h */
diff --git a/src/map/trade.c b/src/map/trade.c
index 880657ff0..aca08872a 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -70,7 +70,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
//Fixed. Only real GMs can request trade from far away! [Lupus]
- if (level < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
+ if (level < battle_config.lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
!check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE)
)) {
clif_tradestart(sd, 0); // too far
@@ -127,7 +127,7 @@ void trade_tradeack(struct map_session_data *sd, int type)
return; //If client didn't send accept, it's a broken packet?
//Copied here as well since the original character could had warped.
- if (pc_isGM(tsd) < lowest_gm_level && (sd->bl.m != tsd->bl.m ||
+ if (pc_isGM(tsd) < battle_config.lowest_gm_level && (sd->bl.m != tsd->bl.m ||
!check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE)
)) {
clif_tradestart(sd, 0); // too far