summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/strlib.c2
-rw-r--r--src/map/clif.c23
2 files changed, 7 insertions, 18 deletions
diff --git a/src/common/strlib.c b/src/common/strlib.c
index da1fddd8c..b65bc0c55 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -383,7 +383,7 @@ int strline(const char* str, size_t pos)
/// @param len Length of the string
/// @param startoff Where to start parsing
/// @param delim Field delimiter
-/// @parem out_pos Array of resulting positions
+/// @param out_pos Array of resulting positions
/// @param npos Size of the pos array
/// @param opt Options that determine the parsing behaviour
/// @return Number of fields in the string or -1 if an error occured
diff --git a/src/map/clif.c b/src/map/clif.c
index 8600d520a..209f32e0b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12137,23 +12137,12 @@ static int packetdb_readdb(void)
ln++;
continue;
}
- for(j=0;j<ARRAYLENGTH(clif_parse_func);j++){
- if(clif_parse_func[j].name != NULL && strcmp(str[2],clif_parse_func[j].name)==0)
- {
- if (packet_db[packet_ver][cmd].func != clif_parse_func[j].func)
- { //If we are updating a function, we need to zero up the previous one. [Skotlex]
- for(i=0;i<=MAX_PACKET_DB;i++){
- if (packet_db[packet_ver][i].func == clif_parse_func[j].func)
- {
- memset(&packet_db[packet_ver][i], 0, sizeof(struct s_packet_db));
- break;
- }
- }
- }
- packet_db[packet_ver][cmd].func = clif_parse_func[j].func;
- break;
- }
- }
+
+ // look up processing function by name
+ ARR_FIND( 0, ARRAYLENGTH(clif_parse_func), j, clif_parse_func[j].name != NULL && strcmp(str[2],clif_parse_func[j].name)==0 );
+ if( j < ARRAYLENGTH(clif_parse_func) )
+ packet_db[packet_ver][cmd].func = clif_parse_func[j].func;
+
// set the identifying cmd for the packet_db version
if (strcmp(str[2],"wanttoconnection")==0)
clif_config.connect_cmd[packet_ver] = cmd;