summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatheus Macabu <mkbu95@gmail.com>2013-02-04 00:32:19 -0200
committerMatheus Macabu <mkbu95@gmail.com>2013-02-04 00:32:19 -0200
commit524291493e64196d8ce02f4b637ea0ee1a176d0a (patch)
tree7a15790fb1b7658d7fb39deaae83f562fd81c872 /src
parentf651ffc9f92dbf339e9691c24d66577bf4a43d47 (diff)
downloadhercules-524291493e64196d8ce02f4b637ea0ee1a176d0a.tar.gz
hercules-524291493e64196d8ce02f4b637ea0ee1a176d0a.tar.bz2
hercules-524291493e64196d8ce02f4b637ea0ee1a176d0a.tar.xz
hercules-524291493e64196d8ce02f4b637ea0ee1a176d0a.zip
Merged some commits from rAthena.
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c9
-rw-r--r--src/map/npc.c27
-rw-r--r--src/map/pc.c4
3 files changed, 22 insertions, 18 deletions
diff --git a/src/char/char.c b/src/char/char.c
index d454e8bd0..1b5c7898d 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -133,7 +133,7 @@ struct char_session_data {
char birthdate[10+1]; // YYYY-MM-DD
};
-int max_connect_user = 0;
+int max_connect_user = -1;
int gm_allow_group = -1;
int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
int start_zeny = 0;
@@ -2154,7 +2154,8 @@ int parse_fromlogin(int fd) {
ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map[0] );
// continued from char_auth_ok...
if( server_id == ARRAYLENGTH(server) || //server not online, bugreport:2359
- ( max_connect_user && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) {
+ (max_connect_user == 0 && sd->group_id != gm_allow_group) ||
+ ( max_connect_user > 0 && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) {
// refuse connection (over populated)
WFIFOHEAD(i,3);
WFIFOW(i,0) = 0x6c;
@@ -4588,8 +4589,8 @@ int char_config_read(const char* cfgName)
char_new_display = atoi(w2);
} else if (strcmpi(w1, "max_connect_user") == 0) {
max_connect_user = atoi(w2);
- if (max_connect_user < 0)
- max_connect_user = 0; // unlimited online players
+ if (max_connect_user < -1)
+ max_connect_user = -1; // unlimited online players
} else if(strcmpi(w1, "gm_allow_group") == 0) {
gm_allow_group = atoi(w2);
} else if (strcmpi(w1, "autosave_time") == 0) {
diff --git a/src/map/npc.c b/src/map/npc.c
index 3aabeaf98..383cd031a 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2884,24 +2884,23 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
setd_sub(st, NULL, ".@atcmd_command$", 0, (void *)command, NULL);
// split atcmd parameters based on spaces
- i = 0;
- j = 0;
-
temp = (char*)aMalloc(strlen(message) + 1);
- while( message[i] != '\0' ) {
- if( message[i] == ' ' && k < 127 ) {
- temp[j] = '\0';
- setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL);
- j = 0;
- ++i;
- } else
- temp[j++] = message[i++];
+ for( i = 0; i < ( strlen( message ) + 1 ) && k < 127; i ++ ) {
+ if( message[i] == ' ' || message[i] == '\0' ) {
+ if( message[ ( i - 1 ) ] == ' ' ) {
+ continue; // To prevent "@atcmd [space][space][space]..."
+ }
+ temp[k] = '\0';
+ k = 0;
+ setd_sub( st, NULL, ".@atcmd_parameters$", j++, (void *)temp, NULL );
+ } else {
+ temp[k] = message[i];
+ k++;
+ }
}
- temp[j] = '\0';
- setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL);
- setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)&k, NULL);
+ setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)__64BPRTSIZE(j), NULL);
aFree(temp);
run_script_main(st);
diff --git a/src/map/pc.c b/src/map/pc.c
index 6f608cd49..4fb555d0f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8194,6 +8194,10 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) {
cursor++;
}
+
+ /* check if combo requirements still fit */
+ if( pc_checkcombo( sd, data ) )
+ continue;
/* it's empty, we can clear all the memory */
if( (sd->combos.count = cursor) == 0 ) {