1 #include <stdio.h>
2 #include <libxml/xmlmemory.h>
3 #include <libxml/parser.h>
4 #include <libxml/tree.h>
5 #include <string.h>
6 #include <stdarg.h>
7 #include "translate.h"
8 #include "asc.h"
9 #include "elconfig.h"
10 #include "errors.h"
11 
12 #define GROUP 0
13 #define DIGROUP 1
14 #ifdef ELC
15 #define STAT_GROUP 2
16 #endif
17 
18 
19 #ifdef ELC
20 typedef struct
21 {
22 	char *name;
23 	const char *string;
24 } named_string;
25 
26 typedef struct
27 {
28 	char *name;
29 	size_t num_strings;
30 	named_string *strings;
31 } string_group;
32 
33 static string_group* named_strings = NULL;
34 static size_t num_named_strings = 0;
35 #endif
36 
37 /*! \name Tooltips*/
38 /*! \{ */
39 #ifdef ELC
40 char	tt_walk[30],
41 	tt_sit[30],
42 	tt_stand[30],
43 	tt_look[30],
44 	tt_use[30],
45 	tt_use_witem[30],
46 	tt_trade[30],
47 	tt_attack[30],
48 	tt_chat[30],
49 	tt_inventory[30],
50 	tt_spell[30],
51 	tt_manufacture[30],
52 	tt_stats[30],
53 	tt_knowledge[30],
54 	tt_encyclopedia[30],
55 	tt_questlog[30],
56 	tt_mapwin[30],
57 	tt_console[30],
58 	tt_buddy[30],
59 	tt_options[30],
60 	tt_help[30],
61 	tt_customize[60],
62 	newchar_warning[50],
63 	newchar_cust_help[100],
64 	newchar_cred_help[100],
65 	newchar_done_help[100],
66 	tt_name[60],
67 	tt_info[30],
68 	tt_emotewin[30],
69 	tt_rangewin[30],
70 	tt_minimap[30];
71 
72 #endif // ELC
73 
74 /*! \} */
75 
76 #ifdef ELC
77 /*! \name Options*/
78 /*! \{ */
79 dichar	opt_shadows,
80 	opt_clouds,
81 	opt_reflections,
82 	opt_show_fps,
83 	opt_sit_lock,
84 	opt_caps_filter,
85 	opt_sound,
86 	opt_music,
87 	opt_autocam,
88 	opt_exit,
89 	opt_full_screen,
90 	opt_strings;
91 
92 char 	switch_video_mode[50],
93 	opt_options[20],
94 	opt_vidmode[20];
95 #endif
96 /*! \} */
97 
98 #ifdef ELC
99 /*! \name Sigils/spells */
100 /*! \{ */
101 char 	sig_too_few_sigs[50];
102 
103 dichar	sig_change,
104 	sig_restore,
105 	sig_space,
106 	sig_increase,
107 	sig_decrease,
108 	sig_temp,
109 	sig_perm,
110 	sig_move,
111 	sig_local,
112 	sig_global,
113 	sig_fire,
114 	sig_water,
115 	sig_air,
116 	sig_earth,
117 	sig_spirit,
118 	sig_matter,
119 	sig_energy,
120 	sig_magic,
121 	sig_destroy,
122 	sig_create,
123 	sig_knowledge,
124 	sig_protection,
125 	sig_remove,
126 	sig_health,
127 	sig_life,
128 	sig_death;
129 #endif
130 /*! \} */
131 
132 #ifdef ELC
133 /*! \name Help messages*/
134 /*! \{ */
135 char
136 	/*3d_objects.c*/
137 	values_str[20],
138 	/*buddy.c*/
139 	buddy_name_str[20],
140 	buddy_long_name_str[100],
141 	buddy_type_str[20],
142 	buddy_long_type_str[100],
143 	buddy_add_str[30],
144 	buddy_change_str[30],
145 	buddy_accept_str[30],
146 	yes_str[10],
147 	no_str[10],
148 	buddy_delete_str[20],
149 	buddy_long_delete_str[100],
150 	buddy_wants_to_add_str[150],
151 	buddy_add_to_list_str[180],
152 	buddy_logon_str[30],
153 	buddy_online_str[30],
154 	buddy_logoff_str[30],
155 	buddy_white_str[10],
156 	buddy_red_str[10],
157 	buddy_green_str[10],
158 	buddy_blue_str[10],
159 	buddy_yellow_str[10],
160 	buddy_request_str[10],
161 	/* chat.c */
162 	channel_help_str[200],
163 	channel_color_title_str[30],
164 	channel_color_str[40],
165 	channel_color_add_str[20],
166 	channel_color_delete_str[20],
167 	/* console.c */
168 	help_cmd_markpos_str[50],
169 	location_info_str[40],
170 	knowledge_cmd_str[40],
171 	marked_str[30],
172 	unmarked_str[30],
173 	urlcmd_none_str[30],
174 	urlcmd_list_str[30],
175 	win_url_str[30],
176 	urlcmd_invalid_str[30],
177 	urlcmd_afk_str[30],
178 	urlcmd_clear_str[30],
179 	urlwin_open_str[50],
180 	urlwin_clear_str[30],
181 	/*draw_scene.c*/
182 	low_framerate_str[100],
183 	/* elconfig */
184 	multiselect_find_prompt_str[40],
185 	multiselect_find_help_str[80],
186 	/* encyclopedia */
187 	encycl_search_prompt_str[25],
188 	/*gamewin.c*/
189 	ranginglock_enabled_str[100],
190 	ranginglock_disabled_str[50],
191 	close_click_targetting_on_str[50],
192 	close_click_targetting_off_str[50],
193 	/* gl_init.c and window size strings */
194 	window_size_adjusted_str[50],
195 	reset_res_str[50],
196 	set_res_str[50],
197 	save_res_str[50],
198 	show_res_str[50],
199 	/*hud.c*/
200 	no_open_on_trade[100],
201 	stats_scroll_help_str[100],
202 	cm_statsbar_str[70],
203 	hud_timer_cm_str[100],
204 	hud_timer_popup_title_str[25],
205 	/* hud_indicators.cpp */
206 	no_indicators_str[20],
207 	cm_indicators_str[85],
208 	day_indicator_str[60],
209 	harvest_indicator_str[60],
210 	poison_indicator_str[60],
211 	messages_indicator_str[60],
212 	ranginglock_indicator_str[70],
213 	glowperk_indicator_str[100],
214 	/*loginwin.c*/
215 	login_username_str[20],
216 	login_password_str[20],
217 	login_rules_str[120],
218 	passmngr_enabled_str[70],
219 	passmngr_disabled_str[70],
220 	passmngr_remember_details_str[70],
221 	passmngr_error_str[70],
222 	password_format_str[150],
223 	show_passwords_str[30],
224 	login_select_window_str[30],
225 	/*items.c*/
226 	sto_all_str[8],
227 	get_all_str[8],
228 	drp_all_str[8],
229 	itm_lst_str[8],
230 	mix_one_str[8],
231 	mix_all_str[8],
232 	auto_get_all_str[30],
233 	item_list_but_str[35],
234 	inv_keeprow_str[30],
235 	quantity_edit_str[100],
236 	equip_here_str[100],
237 	items_text_toggle_help_str[50],
238 	items_unequip_all_help_str[30],
239 	items_doubleclick_unequip_all_help_str[50],
240 	equip_str[20],
241 	mod_click_item_help_str[50],
242 	multiuse_item_help_str[50],
243 	stoall_help_str[50],
244 	getall_help_str[50],
245 	dcdrpall_help_str[50],
246 	drpall_help_str[50],
247 	itmlst_help_str[50],
248 	mixoneall_help_str[50],
249 	items_stack_str[100],
250 	items_cannot_equip_str[100],
251 	mixbut_empty_str[80],
252 	mix_empty_str[50],
253 	click_clear_str[50],
254 	double_click_clear_str[50],
255 	recipe_select_str[50],
256 	recipe_load_str[50],
257 	recipe_find_str[50],
258 	recipe_during_find_str[50],
259 	recipe_show_hide_str[70],
260 	recipe_save_str[70],
261 	/*knowledge.c*/
262 	completed_research[12],
263 	lessthanaminute_str[30],
264 	researching_str[30],
265 	not_researching_anything[25],
266 	not_researching_str[25],
267 	countdown_str[20],
268 	stopwatch_str[20],
269 	minutes_str[15],
270 	minute_str[15],
271 	idle_str[15],
272 	knowledge_read_book[15],
273 	knowledge_read_book_tag[15],
274 	knowledge_unread_book_tag[15],
275 	knowledge_reading_book_tag[15],
276 	knowledge_param_read[15],
277 	knowledge_param_unread[15],
278 	knowledge_param_total[15],
279 	unknown_book_short_str[50],
280 	unknown_book_long_str[150],
281 	know_highlight_prompt_str[20],
282 	know_highlight_cm_str[70],
283 	/*manufacture.c*/
284 	mix_str[5],
285 	mixall_str[10],
286 	clear_str[6],
287 	reset_str[6],
288 	manu_add_str[60],
289 	manu_remove_str[60],
290 	/*multiplayer.c*/
291 	connect_to_server_str[50],
292 	reconnect_str[50],
293 	test_server_connect_str[40],
294 	server_connect_test_failed_str[40],
295 	alt_x_quit[50],
296 	license_check[150],
297 	/*new_character.c*/
298 	skin_str[15],
299 	hair_str[15],
300 	eyes_str[15],
301 	shirt_str[15],
302 	pants_str[15],
303 	boots_str[15],
304 	head_str[15],
305 	gender_str[15],
306 	male_str[15],
307 	female_str[15],
308 	race_str[15],
309 	human_str[15],
310 	elf_str[15],
311 	dwarf_str[15],
312 	gnome_str[15],
313 	orchan_str[15],
314 	draegoni_str[15],
315 	confirm_password[30],
316 	error_username_length[50],
317 	error_password_length[50],
318 	error_pass_no_match[30],
319 	error_bad_pass[30],
320 	error_confirm_create_char[100],
321 	error_max_digits[100],
322 	error_length[100],
323 	error_illegal_character[100],
324 	passwords_match[30],
325 	remember_change_appearance[200],
326 	appearance_str[15],
327 	p2p_race[100],
328 	char_help[200],
329 	invalid_pass[30],
330 	show_password[30],
331 	remember_details_str[30],
332 	hide_password[30],
333 	char_done[15],
334 	char_back[15],
335 	about_human[30],
336 	about_elves[30],
337 	about_dwarfs[30],
338 	about_gnomes[30],
339 	about_orchans[30],
340 	about_draegoni[30],
341 	zoom_in_out[200],
342 	rotate_camera[200],
343 	/*pm_log.c*/
344 	going_afk[30],
345 	not_afk[50],
346 	new_messages[100],
347 	afk_names[15],
348 	afk_messages[25],
349 	afk_print_help[150],
350 	/* ranging window */
351 	ranging_win_title_str[20],
352 	ranging_total_shots_str[40],
353 	ranging_sucessful_shots_str[40],
354 	ranging_missed_shots_str[40],
355 	ranging_success_rate_str[40],
356 	ranging_critical_rate_str[40],
357 	ranging_exp_per_arrow_str[40],
358 	/* storage */
359 	storage_filter_prompt_str[15],
360 	storage_filter_help_str[40],
361 	/* session.c */
362 	session_reset_help[60],
363 	/*trade.c*/
364 	quantity_str[30],
365 	abort_str[10],
366 	you_str[10],
367 	accept_str[12],
368 	/*update.c*/
369 	update_complete_str[40],
370 	rotate_chat_log_restart_str[80],
371 	client_restart_countdown_str[40],
372 	client_restarting_str[20],
373 	restart_now_label[20],
374 	/* context menu strings */
375 	cm_quickspell_menu_str[150],
376 	cm_textedit_menu_str[100],
377 	cm_quickbar_menu_str[150],
378 	cm_hud_menu_str[270],
379 	cm_banner_menu_str[240],
380 	cm_title_menu_str[150],
381 	cm_title_help_str[50],
382 	cm_items_menu_str[190],
383 	cm_storage_menu_str[110],
384 	cm_astro_menu_str[80],
385 	cm_ranging_menu_str[50],
386 	cm_dialog_options_str[80],
387 	cm_dialog_menu_str[60],
388 	cm_url_menu_str[150],
389 	cm_counters_menu_str[160],
390 	cm_help_options_str[50],
391 	cm_npcname_menu_str[60],
392 	cm_dialog_copy_menu_str[50],
393 	cm_minimap_menu_str[60],
394 	cm_user_menu_str[200],
395 	cm_item_list_selected_str[40],
396 	cm_item_list_names_str[200],
397 	cm_stats_bar_base_str[70],
398 	cm_recipe_menu_str[100],
399 	cm_manuwin_menu_str[50],
400 	cm_encycl_base_str[150],
401 	cm_options_default_str[50],
402 	cm_options_initial_str[50],
403 #ifdef JSON_FILES
404 	cm_options_per_character_str[50],
405 #endif
406 	/* user_menus.cpp */
407 	um_invalid_command_str[50],
408 	um_invalid_line_str[50],
409 	um_no_menus_str[50],
410 	um_window_title_str[50],
411 	/* quest_log.cpp */
412 	cm_questlog_menu_str[400],
413 	cm_questlist_menu_str[150],
414 	questlog_find_prompt_str[30],
415 	questlog_add_npc_prompt_str[20],
416 	questlog_add_text_prompt_str[20],
417 	questlog_npc_filter_title_str[20],
418 	questlist_filter_title_str[20],
419 	questlist_showall_str[20],
420 	questlog_cm_help_str[50],
421 	questlog_deldupe_start_str[50],
422 	questlog_deldupe_end_str[75],
423 	questlog_deleted_str[20],
424 	/* new_character.c */
425 	use_appropriate_name[500],
426 	item_list_use_help_str[40],
427 	item_list_pickup_help_str[40],
428 	item_list_edit_help_str[40],
429 	item_list_add_help_str[40],
430 	item_list_drag_help_str[40],
431 	item_list_create_help_str[40],
432 	item_list_find_str[20],
433 	item_list_find_help_str[40],
434 	item_list_find_help_disabled_str[40];
435 #endif
436 /*! \} */
437 
438 #ifdef ELC
439 /*! \name Console*/
440 /*! \{ */
441 char	name_too_long[75],
442 	name_too_short[75],
443 	not_added_to_ignores[75],
444 	already_ignoring[50],
445 	ignore_list_full[100],
446 	added_to_ignores[50],
447 	no_ignores_str[50],
448 	ignores_str[50],
449 	word_too_long[75],
450 	word_too_short[75],
451 	not_added_to_filter[50],
452 	already_filtering[50],
453 	filter_list_full[100],
454 	added_to_filters[50],
455 	no_filters_str[50],
456 	filters_str[50],
457 	not_removed_from_ignores[50],
458 	not_ignoring[75],
459 	removed_from_ignores[50],
460 	not_removed_from_filter[50],
461 	not_filtering[75],
462 	removed_from_filter[50],
463 	video_card_str[20],
464 	video_vendor_str[20],
465 	opengl_version_str[20],
466 	supported_extensions_str[30],
467 	pm_from_str[10],
468 	gm_from_str[10],
469 	ig_from_str[10],
470 	mc_from_str[20],
471 	mod_pm_from_str[15],
472 	help_request_str[20],
473 	help_cmd_str[10],
474 	date_format[100],
475 	book_count_str[60],
476 	know_help_str[60],
477 	char_cmd_str[2],
478 	char_at_str[2],
479 	char_slash_str[2],
480 	gm_cmd_str[5],
481 	mod_cmd_str[5],
482 	bc_cmd_str[5],
483 	msg_accept_buddy_str[55],
484 	full_save_str[80],
485 	local_only_save_str[40],
486 	logconn_str[50],
487 	time_warn_hour_str[75],
488 	time_warn_sunrise_str[100],
489 	time_warn_sunset_str[100],
490 	time_warn_day_str[75],
491 	config_location_str[75],
492 	datadir_location_str[75],
493 	no_spell_to_show_str[40],
494 	invalid_spell_string_str[40],
495 	command_too_long_str[40],
496 	item_list_learn_cat_str[90],
497 	item_uid_help_str[80],
498 	item_use_not_unique_str[80],
499 	item_use_get_failed_str[80],
500 	item_info_load_failed_str[80],
501 	commands_help_prefix_str[20],
502 	commands_help_not_loaded_str[60],
503 	commands_help_not_recognsed_str[40],
504 	commands_help_description_help_str[100],
505 	cmd_ignores[20],
506 	cmd_ignore[20],
507 	cmd_unignore[20],
508 	cmd_filter[20],
509 	cmd_filters[20],
510 	cmd_unfilter[20],
511 	cmd_glinfo[10],
512 	cmd_knowledge[20],
513 	cmd_knowledge_short[10],
514 	cmd_markpos[20],
515 	cmd_mark[20],
516 	cmd_unmark[20],
517 	cmd_stats[10],
518 	cmd_time[10],
519 	cmd_date[10],
520 	cmd_exit[10],
521 	cmd_msg[10],
522 	cmd_afk[5],
523 	cmd_keypress[20],
524 	cmd_user_menu_wait_time_ms[30],
525 	cmd_open_url[20],
526 	cmd_show_spell[20],
527 	cmd_cast_spell[20],
528 	cmd_reload_icons[20],
529 	cmd_session_counters[20],
530 	cmd_relogin[20],
531 	cmd_disconnect[20],
532 	cmd_disco[20];
533 /*! \} */
534 #endif
535 
536 /*! \name Errors */
537 /*! \{ */
538 char	reg_error_str[15],
539 	file_write_error_str[20],
540 	/*2d_objects.c*/
541 	cant_load_2d_object[30],
542 	cant_open_file[30],
543 	/*3d_objects.c*/
544 	object_error_str[30],
545 	nasty_error_str[50],
546 	corrupted_object[100],
547 	bad_object[30],
548 	multiple_material_same_texture[100],
549 	invalid_map[40],
550 #ifdef ELC
551 	/*actors.c*/
552 	cant_load_actor[30],
553 	cant_find_frame[30],
554 	unknown_frame[20],
555 	/*actor_scripts.c*/
556 	resync_server[50],
557 	cant_add_command[50],
558 	/* books.c */
559 	book_open_err_str[30],
560 	/*cache.c*/
561 	cache_items_str[20],
562 	cache_size_str[20],
563 	/* cal.c */
564 	no_animation_err_str[30],
565 	/* console.c */
566 	invalid_location_str[30],
567 	/*cursors.c*/
568 	cursors_file_str[30],
569 	/*dialogues.c*/
570 	close_str[20],
571 	dialogue_copy_str[20],
572 	dialogue_repeat_str[20],
573 	open_storage_str[20],
574 	reopen_storage_str[50],
575 #endif
576 	xml_bad_node[80],
577 	xml_bad_root_node[50],
578 	xml_undefined_node[80],
579 	using_builtin_chanlist[120],
580 	using_eng_chanlist[120],
581 	/*font.c*/
582 	cant_load_font[30],
583 #ifdef ELC
584 	/*gamewin.c*/
585 	no_walk_with_sitlock[100],
586 	/*init.c*/
587 	no_stencil_str[150],
588 	safemode_str[150],
589 	no_sdl_str[30],
590 	no_hardware_stencil_str[150],
591 	suggest_24_or_32_bit[150],
592 	fail_opengl_mode[30],
593 	stencil_falls_back_on_software_accel[150],
594 	last_chance_str[150],
595 	software_mode_str[200],
596 	gl_ext_found[100],
597 	gl_ext_found_not_used[100],
598 	gl_ext_not_found[100],
599 	gl_ext_no_multitexture[150],
600 	disabled_shadow_mapping[50],
601 	shadow_map_size_not_supported_str[100],
602 	disabled_framebuffer[50],
603 	/* framebuffer.c */
604 	fbo_attachment_error[100],
605 	fbo_missing_attachment_error[100],
606 	fbo_dimensions_error[100],
607 	fbo_formats_error[100],
608 	fbo_draw_buffer_error[100],
609 	fbo_read_buffer_error[100],
610 	fbo_unsupported_fromat_error[100],
611 	fbo_unknown_error[100],
612 	fbo_supported_format[100],
613 	gl_ext_not_found_emul_it[100],
614 	fatal_error_str[10],
615 	no_e3d_list[50],
616 	enabled_vertex_arrays[50],
617 	disabled_compiled_vertex_arrays[50],
618 	disabled_point_particles[50],
619 	disabled_particles_str[50],
620 	invalid_video_mode[75],
621 	failed_sdl_net_init[30],
622 	failed_sdl_timer_init[30],
623 	must_use_tabs[80],
624 	init_opengl_str[35],
625 	init_random_str[35],
626 	load_ignores_str[35],
627 	load_filters_str[35],
628 	load_lists_str[35],
629 	load_cursors_str[35],
630 	bld_glow_str[35],
631 	init_lists_str[35],
632 	init_actor_defs_str[35],
633 	load_map_tiles_str[35],
634 	init_lights_str[35],
635 	init_logs_str[35],
636 	read_config_str[35],
637 	init_weather_str[35],
638 	init_audio_str[35],
639 	load_icons_str[35],
640 	load_textures_str[35],
641 #ifdef PAWN
642 	init_pawn_str[35],
643 #endif // PAWN
644 	init_network_str[35],
645 	init_timers_str[35],
646 	load_encyc_str[35],
647 	init_display_str[35],
648 	prep_op_win_str[35],
649 	/* interface;c */
650 	err_mapmarks_str[60],
651 	err_nomap_str[60],
652 	/* map_io.c */
653 	load_map_str[35],
654 	load_3d_object_str[35],
655 	load_2d_object_str[35],
656 	load_lights_str[35],
657 	load_particles_str[35],
658 	bld_sectors_str[35],
659 	init_done_str[35],
660 	/* mines.c */
661 	mines_config_open_err_str[50],
662 	mines_config_error[50],
663 	/* misc.c */
664 #ifdef PNG_SCREENSHOT
665 	max_screenshots_warning_str[200],
666 #endif //PNG_SCREENSHOT
667 	/*multiplayer.c*/
668 	failed_resolve[150],
669 	failed_connect[100],
670 	redefine_your_colours[250],
671 	char_dont_exist[30],
672 	char_name_in_use[50],
673 	server_latency[30],
674 	update_your_client[100],
675 	client_ver_not_supported[100],
676 	packet_overrun[50],
677 	disconnected_from_server[100],
678 	user_disconnect_str[20],
679 	cant_change_map[100],
680 	empty_map_str[100],
681 	no_nomap_str[150],
682 	/*new_actors.c*/
683 	error_body_part[30],
684 	error_head[15],
685 	error_torso[15],
686 	error_weapon[15],
687 	error_helmet[15],
688 	error_cape[15],
689 	duplicate_npc_actor[50],
690 	duplicate_actors_str[50],
691 	bad_actor_name_length[50],
692 	/* item lists */
693 	item_list_format_error[50],
694 	item_list_save_error_str[50],
695 	item_list_cat_format_error_str[50],
696 	item_list_version_error_str[70],
697 	item_list_empty_list_str[50],
698 #endif
699 	/*particles.c*/
700 	particles_filever_wrong[100],
701 	particle_system_overrun[100],
702 	particle_strange_pos[100],
703 	particle_system_dump[50],
704 	particles_disabled_str[50],
705 	point_sprites_enabled[50],
706 	using_textured_quads[50],
707 	definitions_str[20],
708 	part_sys_str[20],
709 	part_part_str[20]
710 #ifdef ELC
711 	/*paste.c*/
712 	,not_ascii[20],
713 	/*rules.c*/
714 	you_can_proceed[50],
715 	accepted_rules[80],
716 	accept_label[20],
717 	read_rules_str[50],
718 	parse_rules_str[50],
719 	rules_not_found[100],
720 	/*sound.c*/
721 	snd_wav_load_error[50],
722 	snd_ogg_load_error[50],
723 	snd_ogg_stream_error[50],
724 	snd_buff_error[50],
725 	snd_invalid_number[50],
726 	snd_source_error[50],
727 	snd_skip_speedup[50],
728 	snd_too_slow[50],
729 	snd_stop_fail[50],
730 	snd_init_error[50],
731 	snd_config_open_err_str[50],
732 	snd_config_error[50],
733 	snd_sound_overflow[50],
734 	snd_media_read[50],
735 	snd_media_notvorbis[50],
736 	snd_media_ver_mismatch[50],
737 	snd_media_invalid_header[50],
738 	snd_media_internal_error[50],
739 	snd_media_false[50],
740 	snd_media_eof[50],
741 	snd_media_hole[50],
742 	snd_media_einval[50],
743 	snd_media_ebadlink[50],
744 	snd_media_enoseek[50],
745 	snd_media_ogg_error[50],
746 	snd_no_music[50],
747 	snd_media_music_stopped[50],
748 	snd_media_ogg_info[50],
749 	snd_media_ogg_info_noartist[50],
750 	/*stats.c*/
751 	stat_no_invalid[50],
752 	/*timers.c*/
753 	timer_lagging_behind[100],
754 	/*spells.c*/
755 	cast_str[20],
756 	invalid_spell_str[20],
757 	/* notepad.c */
758 	cant_parse_notes[100],
759 	notes_wrong[100],
760 	too_many_notes[100],
761 	wrong_note_node[100],
762 	cant_save_notes[100],
763 	exceed_note_buffer[100],
764 	user_no_more_notes[100],
765 	user_no_more_note_tabs[100],
766 	fatal_data_error[120],
767 	dc_note_remove[50],
768 	character_notes_saved_str[70],
769 	notes_save_tooltip_str[40],
770 	using_character_notes_str[60],
771 	cm_use_character_notepad_str[60],
772 	note_saved[50],
773 	note_save_failed[50],
774 	/* encyclopedia */
775 	cant_load_encycl[70],
776 	/* text.c */
777 	invalidnpcmark_str[50],
778 	warn_currently_ignoring[50];
779 #else
780 	;
781 #endif  // ELC
782 /*! \} */
783 
784 #ifdef ELC
785 /*! \name Window/Tab titles */
786 /*! \{ */
787 char	win_notepad[20],
788 	win_prompt[10],
789 	win_statistics[20],
790 	win_sigils[10],
791 	win_help[10],
792 	win_buddy[10],
793 	win_configuration[20],
794 	win_manufacture[20],
795 	win_astrology[20],
796 	win_principal[20],
797 	win_storage[10],
798 	win_storage_vo[15],
799 	win_trade[10],
800 	win_rules[10],
801 	win_bag[5],
802 	win_inventory[15],
803 	win_newchar[20],
804 	win_minimap[20],
805 	win_name_pass[30],
806 	win_design[25],
807 	ttab_controls[10],
808 	ttab_audio[10],
809 	ttab_hud[5],
810 	ttab_server[10],
811 	ttab_chat[10],
812 	ttab_video[10],
813 	ttab_gfx[10],
814 	ttab_camera[15],
815 	ttab_troubleshoot[15],
816 	ttab_font[10],
817 	tab_help[10],
818 	tab_encyclopedia[20],
819 	tab_skills[20],
820 	tab_rules[20],
821 	tab_statistics[20],
822 	tab_knowledge[20],
823 	tab_questlog[20],
824 	tab_counters[20],
825 	tab_session[20],
826 	tab_main[20],
827 	item_list_name_str[30],
828 	item_list_rename_str[30],
829 	item_list_preview_title[30],
830 	item_list_quantity_str[20],
831 	button_okay[10],
832 	button_send[10],
833 	button_cancel[10],
834 	button_new_category[30],
835 	button_remove_category[30],
836 	button_save_notes[30],
837 	label_note_name[20],
838 	game_version_str[60],
839 	game_version_prefix_str[60],
840 	label_cursor_coords[17],
841 	label_mark_filter[13];
842 #endif  // ELC
843 /*! \} */
844 
845 #ifdef ELC
846 #define CONSOLE_STR 5
847 #define ERRORS 7
848 #define HELP_STR 5
849 #define OPTIONS_STR 1
850 #define SIGILS_STR 1
851 #define STATS_STR 5
852 #define STATS_EXTRA 1
853 #define TITLES_STR 1
854 #endif
855 
856 #ifdef MAP_EDITOR
857 #define ERRORS 1
858 #endif
859 
860 group_id * errors;
861 group_id_di * options_str;
862 #ifdef ELC
863 group_id * console_str;
864 group_id * help_str;
865 group_id_di * sigils_str;
866 group_stat * stats_str;
867 group_id * stats_extra;
868 group_id * titles_str;
869 #endif
870 
871 void init_console(void);
872 void init_help(void);
873 void init_spell_translatables ();
874 void init_stats(void);
875 void init_titles(void);
876 void init_errors(void);
877 void * add_xml_group(int type, int no, ...);
878 void free_xml_parser(int type, void * gPtr, int no);
879 void parse_errors(xmlNode * in);
880 #ifdef ELC
881 void parse_console(xmlNode * in);
882 void parse_help(xmlNode * in);
883 void parse_options(xmlNode * in);
884 void parse_spells(xmlNode * in);
885 void parse_stats(xmlNode * in);
886 void parse_titles(xmlNode * in);
887 #endif
888 struct xml_struct load_strings(char * file);
889 struct xml_struct load_strings_file(char * filename);
890 
init_groups()891 void init_groups()
892 {
893 #ifdef ELC
894 	console_str=add_xml_group(GROUP,CONSOLE_STR,"filter","ignore","misc","loading_msg","cmd");
895 	errors=add_xml_group(GROUP,ERRORS,"actors","load","misc","particles","snd","video","rules");
896 	help_str=add_xml_group(GROUP,HELP_STR,"afk","misc","new","tooltips","buddy");
897 	options_str=add_xml_group(DIGROUP,OPTIONS_STR,"options");
898 	sigils_str=add_xml_group(DIGROUP,SIGILS_STR,"sigils");
899 	stats_str=add_xml_group(STAT_GROUP,STATS_STR,"base","cross","misc","nexus","skills");
900 	stats_extra=add_xml_group(GROUP,STATS_EXTRA,"extra");
901 	titles_str = add_xml_group (GROUP, TITLES_STR, "titles");
902 #endif
903 #ifdef MAP_EDITOR
904 	errors=add_xml_group(GROUP,ERRORS,"particles");
905 #endif
906 }
907 
add_xml_group(int type,int no,...)908 void * add_xml_group(int type, int no, ...)
909 {
910 	va_list ap;
911 	int i=0;
912 	va_start(ap, no);
913 	switch(type){
914 		case GROUP: {
915 			group_id * grp;
916 			grp=(group_id*)calloc(no,sizeof(group_id));
917 			for(;i<no;i++)
918 				safe_snprintf (grp[i].xml_id, sizeof (grp[i].xml_id), "%s", va_arg (ap, char*));
919 			va_end(ap);
920 			return grp;
921 		}
922 		case DIGROUP: {
923 			group_id_di * grp;
924 			grp=(group_id_di*)calloc(no,sizeof(group_id_di));
925 			for(;i<no;i++)
926 				safe_snprintf (grp[i].xml_id, sizeof (grp[i].xml_id), "%s", va_arg (ap, char*));
927 			va_end(ap);
928 			return grp;
929 		}
930 #ifdef ELC
931 		case STAT_GROUP: {
932 			group_stat * grp;
933 			grp=(group_stat*)calloc(no,sizeof(group_stat));
934 			for(;i<no;i++)
935 				safe_snprintf (grp[i].xml_id, sizeof (grp[i].xml_id), "%s", va_arg (ap, char*));
936 			va_end(ap);
937 			return grp;
938 		}
939 #endif
940 		default:
941 			va_end(ap);
942 			return NULL;
943 	}
944 }
945 
add_xml_distringid(group_id_di * group,char * xml_id,dichar * var,char * str,char * desc)946 void add_xml_distringid(group_id_di * group, char * xml_id, dichar * var, char * str, char * desc)
947 {
948 	group->distrings=(distring_item**)realloc(group->distrings,(group->no+1)*sizeof(distring_item*));
949 	group->distrings[group->no]=(distring_item*)calloc(1,sizeof(distring_item));
950 	safe_snprintf (group->distrings[group->no]->xml_id, sizeof (group->distrings[group->no]->xml_id), "%s", xml_id);
951 	group->distrings[group->no]->var=var;
952 	safe_snprintf((char*)var->str, sizeof(var->str), "%s", str);
953 	safe_snprintf((char*)var->desc, sizeof(var->desc), "%s", desc);
954 	group->no++;
955 }
956 
957 #ifdef ELC
add_xml_statid(group_stat * group,char * xml_id,names * var,char * name,char * shortname)958 void add_xml_statid(group_stat * group, char * xml_id, names * var, char * name, char * shortname)
959 {
960 	group->statstrings=(statstring_item**)realloc(group->statstrings,(group->no+1)*sizeof(statstring_item*));
961 	group->statstrings[group->no]=(statstring_item*)calloc(1,sizeof(statstring_item));
962 	safe_snprintf (group->statstrings[group->no]->xml_id, sizeof (group->statstrings[group->no]->xml_id), "%s", xml_id);
963 	group->statstrings[group->no]->var=var;
964 	safe_strncpy((char*)var->name, name, sizeof(var->name));
965 	safe_strncpy((char*)var->shortname, shortname, sizeof(var->shortname));
966 	group->no++;
967 }
968 #endif
969 
add_xml_identifier(group_id * group,char * xml_id,char * var,char * def,int max_len)970 void add_xml_identifier(group_id * group, char * xml_id, char * var, char * def, int max_len)
971 {
972 	group->strings=(string_item**)realloc(group->strings,(group->no+1)*sizeof(string_item*));
973 	group->strings[group->no]=(string_item*)calloc(1,sizeof(string_item));
974 	safe_snprintf (group->strings[group->no]->xml_id, sizeof (group->strings[group->no]->xml_id), "%s", xml_id);
975 	group->strings[group->no]->var=var;
976 	safe_strncpy(var, def, max_len);
977 	group->strings[group->no]->max_len=max_len-1;
978 	group->no++;
979 }
980 #ifdef ELC
add_options_distringid(char * xml_id,dichar * var,char * str,char * desc)981 void add_options_distringid(char * xml_id, dichar * var, char * str, char * desc)
982 {
983 	add_xml_distringid(options_str, xml_id, var, str, desc);
984 }
985 #endif //ELC
init_translatables()986 void init_translatables()
987 {
988 	init_groups();
989 	init_errors();
990 #ifdef ELC
991 	init_console();
992 	init_help();
993 	init_spell_translatables ();
994 	init_stats();
995 	init_titles();
996 #endif
997 }
998 
999 #ifdef ELC
1000 /* Save translated strings with their names for later lookup.
1001 */
save_named_strings(const group_id * groups,size_t num_groups,const char * group_name)1002 void save_named_strings(const group_id *groups, size_t num_groups, const char *group_name)
1003 {
1004 	size_t i,j;
1005 
1006 	for (j=0; j<num_groups; j++)
1007 	{
1008 		if (strcmp(groups[j].xml_id, group_name) == 0)
1009 		{
1010 			named_strings = (string_group*)realloc(named_strings, (num_named_strings+1) * sizeof(string_group));
1011 			named_strings[num_named_strings].name = strdup(group_name);
1012 
1013 			named_strings[num_named_strings].num_strings = groups[j].no;
1014 			named_strings[num_named_strings].strings = (named_string*)malloc(sizeof(named_string) * groups[j].no);
1015 
1016 			for (i=0; i<groups[j].no; i++)
1017 			{
1018 				named_strings[num_named_strings].strings[i].name = strdup(groups[j].strings[i]->xml_id);
1019 				named_strings[num_named_strings].strings[i].string = groups[j].strings[i]->var;
1020 			}
1021 
1022 			num_named_strings++;
1023 			return;
1024 		}
1025 	}
1026 }
1027 #endif
1028 
1029 #ifdef ELC
1030 /* Retrieve a translated string by its name.
1031 */
get_named_string(const char * group_name,const char * string_name)1032 const char* get_named_string(const char* group_name, const char* string_name)
1033 {
1034 	size_t i,j;
1035 	if ((group_name!=NULL) && (string_name!=NULL))
1036 		for (j=0; j<num_named_strings; j++)
1037 			if (strcmp(named_strings[j].name, group_name) == 0)
1038 				for (i=0; i<named_strings[j].num_strings; i++)
1039 					if (strcmp(named_strings[j].strings[i].name, string_name) == 0)
1040 						return named_strings[j].strings[i].string;
1041 	return "Unknown string";
1042 }
1043 #endif
1044 
1045 /* Free the memory allocated by translation module
1046 */
free_translations(void)1047 void free_translations(void)
1048 {
1049 #ifdef ELC
1050 	/* the named strings */
1051 	{
1052 	size_t i,j;
1053 	for (j=0; j<num_named_strings; j++)
1054 	{
1055 		for (i=0; i<named_strings[j].num_strings; i++)
1056 			free(named_strings[j].strings[i].name);
1057 		free(named_strings[j].name);
1058 		free(named_strings[j].strings);
1059 	}
1060 	free(named_strings);
1061 	num_named_strings = 0;
1062 	named_strings = NULL;
1063 	}
1064 #endif
1065 }
1066 
1067 #ifdef ELC
init_console()1068 void init_console()
1069 {
1070 	group_id * filter=&(console_str[0]);
1071 	group_id * ignore=&(console_str[1]);
1072 	group_id * misc=&(console_str[2]);
1073 	group_id * loading_msg=&(console_str[3]);
1074 	group_id * cmd_grp=&(console_str[4]);
1075 
1076 	add_xml_identifier(ignore,"toolong",name_too_long,"Name too long, the max limit is 15 characters.",sizeof(name_too_long));
1077 	add_xml_identifier(ignore,"tooshort",name_too_short,"Name too short, only names>=3 characters can be used!",sizeof(name_too_short));
1078 	add_xml_identifier(ignore,"noadd",not_added_to_ignores,"Name not added to the ignore list!",sizeof(not_added_to_ignores));
1079 	add_xml_identifier(ignore,"already",already_ignoring,"You are already ignoring %s!",sizeof(already_ignoring));
1080 	add_xml_identifier(ignore,"full",ignore_list_full,"Wow, your ignore list is full, this is impossible!",sizeof(ignore_list_full));
1081 	add_xml_identifier(ignore,"add",added_to_ignores,"%s was added to your ignore list!",sizeof(added_to_ignores));
1082 	add_xml_identifier(ignore,"norem",not_removed_from_ignores,"Name not removed from the ignore list!",sizeof(not_removed_from_ignores));
1083 	add_xml_identifier(ignore,"not",not_ignoring,"You are NOT ignoring %s in the first place!",sizeof(not_ignoring));
1084 	add_xml_identifier(ignore,"rem",removed_from_ignores,"OK, %s was removed from your ignore list!",sizeof(removed_from_ignores));
1085 	add_xml_identifier(ignore,"none",no_ignores_str,"You are ignoring no one!",sizeof(no_ignores_str));
1086 	add_xml_identifier(ignore,"cur",ignores_str,"You are currently ignoring",sizeof(ignores_str));
1087 
1088 	add_xml_identifier(filter,"toolong",word_too_long,"Word too long, the max limit is 15 characters.",sizeof(word_too_long));
1089 	add_xml_identifier(filter,"tooshort",word_too_short,"Word too short, only words>=3 characters can be used!",sizeof(word_too_short));
1090 	add_xml_identifier(filter,"notadd",not_added_to_filter,"Word not added to the filter list!",sizeof(not_added_to_filter));
1091 	add_xml_identifier(filter,"already",already_filtering,"You are already filtering %s",sizeof(already_filtering));
1092 	add_xml_identifier (filter,"flistfull", filter_list_full, "Your filter list is full, you can't add another filter", sizeof (filter_list_full));
1093 	add_xml_identifier(filter,"add",added_to_filters,"OK, %s was added to your filter list!",sizeof(added_to_filters));
1094 	add_xml_identifier(filter,"norem",not_removed_from_filter,"Word not removed from the filter list!",sizeof(not_removed_from_filter));
1095 	add_xml_identifier(filter,"not",not_filtering,"You are NOT filtering %s in the first place!",sizeof(not_filtering));
1096 	add_xml_identifier(filter,"rem",removed_from_filter,"OK, %s was removed from your filter list!",sizeof(removed_from_filter));
1097 	add_xml_identifier(filter,"none",no_filters_str,"You are filtering nothing!",sizeof(no_filters_str));
1098 	add_xml_identifier(filter,"cur",filters_str,"You are currently filtering",sizeof(filters_str));
1099 
1100 	add_xml_identifier(misc,"fullsave",full_save_str,"Local files saved, asking server to save too...",sizeof(full_save_str));
1101 	add_xml_identifier(misc,"localsaveonly",local_only_save_str,"Local files saved.",sizeof(local_only_save_str));
1102 	add_xml_identifier(misc,"log",logconn_str,"Logging raw connection data",sizeof(logconn_str));
1103 	add_xml_identifier(misc,"card",video_card_str,"Video card",sizeof(video_card_str));
1104 	add_xml_identifier(misc,"vendor",video_vendor_str,"Vendor ID",sizeof(video_vendor_str));
1105 	add_xml_identifier(misc,"ext",supported_extensions_str,"Supported extensions",sizeof(supported_extensions_str));
1106 	add_xml_identifier(misc,"opengl",opengl_version_str,"OpenGL Version",sizeof(opengl_version_str));
1107 	add_xml_identifier(misc,"pm_from",pm_from_str,"[PM from",sizeof(pm_from_str));
1108 	add_xml_identifier(misc,"mod_pm_from",mod_pm_from_str,"[Mod PM from",sizeof(mod_pm_from_str));
1109 	add_xml_identifier(misc,"gm_from",gm_from_str,"#GM from",sizeof(gm_from_str));
1110 	add_xml_identifier(misc,"ig_from",ig_from_str,"#Ig [",sizeof(ig_from_str));
1111 	add_xml_identifier(misc,"mc_from",mc_from_str,"#Mod Chat from",sizeof(mc_from_str));
1112 	add_xml_identifier(misc,"date_format",date_format,"Today is the %s day in the month of %s, the year %04d, Age of the Eternals",sizeof(date_format));
1113 	add_xml_identifier(misc,"book_count",book_count_str,"You have read %d of %d matching books",sizeof(book_count_str));
1114 	add_xml_identifier(misc,"know_help",know_help_str,"Use -(t)otal -(r)ead or -(u)nread to select output",sizeof(know_help_str));
1115 	add_xml_identifier(misc,"time_warn_hour",time_warn_hour_str,"This is your %d minute warning for the coming hour.",sizeof(time_warn_hour_str));
1116 	add_xml_identifier(misc,"time_warn_sunrise",time_warn_sunrise_str,"This is your %d minute warning for the coming sunrise.",sizeof(time_warn_sunrise_str));
1117 	add_xml_identifier(misc,"time_warn_sunset",time_warn_sunset_str,"This is your %d minute warning for the coming sunset.",sizeof(time_warn_sunset_str));
1118 	add_xml_identifier(misc,"time_warn_day",time_warn_day_str,"This is your %d minute warning for the coming day.",sizeof(time_warn_day_str));
1119 	add_xml_identifier(misc,"no_spell_to_show",no_spell_to_show_str,"No spell to show",sizeof(no_spell_to_show_str));
1120 	add_xml_identifier(misc,"invalid_spell_string",invalid_spell_string_str,"Invalid spell string",sizeof(invalid_spell_string_str));
1121 	add_xml_identifier(misc,"command_string_too_long",command_too_long_str,"Command string too long",sizeof(command_too_long_str));
1122 	add_xml_identifier(misc,"item_list_learn_cat",item_list_learn_cat_str,"Note: storage categories need to be learnt by selecting each category.",sizeof(item_list_learn_cat_str));
1123 	add_xml_identifier(misc,"item_uid_help",item_uid_help_str,"Use #item_uid (set to 1) to enable unique item information.",sizeof(item_uid_help_str));
1124 	add_xml_identifier(misc,"item_use_not_unique",item_use_not_unique_str,"Cannot record item use in counters as item is not unique.",sizeof(item_use_not_unique_str));
1125 	add_xml_identifier(misc,"item_use_get_failed",item_use_get_failed_str,"Cannot record item use in counters as problem with item: ",sizeof(item_use_get_failed_str));
1126 	add_xml_identifier(misc,"item_info_load_failed",item_info_load_failed_str,"Could not load the item information file",sizeof(item_info_load_failed_str));
1127 	add_xml_identifier(misc, "commands_help_prefix", commands_help_prefix_str, "Command", sizeof(commands_help_prefix_str));
1128 	add_xml_identifier(misc, "commands_help_not_loaded", commands_help_not_loaded_str, "Commands help file not loaded", sizeof(commands_help_not_loaded_str));
1129 	add_xml_identifier(misc, "commands_help_not_recognsed", commands_help_not_recognsed_str, "Unrecognised command", sizeof(commands_help_not_recognsed_str));
1130 	add_xml_identifier(misc, "commands_help_description_help", commands_help_description_help_str, "For help on a particular command, use ## <command>", sizeof(commands_help_description_help_str));
1131 
1132 	add_xml_identifier(loading_msg,"init_opengl",init_opengl_str,"Initializing OpenGL extensions",sizeof(init_opengl_str));
1133 	add_xml_identifier(loading_msg,"init_random",init_random_str,"Generating random seed",sizeof(init_random_str));
1134 	add_xml_identifier(loading_msg,"load_ignores",load_ignores_str,"Loading ignores",sizeof(load_ignores_str));
1135 	add_xml_identifier(loading_msg,"load_filters",load_filters_str,"Loading filters",sizeof(load_filters_str));
1136 	add_xml_identifier(loading_msg,"load_lists",load_lists_str,"Loading lists",sizeof(load_lists_str));
1137 	add_xml_identifier(loading_msg,"load_cursors",load_cursors_str,"Loading cursors",sizeof(load_cursors_str));
1138 	add_xml_identifier(loading_msg,"bld_glow",bld_glow_str,"Building glow table",sizeof(bld_glow_str));
1139 	add_xml_identifier(loading_msg,"init_lists",init_lists_str,"Initializing lists",sizeof(init_lists_str));
1140 	add_xml_identifier(loading_msg,"init_actor_defs",init_actor_defs_str,"Initializing actor definitions",sizeof(init_actor_defs_str));
1141 	add_xml_identifier(loading_msg,"load_map_tiles",load_map_tiles_str,"Loading map tiles",sizeof(load_map_tiles_str));
1142 	add_xml_identifier(loading_msg,"init_lights",init_lights_str,"Initializing lights",sizeof(init_lights_str));
1143 	add_xml_identifier(loading_msg,"init_logs",init_logs_str,"Initializing logs",sizeof(init_logs_str));
1144 	add_xml_identifier(loading_msg,"read_config",read_config_str,"Reading configuration",sizeof(read_config_str));
1145 	add_xml_identifier(loading_msg,"init_weather",init_weather_str,"Initializing weather",sizeof(init_weather_str));
1146 	add_xml_identifier(loading_msg,"init_audio",init_audio_str,"Initializing audio",sizeof(init_audio_str));
1147 	add_xml_identifier(loading_msg,"load_icons",load_icons_str,"Loading icons",sizeof(load_icons_str));
1148 	add_xml_identifier(loading_msg,"load_textures",load_textures_str,"Loading textures",sizeof(load_textures_str));
1149 #ifdef PAWN
1150 	add_xml_identifier (loading_msg, "init_pawn", init_pawn_str, "Initializing Pawn", sizeof(init_pawn_str));
1151 #endif // PAWN
1152 	add_xml_identifier(loading_msg,"init_network",init_network_str,"Initializing network",sizeof(init_network_str));
1153 	add_xml_identifier(loading_msg,"init_timers",init_timers_str,"Initializing timers",sizeof(init_timers_str));
1154 	add_xml_identifier(loading_msg,"load_encyc",load_encyc_str,"Loading Encyclopedia files",sizeof(load_encyc_str));
1155 	add_xml_identifier(loading_msg,"init_display",init_display_str,"Initializing display stuff",sizeof(init_display_str));
1156 	add_xml_identifier(loading_msg,"prep_op_win",prep_op_win_str,"Preparing opening window",sizeof(prep_op_win_str));
1157 	add_xml_identifier(loading_msg,"load_map",load_map_str,"Loading map",sizeof(load_map_str));
1158 	add_xml_identifier(loading_msg,"load_3d_object",load_3d_object_str,"Loading 3D objects",sizeof(load_3d_object_str));
1159 	add_xml_identifier(loading_msg,"load_2d_object",load_2d_object_str,"Loading 2D objects",sizeof(load_2d_object_str));
1160 	add_xml_identifier(loading_msg,"load_lights",load_lights_str,"Loading lights",sizeof(load_lights_str));
1161 	add_xml_identifier(loading_msg,"load_particles",load_particles_str,"Loading particles",sizeof(load_particles_str));
1162 	add_xml_identifier(loading_msg,"bld_sectors",bld_sectors_str,"Building sectors",sizeof(bld_sectors_str));
1163 	add_xml_identifier(loading_msg,"init_done",init_done_str,"Done",sizeof(init_done_str));
1164 	add_xml_identifier(loading_msg,"config_location",config_location_str,"Your personal settings and logs will be saved in %s",sizeof(config_location_str));
1165 	add_xml_identifier(loading_msg,"datadir_location",datadir_location_str,"The location of the data files in use is %s",sizeof(datadir_location_str));
1166 
1167 	add_xml_identifier(cmd_grp,"help_rq",help_request_str,"#help request",sizeof(help_request_str));
1168 	add_xml_identifier(cmd_grp,"help_cmd",help_cmd_str,"help",sizeof(help_cmd_str));
1169 	add_xml_identifier(cmd_grp,"char_cmd",char_cmd_str,"#",sizeof(char_cmd_str));
1170 	add_xml_identifier(cmd_grp,"char_at",char_at_str,"@",sizeof(char_at_str));
1171 	add_xml_identifier(cmd_grp,"char_slash",char_slash_str,"/",sizeof(char_slash_str));
1172 	add_xml_identifier(cmd_grp,"gm_cmd",gm_cmd_str,"#gm",sizeof(gm_cmd_str));
1173 	add_xml_identifier(cmd_grp,"mod_cmd",mod_cmd_str,"#mod",sizeof(mod_cmd_str));
1174 	add_xml_identifier(cmd_grp,"bc_cmd",bc_cmd_str,"#bc",sizeof(bc_cmd_str));
1175 	add_xml_identifier(cmd_grp,"msg_accept_buddy",msg_accept_buddy_str," wants to add you on his/her buddy list",sizeof(msg_accept_buddy_str));
1176 	add_xml_identifier(cmd_grp,"filter",cmd_filter,"filter",sizeof(cmd_filter));
1177 	add_xml_identifier(cmd_grp,"filters",cmd_filters,"filters",sizeof(cmd_filters));
1178 	add_xml_identifier(cmd_grp,"unfilter",cmd_unfilter,"unfilter",sizeof(cmd_unfilter));
1179 	add_xml_identifier(cmd_grp,"ignore",cmd_ignore,"ignore",sizeof(cmd_ignore));
1180 	add_xml_identifier(cmd_grp,"ignores",cmd_ignores,"ignores",sizeof(cmd_ignores));
1181 	add_xml_identifier(cmd_grp,"unignore",cmd_unignore,"unignore",sizeof(cmd_unignore));
1182 	add_xml_identifier(cmd_grp,"markpos",cmd_markpos,"markpos",sizeof(cmd_markpos));
1183 	add_xml_identifier(cmd_grp,"mark",cmd_mark,"mark",sizeof(cmd_mark));
1184 	add_xml_identifier(cmd_grp,"unmark",cmd_unmark,"unmark",sizeof(cmd_unmark));
1185 	add_xml_identifier(cmd_grp,"stats",cmd_stats,"stats",sizeof(cmd_stats));
1186 	add_xml_identifier(cmd_grp,"time",cmd_time,"time",sizeof(cmd_time));
1187 	add_xml_identifier(cmd_grp,"date",cmd_date,"date",sizeof(cmd_date));
1188 	add_xml_identifier(cmd_grp,"exit",cmd_exit,"exit",sizeof(cmd_exit));
1189 	add_xml_identifier(cmd_grp,"msg",cmd_msg,"msg",sizeof(cmd_msg));
1190 	add_xml_identifier(cmd_grp,"afk",cmd_afk,"afk",sizeof(cmd_afk));
1191 	add_xml_identifier(cmd_grp,"glinfo",cmd_glinfo,"glinfo",sizeof(cmd_glinfo));
1192 	add_xml_identifier(cmd_grp,"knowledge",cmd_knowledge,"knowledge",sizeof(cmd_knowledge));
1193 	add_xml_identifier(cmd_grp,"knowledge_short",cmd_knowledge_short,"know",sizeof(cmd_knowledge_short));
1194 	add_xml_identifier(cmd_grp,"open_url",cmd_open_url,"open_url",sizeof(cmd_open_url));
1195 	add_xml_identifier(cmd_grp,"keypress",cmd_keypress,"keypress",sizeof(cmd_keypress));
1196 	add_xml_identifier(cmd_grp,"user_menu_wait_time_ms",cmd_user_menu_wait_time_ms,"user_menu_wait_time_ms",sizeof(cmd_user_menu_wait_time_ms));
1197 	add_xml_identifier(cmd_grp,"show_spell",cmd_show_spell,"show_spell",sizeof(cmd_show_spell));
1198 	add_xml_identifier(cmd_grp,"cast_spell",cmd_cast_spell,"cast_spell",sizeof(cmd_cast_spell));
1199 	add_xml_identifier(cmd_grp,"session_counters",cmd_session_counters,"session_counters",sizeof(cmd_session_counters));
1200 	add_xml_identifier(cmd_grp,"reload_icons",cmd_reload_icons,"reload_icons",sizeof(cmd_reload_icons));
1201 	add_xml_identifier(cmd_grp,"relogin",cmd_relogin,"relogin",sizeof(cmd_relogin));
1202 	add_xml_identifier(cmd_grp,"disconnect",cmd_disconnect,"disconnect",sizeof(cmd_disconnect));
1203 	add_xml_identifier(cmd_grp,"disco",cmd_disco,"disco",sizeof(cmd_disco));
1204 }
1205 #endif
1206 
init_errors()1207 void init_errors()
1208 {
1209 #ifdef ELC
1210 	group_id * actors=&(errors[0]);
1211 	group_id * load=&(errors[1]);
1212 	group_id * misc=&(errors[2]);
1213 	group_id * particles=&(errors[3]);
1214 	group_id * snd=&(errors[4]);
1215 	group_id * video=&(errors[5]);
1216 	group_id * rules=&(errors[6]);
1217 #endif
1218 #ifdef MAP_EDITOR
1219 	group_id * particles=&(errors[0]);
1220 #endif
1221 
1222 #ifdef ELC
1223 	//Actor related errors
1224 	add_xml_identifier(actors,"load",cant_load_actor,"Can't load actor",sizeof(cant_load_actor));
1225 	add_xml_identifier(actors,"frame",cant_find_frame,"Couldn't find frame",sizeof(cant_find_frame));
1226 	add_xml_identifier(actors,"unk_frame",unknown_frame,"Unknown frame",sizeof(unknown_frame));
1227 	add_xml_identifier(actors,"dup_id",duplicate_actors_str,"Duplicate actor ID",sizeof(duplicate_actors_str));
1228 	add_xml_identifier(actors,"namelen",bad_actor_name_length,"Bad actor name/length",sizeof(bad_actor_name_length));
1229 	add_xml_identifier(actors,"addcommand",cant_add_command,"Unable to add command",sizeof(cant_add_command));
1230 	add_xml_identifier(actors,"loadbody",error_body_part,"Can't load body part",sizeof(error_body_part));
1231 	add_xml_identifier(actors,"head",error_head,"head",sizeof(error_head));
1232 	add_xml_identifier(actors,"torso",error_torso,"torso",sizeof(error_torso));
1233 	add_xml_identifier(actors,"weapon",error_weapon,"weapon",sizeof(error_weapon));
1234 	add_xml_identifier(actors,"helmet",error_helmet,"helmet",sizeof(error_helmet));
1235 	add_xml_identifier(actors,"cape",error_cape,"cape",sizeof(error_cape));
1236 	add_xml_identifier(actors,"dupnpc",duplicate_npc_actor,"Duplicate actor name",sizeof(duplicate_npc_actor));
1237 
1238 	//Loading errors
1239 	add_xml_identifier(load,"obj",cant_load_2d_object,"Can't load 2d object",sizeof(cant_load_2d_object));
1240 	add_xml_identifier(load,"file",cant_open_file,"Can't open file",sizeof(cant_open_file));
1241 	add_xml_identifier(load,"cursors",cursors_file_str,"Can't open cursors file.",sizeof(cursors_file_str));
1242 	add_xml_identifier(load,"font",cant_load_font,"Unable to load font",sizeof(cant_load_font));
1243 	add_xml_identifier(load,"fatal",fatal_error_str,"Fatal",sizeof(fatal_error_str));
1244 	add_xml_identifier(load,"noe3d",no_e3d_list,"Couldn't read e3dlist.txt",sizeof(no_e3d_list));
1245 	add_xml_identifier(load,"invmap",invalid_map,"%s is an invalid map!",sizeof(invalid_map));
1246 	add_xml_identifier(load,"parsenotes",cant_parse_notes,"Unable to parse xml notepad. It will be overwritten.",sizeof(cant_parse_notes));
1247 	add_xml_identifier(load,"noteswrong",notes_wrong,"Document of the wrong type. It will be overwritten.",sizeof(notes_wrong));
1248 	add_xml_identifier(load,"manynotes",too_many_notes,"Too many notes - Last nodes were ignored.",sizeof(too_many_notes));
1249 	add_xml_identifier(load,"notenode",wrong_note_node,"Incorrect node type - could not copy.",sizeof(wrong_note_node));
1250 	add_xml_identifier(load,"savenotes",cant_save_notes,"Unable to write notes to file %s",sizeof(cant_save_notes));
1251 	add_xml_identifier(load,"exceednotes",exceed_note_buffer,"Tried to exceed notepad buffer! Ignored.",sizeof(exceed_note_buffer));
1252 	add_xml_identifier(load,"nomorenotes",user_no_more_notes,"No room for more notes.",sizeof(user_no_more_notes));
1253 	add_xml_identifier(load,"nomorenotetabs",user_no_more_note_tabs,"No room for more note tabs.",sizeof(user_no_more_note_tabs));
1254 	add_xml_identifier(load,"fataldataerror",fatal_data_error,"Fatal error while loading data files. Either set the data_dir correctly or run from the data directory.",sizeof(fatal_data_error));
1255 	add_xml_identifier(load,"encyclerror",cant_load_encycl,"Failed to load encyclopedia, check your installation.",sizeof(cant_load_encycl));
1256 
1257 
1258 	//Miscellaneous errors
1259 	add_xml_identifier(misc,"no_walk_sitlock",no_walk_with_sitlock,"Sitlock is enabled. Disable it or stand before walking.",sizeof(no_walk_with_sitlock));
1260 	add_xml_identifier(misc,"error",reg_error_str,"Error",sizeof(reg_error_str));
1261 	add_xml_identifier(load,"file_write_error",file_write_error_str,"Can't write to file",sizeof(file_write_error_str));
1262 	add_xml_identifier(misc,"objerr",object_error_str,"Object error",sizeof(object_error_str));
1263 	add_xml_identifier(misc,"nasty",nasty_error_str,"Something nasty happened while trying to process: %s",sizeof(nasty_error_str));
1264 	add_xml_identifier(misc,"corrupt",corrupted_object,"Object seems to be corrupted. Skipping the object. Warning: This might cause further problems.",sizeof(corrupted_object));
1265 	add_xml_identifier(misc,"badobj",bad_object,"Bad object",sizeof(bad_object));
1266 	add_xml_identifier(misc,"multimat",multiple_material_same_texture,"Two or more materials with the same texture name!",sizeof(multiple_material_same_texture));
1267 	add_xml_identifier(misc,"resync",resync_server,"Resync with the server...",sizeof(resync_server));
1268 	add_xml_identifier(misc,"vertex",enabled_vertex_arrays,"Vertex Arrays enabled (memory hog on!)...",sizeof(enabled_vertex_arrays));
1269 	add_xml_identifier(misc,"compiled",disabled_compiled_vertex_arrays,"Compiled Vertex Arrays disabled.",sizeof(disabled_compiled_vertex_arrays));
1270 	add_xml_identifier(misc,"point",disabled_point_particles,"Point Particles disabled.",sizeof(disabled_point_particles));
1271 	add_xml_identifier(misc,"particles",disabled_particles_str,"Particles completely disabled!",sizeof(disabled_particles_str));
1272 	add_xml_identifier(misc,"net",failed_sdl_net_init,"Couldn't initialize net",sizeof(failed_sdl_net_init));
1273 	add_xml_identifier(misc,"timer_fail",failed_sdl_timer_init,"Couldn't initialize the timer",sizeof(failed_sdl_timer_init));
1274 	add_xml_identifier(misc,"resolve",failed_resolve,"Can't resolve server address.\nPerhaps you are not connected to the Internet or your DNS server is down!",sizeof(failed_resolve));
1275 	add_xml_identifier(misc,"connect",failed_connect,"Can't connect to server :(",sizeof(failed_connect));
1276 	add_xml_identifier(misc,"redefine",redefine_your_colours,"You need to update your character, due to the new models!\nGo on the New Character screen, type your existing\nusername and password, update your character, then press\nDone. *YOUR STATS AND ITEMS WILL NOT BE AFFECTED*",sizeof(redefine_your_colours));
1277 	add_xml_identifier(misc,"noexist",char_dont_exist,"You don't exist!",sizeof(char_dont_exist));
1278 	add_xml_identifier(misc,"latency",server_latency,"Server latency",sizeof(server_latency));
1279 	add_xml_identifier(misc,"newver",update_your_client,"There is a new version of the client, please update it",sizeof(update_your_client));
1280 	add_xml_identifier(misc,"notsup",client_ver_not_supported,"This version is no longer supported, please update!",sizeof(client_ver_not_supported));
1281 	add_xml_identifier(misc,"packets",packet_overrun,"Packet overrun...data lost!",sizeof(packet_overrun));
1282 	add_xml_identifier(misc,"disconnect",disconnected_from_server,"Disconnected from server!",sizeof(disconnected_from_server));
1283 	add_xml_identifier(misc,"user_disconnect",user_disconnect_str,"Using #disconnect",sizeof(user_disconnect_str));
1284 	add_xml_identifier(misc,"stat",stat_no_invalid,"Server sent invalid stat number",sizeof(stat_no_invalid));
1285 	add_xml_identifier(misc,"ascii",not_ascii,"Not ASCII",sizeof(not_ascii));
1286 	add_xml_identifier(misc,"timer_lag",timer_lagging_behind,"The %s timer was lagging severely behind or had stopped, restarted it", sizeof(timer_lagging_behind));
1287 	add_xml_identifier(misc,"nameinuse",char_name_in_use,"Character name is already taken",sizeof(char_name_in_use));
1288 	add_xml_identifier(misc,"notabs",must_use_tabs,"You cannot disable tabbed windows with video mode %d, forcing them",sizeof(must_use_tabs));
1289 	add_xml_identifier (misc, "nomap", cant_change_map, "Unable to switch to map %s!", sizeof(cant_change_map));
1290 	add_xml_identifier (misc, "emptymap", empty_map_str, "Using an empty map instead.", sizeof(empty_map_str));
1291 	add_xml_identifier (misc, "nonomap", no_nomap_str, "Fatal error: Couldn't load map ./maps/nomap.elm.\nFix your maps.", sizeof(no_nomap_str));
1292 	add_xml_identifier (misc, "nobmpmap", err_nomap_str, "There is no map for this place.", sizeof(err_nomap_str));
1293 	add_xml_identifier (misc, "mapmarks", err_mapmarks_str, "Maximum number of mapmarks reached.", sizeof(err_mapmarks_str));
1294 	add_xml_identifier (misc, "book_open", book_open_err_str, "Couldn't open the book: %s!", sizeof(book_open_err_str));
1295 	add_xml_identifier (misc, "noanimation", no_animation_err_str, "No animation: %s!\n", sizeof(no_animation_err_str));
1296 	add_xml_identifier (misc, "invalid_location", invalid_location_str, "Invalid location %d,%d", sizeof(invalid_location_str));
1297 	add_xml_identifier (misc, "warn_currently_ignoring", warn_currently_ignoring, "Warning: %s is on your #ignore list", sizeof(warn_currently_ignoring));
1298 	add_xml_identifier (misc, "invalidnpcmark", invalidnpcmark_str, "Invalid string for NPC map mark.", sizeof(invalidnpcmark_str));
1299 
1300 	//XML errors. should these have their own group?
1301 	add_xml_identifier (misc, "badnode", xml_bad_node, "There is something wrong with one of a node's fields.", sizeof(xml_bad_node));
1302 	add_xml_identifier (misc, "badroot", xml_bad_root_node, "The root node in %s was incorrect.", sizeof(xml_bad_root_node));
1303 	add_xml_identifier (misc, "undefnode", xml_undefined_node, "Found an unexpected node type while parsing %s (%s).", sizeof(xml_undefined_node));
1304 	add_xml_identifier (misc, "use_builtin_chans", using_builtin_chanlist, "Could not load a channel list from file. Using a limited built-in set instead.", sizeof(using_builtin_chanlist));
1305 	add_xml_identifier (misc, "use_eng_chans", using_eng_chanlist, "Could not load a channel list for language code %s. Using the english set instead.", sizeof(using_eng_chanlist));
1306 
1307 	// Mines errors
1308 	add_xml_identifier (misc, "mines_config_open", mines_config_open_err_str, "Error opening mines configuration file", sizeof(mines_config_open_err_str));
1309 	add_xml_identifier (misc, "mines_config", mines_config_error, "Error loading mines configuration", sizeof(mines_config_error));
1310 
1311 	// Misc
1312 #ifdef PNG_SCREENSHOT
1313 	add_xml_identifier (misc, "max_screenshots_warning", max_screenshots_warning_str, "You have reached the maximum capacity for screenshots. Please move them all to another folder, otherwise this image will be overwritten next time.", sizeof(max_screenshots_warning_str));
1314 #endif //PNG_SCREENSHOT
1315 
1316 	// item lists
1317 	add_xml_identifier (misc, "item_list_format_error", item_list_format_error, "Format error while reading item list.", sizeof(item_list_format_error));
1318 	add_xml_identifier (misc, "item_list_save_error", item_list_save_error_str, "Failed to save the item category file.", sizeof(item_list_save_error_str));
1319 	add_xml_identifier (misc, "item_list_cat_format_error", item_list_cat_format_error_str, "Format error reading item categories.", sizeof(item_list_cat_format_error_str));
1320 	add_xml_identifier (misc, "item_list_version_error", item_list_version_error_str, "Item lists file is not compatible with client version.", sizeof(item_list_version_error_str));
1321 	add_xml_identifier (misc, "item_list_empty_list", item_list_empty_list_str, "No point saving an empty list.", sizeof(item_list_empty_list_str));
1322 
1323 #endif
1324 
1325 	//Particle errors
1326 	add_xml_identifier(particles,"version",particles_filever_wrong,"Particle file %s version (%i) doesn't match file reader version (%i)!",sizeof(particles_filever_wrong));
1327 	add_xml_identifier(particles,"overrun",particle_system_overrun,"Particle file %s tries to define %i particles, when %i is the maximum!",sizeof(particle_system_overrun));
1328 	add_xml_identifier(particles,"pos",particle_strange_pos,"Particle file %s contained strange position/constraint values. Tried to fix.",sizeof(particle_strange_pos));
1329 	add_xml_identifier(particles,"sysdump",particle_system_dump,"-- PARTICLE SYSTEM DUMP --",sizeof(particle_system_dump));
1330 	add_xml_identifier(particles,"disabled",particles_disabled_str,"Particles disabled!",sizeof(particles_disabled_str));
1331 	add_xml_identifier(particles,"point",point_sprites_enabled,"Using point sprites",sizeof(point_sprites_enabled));
1332 	add_xml_identifier(particles,"quads",using_textured_quads,"Using textured quads",sizeof(using_textured_quads));
1333 	add_xml_identifier(particles,"defs",definitions_str,"Definitions",sizeof(definitions_str));
1334 	add_xml_identifier(particles,"system",part_sys_str,"systems",sizeof(part_sys_str));
1335 	add_xml_identifier(particles,"particles",part_part_str,"particles",sizeof(part_part_str));
1336 
1337 #ifdef ELC
1338 	//Sound errors
1339 	add_xml_identifier(snd,"loadwav",snd_wav_load_error,"Failed to load wav file %s",sizeof(snd_wav_load_error));
1340 	add_xml_identifier(snd,"loadfile",snd_ogg_load_error,"Failed to load ogg file",sizeof(snd_ogg_load_error));
1341 	add_xml_identifier(snd,"loadstream",snd_ogg_stream_error,"Failed to load ogg stream",sizeof(snd_ogg_stream_error));
1342 	add_xml_identifier(snd,"buffer",snd_buff_error,"Error creating buffer",sizeof(snd_buff_error));
1343 	add_xml_identifier(snd,"number",snd_invalid_number,"Got invalid sound number",sizeof(snd_invalid_number));
1344 	add_xml_identifier(snd,"source",snd_source_error,"Error creating sources. Sound is disabled",sizeof(snd_source_error));
1345 	add_xml_identifier(snd,"skip",snd_skip_speedup,"Skip! Speeding up...",sizeof(snd_skip_speedup));
1346 	add_xml_identifier(snd,"tooslow",snd_too_slow,"Sorry, too slow to play music or backgrounds...",sizeof(snd_too_slow));
1347 	add_xml_identifier(snd,"fail",snd_stop_fail,"Failed to stop all sounds.",sizeof(snd_stop_fail));
1348 	add_xml_identifier(snd,"snd_init",snd_init_error,"Error initializing sound",sizeof(snd_init_error));
1349 	add_xml_identifier(snd,"sndconfigopen",snd_config_open_err_str,"Error opening sound configuration file",sizeof(snd_config_open_err_str));
1350 	add_xml_identifier(snd,"sndconfig",snd_config_error,"Error loading sound configuration",sizeof(snd_config_error));
1351 	add_xml_identifier(snd,"toomany",snd_sound_overflow,"Too many sounds.",sizeof(snd_sound_overflow));
1352 	add_xml_identifier(snd,"read",snd_media_read,"Read from media.",sizeof(snd_media_read));
1353 	add_xml_identifier(snd,"notvorbis",snd_media_notvorbis,"Not Vorbis data.",sizeof(snd_media_notvorbis));
1354 	add_xml_identifier(snd,"version",snd_media_ver_mismatch,"Vorbis version mismatch.",sizeof(snd_media_ver_mismatch));
1355 	add_xml_identifier(snd,"header",snd_media_invalid_header,"Invalid Vorbis header.",sizeof(snd_media_invalid_header));
1356 	add_xml_identifier(snd,"intern",snd_media_internal_error,"Internal logic fault (bug or heap/stack corruption.",sizeof(snd_media_internal_error));
1357 	add_xml_identifier(snd,"unknown",snd_media_ogg_error,"Unknown Ogg error.",sizeof(snd_media_ogg_error));
1358 	add_xml_identifier(snd,"false",snd_media_false,"Ogg error media false.",sizeof(snd_media_false));
1359 	add_xml_identifier(snd,"hole",snd_media_hole,"Ogg error media hole.",sizeof(snd_media_hole));
1360 	add_xml_identifier(snd,"einval",snd_media_einval,"Ogg error media EINVAL.",sizeof(snd_media_einval));
1361 	add_xml_identifier(snd,"eof",snd_media_eof,"Ogg error media EOF.",sizeof(snd_media_eof));
1362 	add_xml_identifier(snd,"ebadlink",snd_media_ebadlink,"Ogg error media EBADLINK.",sizeof(snd_media_ebadlink));
1363 	add_xml_identifier(snd,"enoseek",snd_media_enoseek,"Ogg error media ENOSEEK.",sizeof(snd_media_enoseek));
1364 	add_xml_identifier(snd,"enomusic",snd_no_music,"This client was built without music support",sizeof(snd_no_music));
1365 	add_xml_identifier(snd,"musicstopped",snd_media_music_stopped,"No song is currently playing",sizeof(snd_media_music_stopped));
1366 	add_xml_identifier(snd,"musicinfo",snd_media_ogg_info,"Currently playing: \"%s\" by %s (%d:%02d/%d:%02d)",sizeof(snd_media_ogg_info));
1367 	add_xml_identifier(snd,"musicinfonoartist",snd_media_ogg_info_noartist,"Currently playing: \"%s\" (%d:%02d/%d:%02d)",sizeof(snd_media_ogg_info_noartist));
1368 
1369 	//Video errors
1370 	add_xml_identifier(video,"nostencil",no_stencil_str,"Video mode %s with a stencil buffer is not available\nTrying this mode without a stencil buffer...",sizeof(no_stencil_str));
1371 	add_xml_identifier(video,"safemode",safemode_str,"Video mode %s without a stencil buffer is not available\nTrying the safemode (640x480x32) Full Screen (no stencil)",sizeof(safemode_str));
1372 	add_xml_identifier(video,"nosdl",no_sdl_str,"Couldn't initialize SDL",sizeof(no_sdl_str));
1373 	add_xml_identifier(video,"nohwstencil",no_hardware_stencil_str,"Couldn't find a hardware accelerated stencil buffer.\nShadows are not available.",sizeof(no_hardware_stencil_str));
1374 	add_xml_identifier(video,"depth",suggest_24_or_32_bit,"Hint: Try a 32 BPP resolution (if you are under XWindows, set your screen display to 24 or 32 bpp).",sizeof(suggest_24_or_32_bit));
1375 	add_xml_identifier(video,"glmode",fail_opengl_mode,"Couldn't set GL mode",sizeof(fail_opengl_mode));
1376 	add_xml_identifier(video,"swstencil",stencil_falls_back_on_software_accel,"Hmm... This mode seems to fall back in software 'acceleration'.\nTrying to disable the stencil buffer.",sizeof(stencil_falls_back_on_software_accel));
1377 	add_xml_identifier(video,"last_try",last_chance_str,"Hmm... No luck without a stencil buffer either...\nLet's try one more thing...",sizeof(last_chance_str));
1378 	add_xml_identifier(video,"swmode",software_mode_str,"Damn, it seems that you are out of luck, we are in the software mode now, so the game will be veeeeery slow. If you DO have a 3D accelerated card, try to update your OpenGl drivers...",sizeof(software_mode_str));
1379 	add_xml_identifier(video,"extfound",gl_ext_found,"%s extension found, using it.",sizeof(gl_ext_found));
1380 	add_xml_identifier(video,"extnouse",gl_ext_found_not_used,"%s extension found, NOT using it...",sizeof(gl_ext_found_not_used));
1381 	add_xml_identifier(video,"extnotfound",gl_ext_not_found,"Couldn't find the %s extension, not using it...",sizeof(gl_ext_not_found));
1382 	add_xml_identifier(video,"multitex",gl_ext_no_multitexture,"Couldn't find the GL_ARB_multitexture extension, giving up clouds shadows, and texture detail...",sizeof(gl_ext_no_multitexture));
1383 	add_xml_identifier(video,"noshadowmapping",disabled_shadow_mapping,"Shadowmapping disabled (need newer hardware)",sizeof(disabled_shadow_mapping));
1384 	add_xml_identifier(video,"toobigshadowmap",shadow_map_size_not_supported_str,"Shadow map size not supported! Shadow map size reduced to %d!",sizeof(shadow_map_size_not_supported_str));
1385 	add_xml_identifier(video,"noframebuffer",disabled_framebuffer,"Framebuffer disabled (need newer driver)",sizeof(disabled_framebuffer));
1386 	//Framebuffer errors
1387 	add_xml_identifier(video,"fboattachmenterror",fbo_attachment_error,"Framebuffer: attachment error",sizeof(fbo_attachment_error));
1388 	add_xml_identifier(video,"fbomissingattachmenterror",fbo_missing_attachment_error,"Framebuffer: missing attachment",sizeof(fbo_missing_attachment_error));
1389 	add_xml_identifier(video,"fboformatserror",fbo_formats_error,"Framebuffer: formats error",sizeof(fbo_formats_error));
1390 	add_xml_identifier(video,"fbodrawbuffererror",fbo_draw_buffer_error,"Framebuffer: draw buffer error",sizeof(fbo_draw_buffer_error));
1391 	add_xml_identifier(video,"fboreadbuffererror",fbo_read_buffer_error,"Framebuffer: read buffer error",sizeof(fbo_read_buffer_error));
1392 	add_xml_identifier(video,"fbounsupportedfromaterror",fbo_unsupported_fromat_error,"Framebuffer: unsupported format error",sizeof(fbo_unsupported_fromat_error));
1393 	add_xml_identifier(video,"fbounknownerror",fbo_unknown_error,"Framebuffer: unkown error %d",sizeof(fbo_unknown_error));
1394 	add_xml_identifier(video,"fbosupportedfromat",fbo_supported_format,"Frame buffer format: %s, depth bits: %d, stencil bits: %d is supported",sizeof(fbo_supported_format));
1395 	add_xml_identifier(video,"extnotfoundemulit",gl_ext_not_found_emul_it,"Couldn't find the %s extension, emulating it...",sizeof(gl_ext_not_found_emul_it));
1396 	add_xml_identifier(video,"invalid",invalid_video_mode,"Stop playing with the configuration file and select valid modes!",sizeof(invalid_video_mode));
1397 
1398 	//Rule errors
1399 	add_xml_identifier(rules,"proceed",you_can_proceed,"Read the rules and you can play in %d seconds",sizeof(you_can_proceed));
1400 	add_xml_identifier(rules,"ready",accepted_rules,"Read the rules and click on \"I Accept\" to play!",sizeof(accepted_rules));
1401 	add_xml_identifier(rules,"accept",accept_label,"I Accept",sizeof(accept_label));
1402 	add_xml_identifier(rules,"read",read_rules_str,"An error occured while reading the rules",sizeof(read_rules_str));
1403 	add_xml_identifier(rules,"parse",parse_rules_str,"An error occored while parsing the rules",sizeof(parse_rules_str));
1404 	add_xml_identifier(rules,"notfound",rules_not_found,"The rules.xml file was not found. You will have to redownload your game.",sizeof(rules_not_found));
1405 #endif
1406 }
1407 
1408 #ifdef ELC
init_help()1409 void init_help()
1410 {
1411 	group_id * afk = &(help_str[0]);
1412 	group_id * misc = &(help_str[1]);
1413 	group_id * new = &(help_str[2]);
1414 	group_id * tooltips = &(help_str[3]);
1415 	group_id * buddy = &(help_str[4]);
1416 
1417 	//AFK Messages
1418 	add_xml_identifier(afk,"going",going_afk,"Going AFK",sizeof(going_afk));
1419 	add_xml_identifier(afk,"not",not_afk,"Not AFK any more",sizeof(not_afk));
1420 	add_xml_identifier(afk,"back",new_messages,"You have %d new messages from the following people: ",sizeof(new_messages));
1421 	add_xml_identifier(afk,"names",afk_names,"Names",sizeof(afk_names));
1422 	add_xml_identifier(afk,"messages",afk_messages,"Messages",sizeof(afk_messages));
1423 	add_xml_identifier(afk,"help",afk_print_help,"To print the messages from the different people type #msg <number> or #msg all to view them all",sizeof(afk_print_help));
1424 	//Miscellaneous
1425 	add_xml_identifier(misc,"values",values_str,"values",sizeof(values_str));
1426 	add_xml_identifier(misc,"close",close_str,"[close]",sizeof(close_str));
1427 	add_xml_identifier(misc,"dialog_copy",dialogue_copy_str,"[copy]",sizeof(dialogue_copy_str));
1428 	add_xml_identifier(misc,"dialogue_repeat",dialogue_repeat_str,"[repeat]",sizeof(dialogue_repeat_str));
1429 	add_xml_identifier(misc,"open_storage",open_storage_str,"Open storage",sizeof(open_storage_str));
1430 	add_xml_identifier(misc,"reopen_storage",reopen_storage_str,"Reopen for setting to take effect",sizeof(reopen_storage_str));
1431 	add_xml_identifier(misc,"low",low_framerate_str,"Low framerate detected, shadows and eye candy disabled!",sizeof(low_framerate_str));
1432 	add_xml_identifier(misc,"encycl_search_prompt",encycl_search_prompt_str,"Enter text to find",sizeof(encycl_search_prompt_str));
1433 	add_xml_identifier(misc,"multiselect_find_prompt", multiselect_find_prompt_str, "Find", sizeof(multiselect_find_prompt_str));
1434 	add_xml_identifier(misc,"multiselect_find_help", multiselect_find_help_str, "Type text to find an option. ENTER: find next, ESC: clear, TAB: case", sizeof(multiselect_find_help_str));
1435 	add_xml_identifier(misc,"size",window_size_adjusted_str,"Window size adjusted to %s",sizeof(window_size_adjusted_str));
1436 	add_xml_identifier(misc,"reset_res",reset_res_str,"Reset window size",sizeof(reset_res_str));
1437 	add_xml_identifier(misc,"set_res",set_res_str,"Set window size",sizeof(set_res_str));
1438 	add_xml_identifier(misc,"save_res",save_res_str,"Saved user defined window size",sizeof(save_res_str));
1439 	add_xml_identifier(misc,"show_res",show_res_str,"Current window size",sizeof(show_res_str));
1440 	add_xml_identifier(misc,"trade",no_open_on_trade,"You can't open this window while on trade.",sizeof(no_open_on_trade));
1441 	add_xml_identifier(misc,"user",login_username_str,"Username:",sizeof(login_username_str));
1442 	add_xml_identifier(misc,"pass",login_password_str,"Password:",sizeof(login_password_str));
1443 	add_xml_identifier(misc,"passmngr_enabled",passmngr_enabled_str,"Open/close password manager window.",sizeof(passmngr_enabled_str));
1444 	add_xml_identifier(misc,"passmngr_disabled",passmngr_disabled_str,"Password manager is disabled.",sizeof(passmngr_disabled_str));
1445 	add_xml_identifier(misc,"passmngr_remember_details",passmngr_remember_details_str,"Use password manager to remember details.",sizeof(passmngr_remember_details_str));
1446 	add_xml_identifier(misc,"passmngr_error",passmngr_error_str,"WARNING: Password manager did not save invalid password.",sizeof(passmngr_error_str));
1447 	add_xml_identifier(misc,"password_format",password_format_str,"Passwords must be 4-15 characters and can include alpha, numeric or others characters but not space or ~.",sizeof(password_format_str));
1448 	add_xml_identifier(misc,"show_passwords",show_passwords_str,"Show Passwords",sizeof(show_passwords_str));
1449 	add_xml_identifier(misc,"login_select_window",login_select_window_str,"Select Login",sizeof(login_select_window_str));
1450 	add_xml_identifier(misc,"login_rules",login_rules_str,"If you log into this game, you accept the rules of Eternal Lands. Press F5 to read them in game.",sizeof(login_rules_str));
1451 	add_xml_identifier(misc,"stoall",sto_all_str,"Sto All",sizeof(sto_all_str));
1452 	add_xml_identifier(misc,"getall",get_all_str,"Get All",sizeof(get_all_str));
1453 	add_xml_identifier(misc,"drpall",drp_all_str,"Drp All",sizeof(drp_all_str));
1454 	add_xml_identifier(misc,"itmlst",itm_lst_str,"Itm Lst",sizeof(itm_lst_str));
1455 	add_xml_identifier(misc,"mixone",mix_one_str,"Mix One",sizeof(mix_one_str));
1456 	add_xml_identifier(misc,"mixall",mix_all_str,"Mix All",sizeof(mix_all_str));
1457 	add_xml_identifier(misc,"autogetall",auto_get_all_str,"Empty Bag Automatically",sizeof(auto_get_all_str));
1458 	add_xml_identifier(misc,"itemlistbut",item_list_but_str,"Open Left Of Inventory",sizeof(item_list_but_str));
1459 	add_xml_identifier(misc,"inv_keeprow",inv_keeprow_str,"Keep First Row\nKeep Last Row",sizeof(inv_keeprow_str));
1460 	add_xml_identifier(misc,"completed",completed_research,"COMPLETED",sizeof(completed_research));
1461 	add_xml_identifier(misc,"lessthanaminute",lessthanaminute_str,"Less than a minute",sizeof(lessthanaminute_str));
1462 	add_xml_identifier(misc,"research",researching_str,"Researching",sizeof(researching_str));
1463 	add_xml_identifier(misc,"nothing",not_researching_anything,"Nothing",sizeof(not_researching_anything));
1464 	add_xml_identifier(misc,"not_researching",not_researching_str,"Researching nothing",sizeof(not_researching_anything));
1465 	add_xml_identifier(misc,"countdown",countdown_str,"Countdown",sizeof(countdown_str));
1466 	add_xml_identifier(misc,"stopwatch",stopwatch_str,"Stopwatch",sizeof(stopwatch_str));
1467 	add_xml_identifier(misc,"minutes",minutes_str,"minutes",sizeof(minutes_str));
1468 	add_xml_identifier(misc,"minute",minute_str,"minute",sizeof(minute_str));
1469 	add_xml_identifier(misc,"idle",idle_str,"Idle",sizeof(idle_str));
1470 	add_xml_identifier(misc,"read_book",knowledge_read_book,"Read Book",sizeof(knowledge_read_book));
1471 	add_xml_identifier(misc,"read_book_tag",knowledge_read_book_tag," (read)",sizeof(knowledge_read_book_tag));
1472 	add_xml_identifier(misc,"unread_book_tag",knowledge_unread_book_tag," (unread)",sizeof(knowledge_unread_book_tag));
1473 	add_xml_identifier(misc,"reading_book_tag",knowledge_reading_book_tag," (reading)",sizeof(knowledge_reading_book_tag));
1474 	add_xml_identifier(misc,"kp_read",knowledge_param_read,"-read",sizeof(knowledge_param_read));
1475 	add_xml_identifier(misc,"kp_unread",knowledge_param_unread,"-unread",sizeof(knowledge_param_unread));
1476 	add_xml_identifier(misc,"kp_total",knowledge_param_total,"-total",sizeof(knowledge_param_total));
1477 	add_xml_identifier(misc,"unknown_book_s",unknown_book_short_str,"(Not yet known to client)",sizeof(unknown_book_short_str));
1478 	add_xml_identifier(misc,"unknown_book_l",unknown_book_long_str,"Researching book not yet known to the client.  Don't worry, reading it will count!",sizeof(unknown_book_long_str));
1479 	add_xml_identifier(misc,"know_highlight_prompt",know_highlight_prompt_str,"Highlight Text",sizeof(know_highlight_prompt_str));
1480 	add_xml_identifier(misc,"know_highlight_cm",know_highlight_cm_str,"Set Highlight Text\nClear Highlight\nCopy Name",sizeof(know_highlight_cm_str));
1481 	add_xml_identifier(misc,"mix",mix_str,"Mix",sizeof(mix_str));
1482 	add_xml_identifier(misc,"mix_all",mixall_str,"Mix all",sizeof(mixall_str));
1483 	add_xml_identifier(misc,"clear",clear_str,"Clear",sizeof(clear_str));
1484 	add_xml_identifier(misc,"manu_add",manu_add_str,"Left-click or scrollwheel to add 1; or 10 with ALT",sizeof(manu_add_str));
1485 	add_xml_identifier(misc,"manu_remove",manu_remove_str,"Left-click or scrollwheel to remove 1; or 10 with ALT",sizeof(manu_remove_str));
1486 	add_xml_identifier(misc,"cast",cast_str,"Cast",sizeof(cast_str));
1487 	add_xml_identifier (misc, "invalid_spell", invalid_spell_str, "Invalid spell", sizeof (invalid_spell_str));
1488 	add_xml_identifier(misc,"connect",connect_to_server_str,"Connecting to Server...",sizeof(connect_to_server_str));
1489 	add_xml_identifier(misc,"reconnect",reconnect_str,"Press any key to try again.",sizeof(reconnect_str));
1490 	add_xml_identifier(misc,"test_server_connect",test_server_connect_str,"Testing server connection...",sizeof(test_server_connect_str));
1491 	add_xml_identifier(misc,"server_connect_test_failed",server_connect_test_failed_str,"server connection test failed",sizeof(server_connect_test_failed_str));
1492 	add_xml_identifier (misc, "x_quit", alt_x_quit, "Press Alt-x to close the game", sizeof (alt_x_quit));
1493 	add_xml_identifier(misc,"license",license_check,"Entropy says: U R 2 g00d 2 r34d +h3 license.txt?\nBTW, that license.txt file is actually there for a reason.",sizeof(license_check));
1494 	add_xml_identifier(misc,"session_reset_help",session_reset_help,"Double-click to reset session information",sizeof(session_reset_help));
1495 	add_xml_identifier(misc,"quantity",quantity_str,"Quantity",sizeof(quantity_str));
1496 	add_xml_identifier(misc,"abort",abort_str,"Abort",sizeof(abort_str));
1497 	add_xml_identifier(misc,"sigils",sig_too_few_sigs,"This spell requires at least 2 sigils",sizeof(sig_too_few_sigs));
1498 	add_xml_identifier(misc,"switch",switch_video_mode,"Switches to video mode %s",sizeof(switch_video_mode));
1499 	add_xml_identifier(misc,"cachei",cache_items_str,"items",sizeof(cache_items_str));
1500 	add_xml_identifier(misc,"caches",cache_size_str,"Cache size",sizeof(cache_size_str));
1501 	add_xml_identifier (misc, "appropr_name", use_appropriate_name, "Use an appropriate name:\nPlease do not create a name that is obscene or offensive, contains more than 2 digits, is senseless or stupid (i.e. djrtq47fa), or is made with the intent of impersonating another player.\nTake into consideration that the name you choose does affect the atmosphere of the game. Inappropriate names can and will be locked.", sizeof (use_appropriate_name) );
1502 	add_xml_identifier(misc,"edit_quantity",quantity_edit_str,"Right-click on the quantity you wish to edit",sizeof(quantity_edit_str));
1503 	add_xml_identifier(misc,"equip_here",equip_here_str,"Place an item in these boxes to equip it",sizeof(equip_here_str));
1504 	add_xml_identifier(misc,"items_text_toggle_help",items_text_toggle_help_str,"Show/hide the text message panel",sizeof(items_text_toggle_help_str));
1505 	add_xml_identifier(misc,"items_unequip_all_help",items_unequip_all_help_str,"Unequip all items",sizeof(items_unequip_all_help_str));
1506 	add_xml_identifier(misc,"items_doubleclick_unequip_all_help",items_doubleclick_unequip_all_help_str,"Double-click to unequip all items",sizeof(items_doubleclick_unequip_all_help_str));
1507 	add_xml_identifier(misc,"mod_click_item_help",mod_click_item_help_str,"Left-click +ctrl/+alt to drop/store all",sizeof(mod_click_item_help_str));
1508 	add_xml_identifier(misc,"multiuse_item_help",multiuse_item_help_str,"Left-click to use (+shift to use again)",sizeof(multiuse_item_help_str));
1509 	add_xml_identifier(misc,"equipment",equip_str,"Equipment",sizeof(equip_str));
1510 	add_xml_identifier(misc,"stoall_help",stoall_help_str,"Move all items into opened storage.",sizeof(stoall_help_str));
1511 	add_xml_identifier(misc,"getall_help",getall_help_str,"Get all items from ground bag.",sizeof(getall_help_str));
1512 	add_xml_identifier(misc,"dcdrpall_help",dcdrpall_help_str,"Double-click to drop all items.",sizeof(dcdrpall_help_str));
1513 	add_xml_identifier(misc,"drpall_help",drpall_help_str,"Drop all items.",sizeof(drpall_help_str));
1514 	add_xml_identifier(misc,"mixoneall_help",mixoneall_help_str,"Mix current manufacture recipe.",sizeof(mixoneall_help_str));
1515 	add_xml_identifier(misc,"itmlst_help",itmlst_help_str,"Show/hide item lists window.",sizeof(itmlst_help_str));
1516 	add_xml_identifier(misc,"items_stack",items_stack_str,"Client can't choose between multiple stacks, make a free slot and let the server do it!",sizeof(items_stack_str));
1517 	add_xml_identifier(misc,"items_cannot_equip",items_cannot_equip_str,"Cannot equip the item!",sizeof(items_cannot_equip_str));
1518 	add_xml_identifier(misc,"mixbut_empty",mixbut_empty_str,"Nothing to mix, add some items using the manufacture window.",sizeof(mixbut_empty_str));
1519 	add_xml_identifier(misc,"mix_empty_str",mix_empty_str,"Nothing to mix, add some items.",sizeof(mix_empty_str));
1520 	add_xml_identifier(misc,"click_clear",click_clear_str,"Click to clear message.",sizeof(click_clear_str));
1521 	add_xml_identifier(misc,"double_click_clear",double_click_clear_str,"Double-click to clear message.",sizeof(double_click_clear_str));
1522 	add_xml_identifier(misc,"recipe_select",recipe_select_str,"Left-click or scroll to select recipe slot.",sizeof(recipe_select_str));
1523 	add_xml_identifier(misc,"recipe_load",recipe_load_str,"Double-click to load recipe.",sizeof(recipe_load_str));
1524 	add_xml_identifier(misc,"recipe_find",recipe_find_str,"Type text - find recipe.",sizeof(recipe_find_str));
1525 	add_xml_identifier(misc,"recipe_during_find",recipe_during_find_str,"Next match - return, +ctrl to load.",sizeof(recipe_during_find_str));
1526 	add_xml_identifier(misc,"recipe_show_hide",recipe_show_hide_str,"Click to show/hide saved recipes. Wheel to scroll.",sizeof(recipe_show_hide_str));
1527 	add_xml_identifier(misc,"recipe_save",recipe_save_str,"Click to save current recipe to selected slot.",sizeof(recipe_save_str));
1528 	add_xml_identifier(misc,"you",you_str,"You",sizeof(you_str));
1529 	add_xml_identifier(misc,"accept",accept_str,"Accept",sizeof(accept_str));
1530 	add_xml_identifier(misc,"cmd_markpos",help_cmd_markpos_str,"Usage: #markpos <x-coord>,<y-coord> <name>",sizeof(help_cmd_markpos_str));
1531 	add_xml_identifier(misc,"location_info",location_info_str,"Location %d,%d marked with %s",sizeof(location_info_str));
1532 	add_xml_identifier(misc,"knowledge_command",knowledge_cmd_str,"List of matching knowledge:",sizeof(knowledge_cmd_str));
1533 	add_xml_identifier(misc,"marked",marked_str,"%s marked",sizeof(marked_str));
1534 	add_xml_identifier(misc,"unmarked",unmarked_str,"%s unmarked",sizeof(unmarked_str));
1535 	add_xml_identifier(misc,"no_urls",urlcmd_none_str,"No URL seen",sizeof(urlcmd_none_str));
1536 	add_xml_identifier(misc,"url_list",urlcmd_list_str,"URL list:",sizeof(urlcmd_list_str));
1537 	add_xml_identifier(misc,"win_url",win_url_str,"URL list",sizeof(win_url_str));
1538 	add_xml_identifier(misc,"invalid_url",urlcmd_invalid_str,"Invalid URL number",sizeof(urlcmd_invalid_str));
1539 	add_xml_identifier(misc,"afk_url",urlcmd_afk_str,"URL seen while AFK:",sizeof(urlcmd_afk_str));
1540 	add_xml_identifier(misc,"clear_url",urlcmd_clear_str,"clear",sizeof(urlcmd_clear_str));
1541 	add_xml_identifier(misc,"open_urlwin",urlwin_open_str,"Click to open; right+click for options",sizeof(urlwin_open_str));
1542 	add_xml_identifier(misc,"clear_urlwin",urlwin_clear_str,"Clear the URL list",sizeof(urlwin_clear_str));
1543 	add_xml_identifier(misc,"reset",reset_str,"Reset",sizeof(reset_str));
1544 	add_xml_identifier(misc,"channel_help",channel_help_str,"Click a Channel to join. You can be in up to 3 channels at a time.\n\nTo talk in a channel, type @ before your message. You do not have to type @ to talk in Local.",sizeof(channel_help_str));
1545 	add_xml_identifier(misc,"channel_color_title",channel_color_title_str,"Channel Colors",sizeof(channel_color_title_str));
1546 	add_xml_identifier(misc,"channel_color",channel_color_str,"Set/delete the color for channel",sizeof(channel_color_str));
1547 	add_xml_identifier(misc,"channel_color_add",channel_color_add_str,"Set",sizeof(channel_color_add_str));
1548 	add_xml_identifier(misc,"channel_color_delete",channel_color_delete_str,"Delete",sizeof(channel_color_delete_str));
1549 	add_xml_identifier(misc,"stats_scroll_help",stats_scroll_help_str,"Scroll Up/Down using CTRL+left/CTRL+right click or scrollwheel.",sizeof(stats_scroll_help_str));
1550 	add_xml_identifier(misc,"cm_statsbar",cm_statsbar_str,"Show Action Points Bar\nShow Last Health Change Always",sizeof(cm_statsbar_str));
1551 	add_xml_identifier(misc,"hud_timer_cm",hud_timer_cm_str,"Change Mode\nKeep State\n--\nStart/Stop\nSet Time\nReset Time\n--\nShow Help",sizeof(hud_timer_cm_str));
1552 	add_xml_identifier(misc,"hud_timer_popup_title",hud_timer_popup_title_str,"Time (in seconds)",sizeof(hud_timer_popup_title_str));
1553 	add_xml_identifier(misc,"no_indicators",no_indicators_str,"No Indicators",sizeof(no_indicators_str));
1554 	add_xml_identifier(misc,"cm_indicators",cm_indicators_str,"--\nMovable Window\nBackground On\nBorder On\n--\nReset Position\n\n--\n",sizeof(cm_indicators_str));
1555 	add_xml_identifier(misc,"day_indicator",day_indicator_str,"S||Special Day||Ordinary Day||Special Days",sizeof(day_indicator_str));
1556 	add_xml_identifier(misc,"harvest_indicator",harvest_indicator_str,"H||Harvesting||Not Harvesting||Harvesting Status",sizeof(harvest_indicator_str));
1557 	add_xml_identifier(misc,"poison_indicator",poison_indicator_str,"P||Poisoned||Not Poisoned||Poison Status",sizeof(poison_indicator_str));
1558 	add_xml_identifier(misc,"messages_indicator",messages_indicator_str,"M||Recent Messages||No Messages||Message Count",sizeof(messages_indicator_str));
1559 	add_xml_identifier(misc,"ranginglock_indicator",ranginglock_indicator_str,"R||Ranging Lock On||Ranging Lock Off||Ranging Lock Status",sizeof(ranginglock_indicator_str));
1560 	add_xml_identifier(misc,"glowperk_indicator",glowperk_indicator_str,"G||Glow Perk On||Glow Perk Off||Glow Perk Status||You do not have the Glow In The Dark perk",sizeof(glowperk_indicator_str));
1561 	add_xml_identifier(misc,"dc_note_rm",dc_note_remove,"Double-click to remove this category",sizeof(dc_note_remove));
1562 	add_xml_identifier(misc,"character_notes_saved",character_notes_saved_str,"Your notes for this character have been saved",sizeof(character_notes_saved_str));
1563 	add_xml_identifier(misc,"notes_save_tooltip",notes_save_tooltip_str,"Right-click for save option",sizeof(notes_save_tooltip_str));
1564 	add_xml_identifier(misc,"using_character_notes",using_character_notes_str,"Now the notepad is just for this character",sizeof(using_character_notes_str));
1565 	add_xml_identifier(misc,"cm_use_character_notepad",cm_use_character_notepad_str,"Use notepad just for this character",sizeof(cm_use_character_notepad_str));
1566 	add_xml_identifier(misc,"note_saved",note_saved,"Your notes have been saved",sizeof(note_saved));
1567 	add_xml_identifier(misc,"note_save_failed",note_save_failed,"Failed to save your notes!",sizeof(note_save_failed));
1568 	add_xml_identifier(misc,"ranginglock_enabled",ranginglock_enabled_str,"Ranging-Lock is now enabled. Disable it or unequip ranging weapon before walking.",sizeof(ranginglock_enabled_str));
1569 	add_xml_identifier(misc,"ranginglock_disabled",ranginglock_disabled_str,"Ranging-Lock is now disabled.",sizeof(ranginglock_disabled_str));
1570 	add_xml_identifier(misc,"close_click_targetting_on",close_click_targetting_on_str,"Close-click targetting on.",sizeof(close_click_targetting_on_str));
1571 	add_xml_identifier(misc,"close_click_targetting_off",close_click_targetting_off_str,"Close-click targetting off.",sizeof(close_click_targetting_off_str));
1572 	add_xml_identifier(misc,"rotate_chat_log_restart", rotate_chat_log_restart_str, "Rotate chat log change will take effect at next restart.", sizeof(rotate_chat_log_restart_str));
1573 	add_xml_identifier(misc,"ranging_win_title", ranging_win_title_str, "Ranging", sizeof(ranging_win_title_str));
1574 	add_xml_identifier(misc,"ranging_total_shots", ranging_total_shots_str, "Total shots", sizeof(ranging_total_shots_str));
1575 	add_xml_identifier(misc,"ranging_sucessful_shots", ranging_sucessful_shots_str, "Successful hits", sizeof(ranging_sucessful_shots_str));
1576 	add_xml_identifier(misc,"ranging_missed_shots", ranging_missed_shots_str, "Missed hits", sizeof(ranging_missed_shots_str));
1577 	add_xml_identifier(misc,"ranging_success_rate", ranging_success_rate_str, "Success rate", sizeof(ranging_success_rate_str));
1578 	add_xml_identifier(misc,"ranging_critical_rate", ranging_critical_rate_str, "Critical rate", sizeof(ranging_critical_rate_str));
1579 	add_xml_identifier(misc,"ranging_exp_per_arrow", ranging_exp_per_arrow_str, "Exp/arrows", sizeof(ranging_exp_per_arrow_str));
1580 	add_xml_identifier(misc,"storage_filter_prompt", storage_filter_prompt_str, "Filter: ", sizeof(storage_filter_prompt_str));
1581 	add_xml_identifier(misc,"storage_filter_help", storage_filter_help_str, "Type text - filter items.", sizeof(storage_filter_help_str));
1582 
1583 	//New characters
1584 	add_xml_identifier(new,"skin",skin_str,"Skin",sizeof(skin_str));
1585 	add_xml_identifier(new,"hair",hair_str,"Hair",sizeof(hair_str));
1586 	add_xml_identifier(new,"eyes",eyes_str,"Eyes",sizeof(eyes_str));
1587 	add_xml_identifier(new,"shirt",shirt_str,"Shirt",sizeof(shirt_str));
1588 	add_xml_identifier(new,"pants",pants_str,"Pants",sizeof(pants_str));
1589 	add_xml_identifier(new,"boots",boots_str,"Boots",sizeof(boots_str));
1590 	add_xml_identifier(new,"head",head_str,"Head",sizeof(head_str));
1591 	add_xml_identifier(new,"gender",gender_str,"Gender",sizeof(gender_str));
1592 	add_xml_identifier(new,"male",male_str,"Male",sizeof(male_str));
1593 	add_xml_identifier(new,"female",female_str,"Female",sizeof(female_str));
1594 	add_xml_identifier(new,"race",race_str,"Race",sizeof(race_str));
1595 	add_xml_identifier(new,"human",human_str,"Human",sizeof(human_str));
1596 	add_xml_identifier(new,"elf",elf_str,"Elf",sizeof(elf_str));
1597 	add_xml_identifier(new,"dwarf",dwarf_str,"Dwarf",sizeof(dwarf_str));
1598 	add_xml_identifier(new,"gnome",gnome_str,"Gnome",sizeof(gnome_str));
1599 	add_xml_identifier(new,"orchan",orchan_str,"Orchan",sizeof(orchan_str));
1600 	add_xml_identifier(new,"draegoni",draegoni_str,"Draegoni",sizeof(draegoni_str));
1601 	add_xml_identifier(new,"confirm",confirm_password,"Confirm:",sizeof(confirm_password));
1602 	add_xml_identifier(new,"userlen",error_username_length,"Username MUST be at least 3 characters long!",sizeof(error_username_length));
1603 	add_xml_identifier(new,"passlen",error_password_length,"The password MUST be at least 4 characters long!",sizeof(error_password_length));
1604 	add_xml_identifier(new,"passnomatch",error_pass_no_match,"Passwords don't match!",sizeof(error_pass_no_match));
1605 	add_xml_identifier(new,"passwordbad",error_bad_pass,"Bad password!",sizeof(error_bad_pass));
1606 	add_xml_identifier(new,"passmatch",passwords_match,"Passwords are matching!",sizeof(passwords_match));
1607 	add_xml_identifier(new,"appearance",remember_change_appearance,"Remember to change your characters appearance before pressing \"Done\"",sizeof(remember_change_appearance));
1608 	add_xml_identifier(new,"appearance_box",appearance_str,"Appearance",sizeof(appearance_str));
1609 	add_xml_identifier(new,"max_digits",error_max_digits,"You can only have 2 digits in your name!",sizeof(error_max_digits));
1610 	add_xml_identifier(new,"max_length",error_length,"Names and passwords can max be 15 characters long",sizeof(error_length));
1611 	add_xml_identifier(new,"illegal_char",error_illegal_character,"You have typed an illegal character!",sizeof(error_illegal_character));
1612 	add_xml_identifier(new,"p2p_race",p2p_race,"You have to pay to create a char with this race",sizeof(p2p_race));
1613 	add_xml_identifier(new,"char_help",char_help,"To customize your character and select name/password, press the buttons at the bottom.",sizeof(char_help));
1614 	add_xml_identifier(new,"confirmcreate",error_confirm_create_char,"Click done again to create a character with that name and appearance.",sizeof(error_confirm_create_char));
1615 	add_xml_identifier(new,"newcharwarning",newchar_warning,"Character creation screen",sizeof(newchar_warning));
1616 	add_xml_identifier(new,"newcharcusthelp",newchar_cust_help,"Click the eye icon below to customize your character.",sizeof(newchar_cust_help)); // it pains me to spell customize with a z:(
1617 	add_xml_identifier(new,"newcharcredhelp",newchar_cred_help,"When ready, click \"Done\" to choose your character name and password.",sizeof(newchar_cred_help));
1618 	add_xml_identifier(new,"newchardonehelp",newchar_done_help,"When ready, click \"Done\" to create your character and enter the game.",sizeof(newchar_done_help));
1619 	add_xml_identifier(new,"wrongpass",invalid_pass,"Invalid password!",sizeof(invalid_pass));
1620 	add_xml_identifier(new,"showpass",show_password,"Show password",sizeof(show_password));
1621 	add_xml_identifier(new,"remember_details",remember_details_str,"Remember details",sizeof(remember_details_str));
1622 	add_xml_identifier(new,"hidepass",hide_password,"Hide password",sizeof(hide_password));
1623 	add_xml_identifier(new,"done",char_done,"Done",sizeof(char_done));
1624 	add_xml_identifier(new,"back",char_back,"Back",sizeof(char_back));
1625 	add_xml_identifier(new,"a_human",about_human,"About Human",sizeof(about_human));
1626 	add_xml_identifier(new,"a_elf",about_elves,"About Elves",sizeof(about_elves));
1627 	add_xml_identifier(new,"a_dwarf",about_dwarfs,"About Dwarfs",sizeof(about_dwarfs));
1628 	add_xml_identifier(new,"a_gnome",about_gnomes,"About Gnomes",sizeof(about_gnomes));
1629 	add_xml_identifier(new,"a_orchan",about_orchans,"About Orchans",sizeof(about_orchans));
1630 	add_xml_identifier(new,"a_draegoni",about_draegoni,"About Draegoni",sizeof(about_draegoni));
1631 	add_xml_identifier(new,"zoom_in_out",zoom_in_out,"To zoom in/out: Middle mouse wheel or Page Up/Down",sizeof(zoom_in_out));
1632 	add_xml_identifier(new,"rotate_camera",rotate_camera,"To rotate the camera: Middle mouse button or arrow keys",sizeof(rotate_camera));
1633 
1634 	//Icons
1635 	add_xml_identifier(tooltips,"walk",tt_walk,"Walk",sizeof(tt_walk));
1636 	add_xml_identifier(tooltips,"sit",tt_sit,"Sit down",sizeof(tt_sit));
1637 	add_xml_identifier(tooltips,"stand",tt_stand,"Stand up",sizeof(tt_stand));
1638 	add_xml_identifier(tooltips,"look",tt_look,"Look at",sizeof(tt_look));
1639 	add_xml_identifier(tooltips,"use",tt_use,"Use",sizeof(tt_use));
1640 	add_xml_identifier(tooltips,"use_witem",tt_use_witem,"Use with",sizeof(tt_use_witem));
1641 	add_xml_identifier(tooltips,"trade",tt_trade,"Trade",sizeof(tt_trade));
1642 	add_xml_identifier(tooltips,"attack",tt_attack,"Attack",sizeof(tt_attack));
1643 	add_xml_identifier(tooltips,"chat",tt_chat,"View Chat",sizeof(tt_chat));
1644 	add_xml_identifier(tooltips,"invent",tt_inventory,"View inventory",sizeof(tt_inventory));
1645 	add_xml_identifier(tooltips,"spell",tt_spell,"View spell window",sizeof(tt_spell));
1646 	add_xml_identifier(tooltips,"manu",tt_manufacture,"View manufacture window",sizeof(tt_manufacture));
1647 	add_xml_identifier(tooltips,"stats",tt_stats,"View stats",sizeof(tt_stats));
1648 	add_xml_identifier(tooltips,"know",tt_knowledge,"View knowledge window",sizeof(tt_knowledge));
1649 	add_xml_identifier(tooltips,"ency",tt_encyclopedia,"View encyclopedia window",sizeof(tt_encyclopedia));
1650 	add_xml_identifier(tooltips,"quest",tt_questlog,"View questlog",sizeof(tt_questlog));
1651 	add_xml_identifier(tooltips,"map",tt_mapwin,"View map",sizeof(tt_mapwin));
1652 	add_xml_identifier(tooltips,"console",tt_console,"View console",sizeof(tt_console));
1653 	add_xml_identifier(tooltips,"buddy",tt_buddy,"View buddy",sizeof(tt_buddy));
1654 	add_xml_identifier(tooltips,"opts",tt_options,"View options",sizeof(tt_options));
1655 	add_xml_identifier(tooltips,"help",tt_help,"View help",sizeof(tt_help));
1656 	add_xml_identifier(tooltips,"customize",tt_customize,"Customize your character",sizeof(tt_customize));
1657 	add_xml_identifier(tooltips,"name_pass",tt_name,"Choose name and password",sizeof(tt_name));
1658 	add_xml_identifier (tooltips, "info", tt_info, "View notepad/URL window", sizeof (tt_info));
1659 	add_xml_identifier (tooltips, "emotewin", tt_emotewin, "View Emote window", sizeof (tt_emotewin));
1660 	add_xml_identifier (tooltips, "range", tt_rangewin, "View Ranging window", sizeof (tt_rangewin));
1661 	add_xml_identifier (tooltips, "minimap", tt_minimap, "View Minimap window", sizeof (tt_minimap));
1662 
1663 	//Buddy list
1664 	add_xml_identifier(buddy, "name", buddy_name_str, "Name:", sizeof(buddy_name_str));
1665 	add_xml_identifier(buddy, "name_desc", buddy_long_name_str, "The name of your buddy", sizeof(buddy_long_name_str));
1666 	add_xml_identifier(buddy, "color", buddy_type_str, "Color:", sizeof(buddy_type_str));
1667 	add_xml_identifier(buddy, "color_desc", buddy_long_type_str, "The color you want your buddy to appear in the list", sizeof(buddy_long_type_str));
1668 	add_xml_identifier(buddy, "add", buddy_add_str, "Add buddy", sizeof(buddy_add_str));
1669 	add_xml_identifier(buddy, "change", buddy_change_str, "Change buddy", sizeof(buddy_change_str));
1670 	add_xml_identifier(buddy, "accept", buddy_accept_str, "Accept buddy", sizeof(buddy_accept_str));
1671 	add_xml_identifier(buddy, "yes", yes_str, "Yes", sizeof(yes_str));
1672 	add_xml_identifier(buddy, "no", no_str, "No", sizeof(yes_str));
1673 	add_xml_identifier(buddy, "delete", buddy_delete_str, "Delete buddy", sizeof(buddy_delete_str));
1674 	add_xml_identifier(buddy, "delete_desc", buddy_long_delete_str, "Check this to delete the buddy from the list", sizeof(buddy_long_delete_str));
1675 	add_xml_identifier(buddy, "request_dialog", buddy_wants_to_add_str, "%s wants to add you to his/her buddy list. Do you wish to allow it?", sizeof(buddy_wants_to_add_str));
1676 	add_xml_identifier(buddy, "add_to_list", buddy_add_to_list_str, "Add to my buddy list", sizeof(buddy_add_to_list_str));
1677 	add_xml_identifier(buddy, "logon", buddy_logon_str, "%.*s has logged on.", sizeof(buddy_logon_str));
1678 	add_xml_identifier(buddy, "online", buddy_online_str, "%.*s is online.", sizeof(buddy_online_str));
1679 	add_xml_identifier(buddy, "logoff", buddy_logoff_str, "%.*s has logged off.", sizeof(buddy_logoff_str));
1680 	add_xml_identifier(buddy, "white", buddy_white_str, "White", sizeof(buddy_white_str));
1681 	add_xml_identifier(buddy, "red", buddy_red_str, "Red", sizeof(buddy_red_str));
1682 	add_xml_identifier(buddy, "green", buddy_green_str, "Green", sizeof(buddy_green_str));
1683 	add_xml_identifier(buddy, "blue", buddy_blue_str, "Blue", sizeof(buddy_blue_str));
1684 	add_xml_identifier(buddy, "yellow", buddy_yellow_str, "Yellow", sizeof(buddy_yellow_str));
1685 	add_xml_identifier(buddy, "request", buddy_request_str, "Requests", sizeof(buddy_request_str));
1686 
1687 	// Update window
1688 	add_xml_identifier(misc, "update_complete", update_complete_str, "The client has been updated", sizeof(update_complete_str));
1689 	add_xml_identifier(misc, "restart_countdown", client_restart_countdown_str, "Client will restart in %d seconds", sizeof(client_restart_countdown_str));
1690 	add_xml_identifier(misc, "restarting", client_restarting_str, "Restarting...", sizeof(client_restarting_str));
1691 	add_xml_identifier(misc, "restart", restart_now_label, "Restart now", sizeof(restart_now_label));
1692 
1693 	/* strings for context menus */
1694 	add_xml_identifier(misc, "cm_quickspell_menu", cm_quickspell_menu_str, "Move Spell Up/Left\nMove Spell Down/Right\nRemove Spell\n--\nRelocatable Window\nMoveable Window\nRotate Window\n--\nReset Position", sizeof(cm_quickspell_menu_str));
1695 	add_xml_identifier(misc, "cm_textedit_menu", cm_textedit_menu_str, "Cut\nCopy\nPaste\n--\nDate\nTime\nCoords", sizeof(cm_textedit_menu_str));
1696 	add_xml_identifier(misc, "cm_quickbar_menu", cm_quickbar_menu_str, "Enable Quickbar Menu\n--\nRelocatable Window\nMoveable Window\nRotate Window\n--\nReset Position", sizeof(cm_quickbar_menu_str));
1697 	add_xml_identifier(misc, "cm_hud_menu", cm_hud_menu_str, "Show Stats\nShow Stats Bars\nShow Knowledge Bar\nShow Timer\nShow Digital Clock\nShow Analogue Clock\nShow Seconds\nShow FPS\nShow Indicators\nEnable Quickbar Menu\n--\nShow Minimap\nShow Ranging Stats\n--\nEnable Sound Effects\nEnable Music\n--\nCopy Location", sizeof(cm_hud_menu_str));
1698 	add_xml_identifier(misc, "cm_banner_menu", cm_banner_menu_str, "Show Names\nShow Health Bars\nShow Health Numbers\nShow Ether Bar\nShow Ether Numbers\nEnable Instance Mode\nShow Speech Bubbles\nEnable Banner Background\nSit Lock\nRanging Lock\n--\nDisable This Menu\n", sizeof(cm_banner_menu_str));
1699 	add_xml_identifier(misc, "cm_title_menu", cm_title_menu_str, "Hide Windows\nOpaque Background\nWindows On Top\nDisable Scaling Controls\n--\nCentred Window\n", sizeof(cm_title_menu_str));
1700 	add_xml_identifier(misc, "cm_title_help", cm_title_help_str, "Right-click for window menu", sizeof(cm_title_help_str));
1701 	add_xml_identifier(misc, "cm_items_menu", cm_items_menu_str, "--\nUse Small Window\nManual Window Size\nItem Window On Drop\nAllow Equipment Swap\nAlt/Ctrl-click With Any Cursor\nButtons On Left\nEquipment Grid On Left\n--\nOpen Storage (View Only)", sizeof(cm_items_menu_str));
1702 	add_xml_identifier(misc, "cm_storage_menu", cm_storage_menu_str, "--\nPrint Items To Console\nSort Categories Alphabetically\nSort Items Alphabetically\nDisable item filter", sizeof(cm_storage_menu_str));
1703 	add_xml_identifier(misc, "cm_astro_menu", cm_astro_menu_str, "--\nPrint Details To Console\nAlways Print Details To Console", sizeof(cm_astro_menu_str));
1704 	add_xml_identifier(misc, "cm_ranging_menu", cm_ranging_menu_str, "--\nPrint To Console", sizeof(cm_ranging_menu_str));
1705 	add_xml_identifier(misc, "cm_dialog_options", cm_dialog_options_str, "Auto close storage dialogue\nAuto select storage option in dialogue", sizeof(cm_dialog_options_str));
1706 	add_xml_identifier(misc, "cm_dialog_menu", cm_dialog_menu_str, "--\nEnable Keypresses\nKeypresses Anywhere", sizeof(cm_dialog_menu_str));
1707 	add_xml_identifier(misc, "cm_url_menu", cm_url_menu_str, "Open\nFind In Console\nMark Visited\nMark Unvisited\n--\nDelete\n--\nDelete All", sizeof(cm_url_menu_str));
1708 	add_xml_identifier(misc, "cm_counters_menu", cm_counters_menu_str, "Delete Entry\n--\nReset Session Total\n--\nEnable Floating Messages For Category\n--\nPrint Category\nPrint All Categories\nPrint Just Session Information", sizeof(cm_counters_menu_str));
1709 	add_xml_identifier(misc, "cm_help_options", cm_help_options_str, "Right-click for options.", sizeof(cm_help_options_str));
1710 	add_xml_identifier(misc, "cm_npcname_menu", cm_npcname_menu_str, "Copy NPC Name\nSet Map Mark\nWrite text to console", sizeof(cm_npcname_menu_str));
1711 	add_xml_identifier(misc, "cm_dialog_copy_menu", cm_dialog_copy_menu_str, "Exclude Responses\nRemove Newlines", sizeof(cm_dialog_copy_menu_str));
1712 	add_xml_identifier(misc, "cm_minimap_menu", cm_minimap_menu_str, "--\nRotate Minimap\nPin Minimap\nOpen On Start", sizeof(cm_minimap_menu_str));
1713 	add_xml_identifier(misc, "cm_user_menu", cm_user_menu_str, "--\nMovable Window\nLock In Standard Position\nChange Standard Position\nBackground On\nBorder On\nSmall Font\nStandard Menus\n--\nShow Commands\n--\nReload Menus\nDisable Menus", sizeof(cm_user_menu_str));
1714 	add_xml_identifier(misc, "cm_item_list_selected", cm_item_list_selected_str, "Edit quantity\n--\nDelete", sizeof(cm_item_list_selected_str));
1715 	add_xml_identifier(misc, "cm_item_list_names", cm_item_list_names_str, "Create new list\nRename active list\n--\nUpdate active list\n--\nDelete active list\n--\nDisable find list\n--\nReload from file\n--\nUse lists just for this character", sizeof(cm_item_list_names_str));
1716 	add_xml_identifier(misc, "cm_stats_bar_base", cm_stats_bar_base_str, "--\nAdd Bar\nRemove Bar\nClick Lock", sizeof(cm_stats_bar_base_str));
1717 	add_xml_identifier(misc, "cm_recipe_menu", cm_recipe_menu_str, "Add additional recipe row\nClear selected recipe\nDelete selected recipe\nSort recipes by name", sizeof(cm_recipe_menu_str));
1718 	add_xml_identifier(misc, "cm_manuwin_menu", cm_manuwin_menu_str, "\n--\nDisable key presses for window", sizeof(cm_manuwin_menu_str));
1719 	add_xml_identifier(misc, "cm_encycl_base", cm_encycl_base_str, "Encyclopedia Index\nSearch Encyclopedia Titles\nRepeat Last Search\nBookmark This Page\nUnbookmark This Page\nClear Bookmarks", sizeof(cm_encycl_base_str));
1720 	add_xml_identifier(misc, "cm_options_default", cm_options_default_str, "Set to default value", sizeof(cm_options_default_str));
1721 	add_xml_identifier(misc, "cm_options_initial", cm_options_initial_str, "Set to initial value", sizeof(cm_options_initial_str));
1722 #ifdef JSON_FILES
1723 	add_xml_identifier(misc, "cm_options_per_character", cm_options_per_character_str, "Manage value just for this character", sizeof(cm_options_per_character_str));
1724 #endif
1725 
1726 	/* user_menus.cpp */
1727 	add_xml_identifier(misc, "um_invalid_command", um_invalid_command_str, "Invalid command text", sizeof(um_invalid_command_str));
1728 	add_xml_identifier(misc, "um_invalid_line", um_invalid_line_str, "<Error: invalid line>", sizeof(um_invalid_line_str));
1729 	add_xml_identifier(misc, "um_no_menus", um_no_menus_str, "No User Menus", sizeof(um_no_menus_str));
1730 	add_xml_identifier(misc, "um_window_title", um_window_title_str, "User Menus", sizeof(um_window_title_str));
1731 
1732 	/* quest_log.cpp */
1733 	add_xml_identifier(misc, "cm_questlog_menu", cm_questlog_menu_str,
1734 		"Show all quests & entries\nOpen quest list window\nOpen NPC list window\n"
1735 		"Select NPCs, starting with none...\nShow just this NPC\nShow just this quest\n--\n"
1736 		"Copy entry\nCopy all entries\nFind text...\nAdd entry...\n--\n"
1737 		"Select entry\nUnselect entry\nSelect all entries\nUnselect all entires\nShow only selected entries\n--\n"
1738 		"Delete entry\nUndelete entry\n--\n"
1739 		"Delete duplicates entries\n--\n"
1740 		"Save changes", sizeof(cm_questlog_menu_str));
1741 	add_xml_identifier(misc, "cm_questlist_menu", cm_questlist_menu_str,
1742 		"Quest completed\nAdd selected entries to quest\n--\n"
1743 		"Hide completed quests\nDo not always open window\nStart window left of entries\n", sizeof(cm_questlist_menu_str));
1744 	add_xml_identifier(misc, "questlog_find_prompt", questlog_find_prompt_str, "Text to Find", sizeof(questlog_find_prompt_str));
1745 	add_xml_identifier(misc, "questlog_add_npc_prompt", questlog_add_npc_prompt_str, "NPC name", sizeof(questlog_add_npc_prompt_str));
1746 	add_xml_identifier(misc, "questlog_add_text_prompt", questlog_add_text_prompt_str, "Entry text", sizeof(questlog_add_text_prompt_str));
1747 	add_xml_identifier(misc, "questlog_npc_filter_title", questlog_npc_filter_title_str, "NPC list", sizeof(questlog_npc_filter_title_str));
1748 	add_xml_identifier(misc, "questlist_filter_title", questlist_filter_title_str, "Quest List", sizeof(questlist_filter_title_str));
1749 	add_xml_identifier(misc, "questlist_showall", questlist_showall_str, "Show all quests", sizeof(questlist_showall_str));
1750 	add_xml_identifier(misc, "questlog_cm_help", questlog_cm_help_str, "Right-click for command menu", sizeof(questlog_cm_help_str));
1751 	add_xml_identifier(misc, "questlog_deldupe_start", questlog_deldupe_start_str, "Deleting duplicate quest log entries...", sizeof(questlog_deldupe_start_str));
1752 	add_xml_identifier(misc, "questlog_deldupe_end", questlog_deldupe_end_str, "...unique entries: %d, deleted duplicates: %d.", sizeof(questlog_deldupe_end_str));
1753 	add_xml_identifier(misc, "questlog_deleted", questlog_deleted_str, "(Deleted)", sizeof(questlog_deleted_str));
1754 	add_xml_identifier(misc, "item_list_use_help", item_list_use_help_str, "Use quantity - right-click", sizeof(item_list_use_help_str));
1755 	add_xml_identifier(misc, "item_list_pickup_help", item_list_pickup_help_str, "Pick up - left-click", sizeof(item_list_pickup_help_str));
1756 	add_xml_identifier(misc, "item_list_edit_help", item_list_edit_help_str, "Edit menu - ctrl+right-click", sizeof(item_list_edit_help_str));
1757 	add_xml_identifier(misc, "item_list_add_help", item_list_add_help_str, "Add to list - ctrl+left-click", sizeof(item_list_add_help_str));
1758 	add_xml_identifier(misc, "item_list_drag_help", item_list_drag_help_str, "Add to list - drag from inv/sto", sizeof(item_list_drag_help_str));
1759 	add_xml_identifier(misc, "item_list_create_help", item_list_create_help_str, "Create new list", sizeof(item_list_create_help_str));
1760 	add_xml_identifier(misc, "item_list_find", item_list_find_str, "Find: ", sizeof(item_list_find_str));
1761 	add_xml_identifier(misc, "item_list_find_help", item_list_find_help_str, "Find list - type text", sizeof(item_list_find_help_str));
1762 	add_xml_identifier(misc, "item_list_find_help_disabled", item_list_find_help_disabled_str, "Find list - (disabled)", sizeof(item_list_find_help_disabled_str));
1763 }
1764 #endif
1765 
1766 #ifdef ELC
init_spell_translatables()1767 void init_spell_translatables ()
1768 {
1769 	//Sigils
1770 	add_xml_distringid(sigils_str,"change",&sig_change,"Change","");
1771 	add_xml_distringid(sigils_str,"restore",&sig_restore,"Restore","");
1772 	add_xml_distringid(sigils_str,"space",&sig_space,"Space","");
1773 	add_xml_distringid(sigils_str,"increase",&sig_increase,"Increase","");
1774 	add_xml_distringid(sigils_str,"decrease",&sig_decrease,"Decrease","");
1775 	add_xml_distringid(sigils_str,"temporary",&sig_temp,"Temporary","");
1776 	add_xml_distringid(sigils_str,"permanent",&sig_perm,"Permanent","");
1777 	add_xml_distringid(sigils_str,"move",&sig_move,"Move","");
1778 	add_xml_distringid(sigils_str,"local",&sig_local,"Local","");
1779 	add_xml_distringid(sigils_str,"global",&sig_global,"Global","");
1780 	add_xml_distringid(sigils_str,"fire",&sig_fire,"Fire","");
1781 	add_xml_distringid(sigils_str,"water",&sig_water,"Water","");
1782 	add_xml_distringid(sigils_str,"air",&sig_air,"Air","");
1783 	add_xml_distringid(sigils_str,"earth",&sig_earth,"Earth","");
1784 	add_xml_distringid(sigils_str,"spirit",&sig_spirit,"Spirit","");
1785 	add_xml_distringid(sigils_str,"matter",&sig_matter,"Matter","");
1786 	add_xml_distringid(sigils_str,"energy",&sig_energy,"Energy","");
1787 	add_xml_distringid(sigils_str,"magic",&sig_magic,"Magic","");
1788 	add_xml_distringid(sigils_str,"destroy",&sig_destroy,"Destroy","");
1789 	add_xml_distringid(sigils_str,"create",&sig_create,"Create","");
1790 	add_xml_distringid(sigils_str,"knowledge",&sig_knowledge,"Knowledge","");
1791 	add_xml_distringid(sigils_str,"protection",&sig_protection,"Protection","");
1792 	add_xml_distringid(sigils_str,"remove",&sig_remove,"Remove","");
1793 	add_xml_distringid(sigils_str,"health",&sig_health,"Health","");
1794 	add_xml_distringid(sigils_str,"life",&sig_life,"Life","");
1795 	add_xml_distringid(sigils_str,"death",&sig_death,"Death","");
1796 }
1797 #endif
1798 
1799 #ifdef ELC
init_stats()1800 void init_stats()
1801 {
1802 	group_stat * base = &(stats_str[0]);
1803 	group_stat * cross = &(stats_str[1]);
1804 	group_stat * misc = &(stats_str[2]);
1805 	group_stat * nexus = &(stats_str[3]);
1806 	group_stat * skills = &(stats_str[4]);
1807 
1808 	//Initial strings
1809 	add_xml_identifier(stats_extra,"base",(char*)attributes.base,"Basic Attributes",sizeof(attributes.base));
1810 	add_xml_identifier(stats_extra,"cross",(char*)attributes.cross,"Cross Attributes",sizeof(attributes.cross));
1811 	add_xml_identifier(stats_extra,"nexus",(char*)attributes.nexus,"Nexus",sizeof(attributes.nexus));
1812 	add_xml_identifier(stats_extra,"skills",(char*)attributes.skills,"Skills",sizeof(attributes.skills));
1813 	add_xml_identifier(stats_extra,"pickpoints",(char*)attributes.pickpoints,"Pickpoints",sizeof(attributes.pickpoints));
1814 
1815 	add_xml_statid(base,"phy",&(attributes.phy),"Physique","phy");
1816 	add_xml_statid(base,"coo",&(attributes.coo),"Coordination","coo");
1817 	add_xml_statid(base,"rea",&(attributes.rea),"Reasoning","rea");
1818 	add_xml_statid(base,"will",&(attributes.wil),"Will","wil");
1819 	add_xml_statid(base,"inst",&(attributes.ins),"Instinct","ins");
1820 	add_xml_statid(base,"vit",&(attributes.vit),"Vitality","vit");
1821 
1822 	add_xml_statid(cross,"might",&(attributes.might),"Might","mig");
1823 	add_xml_statid(cross,"matter",&(attributes.matter),"Matter","mat");
1824 	add_xml_statid(cross,"tough",&(attributes.tough),"Toughness","tou");
1825 	add_xml_statid(cross,"charm",&(attributes.charm),"Charm","cha");
1826 	add_xml_statid(cross,"react",&(attributes.react),"Reaction","reac");
1827 	add_xml_statid(cross,"perc",&(attributes.perc),"Perception","per");
1828 	add_xml_statid(cross,"rat",&(attributes.ration),"Rationality","rat");
1829 	add_xml_statid(cross,"dext",&(attributes.dext),"Dexterity","dex");
1830 	add_xml_statid(cross,"eth",&(attributes.eth),"Ethereality","eth");
1831 
1832 	add_xml_statid(misc,"material",&(attributes.material_points),"Material Points","matp");
1833 	add_xml_statid(misc,"ethereal",&(attributes.ethereal_points),"Ethereal Points","ethp");
1834 	add_xml_statid(misc,"carry",&(attributes.carry_capacity),"Carry capacity","Load");
1835 	add_xml_statid(misc,"food",&(attributes.food),"Food level","food");
1836 	add_xml_statid(misc,"action",&(attributes.action_points),"Action Points","actp");
1837 
1838 	add_xml_statid(nexus,"human",&(attributes.human_nex),"Human","hum");
1839 	add_xml_statid(nexus,"animal",&(attributes.animal_nex),"Animal","ani");
1840 	add_xml_statid(nexus,"vegetal",&(attributes.vegetal_nex),"Vegetal","veg");
1841 	add_xml_statid(nexus,"inorganic",&(attributes.inorganic_nex),"Inorganic","ino");
1842 	add_xml_statid(nexus,"artificial",&(attributes.artificial_nex),"Artificial","art");
1843 	add_xml_statid(nexus,"magic",&(attributes.magic_nex),"Magic","magn");
1844 
1845 	add_xml_statid(skills,"attack",&(attributes.attack_skill),"Attack","att");
1846 	add_xml_statid(skills,"defense",&(attributes.defense_skill),"Defense","def");
1847 	add_xml_statid(skills,"harvest",&(attributes.harvesting_skill),"Harvest","har");
1848 	add_xml_statid(skills,"alch",&(attributes.alchemy_skill),"Alchemy","alc");
1849 	add_xml_statid(skills,"magic",&(attributes.magic_skill),"Magic","mag");
1850 	add_xml_statid(skills,"potion",&(attributes.potion_skill),"Potion","pot");
1851 	add_xml_statid(skills,"summon",&(attributes.summoning_skill),"Summoning","sum");
1852 	add_xml_statid(skills,"manu",&(attributes.manufacturing_skill),"Manufacturing","man");
1853 	add_xml_statid(skills,"crafting",&(attributes.crafting_skill),"Crafting","cra");
1854 	add_xml_statid(skills,"engineering",&(attributes.engineering_skill),"Engineering","eng");
1855 	add_xml_statid(skills,"tailoring",&(attributes.tailoring_skill),"Tailoring","tai");
1856 	add_xml_statid(skills,"ranging",&(attributes.ranging_skill),"Ranging","ran");
1857 	add_xml_statid(skills,"overall",&(attributes.overall_skill),"Overall","oa");
1858 }
1859 #endif
1860 
1861 #ifdef ELC
init_titles()1862 void init_titles ()
1863 {
1864 	add_xml_identifier (titles_str, "w_note", win_notepad, "Notepad", sizeof(win_notepad));
1865 	add_xml_identifier (titles_str, "w_prompt", win_prompt, "Prompt", sizeof(win_prompt));
1866 	add_xml_identifier (titles_str, "w_stats", win_statistics, "Statistics", sizeof(win_statistics));
1867 	add_xml_identifier (titles_str, "w_sigils", win_sigils, "Sigils", sizeof(win_sigils));
1868 	add_xml_identifier (titles_str, "w_inv", win_inventory, "Inventory", sizeof(win_inventory));
1869 	add_xml_identifier (titles_str, "w_help", win_help, "Help", sizeof(win_help));
1870 	add_xml_identifier (titles_str, "w_buddy", win_buddy, "Buddy", sizeof(win_buddy));
1871 	add_xml_identifier (titles_str, "w_config", win_configuration, "Options", sizeof(win_configuration));
1872 	add_xml_identifier (titles_str, "w_manu", win_manufacture, "Manufacture", sizeof(win_manufacture));
1873 	add_xml_identifier (titles_str, "w_astro", win_astrology, "Astrology", sizeof(win_astrology));
1874 	add_xml_identifier (titles_str, "w_principal", win_principal, "Eternal Lands", sizeof(win_principal));
1875 	add_xml_identifier (titles_str, "w_storage", win_storage, "Storage", sizeof(win_storage));
1876 	add_xml_identifier (titles_str, "w_storage_vo", win_storage_vo, " (view only)", sizeof(win_storage_vo));
1877 	add_xml_identifier (titles_str, "w_trade", win_trade, "Trade", sizeof(win_trade));
1878 	add_xml_identifier (titles_str, "w_rules", win_rules, "Rules", sizeof(win_rules));
1879 	add_xml_identifier (titles_str, "w_bag", win_bag, "Bag", sizeof(win_bag));
1880 	add_xml_identifier (titles_str, "w_design", win_design, "Design your character", sizeof(win_design));
1881 	add_xml_identifier (titles_str, "w_name_pass", win_name_pass, "Choose name and password", sizeof(win_name_pass));
1882 	add_xml_identifier (titles_str, "w_newchar", win_newchar, "New Character", sizeof(win_newchar));
1883 	add_xml_identifier (titles_str, "w_minimap", win_minimap, "Minimap", sizeof(win_minimap));
1884 	add_xml_identifier (titles_str, "tab_control", ttab_controls, "Controls", sizeof(ttab_controls));
1885 	add_xml_identifier (titles_str, "tab_audio", ttab_audio, "Audio", sizeof(ttab_audio));
1886 	add_xml_identifier (titles_str, "tab_hud", ttab_hud, "HUD", sizeof(ttab_hud));
1887 	add_xml_identifier (titles_str, "tab_server", ttab_server, "Server", sizeof(ttab_server));
1888 	add_xml_identifier (titles_str, "tab_chat", ttab_chat, "Chat", sizeof(ttab_chat));
1889 	add_xml_identifier (titles_str, "tab_video", ttab_video, "Video", sizeof(ttab_video));
1890 	add_xml_identifier (titles_str, "tab_gfx", ttab_gfx, "GFX", sizeof(ttab_gfx));
1891 	add_xml_identifier (titles_str, "tab_camera", ttab_camera, "Camera", sizeof(ttab_camera));
1892 	add_xml_identifier (titles_str, "tab_troubleshoot", ttab_troubleshoot, "Troubleshoot", sizeof(ttab_troubleshoot));
1893 	add_xml_identifier (titles_str, "tab_font", ttab_font, "Font", sizeof(ttab_font));
1894 	add_xml_identifier (titles_str, "t_help", tab_help, "Help", sizeof(tab_help));
1895 	add_xml_identifier (titles_str, "t_ency", tab_encyclopedia, "Encyclopedia", sizeof(tab_encyclopedia));
1896 	add_xml_identifier (titles_str, "t_skills", tab_skills, "Skills", sizeof(tab_skills));
1897 	add_xml_identifier (titles_str, "t_rules", tab_rules, "Rules", sizeof(tab_rules));
1898 	add_xml_identifier (titles_str, "t_stats", tab_statistics, "Statistics", sizeof(tab_statistics));
1899 	add_xml_identifier (titles_str, "t_know", tab_knowledge, "Knowledge", sizeof(tab_knowledge));
1900 	add_xml_identifier (titles_str, "t_qlog", tab_questlog, "Quest log", sizeof(tab_questlog));
1901 	add_xml_identifier (titles_str, "t_kills", tab_counters, "Counters", sizeof(tab_counters));
1902 	add_xml_identifier (titles_str, "t_session", tab_session, "Session", sizeof(tab_session));
1903 	add_xml_identifier (titles_str, "t_main", tab_main, "Main", sizeof(tab_main));
1904 	add_xml_identifier (titles_str, "b_okay", button_okay, "Okay", sizeof(button_okay));
1905 	add_xml_identifier (titles_str, "b_cancel", button_cancel, "Cancel", sizeof(button_cancel));
1906 	add_xml_identifier (titles_str, "b_new_cat", button_new_category, "New Category", sizeof(button_new_category));
1907 	add_xml_identifier (titles_str, "b_rm_cat", button_remove_category, "Remove Category", sizeof(button_remove_category));
1908 	add_xml_identifier (titles_str, "b_save", button_save_notes, "Save Notes", sizeof(button_save_notes));
1909 	add_xml_identifier (titles_str, "l_nname", label_note_name, "Note name", sizeof(label_note_name));
1910 	add_xml_identifier (titles_str, "l_cursor_coords", label_cursor_coords, "Cursor position", sizeof(label_cursor_coords));
1911 	add_xml_identifier (titles_str, "l_mark_filter", label_mark_filter, "Mark filter", sizeof(label_mark_filter));
1912 	add_xml_identifier (titles_str, "game_version", game_version_str, "Eternal Lands Version %d.%d.%d%s", sizeof(game_version_str));
1913 	add_xml_identifier (titles_str, "game_version_prefix", game_version_prefix_str, "Eternal Lands Version", sizeof(game_version_prefix_str));
1914 	add_xml_identifier (titles_str, "b_send", button_send, "Send", sizeof(button_send));
1915 	add_xml_identifier (titles_str, "item_list_name", item_list_name_str, "Enter list name", sizeof(item_list_name_str));
1916 	add_xml_identifier (titles_str, "item_list_rename", item_list_rename_str, "Enter new name", sizeof(item_list_rename_str));
1917 	add_xml_identifier (titles_str, "item_list_preview", item_list_preview_title, "Item lists", sizeof(item_list_preview_title));
1918 	add_xml_identifier (titles_str, "item_list_quantity", item_list_quantity_str, "Quantity", sizeof(item_list_quantity_str));
1919 }
1920 #endif // ELC
1921 
1922 #ifdef WRITE_XML
save_strings(xmlDoc * doc,char * name)1923 void save_strings(xmlDoc * doc, char * name)
1924 {
1925 	char str[50];
1926 
1927 	//default language is en - change this if you want to save the strings to another folder...
1928 	safe_snprintf (str, sizeof (str), "languages/en/strings/%s", name);
1929 	xmlSaveFormatFileEnc (str, doc, "UTF-8", 1);//We'll save the file in UTF-8
1930 }
1931 #endif
1932 
load_translatables()1933 void load_translatables()
1934 {
1935 	struct xml_struct file=load_strings("console.xml");
1936 #ifdef ELC
1937 	if(file.file!=NULL) {
1938 		//Parse file
1939 		parse_console(file.root);
1940 #ifdef WRITE_XML
1941 		save_strings(file.file,"console.xml");
1942 #endif
1943 		xmlFreeDoc(file.file);
1944 	}
1945 #endif
1946 	file = load_strings("errors.xml");
1947 	if(file.file!=NULL) {
1948 		parse_errors(file.root);
1949 #ifdef WRITE_XML
1950 		save_strings(file.file,"errors.xml");
1951 #endif
1952 		xmlFreeDoc(file.file);
1953 	}
1954 #ifdef ELC
1955 	file = load_strings("help.xml");
1956 	if(file.file!=NULL) {
1957 		parse_help(file.root);
1958 #ifdef WRITE_XML
1959 		save_strings(file.file,"help.xml");
1960 #endif
1961 		xmlFreeDoc(file.file);
1962 	}
1963 #endif
1964 #ifdef ELC
1965 	file = load_strings("options.xml");
1966 	if(file.file!=NULL) {
1967 		parse_options(file.root);
1968 #ifdef WRITE_XML
1969 		save_strings(file.file,"options.xml");
1970 #endif
1971 		xmlFreeDoc(file.file);
1972 	}
1973 #endif
1974 #ifdef ELC
1975 	file = load_strings("spells.xml");
1976 	if(file.file!=NULL) {
1977 		parse_spells(file.root);
1978 #ifdef WRITE_XML
1979 		save_strings(file.file,"spells.xml");
1980 #endif
1981 		xmlFreeDoc(file.file);
1982 	}
1983 #endif
1984 #ifdef ELC
1985 	file = load_strings("stats.xml");
1986 	if(file.file!=NULL){
1987 		parse_stats(file.root);
1988 #ifdef WRITE_XML
1989 		save_strings(file.file,"stats.xml");
1990 #endif
1991 		xmlFreeDoc(file.file);
1992 	}
1993 #endif
1994 #ifdef ELC
1995 	file = load_strings("titles.xml");
1996 	if(file.file!=NULL){
1997 		parse_titles(file.root);
1998 #ifdef WRITE_XML
1999 		save_strings(file.file,"titles.xml");
2000 #endif
2001 		xmlFreeDoc(file.file);
2002 	}
2003 #endif
2004 #ifdef ELC
2005 	save_named_strings(help_str,HELP_STR, "tooltips");
2006 #endif
2007 #ifndef WRITE_XML
2008 //There's no need for these variables to be hanging around any more...
2009 	free_xml_parser(GROUP,errors,ERRORS);
2010 #ifdef ELC
2011 	free_xml_parser(GROUP,console_str,CONSOLE_STR);
2012 	free_xml_parser(GROUP,help_str,HELP_STR);
2013 	free_xml_parser(DIGROUP,options_str,OPTIONS_STR);
2014 	free_xml_parser(DIGROUP,sigils_str,SIGILS_STR);
2015 	free_xml_parser(STAT_GROUP,stats_str,STATS_STR);
2016 	free_xml_parser(GROUP,stats_extra,STATS_EXTRA);
2017 	free_xml_parser(GROUP,titles_str,TITLES_STR);
2018 #endif
2019 #endif
2020 }
2021 
load_strings(char * file)2022 struct xml_struct load_strings(char * file)
2023 {
2024 	char file_name[120];
2025 	struct xml_struct tmp={NULL,NULL};
2026 	safe_snprintf(file_name, sizeof(file_name), "languages/%s/strings/%s",lang,file);
2027 	tmp=load_strings_file(file_name);
2028 	if(tmp.file==NULL||tmp.root==NULL){
2029 		safe_snprintf(file_name, sizeof(file_name), "languages/en/strings/%s",file);
2030 		tmp=load_strings_file(file_name);
2031 		if(tmp.file==NULL){
2032 			//Notify about this error - english only
2033 			LOG_ERROR("Could not read %s\n", file);
2034 		}
2035 	}
2036 	return tmp;
2037 }
2038 
load_strings_file(char * filename)2039 struct xml_struct load_strings_file(char * filename)
2040 {
2041 	struct xml_struct file={NULL,NULL};
2042 	if ((file.file = xmlReadFile(filename, NULL, 0)) == NULL){
2043 #ifdef WRITE_XML
2044 		if ((file.file = xmlNewDoc(BAD_CAST "1.0"))==NULL){
2045 			xmlFreeDoc(file.file);
2046 			file.file=NULL;
2047 		}
2048 #else
2049 		xmlFreeDoc(file.file);
2050 		file.file=NULL;
2051 #endif
2052 	}
2053 	if(file.file){
2054 		if((file.root=xmlDocGetRootElement(file.file))==NULL){
2055 #ifdef WRITE_XML
2056 			file.root=xmlNewNode(NULL,"root");
2057 			xmlDocSetRootElement (file.file, file.root);
2058 			if((file.root=xmlDocGetRootElement(file.file))==NULL) {
2059 #endif
2060 				LOG_ERROR("Fatal: couldn't find root element in %s\n",filename);
2061 				xmlFreeDoc(file.file);
2062 				file.file=NULL;
2063 #ifdef WRITE_XML
2064 			}
2065 #endif
2066 		}
2067 	}
2068 	return file;
2069 }
2070 
copy_strings(xmlNode * in,distring_item * string)2071 void copy_strings(xmlNode * in, distring_item * string)
2072 {
2073 	xmlNode *cur = in->children?in->children:in;
2074 	for(;cur; cur = cur-> next) {
2075 		if(cur->type == XML_ELEMENT_NODE) {
2076 			if(cur->children) {
2077 				if(!xmlStrcasecmp(cur->name, (xmlChar*)"name")) {
2078 					char *p=(char*)string->var->str;
2079 					my_xmlStrncopy(&p,  (char*)cur->children->content, sizeof(string->var->str) -1);
2080 #ifdef WRITE_XML
2081 					string->var->saved_str=1;
2082 #endif
2083 				} else if (!xmlStrcasecmp(cur->name, (xmlChar*)"desc")) {
2084 					char *p=(char*)string->var->desc;
2085 					my_xmlStrncopy(&p, (char*)cur->children->content, sizeof(string->var->desc) -1);
2086 #ifdef WRITE_XML
2087 					string->var->saved_desc=1;
2088 #endif
2089 				}
2090 			}
2091 		}
2092 	}
2093 #ifdef WRITE_XML
2094 	if(!string->var->saved_str) xmlNewTextChild(in, NULL, "name", string->var->str);
2095 	if(!string->var->saved_desc) {
2096 		if(string->var->desc!=NULL) xmlNewTextChild(in, NULL, "desc", string->var->desc);
2097 		else xmlNewTextChild(in, NULL, "desc", " ");
2098 	}
2099 #endif
2100 }
2101 #ifdef ELC
copy_stats(xmlNode * in,statstring_item * string)2102 void copy_stats(xmlNode * in, statstring_item * string)
2103 {
2104 	xmlNode *cur = in->children?in->children:in;
2105 	for(; cur; cur = cur-> next) {
2106 		if(cur->type == XML_ELEMENT_NODE) {
2107 			if(cur->children){
2108 				if(!xmlStrcasecmp(cur->name, (xmlChar*)"name")) {
2109 					char *p=(char*)string->var->name;
2110 					my_xmlStrncopy(&p, (char*)cur->children->content, 20);
2111 #ifdef WRITE_XML
2112 					string->var->saved_name=1;
2113 #endif
2114 				} else if (!xmlStrcasecmp(cur->name, (xmlChar*)"shortname")){
2115 					char *p=(char*)string->var->shortname;
2116 					my_xmlStrncopy(&p, (char*)cur->children->content, 6);
2117 #ifdef WRITE_XML
2118 					string->var->saved_shortname=1;
2119 #endif
2120 				}
2121 			}
2122 		}
2123 	}
2124 #ifdef WRITE_XML
2125 	if(!string->var->saved_name) xmlNewTextChild(in, NULL, "name", string->var->name);
2126 	if(!string->var->saved_shortname) xmlNewTextChild(in, NULL, "shortname", string->var->shortname);
2127 #endif
2128 }
2129 #endif
2130 
2131 #ifdef ELC
parse_statstrings(xmlNode * in,group_stat * group)2132 void parse_statstrings(xmlNode * in, group_stat * group)
2133 {
2134 	xmlNode * cur = in->children?in->children:in;
2135 	int i;
2136 	for(;cur;cur=cur->next) {
2137 		if(cur->type == XML_ELEMENT_NODE) {
2138 			if(cur->children) {
2139 				for(i=0;i<group->no;i++){
2140 					if(!xmlStrcasecmp(cur->name, (xmlChar*)group->statstrings[i]->xml_id)) {
2141 						copy_stats(cur->children,group->statstrings[i]);
2142 #ifdef WRITE_XML
2143 						group->statstrings[i]->saved=1;
2144 #endif
2145 						break;
2146 					}
2147 				}
2148 			}
2149 		}
2150 	}
2151 #ifdef WRITE_XML
2152 	for(i=0;i<group->no;i++) {
2153 		if(!group->statstrings[i]->saved) {
2154 			cur=xmlNewTextChild(in, NULL, group->statstrings[i]->xml_id, NULL);
2155 			copy_stats(cur, group->statstrings[i]);
2156 		}
2157 	}
2158 #endif
2159 }
2160 #endif
2161 
parse_distrings(xmlNode * in,group_id_di * group)2162 void parse_distrings(xmlNode * in, group_id_di * group)
2163 {
2164 	xmlNode * cur = in->children?in->children:in;
2165 	int i;
2166 	for(;cur;cur=cur->next) {
2167 		if(cur->type==XML_ELEMENT_NODE) {
2168 			if(cur->children) {
2169 				for(i=0;i<group->no;i++){
2170 					if(!xmlStrcasecmp(cur->name, (xmlChar*)group->distrings[i]->xml_id)){
2171 						copy_strings(cur->children,group->distrings[i]);
2172 #ifdef WRITE_XML
2173 						group->distrings[i]->saved=1;
2174 #endif
2175 						break;
2176 					}
2177 				}
2178 			}
2179 		}
2180 	}
2181 #ifdef WRITE_XML
2182 	for(i=0;i<group->no;i++) {
2183 		if(!group->distrings[i]->saved) {
2184 			cur=xmlNewTextChild(in, NULL, group->distrings[i]->xml_id, NULL);
2185 			copy_strings(cur, group->distrings[i]);
2186 		}
2187 	}
2188 #endif
2189 }
2190 
parse_strings(xmlNode * in,group_id * group)2191 void parse_strings(xmlNode * in, group_id * group)
2192 {
2193 	int i;
2194 	xmlNode * cur = in->children?in->children:in;
2195 	for(;cur;cur=cur->next) {
2196 		if(cur->type==XML_ELEMENT_NODE) {
2197 			if(cur->children) {
2198 				for(i=0;i<group->no;i++){
2199 					if(!xmlStrcasecmp(cur->name, (xmlChar*)group->strings[i]->xml_id))	{
2200 						my_xmlStrncopy(&group->strings[i]->var, (char*)cur->children->content, group->strings[i]->max_len);
2201 #ifdef WRITE_XML
2202 						group->strings[i]->saved=1;
2203 #endif
2204 						break;
2205 					}
2206 				}
2207 			}
2208 		}
2209 	}
2210 #ifdef WRITE_XML
2211 	for(i=0;i<group->no;i++) {
2212 		if(!group->strings[i]->saved) {
2213 			xmlNewTextChild(in, NULL, group->strings[i]->xml_id, group->strings[i]->var);
2214 		}
2215 	}
2216 #endif
2217 }
2218 
parse_groups(xmlNode * in,void * gPtr,int size,int type)2219 void parse_groups(xmlNode * in, void * gPtr, int size, int type)
2220 {
2221 	group_id * group=gPtr;
2222 	group_id_di * Group=gPtr;
2223 #ifdef ELC
2224 	group_stat * stat=gPtr;
2225 #endif
2226 	size_t i;
2227 	xmlNode * cur = in->children?in->children:in;
2228 	for(;cur;cur=cur->next) {
2229 		if(cur->type==XML_ELEMENT_NODE) {
2230 			for(i=0;i<size;i++) {
2231 				switch(type) {
2232 					case GROUP:
2233 						if(!xmlStrcasecmp(cur->name, (xmlChar*)group[i].xml_id)) {
2234 							parse_strings(cur,&(group[i]));
2235 #ifdef WRITE_XML
2236 							group[i].saved=1;
2237 #endif
2238 							i=size;
2239 						}
2240 						break;
2241 					case DIGROUP:
2242 						if(!xmlStrcasecmp(cur->name, (xmlChar*)Group[i].xml_id)) {
2243 							parse_distrings(cur,&(Group[i]));
2244 #ifdef WRITE_XML
2245 							Group[i].saved=1;
2246 #endif
2247 							i=size;
2248 						}
2249 						break;
2250 #ifdef ELC
2251 					case STAT_GROUP:
2252 						if(!xmlStrcasecmp(cur->name, (xmlChar*)stat[i].xml_id)) {
2253 							parse_statstrings(cur,&(stat[i]));
2254 #ifdef WRITE_XML
2255 							stat[i].saved=1;
2256 #endif
2257 							i=size;
2258 						}
2259 						break;
2260 #endif
2261 					default: break;
2262 				}
2263 			}
2264 		}
2265 	}
2266 #ifdef WRITE_XML
2267 	for(i=0;i<size;i++) {
2268 		switch(type) {
2269 			case GROUP:
2270 				if(!group[i].saved) {
2271 					cur=xmlNewChild(in, NULL, group[i].xml_id, NULL);
2272 					parse_strings(cur,&(group[i]));
2273 				}
2274 				break;
2275 			case DIGROUP:
2276 				if(!Group[i].saved) {
2277 					cur=xmlNewChild(in, NULL, Group[i].xml_id, NULL);
2278 					parse_distrings(cur,&(Group[i]));
2279 				}
2280 				break;
2281 			case STAT_GROUP:
2282 				if(!stat[i].saved) {
2283 					cur=xmlNewChild(in, NULL, stat[i].xml_id, NULL);
2284 					parse_statstrings(cur,&(stat[i]));
2285 				}
2286 			default: break;
2287 		}
2288 	}
2289 #endif
2290 }
2291 
2292 #ifdef ELC
parse_console(xmlNode * in)2293 void parse_console(xmlNode * in)
2294 {
2295 	parse_groups(in,console_str,CONSOLE_STR, GROUP);
2296 }
2297 #endif
2298 
parse_errors(xmlNode * in)2299 void parse_errors(xmlNode * in)
2300 {
2301 	parse_groups(in,errors,ERRORS,GROUP);
2302 }
2303 
2304 #ifdef ELC
parse_help(xmlNode * in)2305 void parse_help(xmlNode * in)
2306 {
2307 	parse_groups(in, help_str, HELP_STR, GROUP);
2308 }
2309 #endif
2310 
2311 #ifdef ELC
parse_options(xmlNode * in)2312 void parse_options(xmlNode * in)
2313 {
2314 	parse_groups(in, options_str, OPTIONS_STR, DIGROUP);
2315 }
2316 #endif
2317 
2318 #ifdef ELC
parse_spells(xmlNode * in)2319 void parse_spells(xmlNode * in)
2320 {
2321 	parse_groups(in, sigils_str, SIGILS_STR, DIGROUP);
2322 }
2323 #endif
2324 
2325 #ifdef ELC
parse_stats(xmlNode * in)2326 void parse_stats(xmlNode * in)
2327 {
2328 	parse_groups(in, stats_extra, STATS_EXTRA, GROUP);
2329 	parse_groups(in, stats_str, STATS_STR, STAT_GROUP);
2330 }
2331 #endif
2332 
2333 #ifdef ELC
parse_titles(xmlNode * in)2334 void parse_titles(xmlNode * in)
2335 {
2336 	parse_groups(in, titles_str, TITLES_STR, GROUP);
2337 }
2338 #endif
2339 
free_xml_parser(int type,void * gPtr,int no)2340 void free_xml_parser(int type, void * gPtr, int no)
2341 {
2342 	group_id * grp=gPtr;
2343 	group_id_di * Grp=gPtr;
2344 #ifdef ELC
2345 	group_stat * stat=gPtr;
2346 #endif
2347 	int i=0,j;
2348 	switch(type) {
2349 		case GROUP:
2350 			for(;i<no;i++){
2351 				for(j=0;j<grp[i].no;j++) {
2352 					free(grp[i].strings[j]);
2353 				}
2354 				free(grp[i].strings);
2355 			}
2356 			free(grp);
2357 			break;
2358 		case DIGROUP:
2359 			for(;i<no;i++) {
2360 				for(j=0;j<Grp[i].no;j++) {
2361 					free(Grp[i].distrings[j]);
2362 				}
2363 				free(Grp[i].distrings);
2364 			}
2365 			free(Grp);
2366 			break;
2367 #ifdef ELC
2368 		case STAT_GROUP:
2369 			for(;i<no;i++) {
2370 				for(j=0;j<stat[i].no;j++) {
2371 					free(stat[i].statstrings[j]);
2372 				}
2373 				free(stat[i].statstrings);
2374 			}
2375 			free(stat);
2376 #endif
2377 		default: break;
2378 	}
2379 }
2380