diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-12-05 23:30:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-12-05 23:30:04 +0300 |
commit | 2747cb0ce0455d2898b922cbe5b0429248c55402 (patch) | |
tree | 3a5f9e557de9472c4c0d60bf2eaa749fea4e4082 /src | |
parent | 2e7cb5a8f05b0a57081360b08906ab23bdba88a8 (diff) | |
download | plugin-2747cb0ce0455d2898b922cbe5b0429248c55402.tar.gz plugin-2747cb0ce0455d2898b922cbe5b0429248c55402.tar.bz2 plugin-2747cb0ce0455d2898b922cbe5b0429248c55402.tar.xz plugin-2747cb0ce0455d2898b922cbe5b0429248c55402.zip |
Fix compilation errors after hercules update.
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/parse.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/emap/parse.c b/src/emap/parse.c index 1d620f4..966c8bb 100644 --- a/src/emap/parse.c +++ b/src/emap/parse.c @@ -56,8 +56,8 @@ void map_parse_join_channel(int fd) if (chan) { int k; - ARR_FIND(0, sd->channel_count, k, sd->channels[k] == chan); - if (k < sd->channel_count || channel->join(chan, sd, "", true) == HCS_STATUS_OK) + ARR_FIND(0, VECTOR_LENGTH(sd->channels), k, VECTOR_INDEX(sd->channels, k) == chan); + if (k < VECTOR_LENGTH(sd->channels) || channel->join(chan, sd, "", true) == HCS_STATUS_OK) res = 1; else res = 0; @@ -81,33 +81,26 @@ void map_parse_part_channel(int fd) else p = name; - for (k = 0; k < sd->channel_count; k ++) + ARR_FIND(0, VECTOR_LENGTH(sd->channels), k, strcmpi(p, VECTOR_INDEX(sd->channels, k)->name) == 0); + if (k == VECTOR_LENGTH(sd->channels)) { - if (strcmpi(p, sd->channels[k]->name) == 0) - break; - } - - if (k == sd->channel_count) return; + } - if (sd->channels[k]->type == HCS_TYPE_ALLY) + if (VECTOR_INDEX(sd->channels, k)->type == HCS_TYPE_ALLY) { - do + for (k = VECTOR_LENGTH(sd->channels) - 1; k >= 0; k--) { - for (k = 0; k < sd->channel_count; k++) + // Loop downward to avoid issues when channel->leave() compacts the array + if (VECTOR_INDEX(sd->channels, k)->type == HCS_TYPE_ALLY) { - if (sd->channels[k]->type == HCS_TYPE_ALLY) - { - channel->leave(sd->channels[k], sd); - break; - } + channel->leave(VECTOR_INDEX(sd->channels, k), sd); } } - while (k != sd->channel_count); } else { - channel->leave(sd->channels[k], sd); + channel->leave(VECTOR_INDEX(sd->channels, k), sd); } } |