anongame_infos.c
上传用户:tany51
上传日期:2013-06-12
资源大小:1397k
文件大小:120k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*
  2.  * This program is free software; you can redistribute it and/or
  3.  * modify it under the terms of the GNU General Public License
  4.  * as published by the Free Software Foundation; either version 2
  5.  * of the License, or (at your option) any later version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful,
  8.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  * GNU General Public License for more details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License
  13.  * along with this program; if not, write to the Free Software
  14.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  15.  */
  16. #define TIMER_INTERNAL_ACCESS
  17. #include "common/setup_before.h"
  18. #ifdef STDC_HEADERS
  19. # include <stdlib.h>
  20. #else
  21. # ifdef HAVE_MALLOC_H
  22. #  include <malloc.h>
  23. # endif
  24. #endif
  25. #ifdef HAVE_STRING_H
  26. # include <string.h>
  27. #else
  28. # ifdef HAVE_STRINGS_H
  29. #  include <strings.h>
  30. # endif
  31. #endif
  32. #include "compat/strrchr.h"
  33. #include <errno.h>
  34. #include "compat/strerror.h"
  35. #include "common/list.h"
  36. #include "common/eventlog.h"
  37. #include "common/util.h"
  38. #include "common/packet.h"
  39. #include "common/tag.h"
  40. #include "common/bn_type.h"
  41. #include "zlib/pvpgn_zlib.h"
  42. #include "tournament.h"
  43. #include "anongame_maplists.h"
  44. #include "anongame_infos.h"
  45. #include "common/setup_after.h"
  46. static FILE * fp = NULL;
  47. static t_anongame_infos * anongame_infos;
  48. static int zlib_compress(void const * src, int srclen, char ** dest, int * destlen);
  49. static int anongame_infos_data_load(void);
  50. static int anongame_infos_URL_init(t_anongame_infos * anongame_infos)
  51. {
  52. t_anongame_infos_URL * anongame_infos_URL;
  53. if (!(anongame_infos))
  54. {
  55. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  56. return -1;
  57. }
  58. if (!(anongame_infos_URL = malloc(sizeof(t_anongame_infos_URL))))
  59. {
  60.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_URL");
  61.     return -1;
  62. }
  63.     
  64. anongame_infos_URL->player_URL = NULL;
  65. anongame_infos_URL->server_URL = NULL;
  66. anongame_infos_URL->tourney_URL = NULL;
  67. anongame_infos_URL->ladder_PG_1v1_URL = NULL;
  68. anongame_infos_URL->ladder_PG_ffa_URL = NULL;
  69. anongame_infos_URL->ladder_PG_team_URL = NULL;
  70. anongame_infos_URL->ladder_AT_2v2_URL = NULL;
  71. anongame_infos_URL->ladder_AT_3v3_URL = NULL;
  72. anongame_infos_URL->ladder_AT_4v4_URL = NULL;
  73. anongame_infos->anongame_infos_URL=anongame_infos_URL;
  74. return 0;
  75. }
  76. static int anongame_infos_URL_destroy(t_anongame_infos_URL * anongame_infos_URL)
  77. {
  78. if (!(anongame_infos_URL))
  79. {
  80. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  81. return -1;
  82. }
  83.     
  84. if (anongame_infos_URL->player_URL) free((void *)anongame_infos_URL->player_URL);
  85. if (anongame_infos_URL->server_URL) free((void *)anongame_infos_URL->server_URL);
  86. if (anongame_infos_URL->tourney_URL) free((void *)anongame_infos_URL->tourney_URL);
  87. if (anongame_infos_URL->ladder_PG_1v1_URL) free((void *)anongame_infos_URL->ladder_PG_1v1_URL);
  88. if (anongame_infos_URL->ladder_PG_ffa_URL) free((void *)anongame_infos_URL->ladder_PG_ffa_URL);
  89. if (anongame_infos_URL->ladder_PG_team_URL) free((void *)anongame_infos_URL->ladder_PG_team_URL);
  90. if (anongame_infos_URL->ladder_AT_2v2_URL) free((void *)anongame_infos_URL->ladder_AT_2v2_URL);
  91. if (anongame_infos_URL->ladder_AT_3v3_URL) free((void *)anongame_infos_URL->ladder_AT_3v3_URL);
  92. if (anongame_infos_URL->ladder_AT_4v4_URL) free((void *)anongame_infos_URL->ladder_AT_4v4_URL);
  93. free((void *)anongame_infos_URL);
  94. return 0;
  95. }
  96. static t_anongame_infos_DESC * anongame_infos_DESC_init(void)
  97. {
  98. t_anongame_infos_DESC * anongame_infos_DESC;
  99. if (!(anongame_infos_DESC = malloc(sizeof(t_anongame_infos_DESC))))
  100. {
  101. eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_DESC");
  102. return NULL;
  103. }
  104. anongame_infos_DESC->langID = NULL;
  105. anongame_infos_DESC->ladder_PG_1v1_desc = NULL;
  106. anongame_infos_DESC->ladder_PG_ffa_desc = NULL;
  107. anongame_infos_DESC->ladder_PG_team_desc = NULL;
  108. anongame_infos_DESC->ladder_AT_2v2_desc = NULL;
  109. anongame_infos_DESC->ladder_AT_3v3_desc = NULL;
  110. anongame_infos_DESC->ladder_AT_4v4_desc = NULL;
  111. anongame_infos_DESC->gametype_1v1_short = NULL;
  112. anongame_infos_DESC->gametype_1v1_long = NULL;
  113. anongame_infos_DESC->gametype_2v2_short = NULL;
  114. anongame_infos_DESC->gametype_2v2_long = NULL;
  115. anongame_infos_DESC->gametype_3v3_short = NULL;
  116. anongame_infos_DESC->gametype_3v3_long = NULL;
  117. anongame_infos_DESC->gametype_4v4_short = NULL;
  118. anongame_infos_DESC->gametype_4v4_long = NULL;
  119. anongame_infos_DESC->gametype_sffa_short = NULL;
  120. anongame_infos_DESC->gametype_sffa_long = NULL;
  121. anongame_infos_DESC->gametype_tffa_short = NULL;
  122. anongame_infos_DESC->gametype_tffa_long = NULL;
  123. anongame_infos_DESC->gametype_2v2v2_short = NULL;
  124. anongame_infos_DESC->gametype_2v2v2_long = NULL;
  125. anongame_infos_DESC->gametype_3v3v3_short = NULL;
  126. anongame_infos_DESC->gametype_3v3v3_long = NULL;
  127. anongame_infos_DESC->gametype_4v4v4_short = NULL;
  128. anongame_infos_DESC->gametype_4v4v4_long = NULL;
  129. anongame_infos_DESC->gametype_2v2v2v2_short = NULL;
  130. anongame_infos_DESC->gametype_2v2v2v2_long = NULL;
  131. anongame_infos_DESC->gametype_3v3v3v3_short = NULL;
  132. anongame_infos_DESC->gametype_3v3v3v3_long = NULL;
  133. anongame_infos_DESC->gametype_5v5_short = NULL;
  134. anongame_infos_DESC->gametype_5v5_long = NULL;
  135. anongame_infos_DESC->gametype_6v6_short = NULL;
  136. anongame_infos_DESC->gametype_6v6_long = NULL;
  137. return anongame_infos_DESC;
  138. }
  139. static int anongame_infos_DESC_destroy(t_anongame_infos_DESC * anongame_infos_DESC)
  140. {
  141. if (!(anongame_infos_DESC))
  142. {
  143. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  144. return -1;
  145. }
  146. if (anongame_infos_DESC->langID) free((void *)anongame_infos_DESC->langID);
  147. if (anongame_infos_DESC->ladder_PG_1v1_desc) free((void *)anongame_infos_DESC->ladder_PG_1v1_desc);
  148. if (anongame_infos_DESC->ladder_PG_ffa_desc) free((void *)anongame_infos_DESC->ladder_PG_ffa_desc);
  149. if (anongame_infos_DESC->ladder_PG_team_desc) free((void *)anongame_infos_DESC->ladder_PG_team_desc);
  150. if (anongame_infos_DESC->ladder_AT_2v2_desc) free((void *)anongame_infos_DESC->ladder_AT_2v2_desc);
  151. if (anongame_infos_DESC->ladder_AT_3v3_desc) free((void *)anongame_infos_DESC->ladder_AT_3v3_desc);
  152. if (anongame_infos_DESC->ladder_AT_4v4_desc) free((void *)anongame_infos_DESC->ladder_AT_4v4_desc);
  153. if (anongame_infos_DESC->gametype_1v1_short) free((void *)anongame_infos_DESC->gametype_1v1_short);
  154. if (anongame_infos_DESC->gametype_1v1_long) free((void *)anongame_infos_DESC->gametype_1v1_long);
  155. if (anongame_infos_DESC->gametype_2v2_short) free((void *)anongame_infos_DESC->gametype_2v2_short);
  156. if (anongame_infos_DESC->gametype_2v2_long) free((void *)anongame_infos_DESC->gametype_2v2_long);
  157. if (anongame_infos_DESC->gametype_3v3_short) free((void *)anongame_infos_DESC->gametype_3v3_short);
  158. if (anongame_infos_DESC->gametype_3v3_long) free((void *)anongame_infos_DESC->gametype_3v3_long);
  159. if (anongame_infos_DESC->gametype_4v4_short) free((void *)anongame_infos_DESC->gametype_4v4_short);
  160. if (anongame_infos_DESC->gametype_4v4_long) free((void *)anongame_infos_DESC->gametype_4v4_long);
  161. if (anongame_infos_DESC->gametype_sffa_short) free((void *)anongame_infos_DESC->gametype_sffa_short);
  162. if (anongame_infos_DESC->gametype_sffa_long) free((void *)anongame_infos_DESC->gametype_sffa_long);
  163. if (anongame_infos_DESC->gametype_tffa_short) free((void *)anongame_infos_DESC->gametype_tffa_short);
  164. if (anongame_infos_DESC->gametype_tffa_long) free((void *)anongame_infos_DESC->gametype_tffa_long);
  165. if (anongame_infos_DESC->gametype_2v2v2_short) free ((void *)anongame_infos_DESC->gametype_2v2v2_short);
  166. if (anongame_infos_DESC->gametype_2v2v2_long) free ((void *)anongame_infos_DESC->gametype_2v2v2_long);
  167. if (anongame_infos_DESC->gametype_3v3v3_short) free ((void *)anongame_infos_DESC->gametype_3v3v3_short);
  168. if (anongame_infos_DESC->gametype_3v3v3_long) free ((void *)anongame_infos_DESC->gametype_3v3v3_long);
  169. if (anongame_infos_DESC->gametype_4v4v4_short) free ((void *)anongame_infos_DESC->gametype_4v4v4_short);
  170. if (anongame_infos_DESC->gametype_4v4v4_long) free ((void *)anongame_infos_DESC->gametype_4v4v4_long);
  171. if (anongame_infos_DESC->gametype_2v2v2v2_short) free ((void *)anongame_infos_DESC->gametype_2v2v2v2_short);
  172. if (anongame_infos_DESC->gametype_2v2v2v2_long) free ((void *)anongame_infos_DESC->gametype_2v2v2v2_long);
  173. if (anongame_infos_DESC->gametype_3v3v3v3_short) free ((void *)anongame_infos_DESC->gametype_3v3v3v3_short);
  174. if (anongame_infos_DESC->gametype_3v3v3v3_long) free ((void *)anongame_infos_DESC->gametype_3v3v3v3_long);
  175. if (anongame_infos_DESC->gametype_5v5_short) free((void *)anongame_infos_DESC->gametype_5v5_short);
  176. if (anongame_infos_DESC->gametype_5v5_long) free((void *)anongame_infos_DESC->gametype_5v5_long);
  177. if (anongame_infos_DESC->gametype_6v6_short) free((void *)anongame_infos_DESC->gametype_6v6_short);
  178. if (anongame_infos_DESC->gametype_6v6_long) free((void *)anongame_infos_DESC->gametype_6v6_long);
  179. free((void *)anongame_infos_DESC);
  180. return 0;
  181. }
  182. static int anongame_infos_THUMBSDOWN_init(t_anongame_infos * anongame_infos)
  183. {
  184. t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN;
  185. if (!(anongame_infos))
  186. {
  187. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  188. return -1;
  189. }
  190. if (!(anongame_infos_THUMBSDOWN = malloc(sizeof(t_anongame_infos_THUMBSDOWN))))
  191. {
  192.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_THUMBSDOWN");
  193.     return -1;
  194. }
  195.     
  196. anongame_infos_THUMBSDOWN->PG_1v1 = 0;
  197. anongame_infos_THUMBSDOWN->PG_2v2 = 0;
  198. anongame_infos_THUMBSDOWN->PG_3v3 = 0;
  199. anongame_infos_THUMBSDOWN->PG_4v4 = 0;
  200. anongame_infos_THUMBSDOWN->PG_ffa = 0;
  201. anongame_infos_THUMBSDOWN->AT_2v2 = 0;
  202. anongame_infos_THUMBSDOWN->AT_3v3 = 0;
  203. anongame_infos_THUMBSDOWN->AT_4v4 = 0;
  204. anongame_infos_THUMBSDOWN->AT_ffa = 0;
  205. anongame_infos_THUMBSDOWN->PG_5v5 = 0;
  206. anongame_infos_THUMBSDOWN->PG_6v6 = 0;
  207. anongame_infos_THUMBSDOWN->PG_2v2v2 = 0;
  208. anongame_infos_THUMBSDOWN->PG_3v3v3 = 0;
  209. anongame_infos_THUMBSDOWN->PG_4v4v4 = 0;
  210. anongame_infos_THUMBSDOWN->PG_2v2v2v2 = 0;
  211. anongame_infos_THUMBSDOWN->PG_3v3v3v3 = 0;
  212. anongame_infos_THUMBSDOWN->AT_2v2v2 = 0;
  213. anongame_infos->anongame_infos_THUMBSDOWN=anongame_infos_THUMBSDOWN;
  214. return 0;
  215. }
  216. static int anongame_infos_THUMBSDOWN_destroy(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN)
  217. {
  218. if (!(anongame_infos_THUMBSDOWN))
  219. {
  220. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  221. return -1;
  222. }
  223. free((void *)anongame_infos_THUMBSDOWN);
  224. return 0;
  225. }
  226. static int anongame_infos_ICON_REQ_WAR3_init(t_anongame_infos * anongame_infos)
  227. {
  228. t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3;
  229. if (!(anongame_infos))
  230. {
  231. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  232. return -1;
  233. }
  234. if (!(anongame_infos_ICON_REQ_WAR3 = malloc(sizeof(t_anongame_infos_ICON_REQ_WAR3))))
  235. {
  236.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_ICON_REQ_WAR3");
  237.     return -1;
  238. }
  239.     
  240. anongame_infos_ICON_REQ_WAR3->Level1 = 25;
  241. anongame_infos_ICON_REQ_WAR3->Level2 = 250;
  242. anongame_infos_ICON_REQ_WAR3->Level3 = 500;
  243. anongame_infos_ICON_REQ_WAR3->Level4 = 1500;
  244. anongame_infos->anongame_infos_ICON_REQ_WAR3=anongame_infos_ICON_REQ_WAR3;
  245. return 0;
  246. }
  247. static int anongame_infos_ICON_REQ_WAR3_destroy(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3)
  248. {
  249. if (!(anongame_infos_ICON_REQ_WAR3))
  250. {
  251. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_WAR3");
  252. return -1;
  253. }
  254. free((void *)anongame_infos_ICON_REQ_WAR3);
  255. return 0;
  256. }
  257. static int anongame_infos_ICON_REQ_W3XP_init(t_anongame_infos * anongame_infos)
  258. {
  259. t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP;
  260. if (!(anongame_infos))
  261. {
  262. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  263. return -1;
  264. }
  265. if (!(anongame_infos_ICON_REQ_W3XP = malloc(sizeof(t_anongame_infos_ICON_REQ_W3XP))))
  266. {
  267.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_ICON_REQ_W3XP");
  268.     return -1;
  269. }
  270.     
  271. anongame_infos_ICON_REQ_W3XP->Level1 = 25;
  272. anongame_infos_ICON_REQ_W3XP->Level2 = 150;
  273. anongame_infos_ICON_REQ_W3XP->Level3 = 350;
  274. anongame_infos_ICON_REQ_W3XP->Level4 = 750;
  275. anongame_infos_ICON_REQ_W3XP->Level5 = 1500;
  276. anongame_infos->anongame_infos_ICON_REQ_W3XP=anongame_infos_ICON_REQ_W3XP;
  277. return 0;
  278. }
  279. static int anongame_infos_ICON_REQ_W3XP_destroy(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP)
  280. {
  281. if (!(anongame_infos_ICON_REQ_W3XP))
  282. {
  283. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  284. return -1;
  285. }
  286. free((void *)anongame_infos_ICON_REQ_W3XP);
  287. return 0;
  288. }
  289. static int anongame_infos_ICON_REQ_TOURNEY_init(t_anongame_infos * anongame_infos)
  290. {
  291. t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY;
  292. if (!(anongame_infos))
  293. {
  294. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  295. return -1;
  296. }
  297. if (!(anongame_infos_ICON_REQ_TOURNEY = malloc(sizeof(t_anongame_infos_ICON_REQ_TOURNEY))))
  298. {
  299.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_ICON_REQ_TOURNEY");
  300.     return -1;
  301. }
  302.     
  303. anongame_infos_ICON_REQ_TOURNEY->Level1 = 10;
  304. anongame_infos_ICON_REQ_TOURNEY->Level2 = 75;
  305. anongame_infos_ICON_REQ_TOURNEY->Level3 = 150;
  306. anongame_infos_ICON_REQ_TOURNEY->Level4 = 250;
  307. anongame_infos_ICON_REQ_TOURNEY->Level5 = 500;
  308. anongame_infos->anongame_infos_ICON_REQ_TOURNEY=anongame_infos_ICON_REQ_TOURNEY;
  309. return 0;
  310. }
  311. static int anongame_infos_ICON_REQ_TOURNEY_destroy(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY)
  312. {
  313. if (!(anongame_infos_ICON_REQ_TOURNEY))
  314. {
  315. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  316. return -1;
  317. }
  318. free((void *)anongame_infos_ICON_REQ_TOURNEY);
  319. return 0;
  320. }
  321. static t_anongame_infos_data_lang * anongame_infos_data_lang_init(char * langID)
  322. {
  323. t_anongame_infos_data_lang * anongame_infos_data_lang;
  324. if (!(anongame_infos_data_lang = malloc(sizeof(t_anongame_infos_data_lang))))
  325. {
  326.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_data_lang");
  327.     return NULL;
  328. }
  329. anongame_infos_data_lang->langID = strdup(langID);
  330. anongame_infos_data_lang->desc_data = NULL;
  331. anongame_infos_data_lang->ladr_data = NULL;
  332. anongame_infos_data_lang->desc_comp_data = NULL;
  333. anongame_infos_data_lang->ladr_comp_data = NULL;
  334. anongame_infos_data_lang->desc_len = 0;
  335. anongame_infos_data_lang->ladr_len = 0;
  336. anongame_infos_data_lang->desc_comp_len = 0;
  337. anongame_infos_data_lang->ladr_comp_len = 0;
  338. return anongame_infos_data_lang;
  339. }
  340. static int anongame_infos_data_lang_destroy(t_anongame_infos_data_lang * anongame_infos_data_lang)
  341. {
  342. if (!(anongame_infos_data_lang))
  343. {
  344. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_data_lang");
  345. return -1;
  346. }
  347. if(anongame_infos_data_lang->langID) free((void *)anongame_infos_data_lang->langID);
  348. if(anongame_infos_data_lang->desc_data) free((void *)anongame_infos_data_lang->desc_data);
  349. if(anongame_infos_data_lang->ladr_data) free((void *)anongame_infos_data_lang->ladr_data);
  350. if(anongame_infos_data_lang->desc_comp_data) free((void *)anongame_infos_data_lang->desc_comp_data);
  351. if(anongame_infos_data_lang->ladr_comp_data) free((void *)anongame_infos_data_lang->ladr_comp_data);
  352. free((void *)anongame_infos_data_lang);
  353. return 0;
  354. }
  355. static int anongame_infos_data_init(t_anongame_infos * anongame_infos)
  356. {
  357. t_anongame_infos_data * anongame_infos_data;
  358. t_list * anongame_infos_data_lang;
  359. if (!(anongame_infos))
  360. {
  361. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  362. return -1;
  363. }
  364. if (!(anongame_infos_data = malloc(sizeof(t_anongame_infos_data))))
  365. {
  366.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_data");
  367.     return -1;
  368. }
  369. if (!(anongame_infos_data_lang = list_create()))
  370. {
  371.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_data_lang");
  372.     return -1;
  373. }
  374. anongame_infos_data->url_data = NULL;
  375. anongame_infos_data->map_data = NULL;
  376. anongame_infos_data->type_data = NULL;
  377. anongame_infos_data->desc_data = NULL;
  378. anongame_infos_data->ladr_data = NULL;
  379. anongame_infos_data->url_comp_data = NULL;
  380. anongame_infos_data->map_comp_data = NULL;
  381. anongame_infos_data->type_comp_data = NULL;
  382. anongame_infos_data->desc_comp_data = NULL;
  383. anongame_infos_data->ladr_comp_data = NULL;
  384. anongame_infos_data->url_len = 0;
  385. anongame_infos_data->map_len = 0;
  386. anongame_infos_data->type_len = 0;
  387. anongame_infos_data->desc_len = 0;
  388. anongame_infos_data->ladr_len = 0;
  389. anongame_infos_data->url_comp_len = 0;
  390. anongame_infos_data->map_comp_len = 0;
  391. anongame_infos_data->type_comp_len = 0;
  392. anongame_infos_data->desc_comp_len = 0;
  393. anongame_infos_data->ladr_comp_len = 0;
  394. anongame_infos->anongame_infos_data_war3=anongame_infos_data;
  395. anongame_infos->anongame_infos_data_lang_war3=anongame_infos_data_lang;
  396. if (!(anongame_infos_data = malloc(sizeof(t_anongame_infos_data))))
  397. {
  398.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_data");
  399.     return -1;
  400. }
  401. if (!(anongame_infos_data_lang = list_create()))
  402. {
  403.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos_data_lang");
  404.     return -1;
  405. }
  406. anongame_infos_data->url_data = NULL;
  407. anongame_infos_data->map_data = NULL;
  408. anongame_infos_data->type_data = NULL;
  409. anongame_infos_data->desc_data = NULL;
  410. anongame_infos_data->ladr_data = NULL;
  411. anongame_infos_data->url_comp_data = NULL;
  412. anongame_infos_data->map_comp_data = NULL;
  413. anongame_infos_data->type_comp_data = NULL;
  414. anongame_infos_data->desc_comp_data = NULL;
  415. anongame_infos_data->ladr_comp_data = NULL;
  416. anongame_infos_data->url_len = 0;
  417. anongame_infos_data->map_len = 0;
  418. anongame_infos_data->type_len = 0;
  419. anongame_infos_data->desc_len = 0;
  420. anongame_infos_data->ladr_len = 0;
  421. anongame_infos_data->url_comp_len = 0;
  422. anongame_infos_data->map_comp_len = 0;
  423. anongame_infos_data->type_comp_len = 0;
  424. anongame_infos_data->desc_comp_len = 0;
  425. anongame_infos_data->ladr_comp_len = 0;
  426. anongame_infos->anongame_infos_data_w3xp=anongame_infos_data;
  427. anongame_infos->anongame_infos_data_lang_w3xp=anongame_infos_data_lang;
  428. return 0;    
  429. }
  430. static int anongame_infos_data_destroy(t_anongame_infos_data * anongame_infos_data, t_list * anongame_infos_data_lang)
  431. {
  432. t_elem * curr;
  433. t_anongame_infos_data_lang * entry;
  434. if(anongame_infos_data->url_data) free((void *)anongame_infos_data->url_data);
  435. if(anongame_infos_data->map_data) free((void *)anongame_infos_data->map_data);
  436. if(anongame_infos_data->type_data) free((void *)anongame_infos_data->type_data);
  437. if(anongame_infos_data->desc_data) free((void *)anongame_infos_data->desc_data);
  438. if(anongame_infos_data->ladr_data) free((void *)anongame_infos_data->ladr_data);
  439. if(anongame_infos_data->url_comp_data) free((void *)anongame_infos_data->url_comp_data);
  440. if(anongame_infos_data->map_comp_data) free((void *)anongame_infos_data->map_comp_data);
  441. if(anongame_infos_data->type_comp_data) free((void *)anongame_infos_data->type_comp_data);
  442. if(anongame_infos_data->desc_comp_data) free((void *)anongame_infos_data->desc_comp_data);
  443. if(anongame_infos_data->ladr_comp_data) free((void *)anongame_infos_data->ladr_comp_data);
  444. free((void *)anongame_infos_data);
  445. if (anongame_infos_data_lang)
  446.     {
  447. LIST_TRAVERSE(anongame_infos_data_lang,curr)
  448. {
  449. if (!(entry = elem_get_data(curr)))
  450. eventlog(eventlog_level_error,__FUNCTION__,"found NULL entry in list");
  451. else
  452. {
  453. anongame_infos_data_lang_destroy(entry);
  454. }
  455. list_remove_elem(anongame_infos_data_lang,curr);
  456. }
  457. list_destroy(anongame_infos_data_lang);
  458.     }
  459. return 0;
  460. }
  461. t_anongame_infos *  anongame_infos_init(void)
  462. {
  463.   t_anongame_infos * anongame_infos;
  464. if (!(anongame_infos = malloc(sizeof(t_anongame_infos))))
  465. {
  466.     eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for anongame_infos");
  467.     return NULL;
  468. }
  469. if (anongame_infos_URL_init(anongame_infos)!=0)
  470. {
  471. free((void *)anongame_infos);
  472. return NULL;
  473. }
  474. if (anongame_infos_THUMBSDOWN_init(anongame_infos)!=0)
  475. {
  476.   anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  477.   free((void *)anongame_infos);
  478.   return NULL;
  479. }
  480. if (anongame_infos_ICON_REQ_WAR3_init(anongame_infos)!=0)
  481. {
  482.   anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  483.   anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  484.   free((void *)anongame_infos);
  485.   return NULL;
  486. }
  487. if (anongame_infos_ICON_REQ_W3XP_init(anongame_infos)!=0)
  488. {
  489.   anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  490.   anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  491.   anongame_infos_ICON_REQ_WAR3_destroy(anongame_infos->anongame_infos_ICON_REQ_WAR3);
  492.   free((void *)anongame_infos);
  493.   return NULL;
  494. }
  495. if (anongame_infos_ICON_REQ_TOURNEY_init(anongame_infos)!=0)
  496. {
  497.   anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  498.   anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  499.   anongame_infos_ICON_REQ_WAR3_destroy(anongame_infos->anongame_infos_ICON_REQ_WAR3);
  500.   anongame_infos_ICON_REQ_W3XP_destroy(anongame_infos->anongame_infos_ICON_REQ_W3XP);
  501.   free((void *)anongame_infos);
  502.   return NULL;
  503. }
  504. if (anongame_infos_data_init(anongame_infos)!=0)
  505. {
  506.   anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  507.   anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  508.   anongame_infos_ICON_REQ_WAR3_destroy(anongame_infos->anongame_infos_ICON_REQ_WAR3);
  509.   anongame_infos_ICON_REQ_W3XP_destroy(anongame_infos->anongame_infos_ICON_REQ_W3XP);
  510.   anongame_infos_ICON_REQ_TOURNEY_destroy(anongame_infos->anongame_infos_ICON_REQ_TOURNEY);
  511.   free((void *)anongame_infos);
  512.   return NULL;
  513. }
  514. anongame_infos->anongame_infos_DESC = NULL;
  515.     if (!(anongame_infos->anongame_infos_DESC_list = list_create()))
  516.     {
  517.         eventlog(eventlog_level_error,__FUNCTION__,"could not create list");
  518.    anongame_infos_ICON_REQ_TOURNEY_destroy(anongame_infos->anongame_infos_ICON_REQ_TOURNEY);
  519.    anongame_infos_ICON_REQ_W3XP_destroy(anongame_infos->anongame_infos_ICON_REQ_W3XP);
  520.    anongame_infos_ICON_REQ_WAR3_destroy(anongame_infos->anongame_infos_ICON_REQ_WAR3);
  521.         anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  522. anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  523. anongame_infos_data_destroy(anongame_infos->anongame_infos_data_war3, anongame_infos->anongame_infos_data_lang_war3);
  524. anongame_infos_data_destroy(anongame_infos->anongame_infos_data_w3xp, anongame_infos->anongame_infos_data_lang_w3xp);
  525. free((void *)anongame_infos);
  526.         return NULL;
  527.     }
  528. return anongame_infos;
  529. }
  530. static int anongame_infos_destroy(t_anongame_infos * anongame_infos)
  531. {
  532. t_elem * curr;
  533.     t_anongame_infos_DESC * entry;
  534. if (!(anongame_infos))
  535. {
  536. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  537. return -1;
  538. }
  539.     
  540. if (anongame_infos->anongame_infos_DESC_list)
  541.     {
  542. LIST_TRAVERSE(anongame_infos->anongame_infos_DESC_list,curr)
  543. {
  544. if (!(entry = elem_get_data(curr)))
  545. eventlog(eventlog_level_error,__FUNCTION__,"found NULL entry in list");
  546. else
  547. {
  548. anongame_infos_DESC_destroy(entry);
  549. }
  550. list_remove_elem(anongame_infos->anongame_infos_DESC_list,curr);
  551. }
  552. list_destroy(anongame_infos->anongame_infos_DESC_list);
  553. anongame_infos->anongame_infos_DESC_list = NULL;
  554.     }
  555. anongame_infos_DESC_destroy(anongame_infos->anongame_infos_DESC);
  556. anongame_infos_URL_destroy(anongame_infos->anongame_infos_URL);
  557. anongame_infos_THUMBSDOWN_destroy(anongame_infos->anongame_infos_THUMBSDOWN);
  558. anongame_infos_ICON_REQ_TOURNEY_destroy(anongame_infos->anongame_infos_ICON_REQ_TOURNEY);
  559.    anongame_infos_ICON_REQ_W3XP_destroy(anongame_infos->anongame_infos_ICON_REQ_W3XP);
  560.    anongame_infos_ICON_REQ_WAR3_destroy(anongame_infos->anongame_infos_ICON_REQ_WAR3);
  561. anongame_infos_data_destroy(anongame_infos->anongame_infos_data_war3, anongame_infos->anongame_infos_data_lang_war3);
  562. anongame_infos_data_destroy(anongame_infos->anongame_infos_data_w3xp, anongame_infos->anongame_infos_data_lang_w3xp);
  563. free((void *)anongame_infos);
  564. return 0;
  565. }
  566. static int anongame_infos_set_str(char ** dst, char * src,char * errstr)
  567. {
  568. char * temp;
  569. if (!(src))
  570. {
  571. eventlog(eventlog_level_error,__FUNCTION__,"got NULL %s",errstr);
  572. return -1;
  573. }
  574. if (!(temp = strdup(src)))
  575. {
  576. eventlog(eventlog_level_error,__FUNCTION__,"could not allocate mem for %s",errstr);
  577. return -1;
  578. }
  579. if (*dst) free((void *)*dst);
  580. *dst = temp;
  581. return 0;
  582. }
  583. static int anongame_infos_URL_set_server_URL(t_anongame_infos_URL * anongame_infos_URL, char * server_URL)
  584. {
  585. if (!(anongame_infos_URL))
  586. {
  587. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  588. return -1;
  589. }
  590. return anongame_infos_set_str(&anongame_infos_URL->server_URL,server_URL,"server_URL");
  591. }
  592. extern char * anongame_infos_URL_get_server_url(void)
  593. {
  594. return anongame_infos->anongame_infos_URL->server_URL;
  595. }
  596. static int anongame_infos_URL_set_player_URL(t_anongame_infos_URL * anongame_infos_URL, char * player_URL)
  597. {
  598. if (!(anongame_infos_URL))
  599. {
  600. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  601. return -1;
  602. }
  603. return anongame_infos_set_str(&anongame_infos_URL->player_URL,player_URL,"player_URL");
  604. }
  605. extern char * anongame_infos_URL_get_player_url(void)
  606. {
  607. return anongame_infos->anongame_infos_URL->player_URL;
  608. }
  609. static int anongame_infos_URL_set_tourney_URL(t_anongame_infos_URL * anongame_infos_URL, char * tourney_URL)
  610. {
  611. if (!(anongame_infos_URL))
  612. {
  613. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  614. return -1;
  615. }
  616. return anongame_infos_set_str(&anongame_infos_URL->tourney_URL,tourney_URL,"tourney_URL");
  617. }
  618. extern char * anongame_infos_URL_get_tourney_url(void)
  619. {
  620. return anongame_infos->anongame_infos_URL->tourney_URL;
  621. }
  622. static int anongame_infos_URL_set_ladder_PG_1v1_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_PG_1v1_URL)
  623. {
  624. if (!(anongame_infos_URL))
  625. {
  626. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  627. return -1;
  628. }
  629. return anongame_infos_set_str(&anongame_infos_URL->ladder_PG_1v1_URL,ladder_PG_1v1_URL,"ladder_PG_1v1_URL");
  630. }
  631. extern char * anongame_infos_URL_get_ladder_PG_1v1_url(void)
  632. {
  633. return anongame_infos->anongame_infos_URL->ladder_PG_1v1_URL;
  634. }
  635. static int anongame_infos_URL_set_ladder_PG_ffa_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_PG_ffa_URL)
  636. {
  637. if (!(anongame_infos_URL))
  638. {
  639. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  640. return -1;
  641. }
  642. return anongame_infos_set_str(&anongame_infos_URL->ladder_PG_ffa_URL,ladder_PG_ffa_URL,"ladder_PG_ffa_URL");
  643. }
  644. extern char * anongame_infos_URL_get_ladder_PG_ffa_url(void)
  645. {
  646. return anongame_infos->anongame_infos_URL->ladder_PG_ffa_URL;
  647. }
  648. static int anongame_infos_URL_set_ladder_PG_team_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_PG_team_URL)
  649. {
  650. if (!(anongame_infos_URL))
  651. {
  652. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  653. return -1;
  654. }
  655. return anongame_infos_set_str(&anongame_infos_URL->ladder_PG_team_URL,ladder_PG_team_URL,"ladder_PG_team_URL");
  656. }
  657. extern char * anongame_infos_URL_get_ladder_PG_team_url(void)
  658. {
  659. return anongame_infos->anongame_infos_URL->ladder_PG_team_URL;
  660. }
  661. static int anongame_infos_URL_set_ladder_AT_2v2_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_AT_2v2_URL)
  662. {
  663. if (!(anongame_infos_URL))
  664. {
  665. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  666. return -1;
  667. }
  668. return anongame_infos_set_str(&anongame_infos_URL->ladder_AT_2v2_URL,ladder_AT_2v2_URL,"ladder_AT_2v2_URL");
  669. }
  670. extern char * anongame_infos_URL_get_ladder_AT_2v2_url(void)
  671. {
  672. return anongame_infos->anongame_infos_URL->ladder_AT_2v2_URL;
  673. }
  674. static int anongame_infos_URL_set_ladder_AT_3v3_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_AT_3v3_URL)
  675. {
  676. if (!(anongame_infos_URL))
  677. {
  678. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  679. return -1;
  680. }
  681. return anongame_infos_set_str(&anongame_infos_URL->ladder_AT_3v3_URL,ladder_AT_3v3_URL,"ladder_AT_3v3_URL");
  682. }
  683. extern char * anongame_infos_URL_get_ladder_AT_3v3_url(void)
  684. {
  685. return anongame_infos->anongame_infos_URL->ladder_AT_3v3_URL;
  686. }
  687. static int anongame_infos_URL_set_ladder_AT_4v4_URL(t_anongame_infos_URL * anongame_infos_URL, char * ladder_AT_4v4_URL)
  688. {
  689. if (!(anongame_infos_URL))
  690. {
  691. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL");
  692. return -1;
  693. }
  694. return anongame_infos_set_str(&anongame_infos_URL->ladder_AT_4v4_URL,ladder_AT_4v4_URL,"ladder_AT_4v4_URL");
  695. }
  696. extern char * anongame_infos_URL_get_ladder_AT_4v4_url(void)
  697. {
  698. return anongame_infos->anongame_infos_URL->ladder_AT_4v4_URL;
  699. }
  700. static int anongame_infos_DESC_set_ladder_PG_1v1_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_PG_1v1_desc)
  701. {
  702. if (!(anongame_infos_DESC))
  703. {
  704. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  705. return -1;
  706. }
  707. return anongame_infos_set_str(&anongame_infos_DESC->ladder_PG_1v1_desc,ladder_PG_1v1_desc,"ladder_PG_1v1_desc");
  708. }
  709. static int anongame_infos_DESC_set_ladder_PG_ffa_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_PG_ffa_desc)
  710. {
  711. if (!(anongame_infos_DESC))
  712. {
  713. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  714. return -1;
  715. }
  716. return anongame_infos_set_str(&anongame_infos_DESC->ladder_PG_ffa_desc,ladder_PG_ffa_desc,"ladder_PG_ffa_desc");
  717. }
  718. static int anongame_infos_DESC_set_ladder_PG_team_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_PG_team_desc)
  719. {
  720. if (!(anongame_infos_DESC))
  721. {
  722. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  723. return -1;
  724. }
  725. return anongame_infos_set_str(&anongame_infos_DESC->ladder_PG_team_desc,ladder_PG_team_desc,"ladder_PG_team_desc");
  726. }
  727. static int anongame_infos_DESC_set_ladder_AT_2v2_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_AT_2v2_desc)
  728. {
  729. if (!(anongame_infos_DESC))
  730. {
  731. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  732. return -1;
  733. }
  734. return anongame_infos_set_str(&anongame_infos_DESC->ladder_AT_2v2_desc,ladder_AT_2v2_desc,"ladder_AT_2v2_desc");
  735. }
  736. static int anongame_infos_DESC_set_ladder_AT_3v3_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_AT_3v3_desc)
  737. {
  738. if (!(anongame_infos_DESC))
  739. {
  740. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  741. return -1;
  742. }
  743. return anongame_infos_set_str(&anongame_infos_DESC->ladder_AT_3v3_desc,ladder_AT_3v3_desc,"ladder_AT_3v3_desc");
  744. }
  745. static int anongame_infos_DESC_set_ladder_AT_4v4_desc(t_anongame_infos_DESC * anongame_infos_DESC, char * ladder_AT_4v4_desc)
  746. {
  747. if (!(anongame_infos_DESC))
  748. {
  749. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  750. return -1;
  751. }
  752. return anongame_infos_set_str(&anongame_infos_DESC->ladder_AT_4v4_desc,ladder_AT_4v4_desc,"ladder_AT_4v4_desc");
  753. }
  754. static int anongame_infos_DESC_set_gametype_1v1_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_1v1_short)
  755. {
  756. if (!(anongame_infos_DESC))
  757. {
  758. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  759. return -1;
  760. }
  761. return anongame_infos_set_str(&anongame_infos_DESC->gametype_1v1_short,gametype_1v1_short,"gametype_1v1_short");
  762. }
  763. static int anongame_infos_DESC_set_gametype_1v1_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_1v1_long)
  764. {
  765. if (!(anongame_infos_DESC))
  766. {
  767. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  768. return -1;
  769. }
  770. return anongame_infos_set_str(&anongame_infos_DESC->gametype_1v1_long,gametype_1v1_long,"gametype_1v1_long");
  771. }
  772. static int anongame_infos_DESC_set_gametype_2v2_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2_short)
  773. {
  774. if (!(anongame_infos_DESC))
  775. {
  776. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  777. return -1;
  778. }
  779. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2_short,gametype_2v2_short,"gametype_2v2_short");
  780. }
  781. static int anongame_infos_DESC_set_gametype_2v2_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2_long)
  782. {
  783. if (!(anongame_infos_DESC))
  784. {
  785. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  786. return -1;
  787. }
  788. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2_long,gametype_2v2_long,"gametype_2v2_long");
  789. }
  790. static int anongame_infos_DESC_set_gametype_3v3_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3_short)
  791. {
  792. if (!(anongame_infos_DESC))
  793. {
  794. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  795. return -1;
  796. }
  797. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3_short,gametype_3v3_short,"gametype_3v3_short");
  798. }
  799. static int anongame_infos_DESC_set_gametype_3v3_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3_long)
  800. {
  801. if (!(anongame_infos_DESC))
  802. {
  803. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  804. return -1;
  805. }
  806. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3_long,gametype_3v3_long,"gametype_3v3_long");
  807. }
  808. static int anongame_infos_DESC_set_gametype_4v4_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_4v4_short)
  809. {
  810. if (!(anongame_infos_DESC))
  811. {
  812. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  813. return -1;
  814. }
  815. return anongame_infos_set_str(&anongame_infos_DESC->gametype_4v4_short,gametype_4v4_short,"gametype_4v4_short");
  816. }
  817. static int anongame_infos_DESC_set_gametype_4v4_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_4v4_long)
  818. {
  819. if (!(anongame_infos_DESC))
  820. {
  821. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  822. return -1;
  823. }
  824. return anongame_infos_set_str(&anongame_infos_DESC->gametype_4v4_long,gametype_4v4_long,"gametype_4v4_long");
  825. }
  826. int anongame_infos_DESC_set_gametype_5v5_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_5v5_short)
  827. {
  828. if (!(anongame_infos_DESC))
  829. {
  830. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  831. return -1;
  832. }
  833. return anongame_infos_set_str(&anongame_infos_DESC->gametype_5v5_short,gametype_5v5_short,"gametype_5v5_short");
  834. }
  835. static int anongame_infos_DESC_set_gametype_5v5_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_5v5_long)
  836. {
  837. if (!(anongame_infos_DESC))
  838. {
  839. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  840. return -1;
  841. }
  842. return anongame_infos_set_str(&anongame_infos_DESC->gametype_5v5_long,gametype_5v5_long,"gametype_5v5_long");
  843. }
  844. static int anongame_infos_DESC_set_gametype_6v6_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_6v6_short)
  845. {
  846. if (!(anongame_infos_DESC))
  847. {
  848. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  849. return -1;
  850. }
  851. return anongame_infos_set_str(&anongame_infos_DESC->gametype_6v6_short,gametype_6v6_short,"gametype_6v6_short");
  852. }
  853. static int anongame_infos_DESC_set_gametype_6v6_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_6v6_long)
  854. {
  855. if (!(anongame_infos_DESC))
  856. {
  857. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  858. return -1;
  859. }
  860. return anongame_infos_set_str(&anongame_infos_DESC->gametype_6v6_long,gametype_6v6_long,"gametype_6v6_long");
  861. }
  862. static int anongame_infos_DESC_set_gametype_sffa_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_sffa_short)
  863. {
  864. if (!(anongame_infos_DESC))
  865. {
  866. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  867. return -1;
  868. }
  869. return anongame_infos_set_str(&anongame_infos_DESC->gametype_sffa_short,gametype_sffa_short,"gametype_sffa_short");
  870. }
  871. static int anongame_infos_DESC_set_gametype_sffa_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_sffa_long)
  872. {
  873. if (!(anongame_infos_DESC))
  874. {
  875. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  876. return -1;
  877. }
  878. return anongame_infos_set_str(&anongame_infos_DESC->gametype_sffa_long,gametype_sffa_long,"gametype_sffa_long");
  879. }
  880. static int anongame_infos_DESC_set_gametype_tffa_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_tffa_short)
  881. {
  882. if (!(anongame_infos_DESC))
  883. {
  884. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  885. return -1;
  886. }
  887. return anongame_infos_set_str(&anongame_infos_DESC->gametype_tffa_short,gametype_tffa_short,"gametype_tffa_short");
  888. }
  889. static int anongame_infos_DESC_set_gametype_tffa_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_tffa_long)
  890. {
  891. if (!(anongame_infos_DESC))
  892. {
  893. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  894. return -1;
  895. }
  896. return anongame_infos_set_str(&anongame_infos_DESC->gametype_tffa_long,gametype_tffa_long,"gametype_tffa_long");
  897. }
  898. static int anongame_infos_DESC_set_gametype_2v2v2_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2v2_short)
  899. {
  900. if (!(anongame_infos_DESC))
  901. {
  902. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  903. return -1;
  904. }
  905. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2v2_short,gametype_2v2v2_short,"gametype_2v2v2_short");
  906. }
  907. static int anongame_infos_DESC_set_gametype_2v2v2_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2v2_long)
  908. {
  909. if (!(anongame_infos_DESC))
  910. {
  911. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  912. return -1;
  913. }
  914. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2v2_long,gametype_2v2v2_long,"gametype_2v2v2_long");
  915. }
  916. static int anongame_infos_DESC_set_gametype_3v3v3_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3v3_short)
  917. {
  918. if (!(anongame_infos_DESC))
  919. {
  920. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  921. return -1;
  922. }
  923. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3v3_short,gametype_3v3v3_short,"gametype_3v3v3_short");
  924. }
  925. static int anongame_infos_DESC_set_gametype_3v3v3_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3v3_long)
  926. {
  927. if (!(anongame_infos_DESC))
  928. {
  929. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  930. return -1;
  931. }
  932. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3v3_long,gametype_3v3v3_long,"gametype_3v3v3_long");
  933. }
  934. static int anongame_infos_DESC_set_gametype_4v4v4_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_4v4v4_short)
  935. {
  936. if (!(anongame_infos_DESC))
  937. {
  938. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  939. return -1;
  940. }
  941. return anongame_infos_set_str(&anongame_infos_DESC->gametype_4v4v4_short,gametype_4v4v4_short,"gametype_4v4v4_short");
  942. }
  943. static int anongame_infos_DESC_set_gametype_4v4v4_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_4v4v4_long)
  944. {
  945. if (!(anongame_infos_DESC))
  946. {
  947. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  948. return -1;
  949. }
  950. return anongame_infos_set_str(&anongame_infos_DESC->gametype_4v4v4_long,gametype_4v4v4_long,"gametype_4v4v4_long");
  951. }
  952. static int anongame_infos_DESC_set_gametype_2v2v2v2_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2v2v2_short)
  953. {
  954. if (!(anongame_infos_DESC))
  955. {
  956. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  957. return -1;
  958. }
  959. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2v2v2_short,gametype_2v2v2v2_short,"gametype_2v2v2v2_short");
  960. }
  961. static int anongame_infos_DESC_set_gametype_2v2v2v2_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_2v2v2v2_long)
  962. {
  963. if (!(anongame_infos_DESC))
  964. {
  965. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  966. return -1;
  967. }
  968. return anongame_infos_set_str(&anongame_infos_DESC->gametype_2v2v2v2_long,gametype_2v2v2v2_long,"gametype_2v2v2v2_long");
  969. }
  970. static int anongame_infos_DESC_set_gametype_3v3v3v3_short(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3v3v3_short)
  971. {
  972. if (!(anongame_infos_DESC))
  973. {
  974. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  975. return -1;
  976. }
  977. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3v3v3_short,gametype_3v3v3v3_short,"gametype_3v3v3v3_short");
  978. }
  979. static int anongame_infos_DESC_set_gametype_3v3v3v3_long(t_anongame_infos_DESC * anongame_infos_DESC, char * gametype_3v3v3v3_long)
  980. {
  981. if (!(anongame_infos_DESC))
  982. {
  983. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC");
  984. return -1;
  985. }
  986. return anongame_infos_set_str(&anongame_infos_DESC->gametype_3v3v3v3_long,gametype_3v3v3v3_long,"gametype_3v3v3v3_long");
  987. }
  988. static t_anongame_infos_DESC * anongame_infos_get_anongame_infos_DESC_by_langID(t_anongame_infos * anongame_infos, char * langID)
  989. {
  990. t_elem * curr;
  991.     t_anongame_infos_DESC * entry;
  992. if (!(anongame_infos))
  993. {
  994. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  995. return NULL;
  996. }
  997. if (!(langID)) return anongame_infos->anongame_infos_DESC;
  998. if (!(anongame_infos->anongame_infos_DESC_list))
  999. {
  1000. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC_list - default values");
  1001. return anongame_infos->anongame_infos_DESC;
  1002. }
  1003.     
  1004. LIST_TRAVERSE(anongame_infos->anongame_infos_DESC_list,curr)
  1005. {
  1006. if (!(entry = (t_anongame_infos_DESC *)elem_get_data(curr)))
  1007. eventlog(eventlog_level_error,__FUNCTION__,"found NULL entry in list");
  1008. else
  1009. {
  1010. if ((entry->langID) && (strcmp(entry->langID,langID)==0)) return entry;
  1011. }
  1012. }
  1013.     
  1014. return anongame_infos->anongame_infos_DESC;
  1015. }
  1016. extern char * anongame_infos_DESC_get_ladder_PG_1v1_desc(char * langID)
  1017. {
  1018.     char * result;
  1019.     
  1020.     if ((result=((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_PG_1v1_desc)))
  1021. return result;
  1022.     else
  1023. return anongame_infos->anongame_infos_DESC->ladder_PG_1v1_desc;
  1024. }
  1025. extern char * anongame_infos_DESC_get_ladder_PG_ffa_desc(char * langID)
  1026. {
  1027.     char * result;
  1028.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_PG_ffa_desc)))
  1029. return result;
  1030.     else
  1031. return anongame_infos->anongame_infos_DESC->ladder_PG_ffa_desc;
  1032. }
  1033. extern char * anongame_infos_DESC_get_ladder_PG_team_desc(char * langID)
  1034. {
  1035.     char * result;
  1036.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_PG_team_desc)))
  1037. return result;
  1038.     else
  1039. return anongame_infos->anongame_infos_DESC->ladder_PG_team_desc;
  1040. }
  1041. extern char * anongame_infos_DESC_get_ladder_AT_2v2_desc(char * langID)
  1042. {
  1043.     char * result;
  1044.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_AT_2v2_desc)))
  1045. return result;
  1046.     else
  1047. return anongame_infos->anongame_infos_DESC->ladder_AT_2v2_desc;
  1048. }
  1049. extern char * anongame_infos_DESC_get_ladder_AT_3v3_desc(char * langID)
  1050. {
  1051.     char * result;
  1052.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_AT_3v3_desc)))
  1053. return result;
  1054.     else
  1055. return anongame_infos->anongame_infos_DESC->ladder_AT_3v3_desc;
  1056. }
  1057. extern char * anongame_infos_DESC_get_ladder_AT_4v4_desc(char * langID)
  1058. {
  1059.     char * result;
  1060.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->ladder_AT_4v4_desc)))
  1061. return result;
  1062.     else
  1063.     return anongame_infos->anongame_infos_DESC->ladder_AT_4v4_desc;
  1064. }
  1065. /**********/
  1066. static char * anongame_infos_DESC_get_gametype_1v1_short(char * langID)
  1067. {
  1068.     char * result;
  1069.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_1v1_short)))
  1070. return result;
  1071.     else
  1072. return anongame_infos->anongame_infos_DESC->gametype_1v1_short;
  1073. }
  1074. static char * anongame_infos_DESC_get_gametype_1v1_long(char * langID)
  1075. {
  1076.     char * result;
  1077.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_1v1_long)))
  1078. return result;
  1079.     else
  1080. return anongame_infos->anongame_infos_DESC->gametype_2v2_long;
  1081. }
  1082. static char * anongame_infos_DESC_get_gametype_2v2_short(char * langID)
  1083. {
  1084.     char * result;
  1085.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2_short)))
  1086. return result;
  1087.     else
  1088. return anongame_infos->anongame_infos_DESC->gametype_2v2_short;
  1089. }
  1090. static char * anongame_infos_DESC_get_gametype_2v2_long(char * langID)
  1091. {
  1092.     char * result;
  1093.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2_long)))
  1094. return result;
  1095.     else
  1096. return anongame_infos->anongame_infos_DESC->gametype_2v2_long;
  1097. }
  1098. static char * anongame_infos_DESC_get_gametype_3v3_short(char * langID)
  1099. {
  1100.     char * result;
  1101.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3_short)))
  1102. return result;
  1103.     else
  1104. return anongame_infos->anongame_infos_DESC->gametype_3v3_short;
  1105. }
  1106. static char * anongame_infos_DESC_get_gametype_3v3_long(char * langID)
  1107. {
  1108.     char * result;
  1109.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3_long)))
  1110. return result;
  1111.     else
  1112. return anongame_infos->anongame_infos_DESC->gametype_3v3_long;
  1113. }
  1114. static char * anongame_infos_DESC_get_gametype_4v4_short(char * langID)
  1115. {
  1116.     char * result;
  1117.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_4v4_short)))
  1118. return result;
  1119.     else
  1120. return anongame_infos->anongame_infos_DESC->gametype_4v4_short;
  1121. }
  1122. static char * anongame_infos_DESC_get_gametype_4v4_long(char * langID)
  1123. {
  1124.     char * result;
  1125.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_4v4_long)))
  1126. return result;
  1127.     else
  1128. return anongame_infos->anongame_infos_DESC->gametype_4v4_long;
  1129. }
  1130. static char * anongame_infos_DESC_get_gametype_5v5_short(char * langID)
  1131. {
  1132.     char * result;
  1133.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_5v5_short)))
  1134. return result;
  1135.     else
  1136. return anongame_infos->anongame_infos_DESC->gametype_5v5_short;
  1137. }
  1138. static char * anongame_infos_DESC_get_gametype_5v5_long(char * langID)
  1139. {
  1140.     char * result;
  1141.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_5v5_long)))
  1142. return result;
  1143.     else
  1144. return anongame_infos->anongame_infos_DESC->gametype_5v5_long;
  1145. }
  1146. static char * anongame_infos_DESC_get_gametype_6v6_short(char * langID)
  1147. {
  1148.     char * result;
  1149.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_6v6_short)))
  1150. return result;
  1151.     else
  1152. return anongame_infos->anongame_infos_DESC->gametype_6v6_short;
  1153. }
  1154. static char * anongame_infos_DESC_get_gametype_6v6_long(char * langID)
  1155. {
  1156.     char * result;
  1157.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_6v6_long)))
  1158. return result;
  1159.     else
  1160. return anongame_infos->anongame_infos_DESC->gametype_6v6_long;
  1161. }
  1162. static char * anongame_infos_DESC_get_gametype_sffa_short(char * langID)
  1163. {
  1164.     char * result;
  1165.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_sffa_short)))
  1166. return result;
  1167.     else
  1168. return anongame_infos->anongame_infos_DESC->gametype_sffa_short;
  1169. }
  1170. static char * anongame_infos_DESC_get_gametype_sffa_long(char * langID)
  1171. {
  1172.     char * result;
  1173.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_sffa_long)))
  1174. return result;
  1175.     else
  1176. return anongame_infos->anongame_infos_DESC->gametype_sffa_long;
  1177. }
  1178. static char * anongame_infos_DESC_get_gametype_tffa_short(char * langID)
  1179. {
  1180.     char * result;
  1181.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_tffa_short)))
  1182. return result;
  1183.     else
  1184. return anongame_infos->anongame_infos_DESC->gametype_tffa_short;
  1185. }
  1186. static char * anongame_infos_DESC_get_gametype_tffa_long(char * langID)
  1187. {
  1188.     char * result;
  1189.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_tffa_long)))
  1190. return result;
  1191.     else
  1192. return anongame_infos->anongame_infos_DESC->gametype_tffa_long;
  1193. }
  1194. static char * anongame_infos_DESC_get_gametype_2v2v2_short(char * langID)
  1195. {
  1196.     char * result;
  1197.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2v2_short)))
  1198. return result;
  1199.     else
  1200. return anongame_infos->anongame_infos_DESC->gametype_2v2v2_short;
  1201. }
  1202. static char * anongame_infos_DESC_get_gametype_2v2v2_long(char * langID)
  1203. {
  1204.     char * result;
  1205.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2v2_long)))
  1206. return result;
  1207.     else
  1208. return anongame_infos->anongame_infos_DESC->gametype_2v2v2_long;
  1209. }
  1210. static char * anongame_infos_DESC_get_gametype_3v3v3_short(char * langID)
  1211. {
  1212.     char * result;
  1213.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3v3_short)))
  1214. return result;
  1215.     else
  1216. return anongame_infos->anongame_infos_DESC->gametype_3v3v3_short;
  1217. }
  1218. static char * anongame_infos_DESC_get_gametype_3v3v3_long(char * langID)
  1219. {
  1220.     char * result;
  1221.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3v3_long)))
  1222. return result;
  1223.     else
  1224. return anongame_infos->anongame_infos_DESC->gametype_3v3v3_long;
  1225. }
  1226. static char * anongame_infos_DESC_get_gametype_4v4v4_short(char * langID)
  1227. {
  1228.     char * result;
  1229.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_4v4v4_short)))
  1230. return result;
  1231.     else
  1232. return anongame_infos->anongame_infos_DESC->gametype_4v4v4_short;
  1233. }
  1234. static char * anongame_infos_DESC_get_gametype_4v4v4_long(char * langID)
  1235. {
  1236.     char * result;
  1237.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_4v4v4_long)))
  1238. return result;
  1239.     else
  1240. return anongame_infos->anongame_infos_DESC->gametype_4v4v4_long;
  1241. }
  1242. static char * anongame_infos_DESC_get_gametype_2v2v2v2_short(char * langID)
  1243. {
  1244.     char * result;
  1245.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2v2v2_short)))
  1246. return result;
  1247.     else
  1248. return anongame_infos->anongame_infos_DESC->gametype_2v2v2v2_short;
  1249. }
  1250. static char * anongame_infos_DESC_get_gametype_2v2v2v2_long(char * langID)
  1251. {
  1252.     char * result;
  1253.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_2v2v2v2_long)))
  1254. return result;
  1255.     else
  1256. return anongame_infos->anongame_infos_DESC->gametype_2v2v2v2_long;
  1257. }
  1258. static char * anongame_infos_DESC_get_gametype_3v3v3v3_short(char * langID)
  1259. {
  1260.     char * result;
  1261.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3v3v3_short)))
  1262. return result;
  1263.     else
  1264. return anongame_infos->anongame_infos_DESC->gametype_3v3v3v3_short;
  1265. }
  1266. static char * anongame_infos_DESC_get_gametype_3v3v3v3_long(char * langID)
  1267. {
  1268.     char * result;
  1269.     if ((result = ((anongame_infos_get_anongame_infos_DESC_by_langID(anongame_infos, langID))->gametype_3v3v3v3_long)))
  1270. return result;
  1271.     else
  1272. return anongame_infos->anongame_infos_DESC->gametype_3v3v3v3_long;
  1273. }
  1274. /**********/
  1275. extern char * anongame_infos_get_short_desc(char * langID, int queue)
  1276. {
  1277.     switch(queue) {
  1278. case ANONGAME_TYPE_1V1:
  1279.     return anongame_infos_DESC_get_gametype_1v1_short(langID);
  1280. case ANONGAME_TYPE_2V2:
  1281.     return anongame_infos_DESC_get_gametype_2v2_short(langID);
  1282. case ANONGAME_TYPE_3V3:
  1283.     return anongame_infos_DESC_get_gametype_3v3_short(langID);
  1284. case ANONGAME_TYPE_4V4:
  1285.     return anongame_infos_DESC_get_gametype_4v4_short(langID);
  1286. case ANONGAME_TYPE_5V5:
  1287.     return anongame_infos_DESC_get_gametype_5v5_short(langID);
  1288. case ANONGAME_TYPE_6V6:
  1289.     return anongame_infos_DESC_get_gametype_6v6_short(langID);
  1290. case ANONGAME_TYPE_2V2V2:
  1291.     return anongame_infos_DESC_get_gametype_2v2v2_short(langID);
  1292. case ANONGAME_TYPE_3V3V3:
  1293.     return anongame_infos_DESC_get_gametype_3v3v3_short(langID);
  1294. case ANONGAME_TYPE_4V4V4:
  1295.     return anongame_infos_DESC_get_gametype_4v4v4_short(langID);
  1296. case ANONGAME_TYPE_2V2V2V2:
  1297.     return anongame_infos_DESC_get_gametype_2v2v2v2_short(langID);
  1298. case ANONGAME_TYPE_3V3V3V3:
  1299.     return anongame_infos_DESC_get_gametype_3v3v3v3_short(langID);
  1300.         case ANONGAME_TYPE_SMALL_FFA:
  1301.     return anongame_infos_DESC_get_gametype_sffa_short(langID);
  1302.         case ANONGAME_TYPE_TEAM_FFA:
  1303.     return anongame_infos_DESC_get_gametype_tffa_short(langID);
  1304.         case ANONGAME_TYPE_AT_2V2:
  1305.     return anongame_infos_DESC_get_gametype_2v2_short(langID);
  1306.         case ANONGAME_TYPE_AT_3V3:
  1307.     return anongame_infos_DESC_get_gametype_3v3_short(langID);
  1308.         case ANONGAME_TYPE_AT_4V4:
  1309.     return anongame_infos_DESC_get_gametype_4v4_short(langID);
  1310. case ANONGAME_TYPE_AT_2V2V2:
  1311.     return anongame_infos_DESC_get_gametype_2v2v2_short(langID);
  1312.         case ANONGAME_TYPE_TY:
  1313.     return tournament_get_format();
  1314.         default:
  1315.             eventlog(eventlog_level_error,__FUNCTION__, "invalid queue (%d)", queue);
  1316.          return NULL;
  1317.     }
  1318. }
  1319. extern char * anongame_infos_get_long_desc(char * langID, int queue)
  1320. {
  1321.     switch(queue) {
  1322. case ANONGAME_TYPE_1V1:
  1323.     return anongame_infos_DESC_get_gametype_1v1_long(langID);
  1324. case ANONGAME_TYPE_2V2:
  1325.     return anongame_infos_DESC_get_gametype_2v2_long(langID);
  1326. case ANONGAME_TYPE_3V3:
  1327.     return anongame_infos_DESC_get_gametype_3v3_long(langID);
  1328. case ANONGAME_TYPE_4V4:
  1329.     return anongame_infos_DESC_get_gametype_4v4_long(langID);
  1330. case ANONGAME_TYPE_5V5:
  1331.     return anongame_infos_DESC_get_gametype_5v5_long(langID);
  1332. case ANONGAME_TYPE_6V6:
  1333.     return anongame_infos_DESC_get_gametype_6v6_long(langID);
  1334. case ANONGAME_TYPE_2V2V2:
  1335.     return anongame_infos_DESC_get_gametype_2v2v2_long(langID);
  1336. case ANONGAME_TYPE_3V3V3:
  1337.     return anongame_infos_DESC_get_gametype_3v3v3_long(langID);
  1338. case ANONGAME_TYPE_4V4V4:
  1339.     return anongame_infos_DESC_get_gametype_4v4v4_long(langID);
  1340. case ANONGAME_TYPE_2V2V2V2:
  1341.     return anongame_infos_DESC_get_gametype_2v2v2v2_long(langID);
  1342. case ANONGAME_TYPE_3V3V3V3:
  1343.     return anongame_infos_DESC_get_gametype_3v3v3v3_long(langID);
  1344.         case ANONGAME_TYPE_SMALL_FFA:
  1345.     return anongame_infos_DESC_get_gametype_sffa_long(langID);
  1346.         case ANONGAME_TYPE_TEAM_FFA:
  1347.     return anongame_infos_DESC_get_gametype_tffa_long(langID);
  1348.         case ANONGAME_TYPE_AT_2V2:
  1349.     return anongame_infos_DESC_get_gametype_2v2_long(langID);
  1350.         case ANONGAME_TYPE_AT_3V3:
  1351.     return anongame_infos_DESC_get_gametype_3v3_long(langID);
  1352.         case ANONGAME_TYPE_AT_4V4:
  1353.     return anongame_infos_DESC_get_gametype_4v4_long(langID);
  1354. case ANONGAME_TYPE_AT_2V2V2:
  1355.     return anongame_infos_DESC_get_gametype_2v2v2_long(langID);
  1356.         case ANONGAME_TYPE_TY:
  1357.     return tournament_get_sponsor();;
  1358.         default:
  1359.             eventlog(eventlog_level_error,__FUNCTION__, "invalid queue (%d)", queue);
  1360.          return NULL;
  1361.     }
  1362. }
  1363. /**********/
  1364. static int anongame_infos_THUMBSDOWN_set_PG_1v1(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1365. {
  1366.     if (!anongame_infos_THUMBSDOWN)
  1367.     {
  1368. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1369. return -1;
  1370.     }
  1371.     anongame_infos_THUMBSDOWN->PG_1v1 = value;
  1372.     return 0;
  1373. }
  1374. static int anongame_infos_THUMBSDOWN_set_PG_2v2(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1375. {
  1376.     if (!anongame_infos_THUMBSDOWN)
  1377.     {
  1378. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1379. return -1;
  1380.     }
  1381.     anongame_infos_THUMBSDOWN->PG_2v2 = value;
  1382.     return 0;
  1383. }
  1384. static int anongame_infos_THUMBSDOWN_set_PG_3v3(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1385. {
  1386.     if (!anongame_infos_THUMBSDOWN)
  1387.     {
  1388. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1389. return -1;
  1390.     }
  1391.     anongame_infos_THUMBSDOWN->PG_3v3 = value;
  1392.     return 0;
  1393. }
  1394. static int anongame_infos_THUMBSDOWN_set_PG_4v4(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1395. {
  1396.     if (!anongame_infos_THUMBSDOWN)
  1397.     {
  1398. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1399. return -1;
  1400.     }
  1401.     anongame_infos_THUMBSDOWN->PG_4v4 = value;
  1402.     return 0;
  1403. }
  1404. static int anongame_infos_THUMBSDOWN_set_PG_5v5(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1405. {
  1406.     if (!anongame_infos_THUMBSDOWN)
  1407.     {
  1408. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1409. return -1;
  1410.     }
  1411.     anongame_infos_THUMBSDOWN->PG_5v5 = value;
  1412.     return 0;
  1413. }
  1414. static int anongame_infos_THUMBSDOWN_set_PG_6v6(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1415. {
  1416.     if (!anongame_infos_THUMBSDOWN)
  1417.     {
  1418. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1419. return -1;
  1420.     }
  1421.     anongame_infos_THUMBSDOWN->PG_6v6 = value;
  1422.     return 0;
  1423. }
  1424. static int anongame_infos_THUMBSDOWN_set_PG_ffa(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1425. {
  1426.     if (!anongame_infos_THUMBSDOWN)
  1427.     {
  1428. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1429. return -1;
  1430.     }
  1431.     anongame_infos_THUMBSDOWN->PG_ffa = value;
  1432.     return 0;
  1433. }
  1434. static int anongame_infos_THUMBSDOWN_set_AT_ffa(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1435. {
  1436.     if (!anongame_infos_THUMBSDOWN)
  1437.     {
  1438. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1439. return -1;
  1440.     }
  1441.     anongame_infos_THUMBSDOWN->AT_ffa = value;
  1442.     return 0;
  1443. }
  1444. static int anongame_infos_THUMBSDOWN_set_AT_2v2(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1445. {
  1446.     if (!anongame_infos_THUMBSDOWN)
  1447.     {
  1448. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1449. return -1;
  1450.     }
  1451.     anongame_infos_THUMBSDOWN->AT_2v2 = value;
  1452.     return 0;
  1453. }
  1454. static int anongame_infos_THUMBSDOWN_set_AT_3v3(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1455. {
  1456.     if (!anongame_infos_THUMBSDOWN)
  1457.     {
  1458. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1459. return -1;
  1460.     }
  1461.     anongame_infos_THUMBSDOWN->AT_3v3 = value;
  1462.     return 0;
  1463. }
  1464. static int anongame_infos_THUMBSDOWN_set_AT_4v4(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1465. {
  1466.     if (!anongame_infos_THUMBSDOWN)
  1467.     {
  1468. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1469. return -1;
  1470.     }
  1471.     anongame_infos_THUMBSDOWN->AT_4v4 = value;
  1472.     return 0;
  1473. }
  1474. static int anongame_infos_THUMBSDOWN_set_PG_2v2v2(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1475. {
  1476.     if (!anongame_infos_THUMBSDOWN)
  1477.     {
  1478. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1479. return -1;
  1480.     }
  1481.     anongame_infos_THUMBSDOWN->PG_2v2v2 = value;
  1482.     return 0;
  1483. }
  1484. static int anongame_infos_THUMBSDOWN_set_PG_3v3v3(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1485. {
  1486.     if (!anongame_infos_THUMBSDOWN)
  1487.     {
  1488. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1489. return -1;
  1490.     }
  1491.     anongame_infos_THUMBSDOWN->PG_3v3v3 = value;
  1492.     return 0;
  1493. }
  1494. static int anongame_infos_THUMBSDOWN_set_PG_4v4v4(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1495. {
  1496.     if (!anongame_infos_THUMBSDOWN)
  1497.     {
  1498. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1499. return -1;
  1500.     }
  1501.     anongame_infos_THUMBSDOWN->PG_4v4v4 = value;
  1502.     return 0;
  1503. }
  1504. static int anongame_infos_THUMBSDOWN_set_AT_2v2v2(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1505. {
  1506.     if (!anongame_infos_THUMBSDOWN)
  1507.     {
  1508. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1509. return -1;
  1510.     }
  1511.     anongame_infos_THUMBSDOWN->AT_2v2v2 = value;
  1512.     return 0;
  1513. }
  1514. static int anongame_infos_THUMBSDOWN_set_PG_2v2v2v2(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1515. {
  1516.     if (!anongame_infos_THUMBSDOWN)
  1517.     {
  1518. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1519. return -1;
  1520.     }
  1521.     anongame_infos_THUMBSDOWN->PG_2v2v2v2 = value;
  1522.     return 0;
  1523. }
  1524. static int anongame_infos_THUMBSDOWN_set_PG_3v3v3v3(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value)
  1525. {
  1526.     if (!anongame_infos_THUMBSDOWN)
  1527.     {
  1528. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_THUMBSDOWN");
  1529. return -1;
  1530.     }
  1531.     anongame_infos_THUMBSDOWN->PG_3v3v3v3 = value;
  1532.     return 0;
  1533. }
  1534. /**********/
  1535. extern char anongame_infos_get_thumbsdown(int queue)
  1536. {
  1537.     switch(queue) {
  1538. case ANONGAME_TYPE_1V1:
  1539.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_1v1;
  1540. case ANONGAME_TYPE_2V2:
  1541.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_2v2;
  1542. case ANONGAME_TYPE_3V3:
  1543.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_3v3;
  1544. case ANONGAME_TYPE_4V4:
  1545.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_4v4;
  1546. case ANONGAME_TYPE_5V5:
  1547.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_5v5;
  1548. case ANONGAME_TYPE_6V6:
  1549.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_6v6;
  1550. case ANONGAME_TYPE_2V2V2:
  1551.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_2v2v2;
  1552. case ANONGAME_TYPE_3V3V3:
  1553.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_3v3v3;
  1554. case ANONGAME_TYPE_4V4V4:
  1555.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_4v4v4;
  1556. case ANONGAME_TYPE_2V2V2V2:
  1557.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_2v2v2v2;
  1558. case ANONGAME_TYPE_3V3V3V3:
  1559.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_3v3v3v3;
  1560.         case ANONGAME_TYPE_SMALL_FFA:
  1561.     return anongame_infos->anongame_infos_THUMBSDOWN->PG_ffa;
  1562.         case ANONGAME_TYPE_TEAM_FFA:
  1563.     return anongame_infos->anongame_infos_THUMBSDOWN->AT_ffa;
  1564.         case ANONGAME_TYPE_AT_2V2:
  1565.     return anongame_infos->anongame_infos_THUMBSDOWN->AT_2v2;
  1566.         case ANONGAME_TYPE_AT_3V3:
  1567.     return anongame_infos->anongame_infos_THUMBSDOWN->AT_3v3;
  1568.         case ANONGAME_TYPE_AT_4V4:
  1569.     return anongame_infos->anongame_infos_THUMBSDOWN->AT_3v3;
  1570. case ANONGAME_TYPE_AT_2V2V2:
  1571.     return anongame_infos->anongame_infos_THUMBSDOWN->AT_2v2v2;
  1572.         case ANONGAME_TYPE_TY:
  1573.     return tournament_get_thumbs_down();
  1574.         default:
  1575.                 eventlog(eventlog_level_error,__FUNCTION__, "invalid queue (%d)", queue);
  1576.         return 1;
  1577.     }
  1578. }
  1579. /**********/
  1580. static int anongame_infos_ICON_REQ_WAR3_set_Level1(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3, int value)
  1581. {
  1582.     if (!anongame_infos_ICON_REQ_WAR3)
  1583.     {
  1584. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_WAR3");
  1585. return -1;
  1586.     }
  1587.     anongame_infos_ICON_REQ_WAR3->Level1 = value;
  1588.     return 0;
  1589. }
  1590. static int anongame_infos_ICON_REQ_WAR3_set_Level2(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3, int value)
  1591. {
  1592.     if (!anongame_infos_ICON_REQ_WAR3)
  1593.     {
  1594. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_WAR3");
  1595. return -1;
  1596.     }
  1597.     anongame_infos_ICON_REQ_WAR3->Level2 = value;
  1598.     return 0;
  1599. }
  1600. static int anongame_infos_ICON_REQ_WAR3_set_Level3(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3, int value)
  1601. {
  1602.     if (!anongame_infos_ICON_REQ_WAR3)
  1603.     {
  1604. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_WAR3");
  1605. return -1;
  1606.     }
  1607.     anongame_infos_ICON_REQ_WAR3->Level3 = value;
  1608.     return 0;
  1609. }
  1610. static int anongame_infos_ICON_REQ_WAR3_set_Level4(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3, int value)
  1611. {
  1612.     if (!anongame_infos_ICON_REQ_WAR3)
  1613.     {
  1614. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_WAR3");
  1615. return -1;
  1616.     }
  1617.     anongame_infos_ICON_REQ_WAR3->Level4 = value;
  1618.     return 0;
  1619. }
  1620. static int anongame_infos_ICON_REQ_W3XP_set_Level1(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value)
  1621. {
  1622.     if (!anongame_infos_ICON_REQ_W3XP)
  1623.     {
  1624. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  1625. return -1;
  1626.     }
  1627.     anongame_infos_ICON_REQ_W3XP->Level1 = value;
  1628.     return 0;
  1629. }
  1630. static int anongame_infos_ICON_REQ_W3XP_set_Level2(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value)
  1631. {
  1632.     if (!anongame_infos_ICON_REQ_W3XP)
  1633.     {
  1634. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  1635. return -1;
  1636.     }
  1637.     anongame_infos_ICON_REQ_W3XP->Level2 = value;
  1638.     return 0;
  1639. }
  1640. static int anongame_infos_ICON_REQ_W3XP_set_Level3(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value)
  1641. {
  1642.     if (!anongame_infos_ICON_REQ_W3XP)
  1643.     {
  1644. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  1645. return -1;
  1646.     }
  1647.     anongame_infos_ICON_REQ_W3XP->Level3 = value;
  1648.     return 0;
  1649. }
  1650. static int anongame_infos_ICON_REQ_W3XP_set_Level4(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value)
  1651. {
  1652.     if (!anongame_infos_ICON_REQ_W3XP)
  1653.     {
  1654. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  1655. return -1;
  1656.     }
  1657.     anongame_infos_ICON_REQ_W3XP->Level4 = value;
  1658.     return 0;
  1659. }
  1660. static int anongame_infos_ICON_REQ_W3XP_set_Level5(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value)
  1661. {
  1662.     if (!anongame_infos_ICON_REQ_W3XP)
  1663.     {
  1664. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_W3XP");
  1665. return -1;
  1666.     }
  1667.     anongame_infos_ICON_REQ_W3XP->Level5 = value;
  1668.     return 0;
  1669. }
  1670. static int anongame_infos_ICON_REQ_TOURNEY_set_Level1(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value)
  1671. {
  1672.     if (!anongame_infos_ICON_REQ_TOURNEY)
  1673.     {
  1674. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  1675. return -1;
  1676.     }
  1677.     anongame_infos_ICON_REQ_TOURNEY->Level1 = value;
  1678.     return 0;
  1679. }
  1680. static int anongame_infos_ICON_REQ_TOURNEY_set_Level2(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value)
  1681. {
  1682.     if (!anongame_infos_ICON_REQ_TOURNEY)
  1683.     {
  1684. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  1685. return -1;
  1686.     }
  1687.     anongame_infos_ICON_REQ_TOURNEY->Level2 = value;
  1688.     return 0;
  1689. }
  1690. static int anongame_infos_ICON_REQ_TOURNEY_set_Level3(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value)
  1691. {
  1692.     if (!anongame_infos_ICON_REQ_TOURNEY)
  1693.     {
  1694. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  1695. return -1;
  1696.     }
  1697.     anongame_infos_ICON_REQ_TOURNEY->Level3 = value;
  1698.     return 0;
  1699. }
  1700. static int anongame_infos_ICON_REQ_TOURNEY_set_Level4(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value)
  1701. {
  1702.     if (!anongame_infos_ICON_REQ_TOURNEY)
  1703.     {
  1704. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  1705. return -1;
  1706.     }
  1707.     anongame_infos_ICON_REQ_TOURNEY->Level4 = value;
  1708.     return 0;
  1709. }
  1710. static int anongame_infos_ICON_REQ_TOURNEY_set_Level5(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value)
  1711. {
  1712.     if (!anongame_infos_ICON_REQ_TOURNEY)
  1713.     {
  1714. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_ICON_REQ_TOURNEY");
  1715. return -1;
  1716.     }
  1717.     anongame_infos_ICON_REQ_TOURNEY->Level5 = value;
  1718.     return 0;
  1719. }
  1720. extern short anongame_infos_get_ICON_REQ_WAR3(int Level)
  1721. {
  1722.   switch(Level) 
  1723.     {
  1724.     case 0:
  1725.       return 0;
  1726.     case 1:
  1727.       return anongame_infos->anongame_infos_ICON_REQ_WAR3->Level1;
  1728.     case 2:
  1729.       return anongame_infos->anongame_infos_ICON_REQ_WAR3->Level2;
  1730.     case 3:
  1731.       return anongame_infos->anongame_infos_ICON_REQ_WAR3->Level3;
  1732.     case 4:
  1733.       return anongame_infos->anongame_infos_ICON_REQ_WAR3->Level4;
  1734.     default:
  1735.       eventlog(eventlog_level_error,__FUNCTION__, "invalid Level (%d)", Level);
  1736.       return -1;
  1737.     }
  1738. }
  1739. extern short anongame_infos_get_ICON_REQ_W3XP(int Level)
  1740. {
  1741.   switch(Level) 
  1742.     {
  1743.     case 0:
  1744.       return 0;
  1745.     case 1:
  1746.       return anongame_infos->anongame_infos_ICON_REQ_W3XP->Level1;
  1747.     case 2:
  1748.       return anongame_infos->anongame_infos_ICON_REQ_W3XP->Level2;
  1749.     case 3:
  1750.       return anongame_infos->anongame_infos_ICON_REQ_W3XP->Level3;
  1751.     case 4:
  1752.       return anongame_infos->anongame_infos_ICON_REQ_W3XP->Level4;
  1753.     case 5:
  1754.       return anongame_infos->anongame_infos_ICON_REQ_W3XP->Level5;
  1755.     default:
  1756.       eventlog(eventlog_level_error,__FUNCTION__, "invalid Level (%d)", Level);
  1757.       return -1;
  1758.     }
  1759. }
  1760. extern short anongame_infos_get_ICON_REQ_TOURNEY(int Level)
  1761. {
  1762.   switch(Level) 
  1763.     {
  1764.     case 0:
  1765.       return 0;
  1766.     case 1:
  1767.       return anongame_infos->anongame_infos_ICON_REQ_TOURNEY->Level1;
  1768.     case 2:
  1769.       return anongame_infos->anongame_infos_ICON_REQ_TOURNEY->Level2;
  1770.     case 3:
  1771.       return anongame_infos->anongame_infos_ICON_REQ_TOURNEY->Level3;
  1772.     case 4:
  1773.       return anongame_infos->anongame_infos_ICON_REQ_TOURNEY->Level4;
  1774.     case 5:
  1775.       return anongame_infos->anongame_infos_ICON_REQ_TOURNEY->Level5;
  1776.     default:
  1777.       eventlog(eventlog_level_error,__FUNCTION__, "invalid Level (%d)", Level);
  1778.       return -1;
  1779.     }
  1780. }
  1781. /**********/
  1782. extern char * anongame_infos_data_get_url(char const * clienttag, int versionid, int * len)
  1783. {
  1784. if(strcmp(clienttag, CLIENTTAG_WARCRAFT3) == 0)
  1785. {
  1786. if(versionid < 0x0000000D)
  1787. {
  1788. (* len) = anongame_infos->anongame_infos_data_war3->url_len;
  1789. return anongame_infos->anongame_infos_data_war3->url_data;
  1790. }
  1791. else
  1792. {
  1793. (* len) = anongame_infos->anongame_infos_data_war3->url_comp_len;
  1794. return anongame_infos->anongame_infos_data_war3->url_comp_data;
  1795. }
  1796. }
  1797. else
  1798. {
  1799. if(versionid < 0x0000000D)
  1800. {
  1801. (* len) = anongame_infos->anongame_infos_data_w3xp->url_len;
  1802. return anongame_infos->anongame_infos_data_w3xp->url_data;
  1803. }
  1804. else
  1805. {
  1806. (* len) = anongame_infos->anongame_infos_data_w3xp->url_comp_len;
  1807. return anongame_infos->anongame_infos_data_w3xp->url_comp_data;
  1808. }
  1809. }
  1810. }
  1811. extern char * anongame_infos_data_get_map(char const * clienttag, int versionid, int * len)
  1812. {
  1813. if(strcmp(clienttag, CLIENTTAG_WARCRAFT3) == 0)
  1814. {
  1815. if(versionid < 0x0000000D)
  1816. {
  1817. (* len) = anongame_infos->anongame_infos_data_war3->map_len;
  1818. return anongame_infos->anongame_infos_data_war3->map_data;
  1819. }
  1820. else
  1821. {
  1822. (* len) = anongame_infos->anongame_infos_data_war3->map_comp_len;
  1823. return anongame_infos->anongame_infos_data_war3->map_comp_data;
  1824. }
  1825. }
  1826. else
  1827. {
  1828. if(versionid < 0x0000000D)
  1829. {
  1830. (* len) = anongame_infos->anongame_infos_data_w3xp->map_len;
  1831. return anongame_infos->anongame_infos_data_w3xp->map_data;
  1832. }
  1833. else
  1834. {
  1835. (* len) = anongame_infos->anongame_infos_data_w3xp->map_comp_len;
  1836. return anongame_infos->anongame_infos_data_w3xp->map_comp_data;
  1837. }
  1838. }
  1839. }
  1840. extern char * anongame_infos_data_get_type(char const * clienttag, int versionid, int * len)
  1841. {
  1842. if(strcmp(clienttag, CLIENTTAG_WARCRAFT3) == 0)
  1843. {
  1844. if(versionid < 0x0000000D)
  1845. {
  1846. (* len) = anongame_infos->anongame_infos_data_war3->type_len;
  1847. return anongame_infos->anongame_infos_data_war3->type_data;
  1848. }
  1849. else
  1850. {
  1851. (* len) = anongame_infos->anongame_infos_data_war3->type_comp_len;
  1852. return anongame_infos->anongame_infos_data_war3->type_comp_data;
  1853. }
  1854. }
  1855. else
  1856. {
  1857. if(versionid < 0x0000000D)
  1858. {
  1859. (* len) = anongame_infos->anongame_infos_data_w3xp->type_len;
  1860. return anongame_infos->anongame_infos_data_w3xp->type_data;
  1861. }
  1862. else
  1863. {
  1864. (* len) = anongame_infos->anongame_infos_data_w3xp->type_comp_len;
  1865. return anongame_infos->anongame_infos_data_w3xp->type_comp_data;
  1866. }
  1867. }
  1868. }
  1869. extern char * anongame_infos_data_get_desc(char const * langID, char const * clienttag, int versionid, int * len)
  1870. {
  1871. t_elem * curr;
  1872. t_anongame_infos_data_lang * entry;
  1873. if(strcmp(clienttag, CLIENTTAG_WARCRAFT3) == 0)
  1874. {
  1875. if(langID != NULL)
  1876. {
  1877. LIST_TRAVERSE(anongame_infos->anongame_infos_data_lang_war3, curr)
  1878. {
  1879. if((entry = elem_get_data(curr)) && strcmp(entry->langID, langID) == 0)
  1880. {
  1881. if(versionid < 0x0000000D)
  1882. {
  1883. (* len) = entry->desc_len;
  1884. return entry->desc_data;
  1885. }
  1886. else
  1887. {
  1888. (* len) = entry->desc_comp_len;
  1889. return entry->desc_comp_data;
  1890. }
  1891. }
  1892. }
  1893. }
  1894. if(versionid < 0x0000000D)
  1895. {
  1896. (* len) = anongame_infos->anongame_infos_data_war3->desc_len;
  1897. return anongame_infos->anongame_infos_data_war3->desc_data;
  1898. }
  1899. else
  1900. {
  1901. (* len) = anongame_infos->anongame_infos_data_war3->desc_comp_len;
  1902. return anongame_infos->anongame_infos_data_war3->desc_comp_data;
  1903. }
  1904. }
  1905. else
  1906. {
  1907. if(langID != NULL)
  1908. {
  1909. LIST_TRAVERSE(anongame_infos->anongame_infos_data_lang_w3xp, curr)
  1910. {
  1911. if((entry = elem_get_data(curr)) && strcmp(entry->langID, langID) == 0)
  1912. {
  1913. if(versionid < 0x0000000D)
  1914. {
  1915. (* len) = entry->desc_len;
  1916. return entry->desc_data;
  1917. }
  1918. else
  1919. {
  1920. (* len) = entry->desc_comp_len;
  1921. return entry->desc_comp_data;
  1922. }
  1923. }
  1924. }
  1925. }
  1926. if(versionid < 0x0000000D)
  1927. {
  1928. (* len) = anongame_infos->anongame_infos_data_w3xp->desc_len;
  1929. return anongame_infos->anongame_infos_data_w3xp->desc_data;
  1930. }
  1931. else
  1932. {
  1933. (* len) = anongame_infos->anongame_infos_data_w3xp->desc_comp_len;
  1934. return anongame_infos->anongame_infos_data_w3xp->desc_comp_data;
  1935. }
  1936. }
  1937. }
  1938. extern char * anongame_infos_data_get_ladr(char const * langID, char const * clienttag, int versionid, int * len)
  1939. {
  1940. t_elem * curr;
  1941. t_anongame_infos_data_lang * entry;
  1942. if(strcmp(clienttag, CLIENTTAG_WARCRAFT3) == 0)
  1943. {
  1944. if(langID != NULL)
  1945. {
  1946. LIST_TRAVERSE(anongame_infos->anongame_infos_data_lang_war3, curr)
  1947. {
  1948. if((entry = elem_get_data(curr)) && strcmp(entry->langID, langID) == 0)
  1949. {
  1950. if(versionid < 0x0000000D)
  1951. {
  1952. (* len) = entry->ladr_len;
  1953. return entry->ladr_data;
  1954. }
  1955. else
  1956. {
  1957. (* len) = entry->ladr_comp_len;
  1958. return entry->ladr_comp_data;
  1959. }
  1960. }
  1961. }
  1962. }
  1963. if(versionid < 0x0000000D)
  1964. {
  1965. (* len) = anongame_infos->anongame_infos_data_war3->ladr_len;
  1966. return anongame_infos->anongame_infos_data_war3->ladr_data;
  1967. }
  1968. else
  1969. {
  1970. (* len) = anongame_infos->anongame_infos_data_war3->ladr_comp_len;
  1971. return anongame_infos->anongame_infos_data_war3->ladr_comp_data;
  1972. }
  1973. }
  1974. else
  1975. {
  1976. if(langID != NULL)
  1977. {
  1978. LIST_TRAVERSE(anongame_infos->anongame_infos_data_lang_w3xp, curr)
  1979. {
  1980. if((entry = elem_get_data(curr)) && strcmp(entry->langID, langID) == 0)
  1981. {
  1982. if(versionid < 0x0000000D)
  1983. {
  1984. (* len) = entry->ladr_len;
  1985. return entry->ladr_data;
  1986. }
  1987. else
  1988. {
  1989. (* len) = entry->ladr_comp_len;
  1990. return entry->ladr_comp_data;
  1991. }
  1992. }
  1993. }
  1994. }
  1995. if(versionid < 0x0000000D)
  1996. {
  1997. (* len) = anongame_infos->anongame_infos_data_w3xp->ladr_len;
  1998. return anongame_infos->anongame_infos_data_w3xp->ladr_data;
  1999. }
  2000. else
  2001. {
  2002. (* len) = anongame_infos->anongame_infos_data_w3xp->ladr_comp_len;
  2003. return anongame_infos->anongame_infos_data_w3xp->ladr_comp_data;
  2004. }
  2005. }
  2006. }
  2007. /**********/
  2008. static void anongame_infos_set_defaults(t_anongame_infos * anongame_infos)
  2009. {
  2010.     t_anongame_infos_URL * anongame_infos_URL;
  2011.     t_anongame_infos_DESC * anongame_infos_DESC;
  2012.     if (!(anongame_infos))
  2013.     {
  2014. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos");
  2015. return;
  2016.     }
  2017.     anongame_infos_URL  = anongame_infos->anongame_infos_URL;
  2018.     anongame_infos_DESC = anongame_infos->anongame_infos_DESC;
  2019.     if (!(anongame_infos_URL))
  2020.     {
  2021. eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_URL, trying to init");
  2022. if (anongame_infos_URL_init(anongame_infos)!=0)
  2023.         { 
  2024.   eventlog(eventlog_level_error,__FUNCTION__,"failed to init... PANIC!");
  2025.   return;
  2026.         }
  2027.     }
  2028.     if (!(anongame_infos_DESC))
  2029.     {
  2030.         eventlog(eventlog_level_error,__FUNCTION__,"got NULL anongame_infos_DESC, trying to init");
  2031. if (!(anongame_infos_DESC = anongame_infos_DESC_init()))
  2032. {
  2033.   eventlog(eventlog_level_error,__FUNCTION__,"failed to init... PANIC!");
  2034.   return;
  2035. }
  2036. else
  2037. anongame_infos->anongame_infos_DESC = anongame_infos_DESC;
  2038.     }
  2039.     
  2040.     // now set default values
  2041.     if (!(anongame_infos_URL->server_URL)) 
  2042. anongame_infos_URL_set_server_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2043.     if (!(anongame_infos_URL->player_URL)) 
  2044. anongame_infos_URL_set_player_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2045.     if (!(anongame_infos_URL->tourney_URL)) 
  2046. anongame_infos_URL_set_tourney_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2047.     if (!(anongame_infos_URL->ladder_PG_1v1_URL)) 
  2048. anongame_infos_URL_set_ladder_PG_1v1_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2049.     if (!(anongame_infos_URL->ladder_PG_ffa_URL)) 
  2050. anongame_infos_URL_set_ladder_PG_ffa_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2051.     if (!(anongame_infos_URL->ladder_PG_team_URL)) 
  2052. anongame_infos_URL_set_ladder_PG_team_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2053.     if (!(anongame_infos_URL->ladder_AT_2v2_URL)) 
  2054. anongame_infos_URL_set_ladder_AT_2v2_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2055.     if (!(anongame_infos_URL->ladder_AT_3v3_URL)) 
  2056. anongame_infos_URL_set_ladder_AT_3v3_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2057.     if (!(anongame_infos_URL->ladder_AT_4v4_URL)) 
  2058. anongame_infos_URL_set_ladder_AT_4v4_URL(anongame_infos_URL,PVPGN_DEFAULT_URL);
  2059.     if (!(anongame_infos_DESC->ladder_PG_1v1_desc)) 
  2060. anongame_infos_DESC_set_ladder_PG_1v1_desc(anongame_infos_DESC,PVPGN_PG_1V1_DESC);
  2061.     if (!(anongame_infos_DESC->ladder_PG_ffa_desc)) 
  2062. anongame_infos_DESC_set_ladder_PG_ffa_desc(anongame_infos_DESC,PVPGN_PG_FFA_DESC);
  2063.     if (!(anongame_infos_DESC->ladder_PG_team_desc)) 
  2064. anongame_infos_DESC_set_ladder_PG_team_desc(anongame_infos_DESC,PVPGN_PG_TEAM_DESC);
  2065.     if (!(anongame_infos_DESC->ladder_AT_2v2_desc)) 
  2066. anongame_infos_DESC_set_ladder_AT_2v2_desc(anongame_infos_DESC,PVPGN_AT_2V2_DESC);
  2067.     if (!(anongame_infos_DESC->ladder_AT_3v3_desc)) 
  2068. anongame_infos_DESC_set_ladder_AT_3v3_desc(anongame_infos_DESC,PVPGN_AT_3V3_DESC);
  2069.     if (!(anongame_infos_DESC->ladder_AT_4v4_desc)) 
  2070. anongame_infos_DESC_set_ladder_AT_4v4_desc(anongame_infos_DESC,PVPGN_AT_4V4_DESC);
  2071.     if (!(anongame_infos_DESC->gametype_1v1_short))
  2072. anongame_infos_DESC_set_gametype_1v1_short(anongame_infos_DESC,PVPGN_1V1_GT_DESC);
  2073.     if (!(anongame_infos_DESC->gametype_1v1_long))
  2074. anongame_infos_DESC_set_gametype_1v1_long(anongame_infos_DESC,PVPGN_1V1_GT_LONG);
  2075.     if (!(anongame_infos_DESC->gametype_2v2_short))
  2076. anongame_infos_DESC_set_gametype_2v2_short(anongame_infos_DESC,PVPGN_2V2_GT_DESC);
  2077.     if (!(anongame_infos_DESC->gametype_2v2_long))
  2078. anongame_infos_DESC_set_gametype_2v2_long(anongame_infos_DESC,PVPGN_2V2_GT_LONG);
  2079.     if (!(anongame_infos_DESC->gametype_3v3_short))
  2080. anongame_infos_DESC_set_gametype_3v3_short(anongame_infos_DESC,PVPGN_3V3_GT_DESC);
  2081.     if (!(anongame_infos_DESC->gametype_3v3_long))
  2082. anongame_infos_DESC_set_gametype_3v3_long(anongame_infos_DESC,PVPGN_3V3_GT_LONG);
  2083.     if (!(anongame_infos_DESC->gametype_4v4_short))
  2084. anongame_infos_DESC_set_gametype_4v4_short(anongame_infos_DESC,PVPGN_4V4_GT_DESC);
  2085.     if (!(anongame_infos_DESC->gametype_4v4_long))
  2086. anongame_infos_DESC_set_gametype_4v4_long(anongame_infos_DESC,PVPGN_4V4_GT_LONG);
  2087.     if (!(anongame_infos_DESC->gametype_sffa_short))
  2088. anongame_infos_DESC_set_gametype_sffa_short(anongame_infos_DESC,PVPGN_SFFA_GT_DESC);
  2089.     if (!(anongame_infos_DESC->gametype_sffa_long))
  2090. anongame_infos_DESC_set_gametype_sffa_long(anongame_infos_DESC,PVPGN_SFFA_GT_LONG);
  2091.     if (!(anongame_infos_DESC->gametype_tffa_short))
  2092. anongame_infos_DESC_set_gametype_tffa_short(anongame_infos_DESC,PVPGN_TFFA_GT_DESC);
  2093.     if (!(anongame_infos_DESC->gametype_tffa_long))
  2094. anongame_infos_DESC_set_gametype_tffa_long(anongame_infos_DESC,PVPGN_TFFA_GT_LONG);
  2095.     if (!(anongame_infos_DESC->gametype_2v2v2_short))
  2096. anongame_infos_DESC_set_gametype_2v2v2_short(anongame_infos_DESC,PVPGN_2V2V2_GT_DESC);
  2097.     if (!(anongame_infos_DESC->gametype_2v2v2_long))
  2098. anongame_infos_DESC_set_gametype_2v2v2_long(anongame_infos_DESC,PVPGN_2V2V2_GT_LONG);
  2099.     if (!(anongame_infos_DESC->gametype_3v3v3_short))
  2100. anongame_infos_DESC_set_gametype_3v3v3_short(anongame_infos_DESC,PVPGN_3V3V3_GT_DESC);
  2101.     if (!(anongame_infos_DESC->gametype_3v3v3_long))
  2102. anongame_infos_DESC_set_gametype_3v3v3_long(anongame_infos_DESC,PVPGN_3V3V3_GT_LONG);
  2103.     if (!(anongame_infos_DESC->gametype_4v4v4_short))
  2104. anongame_infos_DESC_set_gametype_4v4v4_short(anongame_infos_DESC,PVPGN_4V4V4_GT_DESC);
  2105.     if (!(anongame_infos_DESC->gametype_4v4v4_long))
  2106. anongame_infos_DESC_set_gametype_4v4v4_long(anongame_infos_DESC,PVPGN_4V4V4_GT_LONG);
  2107.     if (!(anongame_infos_DESC->gametype_2v2v2v2_short))
  2108. anongame_infos_DESC_set_gametype_2v2v2v2_short(anongame_infos_DESC,PVPGN_2V2V2V2_GT_DESC);
  2109.     if (!(anongame_infos_DESC->gametype_2v2v2v2_long))
  2110. anongame_infos_DESC_set_gametype_2v2v2v2_long(anongame_infos_DESC,PVPGN_2V2V2V2_GT_LONG);
  2111.     if (!(anongame_infos_DESC->gametype_3v3v3v3_short))
  2112. anongame_infos_DESC_set_gametype_3v3v3v3_short(anongame_infos_DESC,PVPGN_3V3V3V3_GT_DESC);
  2113.     if (!(anongame_infos_DESC->gametype_3v3v3v3_long))
  2114. anongame_infos_DESC_set_gametype_3v3v3v3_long(anongame_infos_DESC,PVPGN_3V3V3V3_GT_LONG);
  2115.     if (!(anongame_infos_DESC->gametype_5v5_short))
  2116. anongame_infos_DESC_set_gametype_5v5_short(anongame_infos_DESC,PVPGN_5V5_GT_DESC);
  2117.     if (!(anongame_infos_DESC->gametype_5v5_long))
  2118. anongame_infos_DESC_set_gametype_5v5_long(anongame_infos_DESC,PVPGN_5V5_GT_LONG);
  2119.     if (!(anongame_infos_DESC->gametype_6v6_short))
  2120. anongame_infos_DESC_set_gametype_6v6_short(anongame_infos_DESC,PVPGN_6V6_GT_DESC);
  2121.     if (!(anongame_infos_DESC->gametype_6v6_long))
  2122. anongame_infos_DESC_set_gametype_6v6_long(anongame_infos_DESC,PVPGN_6V6_GT_LONG);
  2123. }
  2124. typedef int (* t_URL_string_handler)(t_anongame_infos_URL * anongame_infos_URL, char * text);
  2125. typedef struct {
  2126. const char * anongame_infos_URL_string;
  2127. t_URL_string_handler URL_string_handler;
  2128. } t_anongame_infos_URL_table_row;
  2129. typedef int (* t_DESC_string_handler)(t_anongame_infos_DESC * anongame_infos_DESC, char * text);
  2130. typedef struct {
  2131. const char * anongame_infos_DESC_string;
  2132. t_DESC_string_handler DESC_string_handler;
  2133. } t_anongame_infos_DESC_table_row;
  2134. typedef int (* t_THUMBSDOWN_string_handler)(t_anongame_infos_THUMBSDOWN * anongame_infos_THUMBSDOWN, char value);
  2135. typedef struct {
  2136. const char * anongame_infos_THUMBSDOWN_string;
  2137. t_THUMBSDOWN_string_handler THUMBSDOWN_string_handler;
  2138. } t_anongame_infos_THUMBSDOWN_table_row;
  2139. typedef int (* t_ICON_REQ_WAR3_string_handler)(t_anongame_infos_ICON_REQ_WAR3 * anongame_infos_ICON_REQ_WAR3, int value);
  2140. typedef struct {
  2141. const char * anongame_infos_ICON_REQ_WAR3_string;
  2142. t_ICON_REQ_WAR3_string_handler ICON_REQ_WAR3_string_handler;
  2143. } t_anongame_infos_ICON_REQ_WAR3_table_row;
  2144. typedef int (* t_ICON_REQ_W3XP_string_handler)(t_anongame_infos_ICON_REQ_W3XP * anongame_infos_ICON_REQ_W3XP, int value);
  2145. typedef struct {
  2146. const char * anongame_infos_ICON_REQ_W3XP_string;
  2147. t_ICON_REQ_W3XP_string_handler ICON_REQ_W3XP_string_handler;
  2148. } t_anongame_infos_ICON_REQ_W3XP_table_row;
  2149. typedef int (* t_ICON_REQ_TOURNEY_string_handler)(t_anongame_infos_ICON_REQ_TOURNEY * anongame_infos_ICON_REQ_TOURNEY, int value);
  2150. typedef struct {
  2151. const char * anongame_infos_ICON_REQ_TOURNEY_string;
  2152. t_ICON_REQ_TOURNEY_string_handler ICON_REQ_TOURNEY_string_handler;
  2153. } t_anongame_infos_ICON_REQ_TOURNEY_table_row;
  2154. static const t_anongame_infos_URL_table_row URL_handler_table[] = 
  2155. {
  2156. { "server_URL", anongame_infos_URL_set_server_URL },
  2157. { "player_URL", anongame_infos_URL_set_player_URL },
  2158. { "tourney_URL", anongame_infos_URL_set_tourney_URL },
  2159. { "ladder_PG_1v1_URL", anongame_infos_URL_set_ladder_PG_1v1_URL },
  2160. { "ladder_PG_ffa_URL", anongame_infos_URL_set_ladder_PG_ffa_URL },
  2161. { "ladder_PG_team_URL", anongame_infos_URL_set_ladder_PG_team_URL },
  2162. { "ladder_AT_2v2_URL", anongame_infos_URL_set_ladder_AT_2v2_URL },
  2163. { "ladder_AT_3v3_URL", anongame_infos_URL_set_ladder_AT_3v3_URL },
  2164. { "ladder_AT_4v4_URL", anongame_infos_URL_set_ladder_AT_4v4_URL },
  2165. { NULL, NULL }
  2166. };
  2167. static const t_anongame_infos_DESC_table_row DESC_handler_table[] = 
  2168. {
  2169. { "ladder_PG_1v1_desc", anongame_infos_DESC_set_ladder_PG_1v1_desc },
  2170. { "ladder_PG_ffa_desc", anongame_infos_DESC_set_ladder_PG_ffa_desc },
  2171. { "ladder_PG_team_desc", anongame_infos_DESC_set_ladder_PG_team_desc },
  2172. { "ladder_AT_2v2_desc", anongame_infos_DESC_set_ladder_AT_2v2_desc },
  2173. { "ladder_AT_3v3_desc", anongame_infos_DESC_set_ladder_AT_3v3_desc },
  2174. { "ladder_AT_4v4_desc", anongame_infos_DESC_set_ladder_AT_4v4_desc },
  2175. { "gametype_1v1_short", anongame_infos_DESC_set_gametype_1v1_short },
  2176. { "gametype_1v1_long", anongame_infos_DESC_set_gametype_1v1_long },
  2177. { "gametype_2v2_short", anongame_infos_DESC_set_gametype_2v2_short },
  2178. { "gametype_2v2_long", anongame_infos_DESC_set_gametype_2v2_long },
  2179. { "gametype_3v3_short", anongame_infos_DESC_set_gametype_3v3_short },
  2180. { "gametype_3v3_long", anongame_infos_DESC_set_gametype_3v3_long },
  2181. { "gametype_4v4_short", anongame_infos_DESC_set_gametype_4v4_short },
  2182. { "gametype_4v4_long", anongame_infos_DESC_set_gametype_4v4_long },
  2183. { "gametype_sffa_short", anongame_infos_DESC_set_gametype_sffa_short },
  2184. { "gametype_sffa_long", anongame_infos_DESC_set_gametype_sffa_long },
  2185. { "gametype_tffa_short", anongame_infos_DESC_set_gametype_tffa_short },
  2186. { "gametype_tffa_long", anongame_infos_DESC_set_gametype_tffa_long },
  2187. { "gametype_2v2v2_short", anongame_infos_DESC_set_gametype_2v2v2_short },
  2188. { "gametype_2v2v2_long", anongame_infos_DESC_set_gametype_2v2v2_long },
  2189. { "gametype_3v3v3_short", anongame_infos_DESC_set_gametype_3v3v3_short },
  2190. { "gametype_3v3v3_long", anongame_infos_DESC_set_gametype_3v3v3_long },
  2191. { "gametype_4v4v4_short", anongame_infos_DESC_set_gametype_4v4v4_short },
  2192. { "gametype_4v4v4_long", anongame_infos_DESC_set_gametype_4v4v4_long },
  2193. { "gametype_2v2v2v2_short", anongame_infos_DESC_set_gametype_2v2v2v2_short },
  2194. { "gametype_2v2v2v2_long", anongame_infos_DESC_set_gametype_2v2v2v2_long },
  2195. { "gametype_3v3v3v3_short", anongame_infos_DESC_set_gametype_3v3v3v3_short },
  2196. { "gametype_3v3v3v3_long", anongame_infos_DESC_set_gametype_3v3v3v3_long },
  2197. { "gametype_5v5_short", anongame_infos_DESC_set_gametype_5v5_short },
  2198. { "gametype_5v5_long", anongame_infos_DESC_set_gametype_5v5_long },
  2199. { "gametype_6v6_short", anongame_infos_DESC_set_gametype_6v6_short },
  2200. { "gametype_6v6_long", anongame_infos_DESC_set_gametype_6v6_long },
  2201. { NULL, NULL }
  2202. };
  2203. static const t_anongame_infos_THUMBSDOWN_table_row THUMBSDOWN_handler_table[] =
  2204. {
  2205. { "PG_1v1", anongame_infos_THUMBSDOWN_set_PG_1v1 },
  2206. { "PG_2v2", anongame_infos_THUMBSDOWN_set_PG_2v2 },
  2207. { "PG_3v3", anongame_infos_THUMBSDOWN_set_PG_3v3 },
  2208. { "PG_4v4", anongame_infos_THUMBSDOWN_set_PG_4v4 },
  2209. { "PG_ffa", anongame_infos_THUMBSDOWN_set_PG_ffa },
  2210. { "AT_2v2", anongame_infos_THUMBSDOWN_set_AT_2v2 },
  2211. { "AT_3v3", anongame_infos_THUMBSDOWN_set_AT_3v3 },
  2212. { "AT_4v4", anongame_infos_THUMBSDOWN_set_AT_4v4 },
  2213. { "AT_ffa", anongame_infos_THUMBSDOWN_set_AT_ffa },
  2214. { "PG_5v5", anongame_infos_THUMBSDOWN_set_PG_5v5 },
  2215. { "PG_6v6", anongame_infos_THUMBSDOWN_set_PG_6v6 },
  2216. { "PG_2v2v2", anongame_infos_THUMBSDOWN_set_PG_2v2v2 },
  2217. { "PG_3v3v3", anongame_infos_THUMBSDOWN_set_PG_3v3v3 },
  2218. { "PG_4v4v4", anongame_infos_THUMBSDOWN_set_PG_4v4v4 },
  2219. { "PG_2v2v2v2", anongame_infos_THUMBSDOWN_set_PG_2v2v2v2 },
  2220. { "PG_3v3v3v3", anongame_infos_THUMBSDOWN_set_PG_3v3v3v3 },
  2221. { "AT_2v2v2", anongame_infos_THUMBSDOWN_set_AT_2v2v2 },
  2222. { NULL, NULL }
  2223. };
  2224. static const t_anongame_infos_ICON_REQ_WAR3_table_row ICON_REQ_WAR3_handler_table[] =
  2225. {
  2226.         { "Level1",                     anongame_infos_ICON_REQ_WAR3_set_Level1 },
  2227.         { "Level2",                     anongame_infos_ICON_REQ_WAR3_set_Level2 },
  2228.         { "Level3",                     anongame_infos_ICON_REQ_WAR3_set_Level3 },
  2229.         { "Level4",                     anongame_infos_ICON_REQ_WAR3_set_Level4 },
  2230. { NULL, NULL }
  2231. };
  2232. static const t_anongame_infos_ICON_REQ_W3XP_table_row ICON_REQ_W3XP_handler_table[] =
  2233. {
  2234.         { "Level1",                     anongame_infos_ICON_REQ_W3XP_set_Level1 },
  2235.         { "Level2",                     anongame_infos_ICON_REQ_W3XP_set_Level2 },
  2236.         { "Level3",                     anongame_infos_ICON_REQ_W3XP_set_Level3 },
  2237.         { "Level4",                     anongame_infos_ICON_REQ_W3XP_set_Level4 },
  2238. { "Level5",                     anongame_infos_ICON_REQ_W3XP_set_Level5 },
  2239. { NULL, NULL }
  2240. };
  2241. static const t_anongame_infos_ICON_REQ_TOURNEY_table_row ICON_REQ_TOURNEY_handler_table[] =
  2242. {
  2243.         { "Level1",                     anongame_infos_ICON_REQ_TOURNEY_set_Level1 },
  2244.         { "Level2",                     anongame_infos_ICON_REQ_TOURNEY_set_Level2 },
  2245.         { "Level3",                     anongame_infos_ICON_REQ_TOURNEY_set_Level3 },
  2246.         { "Level4",                     anongame_infos_ICON_REQ_TOURNEY_set_Level4 },
  2247. { "Level5",                     anongame_infos_ICON_REQ_TOURNEY_set_Level5 },
  2248. { NULL, NULL }
  2249. };
  2250. typedef enum
  2251. {
  2252. parse_UNKNOWN,
  2253. parse_URL,
  2254. parse_DESC,
  2255. parse_THUMBSDOWN,
  2256. parse_ICON_REQ_WAR3,
  2257. parse_ICON_REQ_W3XP,
  2258. parse_ICON_REQ_TOURNEY
  2259. } t_parse_mode;
  2260. typedef enum
  2261. {
  2262. changed,
  2263. unchanged
  2264. } t_parse_state;
  2265. static t_parse_mode switch_parse_mode(char * text, char * langID)
  2266. {
  2267. if (!(text)) return parse_UNKNOWN;
  2268. else if (strcmp(text,"[URL]")==0) return parse_URL;
  2269. else if (strcmp(text,"[THUMBS_DOWN_LIMIT]")==0) return parse_THUMBSDOWN;
  2270. else if (strcmp(text,"[ICON_REQUIRED_RACE_WINS_WAR3]")==0) return parse_ICON_REQ_WAR3;
  2271. else if (strcmp(text,"[ICON_REQUIRED_RACE_WINS_W3XP]")==0) return parse_ICON_REQ_W3XP;
  2272. else if (strcmp(text,"[ICON_REQUIRED_TOURNEY_WINS]")==0) return parse_ICON_REQ_TOURNEY;
  2273. else if (strcmp(text,"[DEFAULT_DESC]")==0) 
  2274. {
  2275. langID[0] = '';
  2276. return parse_DESC;
  2277. }
  2278. else if (strlen(text)==6) 
  2279. {
  2280. strncpy(langID,&(text[1]),4);
  2281. langID[4] = '';
  2282. return parse_DESC;
  2283. }
  2284. else
  2285. eventlog(eventlog_level_error,__FUNCTION__,"got invalid section name: %s", text);
  2286. return parse_UNKNOWN;
  2287. }
  2288. extern int anongame_infos_load(char const * filename)
  2289. {
  2290.     unsigned int line;
  2291.     unsigned int pos;
  2292.     char * buff;
  2293.     char * temp;
  2294.     char  langID[5];
  2295.     t_parse_mode parse_mode = parse_UNKNOWN;
  2296.     t_parse_state parse_state = unchanged;
  2297.     t_anongame_infos_DESC * anongame_infos_DESC = NULL;
  2298.     char * pointer;
  2299.     char * variable;
  2300.     char * value = NULL;
  2301.     t_anongame_infos_DESC_table_row const * DESC_table_row;
  2302.     t_anongame_infos_URL_table_row const * URL_table_row;
  2303.     t_anongame_infos_THUMBSDOWN_table_row const * THUMBSDOWN_table_row;
  2304.     t_anongame_infos_ICON_REQ_WAR3_table_row const *    ICON_REQ_WAR3_table_row;
  2305.     t_anongame_infos_ICON_REQ_W3XP_table_row const *    ICON_REQ_W3XP_table_row;
  2306.     t_anongame_infos_ICON_REQ_TOURNEY_table_row const * ICON_REQ_TOURNEY_table_row;
  2307.     int int_value;
  2308.     char char_value;
  2309.     
  2310.     langID[0]='';
  2311.     if (!filename)
  2312.     {
  2313.         eventlog(eventlog_level_error,__FUNCTION__,"got NULL filename");
  2314.         return -1;
  2315.     }
  2316.     
  2317.     if (!(anongame_infos=anongame_infos_init()))
  2318.     {
  2319.         eventlog(eventlog_level_error,__FUNCTION__,"could not init anongame_infos");
  2320.         return -1;
  2321.     }
  2322.     if (!(fp = fopen(filename,"r")))
  2323.     {
  2324.         eventlog(eventlog_level_error,"anongameinfo_load","could not open file "%s" for reading (fopen: %s)",filename,strerror(errno));
  2325. anongame_infos_destroy(anongame_infos);
  2326.     return -1;
  2327.     }
  2328.     
  2329.     for (line=1; (buff = file_get_line(fp)); line++)
  2330.     {
  2331.         for (pos=0; buff[pos]=='t' || buff[pos]==' '; pos++);
  2332.         if (buff[pos]=='' || buff[pos]=='#')
  2333.         {
  2334.             free(buff);
  2335.             continue;
  2336.         }
  2337.         if ((temp = strrchr(buff,'#')))
  2338.         {
  2339.     unsigned int len;
  2340.     unsigned int endpos;
  2341.     
  2342.             *temp = '';
  2343.     len = strlen(buff)+1;
  2344.             for (endpos=len-1; buff[endpos]=='t' || buff[endpos]==' '; endpos--);
  2345.             buff[endpos+1] = '';
  2346.         }
  2347. if ((buff[0]=='[') && (buff[strlen(buff)-1]==']'))
  2348.   {
  2349.     if ((parse_state == unchanged) && (anongame_infos_DESC != NULL))
  2350.       {
  2351. if (langID[0]!='')
  2352.   list_append_data(anongame_infos->anongame_infos_DESC_list,anongame_infos_DESC);
  2353. else
  2354.   {
  2355.     if (anongame_infos->anongame_infos_DESC == NULL)
  2356.       anongame_infos->anongame_infos_DESC = anongame_infos_DESC;
  2357.     else
  2358.       {
  2359. eventlog(eventlog_level_error,__FUNCTION__,"found another default_DESC block, deleting previous");
  2360. anongame_infos_DESC_destroy(anongame_infos->anongame_infos_DESC);
  2361. anongame_infos->anongame_infos_DESC = anongame_infos_DESC;
  2362.       }
  2363.   }
  2364. anongame_infos_DESC = NULL;
  2365.       }
  2366.     parse_mode = switch_parse_mode(buff,langID);
  2367.     parse_state = changed;
  2368.   }
  2369. else if (buff[0]!='')
  2370.   switch(parse_mode) 
  2371.     {
  2372.     case parse_UNKNOWN:
  2373.       {
  2374. if ((buff[0]!='[') || (buff[strlen(buff)-1]!=']'))
  2375.   {
  2376.     eventlog(eventlog_level_error,__FUNCTION__,"expected [] section start, but found %s on line %u",buff,line);
  2377.   }
  2378. else
  2379.   {
  2380.     parse_mode = switch_parse_mode(buff,langID);
  2381.     parse_state = changed;
  2382.   }
  2383. break;
  2384.       }
  2385.     case parse_URL:
  2386.       {
  2387. parse_state = unchanged;
  2388. variable = buff;
  2389. pointer = strchr(variable,'=');
  2390. for(pointer--;pointer[0]==' ';pointer--);
  2391. pointer[1]='';
  2392. pointer++;
  2393. pointer++;
  2394. pointer = strchr(pointer,'"');
  2395. pointer++;
  2396. value = pointer;
  2397. pointer = strchr(pointer,'"');
  2398. pointer[0]='';
  2399. for(URL_table_row = URL_handler_table; URL_table_row->anongame_infos_URL_string != NULL; URL_table_row++)
  2400.   if (strcmp(URL_table_row->anongame_infos_URL_string, variable)==0) 
  2401.     {
  2402.       if (URL_table_row->URL_string_handler != NULL) URL_table_row->URL_string_handler(anongame_infos->anongame_infos_URL,value);
  2403.     }
  2404. break;
  2405.       }
  2406.     case parse_DESC:
  2407.       {
  2408. if (parse_state == changed) 
  2409.   {
  2410.     anongame_infos_DESC = anongame_infos_DESC_init();
  2411.     parse_state = unchanged;
  2412.     eventlog(eventlog_level_info,__FUNCTION__,"got langID: [%s]",langID);
  2413.     if (langID[0]!='') anongame_infos_DESC->langID = strdup(langID);
  2414.   }
  2415. variable = buff;
  2416. pointer = strchr(variable,'=');
  2417. for(pointer--;pointer[0]==' ';pointer--);
  2418. pointer[1]='';
  2419. pointer++;
  2420. pointer++;
  2421. pointer = strchr(pointer,'"');
  2422. pointer++;
  2423. value = pointer;
  2424. pointer = strchr(pointer,'"');
  2425. pointer[0]='';
  2426. for(DESC_table_row = DESC_handler_table; DESC_table_row->anongame_infos_DESC_string != NULL; DESC_table_row++)
  2427.   if (strcmp(DESC_table_row->anongame_infos_DESC_string, variable)==0) 
  2428.     {
  2429.       if (DESC_table_row->DESC_string_handler != NULL) DESC_table_row->DESC_string_handler(anongame_infos_DESC,value);
  2430.     }
  2431. break;
  2432.       }
  2433.     case parse_THUMBSDOWN:
  2434.       {
  2435. parse_state = unchanged;
  2436. variable = buff;
  2437. pointer = strchr(variable,'=');
  2438. for(pointer--;pointer[0]==' ';pointer--);
  2439. pointer[1]='';
  2440. pointer++;
  2441. pointer++;
  2442. pointer = strchr(pointer,'=');
  2443. pointer++;
  2444. int_value = atoi(pointer);
  2445. if (int_value<0) int_value=0;
  2446. if (int_value>127) int_value=127;
  2447. char_value = (char)int_value;
  2448. for(THUMBSDOWN_table_row = THUMBSDOWN_handler_table; THUMBSDOWN_table_row->anongame_infos_THUMBSDOWN_string != NULL; THUMBSDOWN_table_row++)
  2449.   if (strcmp(THUMBSDOWN_table_row->anongame_infos_THUMBSDOWN_string, variable)==0) 
  2450.     {
  2451.       if (THUMBSDOWN_table_row->THUMBSDOWN_string_handler != NULL) THUMBSDOWN_table_row->THUMBSDOWN_string_handler(anongame_infos->anongame_infos_THUMBSDOWN,char_value);
  2452.     }
  2453. break;
  2454.       }
  2455.     case parse_ICON_REQ_WAR3:
  2456.       {
  2457. parse_state = unchanged;
  2458. variable = buff;
  2459. pointer = strchr(variable,'=');
  2460. for(pointer--;pointer[0]==' ';pointer--);
  2461. pointer[1]='';
  2462. pointer++;
  2463. pointer++;
  2464. pointer = strchr(pointer,'=');
  2465. pointer++;
  2466. int_value = atoi(pointer);
  2467. if (int_value<0) int_value=0;
  2468. for(ICON_REQ_WAR3_table_row = ICON_REQ_WAR3_handler_table; ICON_REQ_WAR3_table_row->anongame_infos_ICON_REQ_WAR3_string != NULL; ICON_REQ_WAR3_table_row++)
  2469.   if (strcmp(ICON_REQ_WAR3_table_row->anongame_infos_ICON_REQ_WAR3_string, variable)==0) 
  2470.     {
  2471.       if (ICON_REQ_WAR3_table_row->ICON_REQ_WAR3_string_handler != NULL) ICON_REQ_WAR3_table_row->ICON_REQ_WAR3_string_handler(anongame_infos->anongame_infos_ICON_REQ_WAR3,int_value);
  2472.     }
  2473. break;
  2474.       }
  2475.     case parse_ICON_REQ_W3XP:
  2476.       {
  2477. parse_state = unchanged;
  2478. variable = buff;
  2479. pointer = strchr(variable,'=');
  2480. for(pointer--;pointer[0]==' ';pointer--);
  2481. pointer[1]='';
  2482. pointer++;
  2483. pointer++;
  2484. pointer = strchr(pointer,'=');
  2485. pointer++;
  2486. int_value = atoi(pointer);
  2487. if (int_value<0) int_value=0;
  2488. for(ICON_REQ_W3XP_table_row = ICON_REQ_W3XP_handler_table; ICON_REQ_W3XP_table_row->anongame_infos_ICON_REQ_W3XP_string != NULL; ICON_REQ_W3XP_table_row++)
  2489.   if (strcmp(ICON_REQ_W3XP_table_row->anongame_infos_ICON_REQ_W3XP_string, variable)==0) 
  2490.     {
  2491.       if (ICON_REQ_W3XP_table_row->ICON_REQ_W3XP_string_handler != NULL) ICON_REQ_W3XP_table_row->ICON_REQ_W3XP_string_handler(anongame_infos->anongame_infos_ICON_REQ_W3XP,int_value);
  2492.     }
  2493. break;
  2494.       }
  2495.     case parse_ICON_REQ_TOURNEY:
  2496.       {
  2497. parse_state = unchanged;
  2498. variable = buff;
  2499. pointer = strchr(variable,'=');
  2500. for(pointer--;pointer[0]==' ';pointer--);
  2501. pointer[1]='';
  2502. pointer++;
  2503. pointer++;
  2504. pointer = strchr(pointer,'=');
  2505. pointer++;
  2506. int_value = atoi(pointer);
  2507. if (int_value<0) int_value=0;
  2508. for(ICON_REQ_TOURNEY_table_row = ICON_REQ_TOURNEY_handler_table; ICON_REQ_TOURNEY_table_row->anongame_infos_ICON_REQ_TOURNEY_string != NULL; ICON_REQ_TOURNEY_table_row++)
  2509.   if (strcmp(ICON_REQ_TOURNEY_table_row->anongame_infos_ICON_REQ_TOURNEY_string, variable)==0) 
  2510.     {
  2511.       if (ICON_REQ_TOURNEY_table_row->ICON_REQ_TOURNEY_string_handler != NULL) ICON_REQ_TOURNEY_table_row->ICON_REQ_TOURNEY_string_handler(anongame_infos->anongame_infos_ICON_REQ_TOURNEY,int_value);
  2512.     }
  2513. break;
  2514.       }
  2515.     }
  2516. free(buff);
  2517.     }
  2518.   
  2519.     if (anongame_infos_DESC)
  2520.       {
  2521. if (langID[0]!='')
  2522. {
  2523.   list_append_data(anongame_infos->anongame_infos_DESC_list,anongame_infos_DESC);
  2524. }
  2525. else
  2526.   {
  2527.     if (anongame_infos->anongame_infos_DESC == NULL)
  2528.       anongame_infos->anongame_infos_DESC = anongame_infos_DESC;
  2529.     else
  2530.       {
  2531. eventlog(eventlog_level_error,__FUNCTION__,"found another default_DESC block, deleting previous");
  2532. anongame_infos_DESC_destroy(anongame_infos->anongame_infos_DESC);
  2533. anongame_infos->anongame_infos_DESC = anongame_infos_DESC;
  2534.       }
  2535.   }
  2536.       }
  2537.     fclose(fp);
  2538.     
  2539.     anongame_infos_set_defaults(anongame_infos);
  2540. anongame_infos_data_load();
  2541.     return 0;
  2542. }
  2543. static int anongame_infos_data_load(void)
  2544. {
  2545. t_elem * curr;
  2546. t_packet * raw;
  2547. int j, k;
  2548. char ladr_count = 0;
  2549. char desc_count;
  2550. char mapscount_total;
  2551. char value;
  2552. char PG_gamestyles;
  2553. char AT_gamestyles;
  2554. char TY_gamestyles;
  2555. char anongame_prefix[ANONGAME_TYPES][5] = { /* queue */
  2556. /* PG 1v1 */ {0x00, 0x00, 0x03, 0x3F, 0x00}, /*  0 */
  2557. /* PG 2v2 */ {0x01, 0x00, 0x02, 0x3F, 0x00}, /*  1 */
  2558. /* PG 3v3 */ {0x02, 0x00, 0x01, 0x3F, 0x00}, /*  2 */
  2559. /* PG 4v4 */ {0x03, 0x00, 0x01, 0x3F, 0x00}, /*  3 */
  2560. /* PG sffa */ {0x04, 0x00, 0x02, 0x3F, 0x00}, /*  4 */
  2561. /* AT 2v2 */ {0x00, 0x00, 0x02, 0x3F, 0x02}, /*  5 */
  2562. /* AT tffa */ {0x01, 0x00, 0x02, 0x3F, 0x02}, /*  6 */
  2563. /* AT 3v3 */ {0x02, 0x00, 0x02, 0x3F, 0x03}, /*  7 */
  2564. /* AT 4v4 */ {0x03, 0x00, 0x02, 0x3F, 0x04}, /*  8 */
  2565. /* TY */ {0x00, 0x01, 0x00, 0x3F, 0x00}, /*  9 */
  2566. /* PG 5v5 */ {0x05, 0x00, 0x01, 0x3F, 0x00}, /* 10 */
  2567. /* PG 6v6 */ {0x06, 0x00, 0x01, 0x3F, 0x00}, /* 11 */
  2568. /* PG 2v2v2 */ {0x07, 0x00, 0x01, 0x3F, 0x00}, /* 12 */
  2569. /* PG 3v3v3 */ {0x08, 0x00, 0x01, 0x3F, 0x00}, /* 13 */
  2570. /* PG 4v4v4 */ {0x09, 0x00, 0x01, 0x3F, 0x00}, /* 14 */
  2571. /* PG 2v2v2v2 */ {0x0A, 0x00, 0x01, 0x3F, 0x00}, /* 15 */
  2572. /* PG 3v3v3v3 */ {0x0B, 0x00, 0x01, 0x3F, 0x00}, /* 16 */
  2573. /* AT 2v2v2 */ {0x04, 0x00, 0x02, 0x3F, 0x02} /* 17 */
  2574. };
  2575. /* hack to give names for new gametypes untill there added to anongame_infos.c */
  2576. char * anongame_gametype_names[ANONGAME_TYPES] = {
  2577.     "One vs. One",
  2578. "Two vs. Two",
  2579.     "Three vs. Three",
  2580.     "Four vs. Four",
  2581. "Small Free for All",
  2582.     "Two vs. Two",
  2583.     "Team Free for All",
  2584. "Three vs. Three",
  2585.     "Four vs. Four",
  2586.     "Tournament Game",
  2587. "Five vs. Five",
  2588.     "Six Vs. Six",
  2589.     "Two vs. Two vs. Two",
  2590. "3 vs. 3 vs. 3",
  2591.     "4 vs. 4 vs. 4",
  2592.     "2 vs. 2 vs. 2 vs. 2",
  2593. "3 vs. 3 vs. 3 vs. 3",
  2594.     "Two vs. Two vs. Two"
  2595. };
  2596. char const * game_clienttag[2] = { CLIENTTAG_WARCRAFT3, CLIENTTAG_WAR3XP };
  2597. char anongame_PG_section = 0x00;
  2598. char anongame_AT_section = 0x01;
  2599. char anongame_TY_section = 0x02;
  2600. /* set thumbsdown from the conf file */
  2601. for (j=0; j < ANONGAME_TYPES; j++)
  2602. anongame_prefix[j][2] = anongame_infos_get_thumbsdown(j);
  2603. if((raw = packet_create(packet_class_raw)) != NULL)
  2604. {
  2605.     packet_append_string(raw, anongame_infos_URL_get_server_url());
  2606.     packet_append_string(raw, anongame_infos_URL_get_player_url());
  2607.     packet_append_string(raw, anongame_infos_URL_get_tourney_url());
  2608. anongame_infos->anongame_infos_data_war3->url_len = packet_get_size(raw);
  2609. if((anongame_infos->anongame_infos_data_war3->url_data = (char *)malloc(anongame_infos->anongame_infos_data_war3->url_len)) != NULL)
  2610. {
  2611. memcpy(anongame_infos->anongame_infos_data_war3->url_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_war3->url_len), anongame_infos->anongame_infos_data_war3->url_len);
  2612. zlib_compress(anongame_infos->anongame_infos_data_war3->url_data, anongame_infos->anongame_infos_data_war3->url_len, &anongame_infos->anongame_infos_data_war3->url_comp_data, &anongame_infos->anongame_infos_data_war3->url_comp_len);
  2613. }
  2614. anongame_infos->anongame_infos_data_w3xp->url_len = packet_get_size(raw);
  2615. if((anongame_infos->anongame_infos_data_w3xp->url_data = (char *)malloc(anongame_infos->anongame_infos_data_w3xp->url_len)) != NULL)
  2616. {
  2617. memcpy(anongame_infos->anongame_infos_data_w3xp->url_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_w3xp->url_len), anongame_infos->anongame_infos_data_w3xp->url_len);
  2618. zlib_compress(anongame_infos->anongame_infos_data_w3xp->url_data, anongame_infos->anongame_infos_data_w3xp->url_len, &anongame_infos->anongame_infos_data_w3xp->url_comp_data, &anongame_infos->anongame_infos_data_w3xp->url_comp_len);
  2619. }
  2620. for(k = 0; k < 2; k++)
  2621. {
  2622. packet_set_size(raw, 0);
  2623.     mapscount_total = maplists_get_totalmaps(game_clienttag[k]);
  2624.     packet_append_data(raw, &mapscount_total, 1);
  2625.     maplists_add_maps_to_packet(raw, game_clienttag[k]);
  2626. if(k == 0)
  2627. {
  2628. anongame_infos->anongame_infos_data_war3->map_len = packet_get_size(raw);
  2629. if((anongame_infos->anongame_infos_data_war3->map_data = (char *)malloc(anongame_infos->anongame_infos_data_war3->map_len)) != NULL)
  2630. {
  2631. memcpy(anongame_infos->anongame_infos_data_war3->map_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_war3->map_len), anongame_infos->anongame_infos_data_war3->map_len);
  2632. zlib_compress(anongame_infos->anongame_infos_data_war3->map_data, anongame_infos->anongame_infos_data_war3->map_len, &anongame_infos->anongame_infos_data_war3->map_comp_data, &anongame_infos->anongame_infos_data_war3->map_comp_len);
  2633. }
  2634. }
  2635. else
  2636. {
  2637. anongame_infos->anongame_infos_data_w3xp->map_len = packet_get_size(raw);
  2638. if((anongame_infos->anongame_infos_data_w3xp->map_data = (char *)malloc(anongame_infos->anongame_infos_data_w3xp->map_len)) != NULL)
  2639. {
  2640. memcpy(anongame_infos->anongame_infos_data_w3xp->map_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_w3xp->map_len), anongame_infos->anongame_infos_data_w3xp->map_len);
  2641. zlib_compress(anongame_infos->anongame_infos_data_w3xp->map_data, anongame_infos->anongame_infos_data_w3xp->map_len, &anongame_infos->anongame_infos_data_w3xp->map_comp_data, &anongame_infos->anongame_infos_data_w3xp->map_comp_len);
  2642. }
  2643. }
  2644. }
  2645. for(k = 0; k < 2; k++)
  2646. {
  2647. packet_set_size(raw, 0);
  2648. value = 0;
  2649. PG_gamestyles = 0;
  2650. AT_gamestyles = 0;
  2651. TY_gamestyles = 0;
  2652.     /* count of gametypes (PG, AT, TY) */
  2653.     for (j=0; j < ANONGAME_TYPES; j++)
  2654. if (maplists_get_totalmaps_by_queue(game_clienttag[k], j)) {
  2655.     if (!anongame_prefix[j][1] && !anongame_prefix[j][4])
  2656. PG_gamestyles++;
  2657.     if (!anongame_prefix[j][1] && anongame_prefix[j][4])
  2658. AT_gamestyles++;
  2659.     if (anongame_prefix[j][1])
  2660. TY_gamestyles++;
  2661. }
  2662.     
  2663.     if (PG_gamestyles)
  2664. value++;
  2665.     if (AT_gamestyles)
  2666. value++;
  2667.     if (TY_gamestyles)
  2668. value++;
  2669.     
  2670.     packet_append_data(raw, &value, 1);
  2671.     
  2672.     /* PG */
  2673.     if (PG_gamestyles) {
  2674. packet_append_data(raw, &anongame_PG_section,1);
  2675. packet_append_data(raw, &PG_gamestyles,1);
  2676. for (j=0; j < ANONGAME_TYPES; j++)
  2677.     if (!anongame_prefix[j][1] && !anongame_prefix[j][4] &&
  2678.     maplists_get_totalmaps_by_queue(game_clienttag[k],j))
  2679.     {
  2680. packet_append_data(raw, &anongame_prefix[j], 5);
  2681. maplists_add_map_info_to_packet(raw, game_clienttag[k], j);
  2682.     }
  2683.     }
  2684.     
  2685.     /* AT */
  2686.     if (AT_gamestyles) {
  2687. packet_append_data(raw,&anongame_AT_section,1);
  2688. packet_append_data(raw,&AT_gamestyles,1);
  2689. for (j=0; j < ANONGAME_TYPES; j++)
  2690.     if (!anongame_prefix[j][1] && anongame_prefix[j][4] &&
  2691.     maplists_get_totalmaps_by_queue(game_clienttag[k],j))
  2692.     {
  2693. packet_append_data(raw, &anongame_prefix[j], 5);
  2694. maplists_add_map_info_to_packet(raw, game_clienttag[k], j);
  2695.     }
  2696.     }
  2697.     
  2698.     /* TY */
  2699.     if (TY_gamestyles) {
  2700. packet_append_data(raw, &anongame_TY_section,1);
  2701. packet_append_data(raw, &TY_gamestyles,1);
  2702. for (j=0; j < ANONGAME_TYPES; j++)
  2703.     if (anongame_prefix[j][1] &&
  2704.     maplists_get_totalmaps_by_queue(game_clienttag[k],j))
  2705.     {
  2706. /* set tournament races available */
  2707. anongame_prefix[j][3] = tournament_get_races();
  2708. /* set tournament type (PG or AT)
  2709.  * PG = 0
  2710.  * AT = number players per team */
  2711. if (tournament_is_arranged())
  2712.     anongame_prefix[j][4] = tournament_get_game_type();
  2713. else
  2714.     anongame_prefix[j][4] = 0;
  2715. packet_append_data(raw, &anongame_prefix[j], 5);
  2716. maplists_add_map_info_to_packet(raw, game_clienttag[k], j);
  2717.     }
  2718.     }
  2719. if(k == 0)
  2720. {
  2721. anongame_infos->anongame_infos_data_war3->type_len = packet_get_size(raw);
  2722. if((anongame_infos->anongame_infos_data_war3->type_data = (char *)malloc(anongame_infos->anongame_infos_data_war3->type_len)) != NULL)
  2723. {
  2724. memcpy(anongame_infos->anongame_infos_data_war3->type_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_war3->type_len), anongame_infos->anongame_infos_data_war3->type_len);
  2725. zlib_compress(anongame_infos->anongame_infos_data_war3->type_data, anongame_infos->anongame_infos_data_war3->type_len, &anongame_infos->anongame_infos_data_war3->type_comp_data, &anongame_infos->anongame_infos_data_war3->type_comp_len);
  2726. }
  2727. }
  2728. else
  2729. {
  2730. anongame_infos->anongame_infos_data_w3xp->type_len = packet_get_size(raw);
  2731. if((anongame_infos->anongame_infos_data_w3xp->type_data = (char *)malloc(anongame_infos->anongame_infos_data_w3xp->type_len)) != NULL)
  2732. {
  2733. memcpy(anongame_infos->anongame_infos_data_w3xp->type_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_w3xp->type_len), anongame_infos->anongame_infos_data_w3xp->type_len);
  2734. zlib_compress(anongame_infos->anongame_infos_data_w3xp->type_data, anongame_infos->anongame_infos_data_w3xp->type_len, &anongame_infos->anongame_infos_data_w3xp->type_comp_data, &anongame_infos->anongame_infos_data_w3xp->type_comp_len);
  2735. }
  2736. }
  2737. }
  2738. for(k = 0; k < 2; k++)
  2739. {
  2740. desc_count = 0;
  2741. packet_set_size(raw, 0);
  2742.     for (j=0; j < ANONGAME_TYPES; j++)
  2743. if (maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2744.     desc_count++;
  2745.     packet_append_data(raw,&desc_count,1);
  2746.     /* PG description section */
  2747.     for (j=0; j < ANONGAME_TYPES; j++)
  2748. if (!anongame_prefix[j][1] && !anongame_prefix[j][4] &&
  2749. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2750. {
  2751.     packet_append_data(raw, &anongame_PG_section, 1);
  2752.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2753.     
  2754.     if (anongame_infos_get_short_desc(NULL, j) == NULL)
  2755. packet_append_string(raw,anongame_gametype_names[j]);
  2756.     else
  2757. packet_append_string(raw,anongame_infos_get_short_desc(NULL, j));
  2758.     
  2759.     if (anongame_infos_get_long_desc(NULL, j) == NULL)
  2760. packet_append_string(raw,"No Descreption");
  2761.     else
  2762. packet_append_string(raw,anongame_infos_get_long_desc(NULL, j));
  2763. }
  2764.     /* AT description section */
  2765.     for (j=0; j < ANONGAME_TYPES; j++)
  2766. if (!anongame_prefix[j][1] && anongame_prefix[j][4] &&
  2767. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2768. {
  2769.     packet_append_data(raw, &anongame_AT_section, 1);
  2770.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2771.     packet_append_string(raw,anongame_infos_get_short_desc(NULL, j));
  2772.     packet_append_string(raw,anongame_infos_get_long_desc(NULL, j));
  2773. }
  2774.     /* TY description section */
  2775.     for (j=0; j < ANONGAME_TYPES; j++)
  2776. if (anongame_prefix[j][1] &&
  2777. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2778. {
  2779.     packet_append_data(raw, &anongame_TY_section, 1);
  2780.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2781.     packet_append_string(raw,anongame_infos_get_short_desc(NULL, j));
  2782.     packet_append_string(raw,anongame_infos_get_long_desc(NULL, j));
  2783. }
  2784. if(k == 0)
  2785. {
  2786. anongame_infos->anongame_infos_data_war3->desc_len = packet_get_size(raw);
  2787. if((anongame_infos->anongame_infos_data_war3->desc_data = (char *)malloc(anongame_infos->anongame_infos_data_war3->desc_len)) != NULL)
  2788. {
  2789. memcpy(anongame_infos->anongame_infos_data_war3->desc_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_war3->desc_len), anongame_infos->anongame_infos_data_war3->desc_len);
  2790. zlib_compress(anongame_infos->anongame_infos_data_war3->desc_data, anongame_infos->anongame_infos_data_war3->desc_len, &anongame_infos->anongame_infos_data_war3->desc_comp_data, &anongame_infos->anongame_infos_data_war3->desc_comp_len);
  2791. }
  2792. }
  2793. else
  2794. {
  2795. anongame_infos->anongame_infos_data_w3xp->desc_len = packet_get_size(raw);
  2796. if((anongame_infos->anongame_infos_data_w3xp->desc_data = (char *)malloc(anongame_infos->anongame_infos_data_w3xp->desc_len)) != NULL)
  2797. {
  2798. memcpy(anongame_infos->anongame_infos_data_w3xp->desc_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_w3xp->desc_len), anongame_infos->anongame_infos_data_w3xp->desc_len);
  2799. zlib_compress(anongame_infos->anongame_infos_data_w3xp->desc_data, anongame_infos->anongame_infos_data_w3xp->desc_len, &anongame_infos->anongame_infos_data_w3xp->desc_comp_data, &anongame_infos->anongame_infos_data_w3xp->desc_comp_len);
  2800. }
  2801. }
  2802. }
  2803. packet_set_size(raw, 0);
  2804.     /*FIXME: Still adding a static number (5)
  2805.     Also maybe need do do some checks to avoid prefs empty strings.*/
  2806.     ladr_count=6;
  2807.     packet_append_data(raw, &ladr_count, 1);
  2808.     packet_append_data(raw, "OLOS", 4);
  2809.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_1v1_desc(NULL));
  2810.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_1v1_url());
  2811.     packet_append_data(raw, "MAET", 4);
  2812.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_team_desc(NULL));
  2813.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_team_url());
  2814.     packet_append_data(raw, " AFF", 4);
  2815.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_ffa_desc(NULL));
  2816.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_ffa_url());
  2817.     packet_append_data(raw, "2SV2", 4);
  2818.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_2v2_desc(NULL));
  2819.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_2v2_url());
  2820.     packet_append_data(raw, "3SV3", 4);
  2821.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_3v3_desc(NULL));
  2822.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_3v3_url());
  2823.     packet_append_data(raw, "4SV4", 4);
  2824.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_4v4_desc(NULL));
  2825.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_4v4_url());
  2826. anongame_infos->anongame_infos_data_war3->ladr_len = packet_get_size(raw);
  2827. if((anongame_infos->anongame_infos_data_war3->ladr_data = (char *)malloc(anongame_infos->anongame_infos_data_war3->ladr_len)) != NULL)
  2828. {
  2829. memcpy(anongame_infos->anongame_infos_data_war3->ladr_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_war3->ladr_len), anongame_infos->anongame_infos_data_war3->ladr_len);
  2830. zlib_compress(anongame_infos->anongame_infos_data_war3->ladr_data, anongame_infos->anongame_infos_data_war3->ladr_len, &anongame_infos->anongame_infos_data_war3->ladr_comp_data, &anongame_infos->anongame_infos_data_war3->ladr_comp_len);
  2831. }
  2832. anongame_infos->anongame_infos_data_w3xp->ladr_len = packet_get_size(raw);
  2833. if((anongame_infos->anongame_infos_data_w3xp->ladr_data = (char *)malloc(anongame_infos->anongame_infos_data_w3xp->ladr_len)) != NULL)
  2834. {
  2835. memcpy(anongame_infos->anongame_infos_data_w3xp->ladr_data, packet_get_data_const(raw, 0, anongame_infos->anongame_infos_data_w3xp->ladr_len), anongame_infos->anongame_infos_data_w3xp->ladr_len);
  2836. zlib_compress(anongame_infos->anongame_infos_data_w3xp->ladr_data, anongame_infos->anongame_infos_data_w3xp->ladr_len, &anongame_infos->anongame_infos_data_w3xp->ladr_comp_data, &anongame_infos->anongame_infos_data_w3xp->ladr_comp_len);
  2837. }
  2838. packet_destroy(raw);
  2839. }
  2840. if((raw = packet_create(packet_class_raw)) != NULL)
  2841. {
  2842. LIST_TRAVERSE(anongame_infos->anongame_infos_DESC_list,curr)
  2843. {
  2844. t_anongame_infos_DESC * anongame_infos_DESC;
  2845. t_anongame_infos_data_lang * anongame_infos_data_lang_war3;
  2846. t_anongame_infos_data_lang * anongame_infos_data_lang_w3xp;
  2847. anongame_infos_DESC = elem_get_data(curr);
  2848. anongame_infos_data_lang_war3 = anongame_infos_data_lang_init(anongame_infos_DESC->langID);
  2849. anongame_infos_data_lang_w3xp = anongame_infos_data_lang_init(anongame_infos_DESC->langID);
  2850. for(k = 0; k < 2; k++)
  2851. {
  2852. desc_count = 0;
  2853. packet_set_size(raw, 0);
  2854.     for (j=0; j < ANONGAME_TYPES; j++)
  2855. if (maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2856.     desc_count++;
  2857.     packet_append_data(raw,&desc_count,1);
  2858.     /* PG description section */
  2859.     for (j=0; j < ANONGAME_TYPES; j++)
  2860. if (!anongame_prefix[j][1] && !anongame_prefix[j][4] &&
  2861. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2862. {
  2863.     packet_append_data(raw, &anongame_PG_section, 1);
  2864.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2865.     
  2866.     if (anongame_infos_get_short_desc(anongame_infos_DESC->langID, j) == NULL)
  2867. packet_append_string(raw,anongame_gametype_names[j]);
  2868.     else
  2869. packet_append_string(raw,anongame_infos_get_short_desc(anongame_infos_DESC->langID, j));
  2870.     
  2871.     if (anongame_infos_get_long_desc(anongame_infos_DESC->langID, j) == NULL)
  2872. packet_append_string(raw,"No Descreption");
  2873.     else
  2874. packet_append_string(raw,anongame_infos_get_long_desc(anongame_infos_DESC->langID, j));
  2875. }
  2876.     /* AT description section */
  2877.     for (j=0; j < ANONGAME_TYPES; j++)
  2878. if (!anongame_prefix[j][1] && anongame_prefix[j][4] &&
  2879. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2880. {
  2881.     packet_append_data(raw, &anongame_AT_section, 1);
  2882.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2883.     packet_append_string(raw,anongame_infos_get_short_desc(anongame_infos_DESC->langID, j));
  2884.     packet_append_string(raw,anongame_infos_get_long_desc(anongame_infos_DESC->langID, j));
  2885. }
  2886.     /* TY description section */
  2887.     for (j=0; j < ANONGAME_TYPES; j++)
  2888. if (anongame_prefix[j][1] &&
  2889. maplists_get_totalmaps_by_queue(game_clienttag[k], j))
  2890. {
  2891.     packet_append_data(raw, &anongame_TY_section, 1);
  2892.     packet_append_data(raw, &anongame_prefix[j][0], 1);
  2893.     packet_append_string(raw,anongame_infos_get_short_desc(anongame_infos_DESC->langID, j));
  2894.     packet_append_string(raw,anongame_infos_get_long_desc(anongame_infos_DESC->langID, j));
  2895. }
  2896. if(k == 0)
  2897. {
  2898. anongame_infos_data_lang_war3->desc_len = packet_get_size(raw);
  2899. if((anongame_infos_data_lang_war3->desc_data = (char *)malloc(anongame_infos_data_lang_war3->desc_len)) != NULL)
  2900. {
  2901. memcpy(anongame_infos_data_lang_war3->desc_data, packet_get_data_const(raw, 0, anongame_infos_data_lang_war3->desc_len), anongame_infos_data_lang_war3->desc_len);
  2902. zlib_compress(anongame_infos_data_lang_war3->desc_data, anongame_infos_data_lang_war3->desc_len, &anongame_infos_data_lang_war3->desc_comp_data, &anongame_infos_data_lang_war3->desc_comp_len);
  2903. }
  2904. }
  2905. else
  2906. {
  2907. anongame_infos_data_lang_w3xp->desc_len = packet_get_size(raw);
  2908. if((anongame_infos_data_lang_w3xp->desc_data = (char *)malloc(anongame_infos_data_lang_w3xp->desc_len)) != NULL)
  2909. {
  2910. memcpy(anongame_infos_data_lang_w3xp->desc_data, packet_get_data_const(raw, 0, anongame_infos_data_lang_w3xp->desc_len), anongame_infos_data_lang_w3xp->desc_len);
  2911. zlib_compress(anongame_infos_data_lang_w3xp->desc_data, anongame_infos_data_lang_w3xp->desc_len, &anongame_infos_data_lang_w3xp->desc_comp_data, &anongame_infos_data_lang_w3xp->desc_comp_len);
  2912. }
  2913. }
  2914. }
  2915. packet_set_size(raw, 0);
  2916.     /*FIXME: Still adding a static number (5)
  2917.     Also maybe need do do some checks to avoid prefs empty strings.*/
  2918.     ladr_count=6;
  2919.     packet_append_data(raw, &ladr_count, 1);
  2920.     packet_append_data(raw, "OLOS", 4);
  2921.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_1v1_desc(anongame_infos_DESC->langID));
  2922.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_1v1_url());
  2923.     packet_append_data(raw, "MAET", 4);
  2924.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_team_desc(anongame_infos_DESC->langID));
  2925.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_team_url());
  2926.     packet_append_data(raw, " AFF", 4);
  2927.     packet_append_string(raw, anongame_infos_DESC_get_ladder_PG_ffa_desc(anongame_infos_DESC->langID));
  2928.     packet_append_string(raw, anongame_infos_URL_get_ladder_PG_ffa_url());
  2929.     packet_append_data(raw, "2SV2", 4);
  2930.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_2v2_desc(anongame_infos_DESC->langID));
  2931.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_2v2_url());
  2932.     packet_append_data(raw, "3SV3", 4);
  2933.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_3v3_desc(anongame_infos_DESC->langID));
  2934.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_3v3_url());
  2935.     packet_append_data(raw, "4SV4", 4);
  2936.     packet_append_string(raw, anongame_infos_DESC_get_ladder_AT_4v4_desc(anongame_infos_DESC->langID));
  2937.     packet_append_string(raw, anongame_infos_URL_get_ladder_AT_4v4_url());
  2938. anongame_infos_data_lang_war3->ladr_len = packet_get_size(raw);
  2939. if((anongame_infos_data_lang_war3->ladr_data = (char *)malloc(anongame_infos_data_lang_war3->ladr_len)) != NULL)
  2940. {
  2941. memcpy(anongame_infos_data_lang_war3->ladr_data, packet_get_data_const(raw, 0, anongame_infos_data_lang_war3->ladr_len), anongame_infos_data_lang_war3->ladr_len);
  2942. zlib_compress(anongame_infos_data_lang_war3->ladr_data, anongame_infos_data_lang_war3->ladr_len, &anongame_infos_data_lang_war3->ladr_comp_data, &anongame_infos_data_lang_war3->ladr_comp_len);
  2943. }
  2944. list_append_data(anongame_infos->anongame_infos_data_lang_war3, anongame_infos_data_lang_war3);
  2945. anongame_infos_data_lang_w3xp->ladr_len = packet_get_size(raw);
  2946. if((anongame_infos_data_lang_w3xp->ladr_data = (char *)malloc(anongame_infos_data_lang_w3xp->ladr_len)) != NULL)
  2947. {
  2948. memcpy(anongame_infos_data_lang_w3xp->ladr_data, packet_get_data_const(raw, 0, anongame_infos_data_lang_w3xp->ladr_len), anongame_infos_data_lang_w3xp->ladr_len);
  2949. zlib_compress(anongame_infos_data_lang_w3xp->ladr_data, anongame_infos_data_lang_w3xp->ladr_len, &anongame_infos_data_lang_w3xp->ladr_comp_data, &anongame_infos_data_lang_w3xp->ladr_comp_len);
  2950. }
  2951. list_append_data(anongame_infos->anongame_infos_data_lang_w3xp, anongame_infos_data_lang_w3xp);
  2952. }
  2953. packet_destroy(raw);
  2954. }
  2955. return 0;
  2956. }
  2957. extern int anongame_infos_unload(void)
  2958. {
  2959. return anongame_infos_destroy(anongame_infos);
  2960. }
  2961. static int zlib_compress(void const * src, int srclen, char ** dest, int * destlen)
  2962. {
  2963.     char* tmpdata;
  2964.     z_stream zcpr;
  2965.     int ret;
  2966.     int lorigtodo;
  2967.     int lorigdone;
  2968.     int all_read_before;
  2969.     ret = Z_OK;
  2970.     lorigtodo = srclen;
  2971.     lorigdone = 0;
  2972.     *dest = NULL;
  2973.     tmpdata=(unsigned char*)malloc(srclen + (srclen/0x10) + 0x200 + 0x8000);
  2974.     if (!tmpdata) {
  2975. eventlog(eventlog_level_error, __FUNCTION__, "not enough memory for tmpdata");
  2976. return -1;
  2977.     }
  2978.     memset(&zcpr,0,sizeof(z_stream));
  2979.     pvpgn_deflateInit(&zcpr, 9);
  2980.     zcpr.next_in = (void *)src;
  2981.     zcpr.next_out = tmpdata;
  2982.     do {
  2983. all_read_before = zcpr.total_in;
  2984. zcpr.avail_in = (lorigtodo < 0x8000) ? lorigtodo : 0x8000;
  2985. zcpr.avail_out = 0x8000;
  2986. ret = pvpgn_deflate(&zcpr,(zcpr.avail_in == lorigtodo) ? Z_FINISH : Z_SYNC_FLUSH);
  2987. lorigdone += (zcpr.total_in-all_read_before);
  2988. lorigtodo -= (zcpr.total_in-all_read_before);
  2989.     } while (ret == Z_OK);
  2990.     (*destlen) = zcpr.total_out;
  2991.     if((*destlen)>0)
  2992.     {
  2993. (*dest) = malloc((*destlen) + 4);
  2994. if (!(*dest)) {
  2995.     eventlog(eventlog_level_error, __FUNCTION__, "not enough memory for dest");
  2996.     pvpgn_deflateEnd(&zcpr);
  2997.     free((void*)tmpdata);
  2998.     return -1;
  2999. }
  3000. bn_short_set((bn_short*)(*dest), lorigdone);
  3001. bn_short_set((bn_short*)(*dest + 2), *destlen);
  3002. memcpy((*dest)+4, tmpdata, (*destlen));
  3003. (*destlen) += 4;
  3004.     }
  3005.     pvpgn_deflateEnd(&zcpr);
  3006.     free((void*)tmpdata);
  3007.     return 0;
  3008. }