| 1 | /* |
| 2 | * Copyright (C) 2004 ls_sons ([email protected]) |
| 3 | * Copyright (C) 2004 Olaf Freyer ([email protected]) |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 20 | #include "setup.h"cxx . . $ `<file>/src/d2cs/setup.h`/ |
| 21 | #include "d2charlist.h"cxx . . $ `<file>/src/d2cs/d2charlist.h`/ |
| 22 | |
| 23 | #include <cstring> |
| 24 | |
| 25 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 26 | #include "compat/strncasecmp.h"cxx . . $ `<file>/src/compat/strncasecmp.h`/ |
| 27 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 28 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 29 | #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/ |
| 30 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 31 | |
| 32 | namespace pvpgncxx . . $ pvpgn/ |
| 33 | { |
| 34 | |
| 35 | namespace d2cscxx . . $ pvpgn/d2cs/ |
| 36 | { |
| 37 | |
| 38 | extern int d2charlist_add_charcxx . . $ pvpgn/d2cs/d2charlist_add_char(c7d3c8db93118531).(t_elistcxx . . $ pvpgn/t_elist# * list_head, t_d2charinfo_filecxx . . $ pvpgn/t_d2charinfo_file# * charinfo, unsigned int expiration_time) |
| 39 | { |
| 40 | t_d2charlistcxx . . $ pvpgn/d2cs/t_d2charlist# * charlist, *ccharlist; |
| 41 | char const * d2char_sort; |
| 42 | t_elistcxx . . $ pvpgn/t_elist# * curr; |
| 43 | |
| 44 | d2char_sort = prefs_get_charlist_sortcxx . . $ pvpgn/d2cs/prefs_get_charlist_sort(33a1f659e94feb42).(); |
| 45 | charlist = (t_d2charlistcxx . . $ pvpgn/d2cs/t_d2charlist#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_d2charlist)); |
| 46 | charlist->charinfocxx . . $ pvpgn/d2cs/d2charlist#charinfo. = charinfo; |
| 47 | charlist->expiration_timecxx . . $ pvpgn/d2cs/d2charlist#expiration_time. = expiration_time; |
| 48 | |
| 49 | if (elist_emptycxx . . $ `src/common/elist.h:246:9`!(list_head)) |
| 50 | elist_addcxx . . $ pvpgn/elist_add(3e860e19053b2cfa).(list_head, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 51 | else |
| 52 | { |
| 53 | if (strcasecmp(d2char_sort, "name") == 0) |
| 54 | { |
| 55 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, list_head) |
| 56 | { |
| 57 | ccharlist = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_d2charlist, list); |
| 58 | if (strncasecmp((char*)charinfo->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..charnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#charname., (char*)ccharlist->charinfocxx . . $ pvpgn/d2cs/d2charlist#charinfo.->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..charnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#charname., stdcxx . . $ std/::strlen((char*)charinfo->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..charnamecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#charname.)) < 0) |
| 59 | break; |
| 60 | } |
| 61 | elist_add_tailcxx . . $ pvpgn/elist_add_tail(3e860e19053b2cfa).(curr, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 62 | } |
| 63 | else if (strcasecmp(d2char_sort, "ctime") == 0) |
| 64 | { |
| 65 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, list_head) |
| 66 | { |
| 67 | ccharlist = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_d2charlist, list); |
| 68 | if (bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..create_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#create_time.) < bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(ccharlist->charinfocxx . . $ pvpgn/d2cs/d2charlist#charinfo.->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..create_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#create_time.)) |
| 69 | break; |
| 70 | } |
| 71 | elist_add_tailcxx . . $ pvpgn/elist_add_tail(3e860e19053b2cfa).(curr, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 72 | } |
| 73 | else if (strcasecmp(d2char_sort, "mtime") == 0) |
| 74 | { |
| 75 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, list_head) |
| 76 | { |
| 77 | ccharlist = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_d2charlist, list); |
| 78 | if (bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..last_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#last_time.) < bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(ccharlist->charinfocxx . . $ pvpgn/d2cs/d2charlist#charinfo.->headercxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#header..last_timecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_0#last_time.)) |
| 79 | break; |
| 80 | } |
| 81 | elist_add_tailcxx . . $ pvpgn/elist_add_tail(3e860e19053b2cfa).(curr, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 82 | } |
| 83 | else if (strcasecmp(d2char_sort, "level") == 0) |
| 84 | { |
| 85 | elist_for_eachcxx . . $ `src/common/elist.h:231:9`!(curr, list_head) |
| 86 | { |
| 87 | ccharlist = elist_entrycxx . . $ `src/common/elist.h:228:9`!(curr, t_d2charlist, list); |
| 88 | if (bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(charinfo->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..experiencecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#experience.) < bn_int_getcxx . . $ pvpgn/bn_int_get(ca1608e2c87725e2).(ccharlist->charinfocxx . . $ pvpgn/d2cs/d2charlist#charinfo.->summarycxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_3#summary..experiencecxx . . $ pvpgn/$anonymous_type_2b39c4fbe0b22632_1#experience.)) |
| 89 | break; |
| 90 | } |
| 91 | elist_add_tailcxx . . $ pvpgn/elist_add_tail(3e860e19053b2cfa).(curr, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "unsorted"); |
| 96 | elist_add_tailcxx . . $ pvpgn/elist_add_tail(3e860e19053b2cfa).(list_head, &charlist->listcxx . . $ pvpgn/d2cs/d2charlist#list.); |
| 97 | } |
| 98 | } |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | } |
| 103 | |
| 104 | } |