From 4d969786748a1373c3eaaf240265920123a011b0 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Nov 2016 14:51:11 +0100 Subject: [PATCH] Merge with develop --- code/CMakeModules/Find3dsMaxSDK.cmake | 25 +- code/CMakeModules/nel.cmake | 79 +++-- code/nel/include/nel/3d/coarse_mesh_manager.h | 2 +- code/nel/include/nel/3d/landscape.h | 2 +- code/nel/include/nel/3d/portal.h | 4 +- .../include/nel/3d/ps_attrib_maker_template.h | 6 + code/nel/include/nel/3d/ps_emitter.h | 2 +- code/nel/include/nel/3d/ps_located.h | 12 +- code/nel/include/nel/3d/ps_zone.h | 2 +- code/nel/include/nel/3d/water_height_map.h | 2 +- code/nel/include/nel/gui/lua_helper.h | 6 +- code/nel/include/nel/ligo/ligo_config.h | 6 +- code/nel/include/nel/misc/common.h | 9 + code/nel/include/nel/misc/mouse_smoother.h | 2 +- code/nel/include/nel/misc/sha1.h | 4 +- .../nel/misc/timeout_assertion_thread.h | 2 +- code/nel/include/nel/net/buf_client.h | 2 +- code/nel/include/nel/net/buf_server.h | 2 +- code/nel/include/nel/net/buf_sock.h | 6 +- code/nel/include/nel/net/pacs_client.h | 2 +- code/nel/include/nel/net/sock.h | 2 +- code/nel/include/nel/net/unitime.h | 6 +- code/nel/include/nel/pacs/move_container.h | 2 +- code/nel/src/3d/cluster.cpp | 2 +- .../3d/driver/direct3d/driver_direct3d.cpp | 2 +- .../direct3d/driver_direct3d_material.cpp | 2 +- .../direct3d/driver_direct3d_shader.cpp | 2 +- .../direct3d/driver_direct3d_texture.cpp | 2 +- .../driver_direct3d_vertex_program.cpp | 4 +- .../3d/driver/opengl/driver_opengl_inputs.cpp | 2 +- .../opengl/driver_opengl_vertex_program.cpp | 4 +- .../3d/driver/opengl/unix_event_emitter.cpp | 2 +- code/nel/src/3d/landscape_user.cpp | 4 +- code/nel/src/3d/mesh.cpp | 6 +- code/nel/src/3d/portal.cpp | 4 +- code/nel/src/3d/ps_emitter.cpp | 8 +- code/nel/src/3d/ps_located.cpp | 18 +- code/nel/src/3d/ps_mesh.cpp | 3 + code/nel/src/3d/ps_ribbon.cpp | 6 +- code/nel/src/3d/std3d.h | 1 + code/nel/src/3d/tessellation.cpp | 2 +- code/nel/src/3d/tile_bank.cpp | 12 +- code/nel/src/3d/vertex_buffer.cpp | 2 +- code/nel/src/3d/vertex_program_parse.cpp | 4 +- code/nel/src/3d/water_height_map.cpp | 4 + code/nel/src/3d/zone_manager.cpp | 4 +- code/nel/src/georges/form_dfn.cpp | 2 +- code/nel/src/georges/form_elm.cpp | 8 +- code/nel/src/georges/header.cpp | 4 +- code/nel/src/georges/type.cpp | 10 +- code/nel/src/gui/group_editbox.cpp | 2 +- code/nel/src/gui/group_html.cpp | 25 +- code/nel/src/gui/group_list.cpp | 2 +- code/nel/src/gui/group_menu.cpp | 4 +- code/nel/src/gui/group_paragraph.cpp | 2 +- code/nel/src/gui/group_tree.cpp | 2 +- code/nel/src/gui/interface_group.cpp | 4 +- code/nel/src/gui/interface_parser.cpp | 4 +- code/nel/src/ligo/ligo_config.cpp | 6 +- code/nel/src/ligo/primitive.cpp | 4 +- code/nel/src/ligo/primitive_class.cpp | 14 +- code/nel/src/ligo/zone_bank.cpp | 2 +- code/nel/src/misc/debug.cpp | 28 +- code/nel/src/misc/dynloadlib.cpp | 2 +- code/nel/src/misc/eid_translator.cpp | 4 +- code/nel/src/misc/file.cpp | 1 - code/nel/src/misc/i_xml.cpp | 8 +- code/nel/src/misc/log.cpp | 8 +- code/nel/src/misc/mem_displayer.cpp | 2 +- code/nel/src/misc/o_xml.cpp | 6 +- code/nel/src/misc/string_mapper.cpp | 3 +- code/nel/src/misc/system_info.cpp | 2 +- code/nel/src/misc/task_manager.cpp | 4 +- code/nel/src/misc/win_displayer.cpp | 2 +- code/nel/src/net/admin.cpp | 2 +- code/nel/src/net/buf_sock.cpp | 6 +- code/nel/src/net/login_client.cpp | 4 +- code/nel/src/net/login_server.cpp | 7 +- code/nel/src/net/message_recorder.cpp | 4 +- code/nel/src/net/service.cpp | 2 +- code/nel/src/net/sock.cpp | 2 +- code/nel/src/net/varpath.cpp | 2 +- code/nel/src/pacs/build_indoor.cpp | 2 +- code/nel/src/pacs/move_container.cpp | 2 +- code/nel/src/sound/audio_mixer_user.cpp | 2 +- code/nel/src/sound/context_sound.cpp | 4 +- .../driver/dsound/sound_driver_dsound.cpp | 10 +- code/nel/src/sound/sound.cpp | 2 +- .../3d/build_far_bank/build_far_bank.cpp | 6 +- code/nel/tools/3d/cluster_viewer/view_cs.cpp | 1 - code/nel/tools/3d/ig_lighter/ig_lighter.cpp | 2 +- .../tools/3d/ligo/plugin_max/CMakeLists.txt | 4 +- .../tools/3d/ligo/plugin_max/ligoscript.txt | 2 +- .../tools/3d/ligo/plugin_max/max_to_ligo.cpp | 20 +- .../tools/3d/ligo/plugin_max/max_to_ligo.h | 2 +- code/nel/tools/3d/ligo/plugin_max/script.cpp | 64 ++-- .../tools/3d/object_viewer/animation_dlg.cpp | 54 ++-- .../tools/3d/object_viewer/animation_dlg.h | 2 +- .../3d/object_viewer/animation_set_dlg.cpp | 69 ++-- .../nel/tools/3d/object_viewer/attrib_dlg.cpp | 8 +- code/nel/tools/3d/object_viewer/bin_op_dlg.h | 2 +- .../tools/3d/object_viewer/bound_checker.h | 8 +- .../tools/3d/object_viewer/choose_name.cpp | 6 +- code/nel/tools/3d/object_viewer/choose_name.h | 2 +- .../tools/3d/object_viewer/choose_pool_id.cpp | 17 +- .../3d/object_viewer/create_file_dlg.cpp | 12 +- .../tools/3d/object_viewer/direction_attr.cpp | 2 +- code/nel/tools/3d/object_viewer/dup_ps.cpp | 4 +- code/nel/tools/3d/object_viewer/edit_ex.cpp | 46 +-- code/nel/tools/3d/object_viewer/edit_ex.h | 2 +- .../3d/object_viewer/edit_morph_mesh_dlg.cpp | 12 +- .../tools/3d/object_viewer/edit_ps_sound.cpp | 4 +- .../tools/3d/object_viewer/editable_range.cpp | 6 +- .../tools/3d/object_viewer/editable_range.h | 46 ++- .../tools/3d/object_viewer/emitter_dlg.cpp | 8 +- .../3d/object_viewer/global_wind_dlg.cpp | 8 +- .../3d/object_viewer/lb_extern_id_dlg.cpp | 40 +-- .../object_viewer/located_bindable_dialog.cpp | 210 ++++++------ .../3d/object_viewer/located_properties.cpp | 2 +- .../3d/object_viewer/located_target_dlg.cpp | 12 +- .../nel/tools/3d/object_viewer/main_frame.cpp | 158 ++++----- code/nel/tools/3d/object_viewer/mesh_dlg.cpp | 10 +- .../tools/3d/object_viewer/multi_tex_dlg.cpp | 49 ++- .../tools/3d/object_viewer/object_viewer.cpp | 306 ++++++++---------- .../tools/3d/object_viewer/object_viewer.h | 62 ++-- .../object_viewer/object_viewer_interface.h | 10 +- .../tools/3d/object_viewer/particle_dlg.cpp | 26 +- .../3d/object_viewer/particle_system_edit.cpp | 44 +-- .../3d/object_viewer/particle_tree_ctrl.cpp | 86 +++-- .../3d/object_viewer/particle_workspace.cpp | 4 +- .../nel/tools/3d/object_viewer/pick_sound.cpp | 8 +- .../precomputed_rotations_dlg.cpp | 16 +- .../tools/3d/object_viewer/ps_mover_dlg.cpp | 32 +- .../tools/3d/object_viewer/range_selector.cpp | 4 +- .../3d/object_viewer/scheme_bank_dlg.cpp | 46 +-- .../tools/3d/object_viewer/select_string.cpp | 6 +- .../tools/3d/object_viewer/select_string.h | 2 +- .../3d/object_viewer/skeleton_scale_dlg.cpp | 59 ++-- code/nel/tools/3d/object_viewer/slot_dlg.cpp | 20 +- .../3d/object_viewer/snapshot_tool_dlg.cpp | 107 +++--- .../3d/object_viewer/snapshot_tool_dlg.h | 2 +- .../tools/3d/object_viewer/sound_anim_dlg.cpp | 16 +- .../3d/object_viewer/sound_anim_view.cpp | 16 +- .../tools/3d/object_viewer/sound_system.cpp | 12 +- .../start_stop_particle_system.cpp | 18 +- .../3d/object_viewer/texture_anim_dlg.cpp | 4 +- .../3d/object_viewer/texture_chooser.cpp | 17 +- .../3d/object_viewer/value_gradient_dlg.cpp | 6 +- .../3d/object_viewer/vegetable_copy_dlg.cpp | 4 +- .../object_viewer/vegetable_density_page.cpp | 48 +-- .../tools/3d/object_viewer/vegetable_dlg.cpp | 44 +-- .../tools/3d/object_viewer/vegetable_dlg.h | 4 +- .../3d/object_viewer/vegetable_list_box.cpp | 3 +- .../3d/object_viewer/vegetable_list_color.cpp | 4 +- .../vegetable_noise_value_dlg.cpp | 2 +- .../3d/object_viewer/water_pool_editor.cpp | 16 +- .../src/object_viewer_widget.cpp | 2 +- .../nel_3dsmax_shared/CMakeLists.txt | 2 +- .../3d/plugin_max/nel_export/CMakeLists.txt | 2 + .../3d/plugin_max/nel_export/nel_export.cpp | 4 +- .../nel_export/nel_export_export.cpp | 14 +- .../nel_export/nel_export_node_properties.cpp | 14 +- .../nel_export/nel_export_scene.cpp | 2 +- .../nel_export/nel_export_script.cpp | 26 +- .../plugin_max/nel_export/nel_export_swt.cpp | 2 +- .../plugin_max/nel_export/nel_export_view.cpp | 12 +- .../3d/plugin_max/nel_export/progress.cpp | 2 +- .../3d/plugin_max/nel_mesh_lib/CMakeLists.txt | 2 + .../3d/plugin_max/nel_mesh_lib/calc_lm.cpp | 4 +- .../plugin_max/nel_mesh_lib/export_anim.cpp | 2 +- .../nel_mesh_lib/export_collision.cpp | 8 +- .../plugin_max/nel_mesh_lib/export_mesh.cpp | 6 +- .../plugin_max/nel_mesh_lib/export_misc.cpp | 10 +- .../3d/plugin_max/nel_mesh_lib/export_nel.h | 4 +- .../plugin_max/nel_mesh_lib/export_scene.cpp | 2 +- .../nel_patch_converter/CMakeLists.txt | 2 + .../plugin_max/nel_patch_converter/PO2RPO.h | 2 +- .../nel_patch_converter/rykolscript.txt | 2 +- .../plugin_max/nel_patch_converter/script.cpp | 6 +- .../plugin_max/nel_patch_edit/CMakeLists.txt | 2 + .../plugin_max/nel_patch_lib/CMakeLists.txt | 2 + .../plugin_max/nel_patch_lib/nel_patch_mesh.h | 3 +- .../tools/3d/plugin_max/nel_patch_lib/rpo.cpp | 6 +- .../tools/3d/plugin_max/nel_patch_lib/rpo.h | 8 +- .../3d/plugin_max/nel_patch_lib/rpo2nel.cpp | 18 +- .../plugin_max/nel_patch_paint/CMakeLists.txt | 2 + .../3d/plugin_max/nel_patch_paint/paint.cpp | 8 +- .../plugin_max/nel_patch_paint/paint_ui.cpp | 22 +- .../nel_patch_paint/paint_vcolor.cpp | 2 +- .../nel_vertex_tree_paint/CMakeLists.txt | 2 + .../scripts/nel_assets_png_batched.ms | 2 +- .../scripts/nel_assets_ps_batched.ms | 2 +- .../plugin_max/scripts/nel_assets_resave.ms | 2 +- .../scripts/nel_assets_resave_hard.ms | 2 +- .../scripts/nel_batched_mergesave.ms | 2 +- .../plugin_max/scripts/nel_batched_script.ms | 2 +- .../plugin_max/tile_utility/tile_utility.cpp | 8 +- code/nel/tools/3d/shape2obj/main.cpp | 2 +- code/nel/tools/3d/shapes_exporter/main.cpp | 2 +- code/nel/tools/3d/tile_edit/Browse.cpp | 14 +- .../3d/tile_edit/SelectionTerritoire.cpp | 52 ++- code/nel/tools/3d/tile_edit/View.cpp | 12 +- .../tools/3d/tile_edit/choose_veget_set.cpp | 8 +- .../tools/3d/tile_edit_qt/browser_model.cpp | 10 +- .../3d/tile_edit_qt/tile_browser_dlg.cpp | 8 +- .../tools/3d/tile_edit_qt/tile_edit_dlg.cpp | 6 +- .../3d/zone_check_bind/zone_check_bind.cpp | 2 +- code/nel/tools/3d/zviewer/zviewer.cpp | 5 +- .../generators/max_exporter_scripts/shape.ms | 2 +- .../export_footer.ms | 4 +- .../processes/anim/maxscript/anim_export.ms | 4 +- .../clodbank/maxscript/clod_export.ms | 4 +- .../processes/ig/maxscript/ig_export.ms | 4 +- .../pacs_prim/maxscript/pacs_prim_export.ms | 4 +- .../processes/rbank/maxscript/cmb_export.ms | 4 +- .../processes/shape/maxscript/shape_export.ms | 6 +- .../processes/veget/maxscript/veget_export.ms | 4 +- .../tools/georges/georges2csv/georges2csv.cpp | 4 +- .../logic_editor_dll/logic_editorDoc.cpp | 4 +- .../logic/logic_editor_dll/logic_editorDoc.h | 8 +- .../misc/branch_patcher/branch_patcherDlg.cpp | 8 +- .../misc/crash_report/crash_report_widget.ui | 2 +- .../tools/misc/data_mirror/data_mirror.cpp | 2 +- .../misc/log_analyser/log_analyserDlg.cpp | 4 +- .../ryzom/client/src/bg_downloader_access.cpp | 4 +- .../client/src/bug_report/bug_reportDlg.cpp | 2 +- code/ryzom/client/src/character_cl.cpp | 2 +- .../src/client_sheets/race_stats_sheet.cpp | 2 +- .../client_sheets/unblock_titles_sheet.cpp | 2 +- code/ryzom/client/src/commands.cpp | 2 +- code/ryzom/client/src/connection.cpp | 16 +- code/ryzom/client/src/contextual_cursor.cpp | 2 +- code/ryzom/client/src/entity_cl.cpp | 15 +- code/ryzom/client/src/far_tp.cpp | 2 +- code/ryzom/client/src/fx_cl.cpp | 2 +- code/ryzom/client/src/ground_fx_manager.cpp | 2 +- code/ryzom/client/src/init.cpp | 4 +- code/ryzom/client/src/init_main_loop.cpp | 2 +- .../src/interface_v3/action_handler_item.cpp | 2 +- .../src/interface_v3/action_handler_misc.cpp | 2 +- .../client/src/interface_v3/character_3d.cpp | 8 +- .../client/src/interface_v3/chat_displayer.h | 2 +- .../client/src/interface_v3/group_html_cs.cpp | 2 +- .../client/src/interface_v3/group_map.cpp | 2 +- .../client/src/interface_v3/guild_manager.cpp | 2 +- .../src/interface_v3/input_handler_manager.h | 2 +- .../src/interface_v3/interface_3d_scene.cpp | 2 +- .../interface_expr_user_fct_game.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 8 +- .../src/interface_v3/macrocmd_manager.cpp | 1 - .../src/interface_v3/people_interraction.cpp | 5 +- .../client/src/interface_v3/people_list.cpp | 2 +- code/ryzom/client/src/login_patch.cpp | 2 +- .../client/src/login_progress_post_thread.cpp | 2 +- code/ryzom/client/src/login_xdelta.cpp | 8 +- code/ryzom/client/src/misc.cpp | 2 +- code/ryzom/client/src/net_manager.cpp | 8 +- code/ryzom/client/src/network_connection.h | 2 +- code/ryzom/client/src/permanent_ban.cpp | 16 +- code/ryzom/client/src/player_cl.cpp | 12 +- code/ryzom/client/src/player_r2_cl.cpp | 13 +- .../client/src/r2/dmc/action_historic.cpp | 2 +- .../client/src/r2/dmc/property_accessor.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- code/ryzom/client/src/r2/tool_pick.cpp | 2 +- code/ryzom/client/src/rosace.cpp | 2 +- code/ryzom/client/src/seven_zip/7zArcIn.cpp | 25 +- code/ryzom/client/src/seven_zip/7zVersion.h | 8 +- code/ryzom/client/src/seven_zip/Aes.cpp | 10 +- code/ryzom/client/src/seven_zip/CpuArch.h | 3 +- code/ryzom/client/src/seven_zip/Lzma86Dec.cpp | 6 +- code/ryzom/client/src/seven_zip/Lzma86Enc.cpp | 6 +- code/ryzom/client/src/seven_zip/LzmaDec.cpp | 12 +- code/ryzom/client/src/seven_zip/LzmaEnc.cpp | 39 ++- code/ryzom/client/src/seven_zip/Ppmd7.cpp | 8 +- .../data_common/r2/r2_ui_property_sheet.lua | 2 +- .../src/game_share/bg_downloader_msg.cpp | 2 +- .../common/src/game_share/bg_downloader_msg.h | 2 +- .../common/src/game_share/cst_loader.cpp | 2 +- code/ryzom/common/src/game_share/dms.cpp | 2 +- .../common/src/game_share/login_registry.cpp | 35 +- .../common/src/game_share/login_registry.h | 2 - .../common/src/game_share/mainland_summary.h | 2 - .../common/src/game_share/mirror_prop_value.h | 4 +- .../src/game_share/mirrored_data_set.cpp | 2 +- .../common/src/game_share/msg_client_server.h | 1 - code/ryzom/common/src/game_share/object.cpp | 2 +- .../src/game_share/persistent_data_tree.cpp | 2 +- .../common/src/game_share/ring_access.cpp | 2 +- code/ryzom/common/src/game_share/scenario.cpp | 8 +- code/ryzom/common/src/game_share/seeds.cpp | 2 +- .../game_share/server_animation_module.cpp | 2 +- .../src/game_share/server_edition_module.cpp | 18 +- .../src/game_share/string_mgr_module.cpp | 2 +- .../src/ags_test/command_event_manager.cpp | 2 +- .../server/src/ai_service/script_compiler.cpp | 2 +- .../src/entities_game_service/cdb_group.h | 2 +- .../common_shard_callbacks.cpp | 2 +- .../entities_game_service.cpp | 2 +- .../entity_manager/entity_base.h | 4 +- .../outpost_manager/outpost.h | 4 +- .../phrase_manager/area_effect.h | 2 +- .../player_manager/character.h | 8 +- .../player_manager/player_manager.cpp | 2 +- .../pvp_manager/pvp_base.h | 2 +- .../pvp_manager/pvp_manager.cpp | 2 +- .../pvp_manager/pvp_manager_2.cpp | 2 +- .../src/frontend_service/vision_provider.cpp | 2 +- .../string_manager_parser.cpp | 2 +- .../src/mail_forum_service/hof_generator.cpp | 2 +- .../persistant_data_service/pds_database.cpp | 2 +- .../src/persistant_data_service/pds_table.h | 4 +- .../pds_table_inline.h | 4 +- .../shard_unifier_service/login_service.cpp | 2 +- .../client/ryzom_installer/src/downloader.cpp | 2 +- .../ryzom_installer/src/installdialog.cpp | 2 +- .../tools/client/ryzom_installer/src/main.cpp | 2 +- .../ryzom_installer/src/migratedialog.cpp | 2 +- .../translations/ryzom_installer_de.ts | 2 +- .../translations/ryzom_installer_es.ts | 2 +- .../translations/ryzom_installer_fr.ts | 2 +- .../translations/ryzom_installer_ru.ts | 2 +- .../alias_synchronizer/alias_synchronizer.cpp | 2 +- .../csv_transform/csv_transform.cpp | 6 +- .../tools/leveldesign/georges_dll/action.cpp | 2 +- .../leveldesign/georges_dll/dfn_dialog.cpp | 4 +- .../leveldesign/georges_dll/edit_list_ctrl.h | 4 +- .../leveldesign/georges_dll/form_dialog.cpp | 12 +- .../leveldesign/georges_dll/georges_edit.cpp | 10 +- .../georges_dll/georges_edit_doc.cpp | 8 +- .../georges_dll/georges_implementation.cpp | 6 +- .../leveldesign/georges_dll/icon_wnd.cpp | 2 +- .../georges_dll/plugin_interface.h | 2 +- .../georges_plugin_sound/PageSimple.cpp | 6 +- .../georges_plugin_sound.cpp | 2 +- .../georges_plugin_sound/sound_plugin.cpp | 2 +- .../mission_compiler_fe.cpp | 2 +- .../mission_compiler_feDlg.cpp | 4 +- .../leveldesign/mission_compiler_lib/main.cpp | 2 +- .../mission_compiler_lib/mission_compiler.cpp | 2 +- .../mission_compiler_lib/mission_compiler.h | 4 +- .../tools/leveldesign/mp_generator/main.cpp | 4 +- .../leveldesign/variable_parser/lua_helper.h | 6 +- .../world_editor/world_editor/action.cpp | 16 +- .../world_editor/builder_zone.cpp | 13 +- .../world_editor/dialog_properties.cpp | 20 +- .../world_editor/world_editor/display.cpp | 2 +- .../world_editor/editor_primitive.cpp | 2 +- .../world_editor/find_primitive_dlg.cpp | 2 +- .../world_editor/world_editor/main_frm.cpp | 9 +- .../world_editor/world_editor/name_dlg.cpp | 7 +- .../world_editor/world_editor.cpp | 4 +- .../world_editor/world_editor_doc.cpp | 26 +- .../world_editor/world_editor_doc.h | 1 - .../graph_plugin.cpp | 4 +- .../world_editor_graph_plugin_dlg.cpp | 2 +- .../plugin.cpp | 10 +- .../world_editor_sound_plugin/DialogFlags.cpp | 10 +- .../sound_plugin.cpp | 2 +- code/ryzom/tools/pd_parser/parser.cpp | 8 +- code/ryzom/tools/pd_parser/templatizer.cpp | 4 +- code/ryzom/tools/scripts/linux/utilities | 2 +- code/ryzom/tools/translation_tools/main.cpp | 9 +- .../mission_compiler_main_window.cpp | 4 +- code/web/public_php/ams/js/jquery.js | 2 +- .../elFinderVolumeMySQL.class.php | 2 +- .../public_php/api/data/js/jquery-1.7.1.js | 2 +- .../webtt/cake/console/libs/tasks/plugin.php | 2 +- .../cases/libs/controller/component.test.php | 2 +- .../controller/controller_merge_vars.test.php | 4 +- .../libs/model/model_validation.test.php | 4 +- .../debug_kit/vendors/debug_kit_debugger.php | 4 +- 372 files changed, 1824 insertions(+), 1777 deletions(-) diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index 9cd4bd67b..cf49a90d3 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -18,6 +18,7 @@ FIND_PATH(MAXSDK_DIR PATHS "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" @@ -36,12 +37,12 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h ) IF(TARGET_X64) - SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) + SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release) ELSE() SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) ENDIF() -MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) +MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} NAMES ${MYLIBRARYNAME} HINTS @@ -73,8 +74,26 @@ if(MAXSDK_FOUND) ${MAXSDK_MAXUTIL_LIBRARY} ${MAXSDK_MAXSCRIPT_LIBRARY} ${MAXSDK_PARAMBLK2_LIBRARY} - ${MAXSDK_BMM_LIBRARY} ) + ${MAXSDK_BMM_LIBRARY}) + # parse maxversion.h to determine SDK version + IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h") + FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)") + + STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}") + UNSET(LINES) + ELSE() + SET(MAXSDK_VERSION "Unknown") + ENDIF() + + MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}") + + # 3ds Max 2013 and later are always Unicode + IF(MAXSDK_VERSION VERSION_GREATER 2012) + SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE) + ELSE() + SET(MAXSDK_DEFINITIONS) + ENDIF() ELSE() set(MAXSDK_LIBRARIES) ENDIF() diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index d311a7747..c3a8c7856 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -367,7 +367,7 @@ ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) MACRO(ADD_PLATFORM_FLAGS _FLAGS) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}") -ENDMACRO(ADD_PLATFORM_FLAGS) +ENDMACRO() MACRO(NL_SETUP_BUILD) @@ -390,9 +390,13 @@ MACRO(NL_SETUP_BUILD) ENDIF() ENDIF() - SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) + IF(CMAKE_CXX_LIBRARY_ARCHITECTURE) + SET(HOST_CPU ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) + ELSE() + SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) + ENDIF() - IF(HOST_CPU MATCHES "(amd|AMD)64") + IF(HOST_CPU MATCHES "(amd|AMD|x86_)64") SET(HOST_CPU "x86_64") ELSEIF(HOST_CPU MATCHES "i.86") SET(HOST_CPU "x86") @@ -402,10 +406,10 @@ MACRO(NL_SETUP_BUILD) # If not specified, use the same CPU as host IF(NOT TARGET_CPU) - SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR}) + SET(TARGET_CPU ${HOST_CPU}) ENDIF() - IF(TARGET_CPU MATCHES "(amd|AMD)64") + IF(TARGET_CPU MATCHES "(amd|AMD|x86_)64") SET(TARGET_CPU "x86_64") ELSEIF(TARGET_CPU MATCHES "i.86") SET(TARGET_CPU "x86") @@ -413,7 +417,7 @@ MACRO(NL_SETUP_BUILD) IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") SET(CLANG ON) - MESSAGE(STATUS "Using Clang compiler") + MESSAGE(STATUS "Using Clang ${CMAKE_CXX_COMPILER_VERSION} compiler") ENDIF() IF(CMAKE_GENERATOR MATCHES "Xcode") @@ -474,6 +478,9 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_X86 1) ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) + ELSEIF(TARGET_CPU STREQUAL "arm64") + SET(TARGET_ARM 1) + SET(TARGET_ARM64 1) ELSEIF(TARGET_CPU STREQUAL "armv7s") SET(TARGET_ARM 1) SET(TARGET_ARMV7S 1) @@ -493,6 +500,10 @@ MACRO(NL_SETUP_BUILD) ENDIF() IF(TARGET_ARM) + IF(TARGET_ARM64) + ADD_PLATFORM_FLAGS("-DHAVE_ARM64") + ENDIF() + IF(TARGET_ARMV7S) ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S") ENDIF() @@ -541,10 +552,6 @@ MACRO(NL_SETUP_BUILD) ENDIF() IF(MSVC) - IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) - SET(MSVC11 ON) - ENDIF() - # Ignore default include paths ADD_PLATFORM_FLAGS("/X") @@ -555,31 +562,31 @@ MACRO(NL_SETUP_BUILD) # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC12) - ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") + ADD_PLATFORM_FLAGS("/Gy-") # /Ox is working with VC++ 2013, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC11) - ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") + ADD_PLATFORM_FLAGS("/Gy-") # /Ox is working with VC++ 2012, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC10) - ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") + ADD_PLATFORM_FLAGS("/Gy-") # /Ox is working with VC++ 2010, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC90) - ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") + ADD_PLATFORM_FLAGS("/Gy-") # don't use a /O[012x] flag if you want custom optimizations SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC80) - ADD_PLATFORM_FLAGS("/Gy- /Wp64 /Zm1000") + ADD_PLATFORM_FLAGS("/Gy- /Wp64") # don't use a /O[012x] flag if you want custom optimizations SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again @@ -588,16 +595,19 @@ MACRO(NL_SETUP_BUILD) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") ENDIF() - ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /wd4250") + ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32 /DWIN32 /D_WINDOWS /wd4250") + + # huge PCH + ADD_PLATFORM_FLAGS("/Zm1000") IF(TARGET_X64) # Fix a bug with Intellisense ADD_PLATFORM_FLAGS("/D_WIN64") # Fix a compilation error for some big C++ files - SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj") + ADD_PLATFORM_FLAGS("/bigobj") ELSE() # Allows 32 bits applications to use 3 GB of RAM - SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") + ADD_PLATFORM_LINKFLAGS("/LARGEADDRESSAWARE") ENDIF() # Exceptions are only set for C++ @@ -840,6 +850,9 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing") + # hardening + ADD_PLATFORM_FLAGS("-D_FORTIFY_SOURCE=2") + IF(NOT WITH_LOW_MEMORY) ADD_PLATFORM_FLAGS("-pipe") ENDIF() @@ -850,6 +863,12 @@ MACRO(NL_SETUP_BUILD) IF(WITH_WARNINGS) ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") + ELSE() + # Check wrong formats in printf-like functions + ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security") + + # Don't display invalid or unused command lines arguments by default (often too verbose) + ADD_PLATFORM_FLAGS("-Wno-invalid-command-line-argument -Wno-unused-command-line-argument") ENDIF() IF(ANDROID) @@ -859,7 +878,7 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("-Wa,--noexecstack") IF(TARGET_ARM) - ADD_PLATFORM_FLAGS("-fpic -fstack-protector") + ADD_PLATFORM_FLAGS("-fpic") ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__") IF(TARGET_ARMV7) @@ -871,24 +890,20 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_THUMB ON) IF(TARGET_THUMB) - ADD_PLATFORM_FLAGS("-mthumb -fno-strict-aliasing -finline-limit=64") + ADD_PLATFORM_FLAGS("-mthumb -finline-limit=64") SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm") ELSE() ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") - SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") - SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") ENDIF() ELSEIF(TARGET_X86) # Optimizations for Intel Atom ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops") - ADD_PLATFORM_FLAGS("-fstack-protector -funswitch-loops -finline-limit=300") - SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") - SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") + ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") ELSEIF(TARGET_MIPS) - ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fno-strict-aliasing") + ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers") SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300") ENDIF() - SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib") ENDIF() @@ -897,16 +912,22 @@ MACRO(NL_SETUP_BUILD) ENDIF() # Fix "relocation R_X86_64_32 against.." error on x64 platforms - IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW) + IF(NOT MINGW) ADD_PLATFORM_FLAGS("-fPIC") ENDIF() SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") + # hardening + ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4") + IF(NOT APPLE) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") ENDIF() + # hardening + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now") + IF(WITH_SYMBOLS) SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") ELSE() @@ -920,7 +941,7 @@ MACRO(NL_SETUP_BUILD) SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") ENDIF() -ENDMACRO(NL_SETUP_BUILD) +ENDMACRO() MACRO(NL_SETUP_BUILD_FLAGS) SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) diff --git a/code/nel/include/nel/3d/coarse_mesh_manager.h b/code/nel/include/nel/3d/coarse_mesh_manager.h index ce571cbd1..feaad9e05 100644 --- a/code/nel/include/nel/3d/coarse_mesh_manager.h +++ b/code/nel/include/nel/3d/coarse_mesh_manager.h @@ -84,7 +84,7 @@ public: void setTextureFile (const char* file); /** - * Add a coarse mesh in the manager. If an error occured, it returns CantAddCoarseMesh. + * Add a coarse mesh in the manager. If an error occurred, it returns CantAddCoarseMesh. * \param vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR * \param indexBuffer containing triangles that will be inserted. * \return false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason diff --git a/code/nel/include/nel/3d/landscape.h b/code/nel/include/nel/3d/landscape.h index 66dec0f64..aa432f88b 100644 --- a/code/nel/include/nel/3d/landscape.h +++ b/code/nel/include/nel/3d/landscape.h @@ -716,7 +716,7 @@ private: bool _RefineMode; float _FarTransition; uint _TileMaxSubdivision; - // For VertexProgram. true if change has occured in threshold since the last render(). + // For VertexProgram. true if change has occurred in threshold since the last render(). float _VPThresholdChange; /// \name VertexBuffer mgt. diff --git a/code/nel/include/nel/3d/portal.h b/code/nel/include/nel/3d/portal.h index 0531f9eb5..51fd99913 100644 --- a/code/nel/include/nel/3d/portal.h +++ b/code/nel/include/nel/3d/portal.h @@ -92,9 +92,9 @@ public: void setWorldMatrix (const NLMISC::CMatrix &WM); - void setName (std::string &name) { _Name = name; } + void setName (const std::string &name) { _Name = name; } - std::string getName () { return _Name; } + std::string getName () const { return _Name; } void open (bool opened) { _Opened = opened; } bool isOpened () { return _Opened; } diff --git a/code/nel/include/nel/3d/ps_attrib_maker_template.h b/code/nel/include/nel/3d/ps_attrib_maker_template.h index 92953b86f..c41931ab3 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_template.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_template.h @@ -24,6 +24,8 @@ #include "nel/misc/rgba.h" #include "nel/misc/traits_nl.h" +#include + namespace NL3D { /* @@ -480,7 +482,11 @@ void CPSValueGradientFunc::setValuesUnpacked(const T *valueTab, uint32 numVal _MaxValue = _MinValue = valueTab[0]; _NbValues = (numValues - 1) * nbStages; _Tab.resize(_NbValues + 1); +#ifdef NL_COMP_VC14 + std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size())); +#else std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]); +#endif } diff --git a/code/nel/include/nel/3d/ps_emitter.h b/code/nel/include/nel/3d/ps_emitter.h index 00163c48e..3d62dd7f0 100644 --- a/code/nel/include/nel/3d/ps_emitter.h +++ b/code/nel/include/nel/3d/ps_emitter.h @@ -336,7 +336,7 @@ protected: * should not be called directly. Call CPSLocated::resize instead */ virtual void resize(uint32 size); - virtual void bounceOccured(uint32 index, TAnimationTime timeToNextSimStep); + virtual void bounceOccurred(uint32 index, TAnimationTime timeToNextSimStep); void updateMaxCountVect(); diff --git a/code/nel/include/nel/3d/ps_located.h b/code/nel/include/nel/3d/ps_located.h index 30fa7defa..08d1c72d8 100644 --- a/code/nel/include/nel/3d/ps_located.h +++ b/code/nel/include/nel/3d/ps_located.h @@ -66,14 +66,14 @@ class CParticleSystem; /// This structure helps to perform the collision step, by telling which collisionner is the nearest if there are several candidate -/// a distance of -1 indicates that no collisions occured +/// a distance of -1 indicates that no collisions occurred struct CPSCollisionInfo { CPSCollisionInfo *Next; - float Dist; // Distance to the nearest collider, or -1 if not collision occured + float Dist; // Distance to the nearest collider, or -1 if not collision occurred NLMISC::CVector NewPos; - NLMISC::CVector NewSpeed; // The speed of particle after a collision occured. After the updated of collision it is swapped with the post-collision speed - CPSZone *CollisionZone; // The zone on which the bounce occured, can be useful to check the behaviour in case of collision + NLMISC::CVector NewSpeed; // The speed of particle after a collision occurred. After the updated of collision it is swapped with the post-collision speed + CPSZone *CollisionZone; // The zone on which the bounce occurred, can be useful to check the behaviour in case of collision uint32 Index; CPSCollisionInfo() { @@ -906,10 +906,10 @@ protected: */ virtual void resize(uint32 size) = 0; - /** a bounce occured, so some action could be done. The default behaviour does nothing + /** a bounce occurred, so some action could be done. The default behaviour does nothing * \param index the index of the element that bounced */ - virtual void bounceOccured(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {} + virtual void bounceOccurred(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {} /** show an drawing to represent the object, and in red if it is selected * \param tab : a table of 2 * nbSeg vector. only the x and y coordinates are used diff --git a/code/nel/include/nel/3d/ps_zone.h b/code/nel/include/nel/3d/ps_zone.h index 7289e64e0..0e0ff7274 100644 --- a/code/nel/include/nel/3d/ps_zone.h +++ b/code/nel/include/nel/3d/ps_zone.h @@ -120,7 +120,7 @@ protected: /** * This set speed of a located so that it looks like bouncing on a surface * \param locatedIndex the index - * \param bouncePoint the position where the collision occured + * \param bouncePoint the position where the collision occurred * \param surfNormal the normal of the surface at the collision point (this must be a unit vector) * \elasticity 1 = full bounce, 0 = no bounce (contact) * \ellapsedTime the time ellapsed diff --git a/code/nel/include/nel/3d/water_height_map.h b/code/nel/include/nel/3d/water_height_map.h index f705c0368..dcd38d90d 100644 --- a/code/nel/include/nel/3d/water_height_map.h +++ b/code/nel/include/nel/3d/water_height_map.h @@ -79,7 +79,7 @@ public: /** Set the userPos (relative to the height map coordinates). This is needed because a height map can't be used with large surface (such as a sea). * As a consequence, the height map is only valid below the user (e.g from user.x - 0.5 * size to user.x + 0.5 *size). - * When setPos is called, and if a move has occured, new area of the height field are set to 0 + * When setPos is called, and if a move has occurred, new area of the height field are set to 0 * The pos set will be taken in account when buffers have been swapped (e.g when the propagation time as ellapsed) */ void setUserPos(sint x, sint y); diff --git a/code/nel/include/nel/gui/lua_helper.h b/code/nel/include/nel/gui/lua_helper.h index 50896b30c..7388c729d 100644 --- a/code/nel/include/nel/gui/lua_helper.h +++ b/code/nel/include/nel/gui/lua_helper.h @@ -90,7 +90,7 @@ namespace NLGUI virtual std::string luaWhat() const throw() {return NLMISC::toString("LUAError: %s", what());} }; - // A parse error occured + // A parse error occurred class ELuaParseError : public ELuaError { public: @@ -117,7 +117,7 @@ namespace NLGUI std::string _Reason; }; - // A execution error occured + // A execution error occurred class ELuaExecuteError : public ELuaError { public: @@ -128,7 +128,7 @@ namespace NLGUI virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaExecuteError: %s", what());} }; - // A bad cast occured when using lua_checkcast + // A bad cast occurred when using lua_checkcast class ELuaBadCast : public ELuaError { public: diff --git a/code/nel/include/nel/ligo/ligo_config.h b/code/nel/include/nel/ligo/ligo_config.h index 8e2c38e25..4d93843e5 100644 --- a/code/nel/include/nel/ligo/ligo_config.h +++ b/code/nel/include/nel/ligo/ligo_config.h @@ -49,13 +49,13 @@ public: * This file will try to open the file ligo class description file (XML) using the LigoClass as file name. * It will try first to load directly the file and then to lookup the file in NLMISC::CPath. */ - bool readConfigFile (const char *fileName, bool parsePrimitiveComboContent); + bool readConfigFile (const std::string &fileName, bool parsePrimitiveComboContent); /** * This file will read the file ligo class description file (XML) using the LigoClass as file name. * It will try first to load directly the file and then to lookup the file in NLMISC::CPath. */ - bool readPrimitiveClass (const char *fileName, bool parsePrimitiveComboContent); + bool readPrimitiveClass (const std::string &fileName, bool parsePrimitiveComboContent); bool reloadIndexFile(const std::string &indexFileName = std::string()); @@ -100,7 +100,7 @@ public: /// Build a standard human readable alias string std::string aliasToString(uint32 fullAlias); /// Read a standard human readable alias string - uint32 aliasFromString(std::string fullAlias); + uint32 aliasFromString(const std::string &fullAlias); // Get a primitive class diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index 4ddc88076..0617ad560 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -286,6 +286,15 @@ inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp( #define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8()) #define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) +// macros helper to convert UTF-8 std::string and TCHAR* +#ifdef _UNICODE +#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8()) +#define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) +#else +#define tStrToUtf8(str) ((LPCSTR)str) +#define utf8ToTStr(str) (str.c_str()) +#endif + // wrapper for fopen to be able to open files with an UTF-8 filename FILE* nlfopen(const std::string &filename, const std::string &mode); diff --git a/code/nel/include/nel/misc/mouse_smoother.h b/code/nel/include/nel/misc/mouse_smoother.h index 86a75b7f1..f909cde96 100644 --- a/code/nel/include/nel/misc/mouse_smoother.h +++ b/code/nel/include/nel/misc/mouse_smoother.h @@ -46,7 +46,7 @@ public: double getSamplingPeriod() const { return _SamplingPeriod; } // Reset smoother. The next returned position will be the exact position of mouse (no smoothing with previous position is done) void reset(); - // \return trueif no sampling has occured since last resetor construction + // \return trueif no sampling has occurred since last resetor construction bool isReseted() const { return !_Init; } // Sample pos, and return smoothed position CVector2f samplePos(const CVector2f &wantedPos, double date); diff --git a/code/nel/include/nel/misc/sha1.h b/code/nel/include/nel/misc/sha1.h index d4c630c22..ae42c3c1e 100644 --- a/code/nel/include/nel/misc/sha1.h +++ b/code/nel/include/nel/misc/sha1.h @@ -29,7 +29,7 @@ struct CHashKey CHashKey (const unsigned char Message_Digest[20]) { - HashKeyString = ""; + HashKeyString.clear(); for(sint i = 0; i < 20 ; ++i) { HashKeyString += Message_Digest[i]; @@ -45,7 +45,7 @@ struct CHashKey } else if (str.size() == 40) { - HashKeyString = ""; + HashKeyString.clear(); for(uint i = 0; i < str.size(); i+=2) { uint8 val; diff --git a/code/nel/include/nel/misc/timeout_assertion_thread.h b/code/nel/include/nel/misc/timeout_assertion_thread.h index 1d329ed2b..82b07b0dc 100644 --- a/code/nel/include/nel/misc/timeout_assertion_thread.h +++ b/code/nel/include/nel/misc/timeout_assertion_thread.h @@ -81,7 +81,7 @@ public: } //nldebug("active, leave sleep, test assert"); - // If this assert occured, it means that a checked part of the code was + // If this assert occurred, it means that a checked part of the code was // to slow and then I decided to assert to display the problem. nlassert(!(_Control==ACTIVE && _Counter==lastCounter)); } diff --git a/code/nel/include/nel/net/buf_client.h b/code/nel/include/nel/net/buf_client.h index a540f78d9..c85e2f1ba 100644 --- a/code/nel/include/nel/net/buf_client.h +++ b/code/nel/include/nel/net/buf_client.h @@ -159,7 +159,7 @@ public: /** Force to send data pending in the send queue now. If all the data could not be sent immediately, * the returned nbBytesRemaining value is non-zero. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. - * \returns False if an error has occured (e.g. the remote host is disconnected). + * \returns False if an error has occurred (e.g. the remote host is disconnected). * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() */ bool flush( uint *nbBytesRemaining=NULL ) { return _BufSock->flush( nbBytesRemaining ); } diff --git a/code/nel/include/nel/net/buf_server.h b/code/nel/include/nel/net/buf_server.h index 70c56d2c8..ba92cdced 100644 --- a/code/nel/include/nel/net/buf_server.h +++ b/code/nel/include/nel/net/buf_server.h @@ -235,7 +235,7 @@ public: * the returned nbBytesRemaining value is non-zero. * \param destid The identifier of the destination connection. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. - * \returns False if an error has occured (e.g. the remote host is disconnected). + * \returns False if an error has occurred (e.g. the remote host is disconnected). * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() */ bool flush( TSockId destid, uint *nbBytesRemaining=NULL ); diff --git a/code/nel/include/nel/net/buf_sock.h b/code/nel/include/nel/net/buf_sock.h index 5a2f3c074..1a491d45d 100644 --- a/code/nel/include/nel/net/buf_sock.h +++ b/code/nel/include/nel/net/buf_sock.h @@ -84,7 +84,7 @@ protected: ///@name Sending data //@{ - /// Update the network sending (call this method evenly). Returns false if an error occured. + /// Update the network sending (call this method evenly). Returns false if an error occurred. bool update(); /** Sets the time flush trigger (in millisecond). When this time is elapsed, @@ -101,7 +101,7 @@ protected: * (see CNonBlockingBufSock), if all the data could not be sent immediately, * the returned nbBytesRemaining value is non-zero. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. - * \returns False if an error has occured (e.g. the remote host is disconnected). + * \returns False if an error has occurred (e.g. the remote host is disconnected). * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() */ bool flush( uint *nbBytesRemaining=NULL ); @@ -170,7 +170,7 @@ protected: } /** Pushes a buffer to the send queue and update, - * or returns false if the socket is not physically connected the or an error occured during sending + * or returns false if the socket is not physically connected the or an error occurred during sending */ bool pushBuffer( const NLMISC::CMemStream& buffer ) { diff --git a/code/nel/include/nel/net/pacs_client.h b/code/nel/include/nel/net/pacs_client.h index f3c6d0426..7cc61deba 100644 --- a/code/nel/include/nel/net/pacs_client.h +++ b/code/nel/include/nel/net/pacs_client.h @@ -553,7 +553,7 @@ static void cbPacsAnswer (CMessage &msgin, TSockId from, CCallbackNetBase &netba client->getPositionSpeedCallback (id, position, speed); } else - NLMISC::nlError ("Pacs client: unkown sub message string"); + NLMISC::nlError ("Pacs client: unknown sub message string"); // Next message ? msgin.serial (again); diff --git a/code/nel/include/nel/net/sock.h b/code/nel/include/nel/net/sock.h index 8f7201013..5ff2ea94c 100644 --- a/code/nel/include/nel/net/sock.h +++ b/code/nel/include/nel/net/sock.h @@ -121,7 +121,7 @@ public: /// Releases the network engine static void releaseNetwork(); - /** Returns the code of the last error that has occured. + /** Returns the code of the last error that has occurred. * Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code. * See also errorString() */ diff --git a/code/nel/include/nel/net/unitime.h b/code/nel/include/nel/net/unitime.h index 21e8b68e4..43bf7a5a3 100644 --- a/code/nel/include/nel/net/unitime.h +++ b/code/nel/include/nel/net/unitime.h @@ -52,7 +52,7 @@ public: static const char *getStringUniTime (NLMISC::TTime ut); - /** You need to call this function before calling getUniTime or an assert will occured. + /** You need to call this function before calling getUniTime or an assert will occurred. * This function will connect to the time service and synchronize your computer. * This function assumes that all services run on server that are time synchronized with NTP for example. * If addr is NULL, the function will connect to the Time Service via the Naming Service. In this case, @@ -87,11 +87,11 @@ public: */ static void simulate() { nlstop; _Simulate = true; } - static bool Sync; // true if the synchronization occured + static bool Sync; // true if the synchronization occurred private: static NLMISC::TTime _SyncUniTime; // time in millisecond when the universal time received - static NLMISC::TTime _SyncLocalTime; // time in millisecond when the syncro with universal time occured + static NLMISC::TTime _SyncLocalTime; // time in millisecond when the syncro with universal time occurred // If true, do not synchronize static bool _Simulate; diff --git a/code/nel/include/nel/pacs/move_container.h b/code/nel/include/nel/pacs/move_container.h index 8cea65b3e..5193e8386 100644 --- a/code/nel/include/nel/pacs/move_container.h +++ b/code/nel/include/nel/pacs/move_container.h @@ -282,7 +282,7 @@ private: // Free world image pointers void freeWorldImage (CPrimitiveWorldImage *worldImage); - // Called by CMovePrimitive when a change occured on the primitive BB + // Called by CMovePrimitive when a change occurred on the primitive BB void changed (CMovePrimitive* primitive, uint8 worldImage); // Remove the collisionable primitive from the modified list diff --git a/code/nel/src/3d/cluster.cpp b/code/nel/src/3d/cluster.cpp index 76ed153e1..d78468e61 100644 --- a/code/nel/src/3d/cluster.cpp +++ b/code/nel/src/3d/cluster.cpp @@ -319,7 +319,7 @@ void CCluster::serial (NLMISC::IStream&f) // write the env fx name std::string envFxName = CStringMapper::unmap(_EnvironmentFxId); if (envFxName == "no fx") - envFxName = ""; + envFxName.clear(); f.serial(envFxName); } diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 887034a9d..5bd0e2cbf 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1265,7 +1265,7 @@ bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc) if (error != ERROR_CLASS_ALREADY_EXISTS) { nlwarning("CDriverD3D::init: Can't register window class %s (error code %i)", _WindowClass.c_str(), (sint)error); - _WindowClass = ""; + _WindowClass.clear(); return false; } } diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index 1e8878fb9..cc54d6305 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -568,7 +568,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) if (_PixelProgram) { #ifdef NL_DEBUG_D3D - // Check, should not occured + // Check, should not occur nlassertex (_PixelShader, ("STOP : no pixel shader available. Can't render this material.")); #endif // NL_DEBUG_D3D diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp index 5cc6c283c..6f48cc2a4 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp @@ -62,7 +62,7 @@ void CD3DShaderFX::setName (const char *name) bool CD3DShaderFX::loadShaderFile (const char *filename) { - _Text = ""; + _Text.clear(); // Lookup string _filename = NLMISC::CPath::lookup(filename, false, true, true); if (!_filename.empty()) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index ad5de53c1..d9ba5a526 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -270,7 +270,7 @@ uint getPixelFormatSize (D3DFORMAT destFormat) case D3DFMT_DXT3: bits=8; break; case D3DFMT_DXT4: bits=8; break; case D3DFMT_DXT5: bits=8; break; - default: nlstop; break; // unkown pixel format + default: nlstop; break; // unknown pixel format } return bits; } diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp index d4af02592..69ae49c4f 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp @@ -109,7 +109,7 @@ void dumpWriteMask(uint mask, std::string &out) H_AUTO_D3D(dumpWriteMask) if (mask == 0xf) { - out = ""; + out.clear(); return; } out = "."; @@ -126,7 +126,7 @@ void dumpSwizzle(const CVPSwizzle &swz, std::string &out) H_AUTO_D3D(dumpSwizzle) if (swz.isIdentity()) { - out = ""; + out.clear(); return; } out = "."; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index cbd1bcd9a..46804cce1 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -491,7 +491,7 @@ void CDriverGL::showCursor(bool b) } else { - _CurrName = ""; + _CurrName.clear(); } // update current hardware icon to avoid to have the plain arrow diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 93d281fec..c2e37ac89 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -1270,7 +1270,7 @@ static void ARBVertexProgramDumpWriteMask(uint mask, std::string &out) H_AUTO_OGL(ARBVertexProgramDumpWriteMask) if (mask == 0xf) { - out = ""; + out.clear(); return; } out = "."; @@ -1286,7 +1286,7 @@ static void ARBVertexProgramDumpSwizzle(const CVPSwizzle &swz, std::string &out) H_AUTO_OGL(ARBVertexProgramDumpSwizzle) if (swz.isIdentity()) { - out = ""; + out.clear(); return; } out = "."; diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 4da55a009..b55ad5865 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -626,7 +626,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) } case SelectionClear: _SelectionOwned = false; - _CopiedString = ""; + _CopiedString.clear(); break; case SelectionNotify: { diff --git a/code/nel/src/3d/landscape_user.cpp b/code/nel/src/3d/landscape_user.cpp index c2c3a4b27..fd1bc3747 100644 --- a/code/nel/src/3d/landscape_user.cpp +++ b/code/nel/src/3d/landscape_user.cpp @@ -262,8 +262,8 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::s { NL3D_HAUTO_LOAD_LANDSCAPE; - zoneRemoved= ""; - zoneAdded= ""; + zoneRemoved.clear(); + zoneAdded.clear(); CZoneManager::SZoneManagerWork Work; // Check if new zone must be added to landscape if (_ZoneManager.isWorkComplete(Work)) diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index 0d3095182..3595c962d 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -1101,7 +1101,11 @@ bool CMeshGeom::retrieveTriangles(std::vector &indices) const else { // std::copy will convert from 16 bits index to 32 bit index - std::copy((uint16 *) iba.getPtr(), ((uint16 *) iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx*3]); +#ifdef NL_COMP_VC14 + std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), stdext::make_checked_array_iterator(&indices[triIdx * 3], indices.size() - triIdx * 3)); +#else + std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx * 3]); +#endif } // next triIdx+= pb.getNumIndexes()/3; diff --git a/code/nel/src/3d/portal.cpp b/code/nel/src/3d/portal.cpp index deb80c5c5..62df832db 100644 --- a/code/nel/src/3d/portal.cpp +++ b/code/nel/src/3d/portal.cpp @@ -242,11 +242,11 @@ void CPortal::serial (NLMISC::IStream& f) { std::string occName = CStringMapper::unmap(_OcclusionModelId); if (occName == "no occlusion") - occName = ""; + occName.clear(); f.serial(occName); occName = CStringMapper::unmap(_OpenOcclusionModelId); if (occName == "no occlusion") - occName = ""; + occName.clear(); f.serial(occName); } } diff --git a/code/nel/src/3d/ps_emitter.cpp b/code/nel/src/3d/ps_emitter.cpp index c9806722f..a976ea5c4 100644 --- a/code/nel/src/3d/ps_emitter.cpp +++ b/code/nel/src/3d/ps_emitter.cpp @@ -1901,9 +1901,9 @@ void CPSEmitter::resize(uint32 size) } ///========================================================================== -void CPSEmitter::bounceOccured(uint32 index, TAnimationTime timeToNextSimStep) +void CPSEmitter::bounceOccurred(uint32 index, TAnimationTime timeToNextSimStep) { - NL_PS_FUNC(CPSEmitter_bounceOccured) + NL_PS_FUNC(CPSEmitter_bounceOccurred) // TODO : avoid duplication with deleteElement if (_EmittedType && _EmissionType == CPSEmitter::onBounce) { @@ -2797,7 +2797,7 @@ void CPSEmitter::doEmitOnce(uint firstInstanceIndex) startPos = _Owner->getParametricInfos()[k].Pos; } float currTime = _Owner->getTime()[k]; - _Owner->getTime()[k] = 0.f; // when emit occured, time was 0 + _Owner->getTime()[k] = 0.f; // when emit occurred, time was 0 sint32 nbToGenerate = (sint32) (emitLOD * *numToEmitPtr); if (nbToGenerate > 0) { @@ -2830,7 +2830,7 @@ void CPSEmitter::doEmitOnce(uint firstInstanceIndex) startPos = _Owner->getParametricInfos()[k].Pos; } float currTime = _Owner->getTime()[k]; - _Owner->getTime()[k] = 0.f; // when emit occured, time was 0 + _Owner->getTime()[k] = 0.f; // when emit occurred, time was 0 processEmitConsistent(startPos, k, nbToGenerate, _Owner->getAgeInSeconds(k) / CParticleSystem::RealEllapsedTimeRatio); // restore time & pos _Owner->getTime()[k] = currTime; diff --git a/code/nel/src/3d/ps_located.cpp b/code/nel/src/3d/ps_located.cpp index 5409f3480..6572a5b23 100644 --- a/code/nel/src/3d/ps_located.cpp +++ b/code/nel/src/3d/ps_located.cpp @@ -1004,7 +1004,7 @@ void CPSLocated::postNewElement(const NLMISC::CVector &pos, const CPSCollisionInfo &ci = _Collisions[indexInEmitter]; if (ci.Dist != -1.f) { - // a collision occured, check time from collision to next time step + // a collision occurred, check time from collision to next time step if ((emitterLocated.getPos()[indexInEmitter] - ci.NewPos) * (pos - ci.NewPos) > 0.f) return; // discard emit that are farther than the collision } } @@ -1839,10 +1839,10 @@ void CPSLocated::updateCollisions() { _Pos[currCollision->Index] = currCollision->NewPos; std::swap(_Speed[currCollision->Index], currCollision->NewSpeed); // keep speed because may be needed when removing particles - // notify each located bindable that a bounce occured ... + // notify each located bindable that a bounce occurred ... for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it) { - (*it)->bounceOccured(currCollision->Index, computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index))); + (*it)->bounceOccurred(currCollision->Index, computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index))); } if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy) { @@ -1878,13 +1878,13 @@ void CPSLocated::updateCollisions() // if particle is too old, check whether it died before the collision _Pos[currCollision->Index] = currCollision->NewPos; std::swap(_Speed[currCollision->Index], currCollision->NewSpeed); - // notify each located bindable that a bounce occured ... + // notify each located bindable that a bounce occurred ... if (!_LocatedBoundCont.empty()) { TAnimationTime timeFromcollisionToNextSimStep = computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index)); for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it) { - (*it)->bounceOccured(currCollision->Index, timeFromcollisionToNextSimStep); + (*it)->bounceOccurred(currCollision->Index, timeFromcollisionToNextSimStep); } } if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy) @@ -2190,7 +2190,7 @@ void CPSLocated::removeOldParticles() TAnimationTime timeUntilNextSimStep; if (_Collisions[*it].Dist == -1.f) { - // no collision occured + // no collision occurred if (_Time[*it] > 1.f) { @@ -2213,18 +2213,18 @@ void CPSLocated::removeOldParticles() } else { - // a collision occured before particle died, so pos is already good + // a collision occurred before particle died, so pos is already good if (_LifeScheme) { timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] / _TimeIncrement[*it]); - // compute age of particle when collision occured + // compute age of particle when collision occurred _Time[*it] -= timeUntilNextSimStep * _TimeIncrement[*it]; NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions } else { timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] * _InitialLife); - // compute age of particle when collision occured + // compute age of particle when collision occurred _Time[*it] -= timeUntilNextSimStep / (_InitialLife == 0.f ? 1.f : _InitialLife); NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions } diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index 5002f0054..b1a9cc8b8 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1113,6 +1113,9 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const { const_cast(this)->update(); } +#ifdef NL_COMP_VC14 + std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), stdext::make_unchecked_array_iterator(shapesNames)); +#else std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames); } diff --git a/code/nel/src/3d/ps_ribbon.cpp b/code/nel/src/3d/ps_ribbon.cpp index af907313f..b00b89775 100644 --- a/code/nel/src/3d/ps_ribbon.cpp +++ b/code/nel/src/3d/ps_ribbon.cpp @@ -1463,7 +1463,11 @@ void CPSRibbon::setShape(const CVector *shape, uint32 nbPointsInShape, bool brac ///================================================================================================================== void CPSRibbon::getShape(CVector *shape) const { - NL_PS_FUNC(CPSRibbon_getShape) + NL_PS_FUNC(CPSRibbon_getShape); + +#ifdef NL_COMP_VC14 + std::copy(_Shape.begin(), _Shape.end(), stdext::make_unchecked_array_iterator(shape)); +#else std::copy(_Shape.begin(), _Shape.end(), shape); } diff --git a/code/nel/src/3d/std3d.h b/code/nel/src/3d/std3d.h index 3fc5b55d6..e81f1ead4 100644 --- a/code/nel/src/3d/std3d.h +++ b/code/nel/src/3d/std3d.h @@ -34,6 +34,7 @@ #include #include #include +#include #include "nel/misc/rgba.h" #include "nel/misc/debug.h" diff --git a/code/nel/src/3d/tessellation.cpp b/code/nel/src/3d/tessellation.cpp index 58171c40f..b683725a3 100644 --- a/code/nel/src/3d/tessellation.cpp +++ b/code/nel/src/3d/tessellation.cpp @@ -2530,7 +2530,7 @@ void CTessFace::refreshTesselationGeometry() // *************************************************************************** bool CTessFace::updateBindEdge(CTessFace *&edgeFace, bool &splitWanted) { - // Return true, when the bind should be Ok, or if a split has occured. + // Return true, when the bind should be Ok, or if a split has occurred. // Return false only if pointers are updated, without splits. if(edgeFace==NULL) diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index 0f05b3df6..5cacae18e 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -134,7 +134,7 @@ void CTileBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream) nlassert (f.isReading()); // Reset _AbsPath - _AbsPath=""; + _AbsPath.clear(); // Remove diffuse and additive in transition uint tileCount=(uint)getTileCount (); @@ -782,7 +782,7 @@ void CTile::serial(NLMISC::IStream &f) throw(NLMISC::EStream) _Flags=0; // Initialize alpha name - _BitmapName[alpha]=""; + _BitmapName[alpha].clear(); // Read free flag f.serial (tmp); @@ -804,7 +804,7 @@ void CTile::serial(NLMISC::IStream &f) throw(NLMISC::EStream) // *************************************************************************** void CTile::clearTile (CTile::TBitmap type) { - _BitmapName[type]=""; + _BitmapName[type].clear(); } @@ -1521,7 +1521,7 @@ void CTileSet::setDisplacement (TDisplacement displacement, const std::string& f // *************************************************************************** void CTileSet::cleanUnusedData () { - _Name=""; + _Name.clear(); _ChildName.clear(); _Border128[0].reset (); _Border128[1].reset (); @@ -1853,14 +1853,12 @@ CTileNoise::CTileNoise () { // Not loaded _TileNoiseMap=NULL; - _FileName=""; } // *************************************************************************** CTileNoise::CTileNoise (const CTileNoise &src) { // Default ctor _TileNoiseMap=NULL; - _FileName=""; // Copy *this=src; @@ -1932,7 +1930,7 @@ void CTileNoise::reset() } // Erase filename - _FileName=""; + _FileName.clear(); } // *************************************************************************** diff --git a/code/nel/src/3d/vertex_buffer.cpp b/code/nel/src/3d/vertex_buffer.cpp index fc09dc956..8315b46da 100644 --- a/code/nel/src/3d/vertex_buffer.cpp +++ b/code/nel/src/3d/vertex_buffer.cpp @@ -885,7 +885,7 @@ void CVertexBuffer::serialHeader(NLMISC::IStream &f) if(f.isReading()) { _PreferredMemory = RAMPreferred; - _Name = ""; + _Name.clear(); } } } diff --git a/code/nel/src/3d/vertex_program_parse.cpp b/code/nel/src/3d/vertex_program_parse.cpp index 0e144d54f..259e72b41 100644 --- a/code/nel/src/3d/vertex_program_parse.cpp +++ b/code/nel/src/3d/vertex_program_parse.cpp @@ -1110,7 +1110,7 @@ static void dumpWriteMask(uint mask, std::string &out) { if (mask == 0xf) { - out = ""; + out.clear(); return; } out = "."; @@ -1125,7 +1125,7 @@ static void dumpSwizzle(const CVPSwizzle &swz, std::string &out) { if (swz.isIdentity()) { - out = ""; + out.clear(); return; } out = "."; diff --git a/code/nel/src/3d/water_height_map.cpp b/code/nel/src/3d/water_height_map.cpp index 9ab5a31f3..38ca1cacf 100644 --- a/code/nel/src/3d/water_height_map.cpp +++ b/code/nel/src/3d/water_height_map.cpp @@ -305,7 +305,11 @@ void CWaterHeightMap::makeCpy(uint buffer, uint dX, uint dY, uint sX, uint sY, { if (dest < src) { +#ifdef NL_COMP_VC14 + std::copy(src, src + width, stdext::make_unchecked_array_iterator(dest)); +#else std::copy(src, src + width, dest); +#endif } else { diff --git a/code/nel/src/3d/zone_manager.cpp b/code/nel/src/3d/zone_manager.cpp index efa36fa66..34a670b5e 100644 --- a/code/nel/src/3d/zone_manager.cpp +++ b/code/nel/src/3d/zone_manager.cpp @@ -170,7 +170,7 @@ bool CZoneManager::isWorkComplete (CZoneManager::SZoneManagerWork &rWork) rWork.NameZoneAdded = ite->ZoneToAddName; rWork.ZoneRemoved = false; rWork.IdZoneToRemove = 0; - rWork.NameZoneRemoved = ""; + rWork.NameZoneRemoved.clear(); rWork.Zone = const_cast(ite->Zone); _LoadedZones.push_back (ite->ZoneToAddId); @@ -187,7 +187,7 @@ bool CZoneManager::isWorkComplete (CZoneManager::SZoneManagerWork &rWork) { _RemovingZone = false; rWork.ZoneAdded = false; - rWork.NameZoneAdded = ""; + rWork.NameZoneAdded.clear(); rWork.ZoneRemoved = true; rWork.IdZoneToRemove = _IdZoneToRemove; rWork.NameZoneRemoved = getZoneNameFromId(_IdZoneToRemove); diff --git a/code/nel/src/georges/form_dfn.cpp b/code/nel/src/georges/form_dfn.cpp index 16ee74d5b..114a3aaf1 100644 --- a/code/nel/src/georges/form_dfn.cpp +++ b/code/nel/src/georges/form_dfn.cpp @@ -498,7 +498,7 @@ void CFormDfn::CEntry::setDfn (CFormLoader &loader, const char *filename) void CFormDfn::CEntry::setDfnPointer () { TypeElement = EntryVirtualDfn; - Filename = ""; + Filename.clear(); Type = NULL; Dfn = NULL; } diff --git a/code/nel/src/georges/form_elm.cpp b/code/nel/src/georges/form_elm.cpp index 01e4010e2..1c752b0bc 100644 --- a/code/nel/src/georges/form_elm.cpp +++ b/code/nel/src/georges/form_elm.cpp @@ -1512,7 +1512,7 @@ const char* CFormElm::tokenize (const char *name, string &str, uint &/* errorInd return name+1; } - str = ""; + str.clear(); while ( (*name != '.') && (*name != '[') && (*name != ']') && (*name != 0) ) { // Add a char @@ -2066,7 +2066,7 @@ void CFormElmStruct::getFormName (std::string &result, const CFormElm *child) co // Reset the result if (child == NULL) { - result = ""; + result.clear(); result.reserve (50); } @@ -2723,7 +2723,7 @@ void CFormElmArray::getFormName (std::string &result, const CFormElm *child) con // Reset the result if (child == NULL) { - result = ""; + result.clear(); result.reserve (50); } @@ -3067,7 +3067,7 @@ void CFormElmAtom::getFormName (std::string &result, const CFormElm *child) cons { // Must be NULL nlassert (child == NULL); - result = ""; + result.clear(); result.reserve (50); // Get parent form name diff --git a/code/nel/src/georges/header.cpp b/code/nel/src/georges/header.cpp index ff92d60ea..a2df85cd3 100644 --- a/code/nel/src/georges/header.cpp +++ b/code/nel/src/georges/header.cpp @@ -159,7 +159,7 @@ void CFileHeader::read (xmlNodePtr root) } // Look for the comment node - Comments = ""; + Comments.clear(); xmlNodePtr node = CIXml::getFirstChildNode (root, "COMMENTS"); if (node) { @@ -181,7 +181,7 @@ void CFileHeader::read (xmlNodePtr root) } // Look for the log node - Log = ""; + Log.clear(); node = CIXml::getFirstChildNode (root, "LOG"); if (node) { diff --git a/code/nel/src/georges/type.cpp b/code/nel/src/georges/type.cpp index f401c7ee8..5867f1282 100644 --- a/code/nel/src/georges/type.cpp +++ b/code/nel/src/georges/type.cpp @@ -185,7 +185,7 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)value); } else - Default = ""; + Default.clear(); // Read Min value = (const char*)xmlGetProp (root, (xmlChar*)"Min"); @@ -197,7 +197,7 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)value); } else - Min = ""; + Min.clear(); // Read Max value = (const char*)xmlGetProp (root, (xmlChar*)"Max"); @@ -209,7 +209,7 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)value); } else - Max = ""; + Max.clear(); // Read Increment value = (const char*)xmlGetProp (root, (xmlChar*)"Increment"); @@ -221,7 +221,7 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)value); } else - Increment = ""; + Increment.clear(); // Read the definitions uint childrenCount = CIXml::countChildren (root, "DEFINITION"); @@ -465,7 +465,7 @@ uint getNextToken (const char *startString, string &token, uint &offset) offset += 9; return NL_TOKEN_NAME; } - token = ""; + token.clear(); while (startString[offset]) { if (startString[offset] == '\\') diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 48347aed1..4ac977803 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -1768,7 +1768,7 @@ namespace NLGUI // *************************************************************************** void CGroupEditBox::clearAllEditBox() { - _InputString = ""; + _InputString.clear(); _CursorPos = 0; _CursorAtPreviousLineEnd = false; if (!_ViewText) return; diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 2e77b091b..eee811d02 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -2089,10 +2089,10 @@ namespace NLGUI templateName = value[MY_HTML_TEXTAREA_Z_INPUT_TMPL]; // Get the string name - _TextAreaName = ""; + _TextAreaName.clear(); _TextAreaRow = 1; _TextAreaCols = 10; - _TextAreaContent = ""; + _TextAreaContent.clear(); _TextAreaMaxLength = 1024; if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME]) _TextAreaName = value[MY_HTML_TEXTAREA_NAME]; @@ -2112,7 +2112,7 @@ namespace NLGUI if(!_TitlePrefix.empty()) _TitleString = _TitlePrefix + " - "; else - _TitleString = ""; + _TitleString.clear(); _Title = true; } break; @@ -2144,10 +2144,10 @@ namespace NLGUI endParagraph(); break; case HTML_OBJECT: - _ObjectType = ""; - _ObjectData = ""; - _ObjectMD5Sum = ""; - _ObjectAction = ""; + _ObjectType.clear(); + _ObjectData.clear(); + _ObjectMD5Sum.clear(); + _ObjectAction.clear(); if (present[HTML_OBJECT_TYPE] && value[HTML_OBJECT_TYPE]) _ObjectType = value[HTML_OBJECT_TYPE]; if (present[HTML_OBJECT_DATA] && value[HTML_OBJECT_DATA]) @@ -2369,7 +2369,7 @@ namespace NLGUI { endParagraph(); } - _DivName = ""; + _DivName.clear(); popIfNotEmpty (_Divs); popIfNotEmpty (_BlockLevelElement); break; @@ -2614,7 +2614,7 @@ namespace NLGUI { CLuaManager::getInstance().executeLuaScript("\nlocal __ALLREADYDL__=true\n"+_ObjectScript, true); } - _ObjectScript = ""; + _ObjectScript.clear(); } } _Object = false; @@ -2632,7 +2632,7 @@ namespace NLGUI { // we receive an embeded lua script _ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain - _LuaScript = ""; + _LuaScript.clear(); } } @@ -2687,8 +2687,6 @@ namespace NLGUI _LI = false; _SelectOption = false; _GroupListAdaptor = NULL; - _DocumentUrl = ""; - _DocumentDomain = ""; _UrlFragment.clear(); _RefreshUrl.clear(); _NextRefreshTime = 0.0; @@ -2741,7 +2739,6 @@ namespace NLGUI DefaultCheckBoxBitmapOver = "checkbox_over.tga"; DefaultRadioButtonBitmapNormal = "w_radiobutton.png"; DefaultRadioButtonBitmapPushed = "w_radiobutton_pushed.png"; - DefaultRadioButtonBitmapOver = ""; DefaultBackgroundBitmapView = "bg"; clearContext(); @@ -5825,7 +5822,7 @@ namespace NLGUI if (it->second == "monospace") style.FontFamily = "monospace"; else - style.FontFamily = ""; + style.FontFamily.clear(); } else if (it->first == "font-weight") diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index e75f8787e..8869c4498 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -363,7 +363,7 @@ namespace NLGUI uint32 i; if( fromString( value, i ) ) _TextId = i; - _HardText = ""; + _HardText.clear(); onTextChanged(); return; } diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index 7ab5db84c..80117e5bd 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -266,7 +266,7 @@ namespace NLGUI else if (stricmp((char*)cur->name, "action") == 0) { - string strId, strAh, strParams, strCond, strTexture=""; + string strId, strAh, strParams, strCond, strTexture; ucstring ucstrName; if (id) strId = (const char*)id; @@ -1077,7 +1077,7 @@ namespace NLGUI for (uint32 i = 0; i < pCurGSM->_Lines.size(); ++i) if (sRest == pCurGSM->_Lines[i].Id) return pCurGSM->_Lines[i].ViewText; - sRest = ""; + sRest.clear(); } else // no a lot of token left { diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index 9e065c878..6261656aa 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -337,7 +337,7 @@ namespace NLGUI if( fromString( value, i ) ) { _TextId = i; - _HardText = ""; + _HardText.clear(); } onTextChanged(); return; diff --git a/code/nel/src/gui/group_tree.cpp b/code/nel/src/gui/group_tree.cpp index 1b80ee84b..b8e2ae1f4 100644 --- a/code/nel/src/gui/group_tree.cpp +++ b/code/nel/src/gui/group_tree.cpp @@ -765,7 +765,7 @@ namespace NLGUI rVR.getTextureSizeFromId(id, _XExtend, dummy); else // if not found, reset, to avoid errors - _ArboXExtend= ""; + _ArboXExtend.clear(); } // ---------------------------------------------------------------------------- diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 5f4366981..623dfe5bd 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -1031,12 +1031,12 @@ namespace NLGUI if (posid > 0) idTmp = idTmp.substr (0, posid); else - idTmp = ""; + idTmp.clear(); if (poslid > 0) lidTmp = lidTmp.substr (0, poslid); else - lidTmp = ""; + lidTmp.clear(); } return true; } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 068d827bf..4362b5c12 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -665,7 +665,7 @@ namespace NLGUI if (strchr(ptr, '#') != NULL) { string LastProp = ptr.str(); - string NewProp =""; + string NewProp; string RepProp; while (LastProp.size() > 0) @@ -709,7 +709,7 @@ namespace NLGUI else { NewProp += LastProp; - LastProp = ""; + LastProp.clear(); } } xmlSetProp(node,props->name, (const xmlChar*)NewProp.c_str()); diff --git a/code/nel/src/ligo/ligo_config.cpp b/code/nel/src/ligo/ligo_config.cpp index f836c808e..7139221e6 100644 --- a/code/nel/src/ligo/ligo_config.cpp +++ b/code/nel/src/ligo/ligo_config.cpp @@ -39,7 +39,7 @@ CLigoConfig::CLigoConfig() // *************************************************************************** -bool CLigoConfig::readConfigFile (const char *fileName, bool parsePrimitiveComboContent) +bool CLigoConfig::readConfigFile (const std::string &fileName, bool parsePrimitiveComboContent) { // The CF CConfigFile cf; @@ -73,7 +73,7 @@ bool CLigoConfig::readConfigFile (const char *fileName, bool parsePrimitiveCombo // *************************************************************************** -bool CLigoConfig::readPrimitiveClass (const char *_fileName, bool parsePrimitiveComboContent) +bool CLigoConfig::readPrimitiveClass (const std::string &_fileName, bool parsePrimitiveComboContent) { // File exist ? string filename = _fileName; @@ -785,7 +785,7 @@ std::string CLigoConfig::aliasToString(uint32 fullAlias) } -uint32 CLigoConfig::aliasFromString(std::string fullAlias) +uint32 CLigoConfig::aliasFromString(const std::string &fullAlias) { uint32 staticPart; uint32 dynPart; diff --git a/code/nel/src/ligo/primitive.cpp b/code/nel/src/ligo/primitive.cpp index 3fc97fdf5..c94c1609e 100644 --- a/code/nel/src/ligo/primitive.cpp +++ b/code/nel/src/ligo/primitive.cpp @@ -1240,7 +1240,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ if (indexStr==string::npos) { childName=path; - path=""; + path.clear(); } else { @@ -1664,7 +1664,7 @@ bool IPrimitive::read (xmlNodePtr xmlNode, const char *filename, uint version, C if (commentNode) { if (!CIXml::getContentString(_UnparsedProperties, commentNode)) - _UnparsedProperties = ""; + _UnparsedProperties.clear(); } // Read the expanded flag diff --git a/code/nel/src/ligo/primitive_class.cpp b/code/nel/src/ligo/primitive_class.cpp index 2b32cadec..02923285c 100644 --- a/code/nel/src/ligo/primitive_class.cpp +++ b/code/nel/src/ligo/primitive_class.cpp @@ -183,8 +183,8 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode, // init default parameters AutoInit = false; Deletable = true; - FileExtension = ""; - FileType = ""; + FileExtension.clear(); + FileType.clear(); Collision = false; LinkBrothers = false; ShowArrow = true; @@ -351,16 +351,16 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode, parameter.WidgetHeight = (uint)temp; // Read the file extension - parameter.FileExtension = ""; + parameter.FileExtension.clear(); CIXml::getPropertyString (parameter.FileExtension, paramNode, "FILE_EXTENSION"); parameter.FileExtension = toLower(parameter.FileExtension); // Autonaming preference - parameter.Autoname = ""; + parameter.Autoname.clear(); CIXml::getPropertyString (parameter.Autoname, paramNode, "AUTONAME"); // Read the file extension - parameter.Folder = ""; + parameter.Folder.clear(); CIXml::getPropertyString (parameter.Folder, paramNode, "FOLDER"); parameter.Folder = toLower(parameter.Folder); @@ -650,7 +650,7 @@ void CPrimitiveClass::CParameter::CConstStringValue::getPrimitivesForPrimPath (s bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass) const { - result = ""; + result.clear(); string::size_type strBegin = 0; string::size_type strEnd = 0; while (strBegin != Autoname.size()) @@ -745,7 +745,7 @@ bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const bool CPrimitiveClass::CParameter::getDefaultValue (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass, std::string *fromWhere) const { - result = ""; + result.clear(); if (!Autoname.empty()) { if (fromWhere) diff --git a/code/nel/src/ligo/zone_bank.cpp b/code/nel/src/ligo/zone_bank.cpp index 6d5de79e8..a72d1a98f 100644 --- a/code/nel/src/ligo/zone_bank.cpp +++ b/code/nel/src/ligo/zone_bank.cpp @@ -88,7 +88,7 @@ void CZoneBankElement::convertSize() } fromString(sTmp, _SizeX); - ++i; sTmp = ""; + ++i; sTmp.clear(); for (; i < sizeString.size(); ++i) { sTmp += sizeString[i]; diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index c9ac2f593..01fe6257a 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -453,7 +453,7 @@ public: string shortExc, longExc, subject; string addr, ext; ULONG_PTR skipNFirst = 0; - _Reason = ""; + _Reason.clear(); if (m_pexp == NULL) { @@ -491,25 +491,25 @@ public: case EXCEPTION_STACK_OVERFLOW : shortExc="Stack Overflow"; longExc="Stack overflow. Can occur during errant recursion, or when a function creates a particularly large array on the stack"; break; case EXCEPTION_INVALID_DISPOSITION : shortExc="Invalid Disposition"; longExc="Whatever number the exception filter returned, it wasn't a value the OS knows about"; break; case EXCEPTION_GUARD_PAGE : shortExc="Guard Page"; longExc="Memory Allocated as PAGE_GUARD by VirtualAlloc() has been accessed"; break; - case EXCEPTION_INVALID_HANDLE : shortExc="Invalid Handle"; longExc=""; break; + case EXCEPTION_INVALID_HANDLE : shortExc="Invalid Handle"; longExc.clear(); break; case CONTROL_C_EXIT : shortExc="Control-C"; longExc="Lets the debugger know the user hit Ctrl-C. Seemingly for console apps only"; break; case STATUS_NO_MEMORY : shortExc="No Memory"; longExc="Called by HeapAlloc() if you specify HEAP_GENERATE_EXCEPTIONS and there is no memory or heap corruption"; ext = ", unable to allocate "; ext += toString ("%d bytes", m_pexp->ExceptionRecord->ExceptionInformation [0]); break; - case STATUS_WAIT_0 : shortExc="Wait 0"; longExc=""; break; - case STATUS_ABANDONED_WAIT_0 : shortExc="Abandoned Wait 0"; longExc=""; break; + case STATUS_WAIT_0 : shortExc="Wait 0"; longExc.clear(); break; + case STATUS_ABANDONED_WAIT_0 : shortExc="Abandoned Wait 0"; longExc.clear(); break; case STATUS_USER_APC : shortExc="User APC"; longExc="A user APC was delivered to the current thread before the specified Timeout interval expired"; break; - case STATUS_TIMEOUT : shortExc="Timeout"; longExc=""; break; - case STATUS_PENDING : shortExc="Pending"; longExc=""; break; - case STATUS_SEGMENT_NOTIFICATION : shortExc="Segment Notification"; longExc=""; break; - case STATUS_FLOAT_MULTIPLE_FAULTS : shortExc="Float Multiple Faults"; longExc=""; break; - case STATUS_FLOAT_MULTIPLE_TRAPS : shortExc="Float Multiple Traps"; longExc=""; break; + case STATUS_TIMEOUT : shortExc="Timeout"; longExc.clear(); break; + case STATUS_PENDING : shortExc="Pending"; longExc.clear(); break; + case STATUS_SEGMENT_NOTIFICATION : shortExc="Segment Notification"; longExc.clear(); break; + case STATUS_FLOAT_MULTIPLE_FAULTS : shortExc="Float Multiple Faults"; longExc.clear(); break; + case STATUS_FLOAT_MULTIPLE_TRAPS : shortExc="Float Multiple Traps"; longExc.clear(); break; #ifdef NL_COMP_VC6 - case STATUS_ILLEGAL_VLM_REFERENCE : shortExc="Illegal VLM Reference"; longExc=""; break; + case STATUS_ILLEGAL_VLM_REFERENCE : shortExc="Illegal VLM Reference"; longExc.clear(); break; #endif case 0xE06D7363 : shortExc="Microsoft C++ Exception"; longExc="Microsoft C++ Exception"; break; // cpp exception - case 0xACE0ACE : shortExc=""; longExc=""; + case 0xACE0ACE : shortExc.clear(); longExc.clear(); if (m_pexp->ExceptionRecord->NumberParameters == 1) skipNFirst = m_pexp->ExceptionRecord->ExceptionInformation [0]; break; // just want the stack @@ -824,7 +824,7 @@ public: // replace param with the value of the stack for this param string parse = str; - str = ""; + str.clear(); uint pos2 = 0; sint stop = 0; @@ -943,7 +943,7 @@ public: str += tmp; } str += parse[i]; - type = ""; + type.clear(); } else { @@ -1442,7 +1442,7 @@ std::string formatErrorMessage(int errorCode) NULL ); - // empty buffer, an error occured + // empty buffer, an error occurred if (len == 0) return toString("FormatMessage returned error %d", getLastError()); // convert wchar_t* to std::string diff --git a/code/nel/src/misc/dynloadlib.cpp b/code/nel/src/misc/dynloadlib.cpp index fadf2e249..66f774fa2 100644 --- a/code/nel/src/misc/dynloadlib.cpp +++ b/code/nel/src/misc/dynloadlib.cpp @@ -255,7 +255,7 @@ void CLibrary::freeLibrary() _PureNelLibrary = NULL; _LibHandle = NULL; _Ownership = false; - _LibFileName = ""; + _LibFileName.clear(); } } diff --git a/code/nel/src/misc/eid_translator.cpp b/code/nel/src/misc/eid_translator.cpp index 591b9db7a..0d126de50 100644 --- a/code/nel/src/misc/eid_translator.cpp +++ b/code/nel/src/misc/eid_translator.cpp @@ -587,10 +587,10 @@ void CEntityIdTranslator::getEntityIdInfo (const CEntityId &eid, ucstring &entit if (it == RegisteredEntities.end ()) { nlwarning ("EIT: %s is not registered in CEntityIdTranslator", reid.toString().c_str()); - entityName = ""; + entityName.clear(); entitySlot = -1; uid = std::numeric_limits::max(); - userName = ""; + userName.clear(); online = false; } else diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 01c417635..727c02f83 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -550,7 +550,6 @@ uint CIFile::getDbgStreamSize() const COFile::COFile() : IStream(false) { _F=NULL; - _FileName = ""; } // ====================================================================================================== diff --git a/code/nel/src/misc/i_xml.cpp b/code/nel/src/misc/i_xml.cpp index fbd8f5d9f..3c8a3c6ba 100644 --- a/code/nel/src/misc/i_xml.cpp +++ b/code/nel/src/misc/i_xml.cpp @@ -67,7 +67,6 @@ CIXml::CIXml () : IStream (true /* Input mode */) _CurrentNode = NULL; _PushBegin = false; _AttribPresent = false; - _ErrorString = ""; _TryBinaryMode = false; _BinaryStream = NULL; } @@ -82,7 +81,6 @@ CIXml::CIXml (bool tryBinaryMode) : IStream (true /* Input mode */) _CurrentNode = NULL; _PushBegin = false; _AttribPresent = false; - _ErrorString = ""; _TryBinaryMode = tryBinaryMode; _BinaryStream = NULL; } @@ -116,7 +114,7 @@ void CIXml::release () _CurrentNode = NULL; _PushBegin = false; _AttribPresent = false; - _ErrorString = ""; + _ErrorString.clear(); resetPtrTable(); } @@ -195,7 +193,7 @@ bool CIXml::init (IStream &stream) } // Set error handler - _ErrorString = ""; + _ErrorString.clear(); xmlSetGenericErrorFunc (this, xmlGenericErrorFuncRead); // Ask to get debug info @@ -319,7 +317,7 @@ void CIXml::serialSeparatedBufferIn ( string &value, bool checkSeparator ) // If no more node, empty string if (_CurrentNode == NULL) { - value = ""; + value.clear(); _ContentStringIndex = 0; _ContentString.erase (); return; diff --git a/code/nel/src/misc/log.cpp b/code/nel/src/misc/log.cpp index 08f6b3107..4efae637a 100644 --- a/code/nel/src/misc/log.cpp +++ b/code/nel/src/misc/log.cpp @@ -377,11 +377,11 @@ void CLog::displayRawString (const char *str) { localargs.Date = 0; localargs.LogType = CLog::LOG_NO; - localargs.ProcessName = ""; + localargs.ProcessName.clear(); localargs.ThreadId = 0; localargs.FileName = NULL; localargs.Line = -1; - localargs.CallstackAndLog = ""; + localargs.CallstackAndLog.clear(); TempString = str; } @@ -397,11 +397,11 @@ void CLog::displayRawString (const char *str) { localargs.Date = 0; localargs.LogType = CLog::LOG_NO; - localargs.ProcessName = ""; + localargs.ProcessName.clear(); localargs.ThreadId = 0; localargs.FileName = NULL; localargs.Line = -1; - localargs.CallstackAndLog = ""; + localargs.CallstackAndLog.clear(); disp = str; args = &localargs; diff --git a/code/nel/src/misc/mem_displayer.cpp b/code/nel/src/misc/mem_displayer.cpp index b8f4f2ea3..c2d7049de 100644 --- a/code/nel/src/misc/mem_displayer.cpp +++ b/code/nel/src/misc/mem_displayer.cpp @@ -85,7 +85,7 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr) // replace param with the value of the stack for this param string parse = str; - str = ""; + str.clear(); uint pos = 0; sint stop = 0; diff --git a/code/nel/src/misc/o_xml.cpp b/code/nel/src/misc/o_xml.cpp index 6df48ef80..ec121b2b5 100644 --- a/code/nel/src/misc/o_xml.cpp +++ b/code/nel/src/misc/o_xml.cpp @@ -134,7 +134,7 @@ COXml::COXml () : IStream (false /* Output mode */) _CurrentNode = NULL; // Content string - _ContentString = ""; + _ContentString.clear(); // Push begin _PushBegin = false; @@ -160,7 +160,7 @@ bool COXml::init (IStream *stream, const char *version) if (!stream->isReading()) { // Set error handler - _ErrorString = ""; + _ErrorString.clear(); xmlSetGenericErrorFunc (this, xmlGenericErrorFuncWrite); // Set XML mode @@ -179,7 +179,7 @@ bool COXml::init (IStream *stream, const char *version) _CurrentNode = NULL; // Content string - _ContentString = ""; + _ContentString.clear(); // Push begin _PushBegin = false; diff --git a/code/nel/src/misc/string_mapper.cpp b/code/nel/src/misc/string_mapper.cpp index cf8a38e49..7177b062b 100644 --- a/code/nel/src/misc/string_mapper.cpp +++ b/code/nel/src/misc/string_mapper.cpp @@ -33,8 +33,7 @@ CStringMapper CStringMapper::_GlobalMapper; // **************************************************************************** CStringMapper::CStringMapper() { - _EmptyId = new string; - *_EmptyId = ""; + _EmptyId = new string(); } // **************************************************************************** diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index b78389064..9bea47e29 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1525,7 +1525,7 @@ NLMISC_CATEGORISED_DYNVARIABLE(nel, string, AvailableHDSpace, "Hard drive space if (get) { *pointer = (CSystemInfo::availableHDSpace(location)); - location = ""; + location.clear(); } else { diff --git a/code/nel/src/misc/task_manager.cpp b/code/nel/src/misc/task_manager.cpp index 4cdb16bd0..c4ec29288 100644 --- a/code/nel/src/misc/task_manager.cpp +++ b/code/nel/src/misc/task_manager.cpp @@ -37,7 +37,7 @@ CTaskManager::CTaskManager() : _RunningTask (""), _TaskQueue (""), _DoneTaskQueu _IsTaskRunning = false; _ThreadRunning = true; CSynchronized::CAccessor currentTask(&_RunningTask); - currentTask.value () = ""; + currentTask.value ().clear(); _Thread = IThread::create(this); _Thread->start(); _ChangePriorityCallback = NULL; @@ -111,7 +111,7 @@ void CTaskManager::run(void) CSynchronized::CAccessor currentTask(&_RunningTask); CSynchronized >::CAccessor doneTask(&_DoneTaskQueue); doneTask.value().push_front (currentTask.value ()); - currentTask.value () = ""; + currentTask.value ().clear(); if (doneTask.value().size () > NLMISC_DONE_TASK_SIZE) doneTask.value().resize (NLMISC_DONE_TASK_SIZE); } diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index 37db08fbf..b157448ec 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -156,7 +156,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) string str; while (*pos2 != '\0') { - str = ""; + str.clear(); // get the string while (*pos2 != '\0' && *pos2 != '\n') diff --git a/code/nel/src/net/admin.cpp b/code/nel/src/net/admin.cpp index 89981a697..625523ea5 100644 --- a/code/nel/src/net/admin.cpp +++ b/code/nel/src/net/admin.cpp @@ -381,7 +381,7 @@ void serviceGetView (uint32 rid, const string &rawvarpath, TAdminViewResult &ans if (CCommandRegistry::getInstance().isNamedCommandHandler(varpath.Destination[0].first)) { varpath.Destination[0].first += "."+varpath.Destination[0].second; - varpath.Destination[0].second = ""; + varpath.Destination[0].second.clear(); } if (varpath.isFinal()) diff --git a/code/nel/src/net/buf_sock.cpp b/code/nel/src/net/buf_sock.cpp index c419e1aa2..b3d6d7acb 100644 --- a/code/nel/src/net/buf_sock.cpp +++ b/code/nel/src/net/buf_sock.cpp @@ -84,7 +84,7 @@ CBufSock::~CBufSock() delete Sock; // the socket disconnects automatically if needed // destroy the structur to be sure that other people will not access to this anymore - AuthorizedCallback = ""; + AuthorizedCallback.clear(); Sock = NULL; _KnowConnected = false; _LastFlushTime = 0; @@ -131,7 +131,7 @@ string stringFromVectorPart( const vector& v, uint32 pos, uint32 len ) * (see CNonBlockingBufSock), if all the data could not be sent immediately, * the returned nbBytesRemaining value is non-zero. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. - * \returns False if an error has occured (e.g. the remote host is disconnected). + * \returns False if an error has occurred (e.g. the remote host is disconnected). * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() * * Note: this method works with both blocking and non-blocking sockets @@ -270,7 +270,7 @@ void CBufSock::setTimeFlushTrigger( sint32 ms ) /* - * Update the network sending (call this method evenly). Returns false if an error occured. + * Update the network sending (call this method evenly). Returns false if an error occurred. */ bool CBufSock::update() { diff --git a/code/nel/src/net/login_client.cpp b/code/nel/src/net/login_client.cpp index 71ffc6825..0f4383e16 100644 --- a/code/nel/src/net/login_client.cpp +++ b/code/nel/src/net/login_client.cpp @@ -127,7 +127,7 @@ string CLoginClient::authenticate(const string &loginServiceAddr, const ucstring string CLoginClient::authenticateBegin(const string &loginServiceAddr, const ucstring &login, const string &cpassword, const string &application) { - VerifyLoginPasswordReason = ""; + VerifyLoginPasswordReason.clear(); VerifyLoginPassword = false; // S01: connect to the LS @@ -355,7 +355,7 @@ string CLoginClient::selectShardBegin(sint32 shardId) { nlassert(_LSCallbackClient != 0 && _LSCallbackClient->connected()); - ShardChooseShardReason = ""; + ShardChooseShardReason.clear(); ShardChooseShard = false; if (ShardList.empty()) diff --git a/code/nel/src/net/login_server.cpp b/code/nel/src/net/login_server.cpp index 5bd6dfd34..ff7d992c4 100644 --- a/code/nel/src/net/login_server.cpp +++ b/code/nel/src/net/login_server.cpp @@ -157,7 +157,7 @@ void cbWSChooseShard (CMessage &msgin, const std::string &/* serviceName */, TSe // add it to the awaiting client nlinfo ("LS: New cookie %s (name '%s' priv '%s' extended '%s' instance %u slot %u) inserted in the pending user list (awaiting new client)", cookie.toString().c_str(), userName.c_str(), userPriv.c_str(), userExtended.c_str(), instanceId, charSlot); PendingUsers.push_back (CPendingUser (cookie, userName, userPriv, userExtended, instanceId, charSlot)); - reason = ""; + reason.clear(); // callback if needed if (NewCookieCallback != NULL) @@ -233,7 +233,7 @@ void cbShardValidation (CMessage &msgin, TSockId from, CCallbackNetBase &netbase // if the cookie is not valid and we accept them, clear the error if(AcceptInvalidCookie && !reason.empty()) { - reason = ""; + reason.clear(); cookie.set (rand(), rand(), rand()); } @@ -425,7 +425,8 @@ void CLoginServer::addNewCookieCallback(TNewCookieCallback newCookieCb) string CLoginServer::isValidCookie (const CLoginCookie &lc, string &userName, string &userPriv, string &userExtended, uint32 &instanceId, uint32 &charSlot) { - userName = userPriv = ""; + userName.clear(); + userPriv.clear(); if (!AcceptInvalidCookie && !lc.isValid()) return "The cookie is invalid"; diff --git a/code/nel/src/net/message_recorder.cpp b/code/nel/src/net/message_recorder.cpp index 2f27be151..7b5412492 100644 --- a/code/nel/src/net/message_recorder.cpp +++ b/code/nel/src/net/message_recorder.cpp @@ -159,7 +159,7 @@ void CMessageRecorder::recordNext( sint64 updatecounter, TNetworkEvent event, TS void CMessageRecorder::stopRecord() { _File.close(); - _Filename = ""; + _Filename.clear(); } @@ -395,7 +395,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add void CMessageRecorder::stopReplay() { _File.close(); - _Filename = ""; + _Filename.clear(); } diff --git a/code/nel/src/net/service.cpp b/code/nel/src/net/service.cpp index 989f94d81..24064db55 100644 --- a/code/nel/src/net/service.cpp +++ b/code/nel/src/net/service.cpp @@ -1453,7 +1453,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName, } if (dispName.empty()) - str = ""; + str.clear(); else str = dispName + ": "; diff --git a/code/nel/src/net/sock.cpp b/code/nel/src/net/sock.cpp index 0e2329733..77c707712 100644 --- a/code/nel/src/net/sock.cpp +++ b/code/nel/src/net/sock.cpp @@ -149,7 +149,7 @@ void CSock::releaseNetwork() } -/* Returns the code of the last error that has occured. +/* Returns the code of the last error that has occurred. * Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code. * See also errorString() */ diff --git a/code/nel/src/net/varpath.cpp b/code/nel/src/net/varpath.cpp index 729f52074..4fc52c341 100644 --- a/code/nel/src/net/varpath.cpp +++ b/code/nel/src/net/varpath.cpp @@ -167,7 +167,7 @@ void CVarPath::decode () if (val == "=") { srv += val + RawVarPath.substr (TokenPos); - var = ""; + var.clear(); } else var = RawVarPath.substr (TokenPos); diff --git a/code/nel/src/pacs/build_indoor.cpp b/code/nel/src/pacs/build_indoor.cpp index b4bad19a6..ca14eb7cf 100644 --- a/code/nel/src/pacs/build_indoor.cpp +++ b/code/nel/src/pacs/build_indoor.cpp @@ -631,7 +631,7 @@ bool computeRetriever(CCollisionMeshBuild &cmb, CLocalRetriever &lr, CVector &tr { nlwarning("Edge issues reported !!"); uint i; - error = ""; + error.clear(); for (i=0; igetSource()); diff --git a/code/nel/src/sound/context_sound.cpp b/code/nel/src/sound/context_sound.cpp index d1403c7c9..fe2512ac0 100644 --- a/code/nel/src/sound/context_sound.cpp +++ b/code/nel/src/sound/context_sound.cpp @@ -160,7 +160,7 @@ void CContextSound::init() uint contextArgIndex[SoundContextNbArgs]; bool useRandom = false; bool parseArg = false; - _BaseName = ""; + _BaseName.clear(); //nldebug("Init the context sound %s", _PatternName.c_str()); @@ -190,7 +190,7 @@ void CContextSound::init() nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/)); fromString(index, contextArgIndex[nbJoker++]); parseArg = false; - index = ""; + index.clear(); } } else if (*first == 'r') diff --git a/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp b/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp index ba212b990..986993c49 100644 --- a/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp @@ -563,15 +563,15 @@ void CSoundDriverDSound::initDevice(const std::string &device, ISoundDriver::TSo switch (hr) { case DSERR_BUFFERLOST: - throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_BUFFERLOST"); + throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_BUFFERLOST"); case DSERR_INVALIDCALL: - throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_INVALIDCALL"); + throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_INVALIDCALL"); case DSERR_INVALIDPARAM: - throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_INVALIDPARAM"); + throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_INVALIDPARAM"); case DSERR_PRIOLEVELNEEDED: - throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_PRIOLEVELNEEDED"); + throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_PRIOLEVELNEEDED"); default: - throw ESoundDriver("Failed to lock the DirectSound primary buffer : unkown error"); + throw ESoundDriver("Failed to lock the DirectSound primary buffer: unknown error"); } } diff --git a/code/nel/src/sound/sound.cpp b/code/nel/src/sound/sound.cpp index a1c9fd595..6c204be10 100644 --- a/code/nel/src/sound/sound.cpp +++ b/code/nel/src/sound/sound.cpp @@ -92,7 +92,7 @@ CSound *CSound::createSound(const std::string &filename, NLGEORGES::UFormElm& fo } else { - nlassertex(false, ("SoundType unsuported : %s", dfnName.c_str())); + nlassertex(false, ("SoundType unsupported: %s", dfnName.c_str())); } } diff --git a/code/nel/tools/3d/build_far_bank/build_far_bank.cpp b/code/nel/tools/3d/build_far_bank/build_far_bank.cpp index dfc3f7f65..e625b4e7f 100644 --- a/code/nel/tools/3d/build_far_bank/build_far_bank.cpp +++ b/code/nel/tools/3d/build_far_bank/build_far_bank.cpp @@ -271,7 +271,7 @@ int main (int argc, char **argv) bool _256=(type==CTileBank::_256x256); // Diffuse bitmap filled ? - if (pTile->getRelativeFileName (CTile::diffuse)!="") + if (!pTile->getRelativeFileName (CTile::diffuse).empty()) { // File exist ? string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::diffuse), false); @@ -302,7 +302,7 @@ int main (int argc, char **argv) } // Additive bitmap filled ? - if (pTile->getRelativeFileName (CTile::additive)!="") + if (!pTile->getRelativeFileName (CTile::additive).empty()) { // File exist ? string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::additive), false); @@ -333,7 +333,7 @@ int main (int argc, char **argv) } // Alpha bitmap filled ? - if (pTile->getRelativeFileName (CTile::alpha)!="") + if (!pTile->getRelativeFileName (CTile::alpha).empty()) { // File exist ? string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::alpha), false); diff --git a/code/nel/tools/3d/cluster_viewer/view_cs.cpp b/code/nel/tools/3d/cluster_viewer/view_cs.cpp index 5e31543ca..9e4dc4f80 100644 --- a/code/nel/tools/3d/cluster_viewer/view_cs.cpp +++ b/code/nel/tools/3d/cluster_viewer/view_cs.cpp @@ -175,7 +175,6 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector &D if (ITemp != NULL) { SDispCS dcsTemp; - dcsTemp.Name = ""; for (sint32 i = 0; i < (1+nNbPlus); ++i) dcsTemp.Name += " "; dcsTemp.Name += nameIG; diff --git a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp index a243ad7bc..10cbb076d 100644 --- a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp +++ b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp @@ -227,7 +227,7 @@ int main(int argc, char* argv[]) CGlobalRetriever *globalRetriever= NULL; uint32 grFileDate= 0; uint32 rbankFileDate= 0; - if( grFile!="" && rbankFile!="" ) + if( !grFile.empty() && !rbankFile.empty()) { CIFile fin; // serial the retrieverBank. Exception if not found. diff --git a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt index 761537791..6427c6b17 100644 --- a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt +++ b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt @@ -19,7 +19,9 @@ SET_TARGET_PROPERTIES(ligoscape_utility PROPERTIES SUFFIX ".dlx") NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility") NL_ADD_RUNTIME_FLAGS(ligoscape_utility) NL_ADD_LIB_SUFFIX(ligoscape_utility) - + +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS ligoscape_utility RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) INSTALL(FILES ligoscript.txt DESTINATION maxplugin/docs) INSTALL(DIRECTORY scripts/ diff --git a/code/nel/tools/3d/ligo/plugin_max/ligoscript.txt b/code/nel/tools/3d/ligo/plugin_max/ligoscript.txt index 072e3b06f..71fcf6174 100644 --- a/code/nel/tools/3d/ligo/plugin_max/ligoscript.txt +++ b/code/nel/tools/3d/ligo/plugin_max/ligoscript.txt @@ -46,7 +46,7 @@ NeLLigoGetErrorZoneTemplate code_array vertex_id_array message_array error_index Get the export errors after a call to NeLLigoExportZoneTemplate. code_array is an integer array with the error code. (2 for OpenedEdge, 4 for InvalidVertexList, 5 for NotInserted) -vertex_id_array is an integer array with the id of the vertex where an error occured. +vertex_id_array is an integer array with the id of the vertex where an error occurred. message_array is a string array with the error message for the vertices error_index is the id of the error buffer (1 ~ 9) diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp index 6eb8d1301..7de43f6b9 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp @@ -124,17 +124,17 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di if (hModule) { // Get the path - char sModulePath[256]; + TCHAR sModulePath[256]; int res=GetModuleFileName(hModule, sModulePath, 256); // Success ? if (res) { // Path - char sDrive[256]; - char sDir[256]; - _splitpath (sModulePath, sDrive, sDir, NULL, NULL); - _makepath (sModulePath, sDrive, sDir, "ligoscape", ".cfg"); + TCHAR sDrive[256]; + TCHAR sDir[256]; + _tsplitpath (sModulePath, sDrive, sDir, NULL, NULL); + _tmakepath (sModulePath, sDrive, sDir, _T("ligoscape"), _T(".cfg")); try { @@ -144,7 +144,7 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di // ok return true; } - catch (Exception& e) + catch (const Exception& e) { // Print an error message char msg[512]; @@ -160,22 +160,22 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di // *************************************************************************** -void CMaxToLigo::errorMessage (const char *msg, const char *title, Interface& it, bool dialog) +void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title, Interface& it, bool dialog) { // Text or dialog ? if (dialog) { // Dialog message - MessageBox (it.GetMAXHWnd(), msg, title, MB_OK|MB_ICONEXCLAMATION); + MessageBox (it.GetMAXHWnd(), utf8ToTStr(msg), utf8ToTStr(title), MB_OK|MB_ICONEXCLAMATION); } else { // Text message - mprintf ((string(msg) + "\n").c_str()); + mprintf (utf8ToTStr(msg + "\n")); } // Output in log - nlwarning ("LIGO ERROR : %s", msg); + nlwarning ("LIGO ERROR : %s", msg.c_str()); } // *************************************************************************** diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.h b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.h index 23bcfd0f2..e8b19073f 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.h +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.h @@ -70,7 +70,7 @@ public: * \param it if a max interface * \param dialog is true to see the message in a dilog, false to see it in the script window. */ - static void errorMessage (const char *msg, const char *title, Interface& it, bool dialog); + static void errorMessage (const std::string &msg, const std::string &title, Interface& it, bool dialog); }; } diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 8a88136c5..d8f8123cd 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -137,7 +137,7 @@ Value* export_material_cf (Value** arg_list, int count) check_arg_count(export_material, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]"; + TCHAR *message = _T("NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Boolean, message); @@ -306,7 +306,7 @@ Value* export_transition_cf (Value** arg_list, int count) check_arg_count(export_transition, 6, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]"; + TCHAR *message = _T("NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]"); type_check(arg_list[0], Array, message); type_check(arg_list[1], String, message); type_check(arg_list[2], String, message); @@ -326,8 +326,8 @@ Value* export_transition_cf (Value** arg_list, int count) // The second arg string matFilename[2]; - matFilename[0] = arg_list[2]->to_string(); - matFilename[1] = arg_list[3]->to_string(); + matFilename[0] = tStrToUtf8(arg_list[2]->to_string()); + matFilename[1] = tStrToUtf8(arg_list[3]->to_string()); // The third arg bool checkOnly = (arg_list[4]->to_bool() != FALSE); @@ -427,7 +427,7 @@ Value* export_transition_cf (Value** arg_list, int count) // Serial materials[mat].serial (inputXml); } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[2048]; @@ -541,7 +541,7 @@ Value* export_transition_cf (Value** arg_list, int count) ok = false; } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -595,7 +595,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count) check_arg_count(get_error_zone_template, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]"; + TCHAR *message = _T("NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]"); type_check(arg_list[0], Array, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -637,7 +637,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count) vertexId->append (Integer::intern (id+1)); // Append messages - messages->append (new String("[LIGO DEBUG] Opened edge")); + messages->append (new String(_T("[LIGO DEBUG] Opened edge"))); } // Return the main error message @@ -687,7 +687,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 3, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]"; + TCHAR *message = _T("NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Boolean, message); @@ -700,7 +700,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = arg_list[1]->to_string(); + string fileName = tStrToUtf8(arg_list[1]->to_string()); // The fourth arg bool errorInDialog = (arg_list[2]->to_bool() != FALSE); @@ -778,7 +778,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count) CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog); } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -820,7 +820,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]"; + TCHAR *message = _T("NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Integer, message); @@ -834,7 +834,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = arg_list[1]->to_string(); + string fileName = tStrToUtf8(arg_list[1]->to_string()); // The second arg int transitionNumber = arg_list[2]->to_int(); @@ -901,7 +901,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count) CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog); } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -987,7 +987,7 @@ Value* export_zone_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 5, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]"; + TCHAR *message = _T("NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Array, message); @@ -1002,7 +1002,7 @@ Value* export_zone_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = arg_list[1]->to_string(); + string fileName = tStrToUtf8(arg_list[1]->to_string()); // The thrid arg Array *array = (Array*)arg_list[2]; @@ -1047,8 +1047,8 @@ Value* export_zone_cf (Value** arg_list, int count) type_check (cell->get(2), String, message); // Get the strings - categories[i].first = cell->get(1)->to_string(); - categories[i].second = cell->get(2)->to_string(); + categories[i].first = tStrToUtf8(cell->get(1)->to_string()); + categories[i].second = tStrToUtf8(cell->get(2)->to_string()); } // Get a Object pointer @@ -1313,7 +1313,7 @@ Value* export_zone_cf (Value** arg_list, int count) CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -1324,7 +1324,7 @@ Value* export_zone_cf (Value** arg_list, int count) } } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -1362,14 +1362,14 @@ Value* get_error_string_cf (Value** arg_list, int count) check_arg_count(get_error_string, 1, count); // Checks arg - char *message = "NeLLigoGetErrorString [error code]"; + TCHAR *message = _T("NeLLigoGetErrorString [error code]"); type_check(arg_list[0], Integer, message); // The first arg int errorCode = arg_list[0]->to_int()-1; // Error code - return new String ((char*)CLigoError::getStringError ((CLigoError::TError)errorCode)); + return new String (utf8ToTStr(CLigoError::getStringError ((CLigoError::TError)errorCode))); } // *************************************************************************** @@ -1380,14 +1380,14 @@ Value* set_directory_cf (Value** arg_list, int count) check_arg_count(set_directory, 1, count); // Checks arg - char *message = "NeLLigoDirectory [path]"; + TCHAR *message = _T("NeLLigoDirectory [path]"); type_check(arg_list[0], String, message); // The first arg - const char *dir = arg_list[0]->to_string(); + const std::string dir = tStrToUtf8(arg_list[0]->to_string()); // Set the directory - return (chdir (dir)==0)?&true_value:&false_value; + return (chdir (dir.c_str())==0)?&true_value:&false_value; } // *************************************************************************** @@ -1398,7 +1398,7 @@ Value* get_zone_mask_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 5, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]"; + TCHAR *message = _T("NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -1558,7 +1558,7 @@ Value* get_zone_size_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 6, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]"; + TCHAR *message = _T("NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -1835,7 +1835,7 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c CMaxToLigo::errorMessage ("Can't initialise opengl offscreen renderer", "NeL Ligo check zone", *MAXScript_interface, errorInDialog); } } - catch (Exception &e) + catch (const Exception &e) { // Error char tmp[512]; @@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) check_arg_count(NeLLigoMakeSnapShot, 7, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"; + TCHAR *message = _T("NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Integer, message); @@ -1876,7 +1876,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = arg_list[1]->to_string(); + string fileName = tStrToUtf8(arg_list[1]->to_string()); // The thrid arg int xMin = arg_list[2]->to_int(); @@ -2042,7 +2042,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -2068,7 +2068,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) } } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; diff --git a/code/nel/tools/3d/object_viewer/animation_dlg.cpp b/code/nel/tools/3d/object_viewer/animation_dlg.cpp index 18952ef21..30b801256 100644 --- a/code/nel/tools/3d/object_viewer/animation_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/animation_dlg.cpp @@ -85,7 +85,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAnimationDlg message handlers -void CAnimationDlg::OnEnd() +void CAnimationDlg::OnEnd() { UpdateData (); CurrentFrame=End; @@ -95,7 +95,7 @@ void CAnimationDlg::OnEnd() updateBar (); } -void CAnimationDlg::OnPlay() +void CAnimationDlg::OnPlay() { // play UpdateData (); @@ -111,7 +111,7 @@ void CAnimationDlg::OnPlay() Main->enableFXs(true); } -void CAnimationDlg::OnStop() +void CAnimationDlg::OnStop() { // Is checked ? UpdateData (); @@ -124,7 +124,7 @@ void CAnimationDlg::OnStop() Main->enableFXs(false); } -void CAnimationDlg::OnChangeCurrentFrame() +void CAnimationDlg::OnChangeCurrentFrame() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() @@ -133,7 +133,7 @@ void CAnimationDlg::OnChangeCurrentFrame() // Update values UpdateData (); - + // Clamp current frame clamp (UICurrentFrame, (int)Start, (int)End); CurrentFrame=(float)UICurrentFrame; @@ -141,21 +141,21 @@ void CAnimationDlg::OnChangeCurrentFrame() // Update updateBar (); - UpdateData (FALSE); + UpdateData (FALSE); } -void CAnimationDlg::OnChangeEndEdit() +void CAnimationDlg::OnChangeEndEdit() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + // TODO: Add your control notification handler code here // Update values UpdateData (); - + // Clamp current frame if (EndsetAnimTime (Start, End); } -void CAnimationDlg::OnChangeSpeed() +void CAnimationDlg::OnChangeSpeed() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + UpdateData(); if (Speed<=0.001f) Speed=0.001f; @@ -187,7 +187,7 @@ void CAnimationDlg::OnChangeSpeed() Main->setAnimTime (Start, End); } -void CAnimationDlg::OnStart() +void CAnimationDlg::OnStart() { UpdateData (); CurrentFrame=Start; @@ -197,16 +197,16 @@ void CAnimationDlg::OnStart() updateBar (); } -void CAnimationDlg::OnChangeStartEdit() +void CAnimationDlg::OnChangeStartEdit() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + // Update values UpdateData (); - + // Clamp current frame if (EndsetAnimTime (Start, End); } -void CAnimationDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CAnimationDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: Add your message handler code here and/or call default @@ -290,7 +290,7 @@ void CAnimationDlg::handle () float backup = CurrentFrame; CurrentFrame=(float)fmod ((CurrentFrame-Start), End-Start)+Start; if (backup!=CurrentFrame) - { + { LastFrame = CurrentFrame; Main->enableFXs(false); Main->enableFXs(true); @@ -306,7 +306,7 @@ void CAnimationDlg::handle () // Stop animation OnStop (); - + } if (CurrentFrameloadAnimation (name, instance); + _ObjView->loadAnimation (tStrToUtf8(name), instance); // Touch the channel mixer _ObjView->reinitChannels (); @@ -156,9 +156,9 @@ void CAnimationSetDlg::OnAddAnimation () refresh (TRUE); } } - catch (Exception& e) + catch (const Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -173,8 +173,8 @@ void CAnimationSetDlg::OnAddSkelWt() if (instance != CB_ERR) { // TODO: Add your control notification handler code here - static char BASED_CODE szFilter[] = "NeL Skeleton Weight Template Files (*.swt)|*.swt|All Files (*.*)|*.*||"; - CFileDialog fileDlg( TRUE, ".swt", "*.swt", OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Skeleton Weight Template Files (*.swt)|*.swt|All Files (*.*)|*.*||"); + CFileDialog fileDlg( TRUE, _T(".swt"), _T("*.swt"), OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { // Open the file @@ -188,7 +188,7 @@ void CAnimationSetDlg::OnAddSkelWt() CString filename=fileDlg.GetNextPathName(pos); // Load the animation - _ObjView->loadSWT (filename, instance); + _ObjView->loadSWT (tStrToUtf8(filename), instance); // Touch the channel mixer _ObjView->reinitChannels (); @@ -197,9 +197,9 @@ void CAnimationSetDlg::OnAddSkelWt() refresh (TRUE); } } - catch (Exception& e) + catch (const Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -233,9 +233,8 @@ void CAnimationSetDlg::refresh (BOOL update) uint i; for (i=0; i<_ObjView->getNumInstance (); i++) { - char name[512]; - _splitpath (_ObjView->getInstance (i)->Saved.ShapeFilename.c_str(), NULL, NULL, name, NULL); - EditedObject.InsertString (-1, name); + std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename); + EditedObject.InsertString (-1, utf8ToTStr(name)); } // Get edited object @@ -270,7 +269,7 @@ void CAnimationSetDlg::refresh (BOOL update) CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name)); // Insert an intem - HTREEITEM item=Tree.InsertItem (name); + HTREEITEM item=Tree.InsertItem(utf8ToTStr(name)); Tree.SetItemData (item, i); nlassert (item!=NULL); @@ -281,7 +280,7 @@ void CAnimationSetDlg::refresh (BOOL update) while (ite!=setString.end()) { // Add this string - HTREEITEM newItem = Tree.InsertItem (ite->c_str(), item); + HTREEITEM newItem = Tree.InsertItem (utf8ToTStr(*ite), item); Tree.SetItemData (newItem, 0xffffffff); // Get the track @@ -296,20 +295,17 @@ void CAnimationSetDlg::refresh (BOOL update) keyTrack->getKeysInRange (track->getBeginTime ()-1, track->getEndTime ()+1, keys); // Print track info - char name[512]; - _snprintf (name, 512, "%s (%f - %f) %d keys", typeid(*track).name(), track->getBeginTime (), track->getEndTime (), keys.size()); - HTREEITEM keyItem = Tree.InsertItem (name, newItem); - Tree.SetItemData (keyItem, 0xffffffff); + name = toString("%s (%f - %f) %u keys", typeid(*track).name(), track->getBeginTime(), track->getEndTime(), (uint32)keys.size()); } else { // Print track info - char name[512]; - _snprintf (name, 512, "%s (%f - %f)", typeid(*track).name(), track->getBeginTime (), track->getEndTime ()); - HTREEITEM keyItem = Tree.InsertItem (name, newItem); - Tree.SetItemData (keyItem, 0xffffffff); + name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime()); } + HTREEITEM keyItem = Tree.InsertItem(utf8ToTStr(name), newItem); + Tree.SetItemData(keyItem, 0xffffffff); + ite++; } } @@ -325,7 +321,7 @@ void CAnimationSetDlg::refresh (BOOL update) CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight (object->AnimationSet.getSkeletonWeightIdByName (name)); // Insert an intem - HTREEITEM item=SkelTree.InsertItem (name); + HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); nlassert (item!=NULL); // Get number of node in this skeleton weight @@ -334,11 +330,10 @@ void CAnimationSetDlg::refresh (BOOL update) // Add the nodein the tree for (uint n=0; ngetNodeName (n).c_str(), swt->getNodeWeight(n)*100); + std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100); // Add this string - SkelTree.InsertItem (percent, item); + SkelTree.InsertItem (utf8ToTStr(percent), item); } } @@ -346,7 +341,7 @@ void CAnimationSetDlg::refresh (BOOL update) for (i=0; iSaved.PlayList.size(); i++) { // Insert an intem - int item=PlayList.InsertString (-1, object->Saved.PlayList[i].c_str()); + int item=PlayList.InsertString (-1, utf8ToTStr(object->Saved.PlayList[i])); nlassert (item!=LB_ERR); } } @@ -372,9 +367,9 @@ void CAnimationSetDlg::refresh (BOOL update) for (i=0; iSaved.PlayList.size(); i++) { // Insert an intem - char text[512]; + TCHAR text[512]; PlayList.GetText( i, text); - object->Saved.PlayList[i] = text; + object->Saved.PlayList[i] = tStrToUtf8(text); } CDialog::UpdateData (update); diff --git a/code/nel/tools/3d/object_viewer/attrib_dlg.cpp b/code/nel/tools/3d/object_viewer/attrib_dlg.cpp index a70216a43..674e7f307 100644 --- a/code/nel/tools/3d/object_viewer/attrib_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/attrib_dlg.cpp @@ -355,7 +355,7 @@ void CAttribDlg::init(HBITMAP bitmap, sint x, sint y, CWnd *pParent) for (uint k = 0; k < getNumScheme(); ++k) { - m_Scheme.InsertString(k, getSchemeName(k).c_str()); + m_Scheme.InsertString(k, utf8ToTStr(getSchemeName(k))); } @@ -683,7 +683,7 @@ END_MESSAGE_MAP() { CString out; - out.Format("%g", Scheme->getValue(index) ); + out.Format(_T("%g"), Scheme->getValue(index) ); dc->TextOut(x + 10, y + 4, out); } CEditAttribDlg *newDialog(const std::string &id, IPSWrapperFloat *wrapper) @@ -896,7 +896,7 @@ END_MESSAGE_MAP() { CString out; - out.Format("%d", Scheme->getValue(index) ); + out.Format(_T("%d"), Scheme->getValue(index) ); dc->TextOut(x + 10, y + 4, out); } CEditAttribDlg *newDialog(const std::string &id, IPSWrapperUInt *wrapper) @@ -1085,7 +1085,7 @@ END_MESSAGE_MAP() { CString out; - out.Format("%d", Scheme->getValue(index) ); + out.Format(_T("%d"), Scheme->getValue(index) ); dc->TextOut(x + 10, y + 4, out); } CEditAttribDlg *newDialog(const std::string &id, IPSWrapper *wrapper) diff --git a/code/nel/tools/3d/object_viewer/bin_op_dlg.h b/code/nel/tools/3d/object_viewer/bin_op_dlg.h index a35e8ee6a..c0080c866 100644 --- a/code/nel/tools/3d/object_viewer/bin_op_dlg.h +++ b/code/nel/tools/3d/object_viewer/bin_op_dlg.h @@ -98,7 +98,7 @@ public: } // init the operator list box - static const char *ops[] = { "selectArg1", "selectArg2", "modulate", "add", "subtract" } ; + static const TCHAR *ops[] = { _T("selectArg1"), _T("selectArg2"), _T("modulate"), _T("add"), _T("subtract") }; for (k = 0 ; k < (uint) NL3D::CPSBinOp::last ; ++k) { // SchemeWrapper[k].S reference the atriobute maker being edited diff --git a/code/nel/tools/3d/object_viewer/bound_checker.h b/code/nel/tools/3d/object_viewer/bound_checker.h index 6f797b556..1c1edec0c 100644 --- a/code/nel/tools/3d/object_viewer/bound_checker.h +++ b/code/nel/tools/3d/object_viewer/bound_checker.h @@ -77,24 +77,24 @@ public: /** validate a value against upper bound. (if an upper bound was set * \return NULL if ok or an error message */ - const char *validateUpperBound(T v) + const TCHAR *validateUpperBound(T v) { if (!_UpperBoundEnabled) return NULL; if (_UpperBoundExcluded && v < _UpperBound) return NULL; if (!_UpperBoundExcluded && v <= _UpperBound) return NULL; - return "value too high"; + return _T("value too high"); } /** validate a value against lower bound. (if an lower bound was set * \return NULL if ok or an error message */ - const char *validateLowerBound(T v) + const TCHAR *validateLowerBound(T v) { if (!_LowerBoundEnabled) return NULL; if (_LowerBoundExcluded && v > _LowerBound) return NULL; if (!_LowerBoundExcluded && v >= _LowerBound) return NULL; - return "value too low"; + return _T("value too low"); } /// copy this bound checker object to another one diff --git a/code/nel/tools/3d/object_viewer/choose_name.cpp b/code/nel/tools/3d/object_viewer/choose_name.cpp index ac15d50da..91dbf8d40 100644 --- a/code/nel/tools/3d/object_viewer/choose_name.cpp +++ b/code/nel/tools/3d/object_viewer/choose_name.cpp @@ -22,18 +22,18 @@ // CChooseName dialog -CChooseName::CChooseName(const char *initialName, CWnd* pParent /*=NULL*/) +CChooseName::CChooseName(const CString &initialName, CWnd* pParent /*=NULL*/) : CDialog(CChooseName::IDD, pParent) { //{{AFX_DATA_INIT(CChooseName) - m_Name = _T(initialName); + m_Name = initialName; //}}AFX_DATA_INIT } std::string CChooseName::getName() { - return std::string(m_Name); + return tStrToUtf8(m_Name); } void CChooseName::DoDataExchange(CDataExchange* pDX) diff --git a/code/nel/tools/3d/object_viewer/choose_name.h b/code/nel/tools/3d/object_viewer/choose_name.h index bcde16b76..a4a66e128 100644 --- a/code/nel/tools/3d/object_viewer/choose_name.h +++ b/code/nel/tools/3d/object_viewer/choose_name.h @@ -32,7 +32,7 @@ class CChooseName : public CDialog { // Construction public: - CChooseName(const char *initialName, CWnd* pParent = NULL); // standard constructor + CChooseName(const CString &initialName, CWnd* pParent = NULL); // standard constructor std::string getName(); diff --git a/code/nel/tools/3d/object_viewer/choose_pool_id.cpp b/code/nel/tools/3d/object_viewer/choose_pool_id.cpp index b15236cf0..3653e72d1 100644 --- a/code/nel/tools/3d/object_viewer/choose_pool_id.cpp +++ b/code/nel/tools/3d/object_viewer/choose_pool_id.cpp @@ -52,25 +52,28 @@ void CChoosePoolID::OnOK() { CString val; GetDlgItem(IDC_POOL_ID)->GetWindowText(val); - if (::sscanf((LPCTSTR) val, "%d", &PoolID) == 1) + + if (NLMISC::fromString(tStrToUtf8(val), PoolID)) { GetDlgItem(IDC_POOL_NAME)->GetWindowText(val); - Name = (LPCTSTR) val; + Name = tStrToUtf8(val); CDialog::OnOK(); } else { - MessageBox("Invalid value", "error", MB_OK); + MessageBox(_T("Invalid value"), _T("error"), MB_OK); } } BOOL CChoosePoolID::OnInitDialog() { CDialog::OnInitDialog(); - char val[128]; - sprintf(val, "%d", PoolID); - GetDlgItem(IDC_POOL_ID)->SetWindowText(val); - GetDlgItem(IDC_POOL_NAME)->SetWindowText(Name.c_str()); + + std::string val = NLMISC::toString(PoolID); + + GetDlgItem(IDC_POOL_ID)->SetWindowText(utf8ToTStr(val)); + GetDlgItem(IDC_POOL_NAME)->SetWindowText(utf8ToTStr(Name)); + if (_FreezeID) { GetDlgItem(IDC_POOL_ID)->EnableWindow(FALSE); diff --git a/code/nel/tools/3d/object_viewer/create_file_dlg.cpp b/code/nel/tools/3d/object_viewer/create_file_dlg.cpp index e42191f0b..64a404f88 100644 --- a/code/nel/tools/3d/object_viewer/create_file_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/create_file_dlg.cpp @@ -72,7 +72,7 @@ BOOL CCreateFileDlg::OnInitDialog() { CDialog::OnInitDialog(); SetWindowText((LPCTSTR) _Title); - GetDlgItem(IDC_LOCATION)->SetWindowText(_DefaultBasePath.c_str()); + GetDlgItem(IDC_LOCATION)->SetWindowText(utf8ToTStr(_DefaultBasePath)); if (!_DefaultBasePath.empty()) { GetDlgItem(IDC_FILENAME)->SetFocus(); @@ -90,10 +90,10 @@ void CCreateFileDlg::OnOK() { CString filename; GetDlgItem(IDC_FILENAME)->GetWindowText(filename); - _Filename = (LPCTSTR) filename; + _Filename = tStrToUtf8(filename); CString location; GetDlgItem(IDC_LOCATION)->GetWindowText(location); - _Path = (LPCTSTR) location; + _Path = tStrToUtf8(location); if (_Path.empty()) { localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION); @@ -139,9 +139,9 @@ void CCreateFileDlg::OnOK() void CCreateFileDlg::OnCancel() { - _Filename = ""; - _Path = ""; - _FullPath = ""; + _Filename.clear(); + _Path.clear(); + _FullPath.clear(); CDialog::OnCancel(); } diff --git a/code/nel/tools/3d/object_viewer/direction_attr.cpp b/code/nel/tools/3d/object_viewer/direction_attr.cpp index 666fd60e0..047457390 100644 --- a/code/nel/tools/3d/object_viewer/direction_attr.cpp +++ b/code/nel/tools/3d/object_viewer/direction_attr.cpp @@ -173,7 +173,7 @@ void CDirectionAttr::OnDestroy() void CDirectionAttr::OnGlobalDirection() { nlassert(_DirectionWrapper); - CChooseName chooseName(_DirectionWrapper->getGlobalVectorValueName().c_str()); + CChooseName chooseName(utf8ToTStr(_DirectionWrapper->getGlobalVectorValueName())); if (chooseName.DoModal() == IDOK) { diff --git a/code/nel/tools/3d/object_viewer/dup_ps.cpp b/code/nel/tools/3d/object_viewer/dup_ps.cpp index 6d21a7496..11896b8dd 100644 --- a/code/nel/tools/3d/object_viewer/dup_ps.cpp +++ b/code/nel/tools/3d/object_viewer/dup_ps.cpp @@ -118,7 +118,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in) return newPS->detach(index); } } - catch (NLMISC::EStream &e) + catch (const NLMISC::EStream &e) { nlwarning (e.what()); return NULL; @@ -154,7 +154,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in) return loc->unbind(subIndex); } } - catch (NLMISC::EStream &e) + catch (const NLMISC::EStream &e) { nlwarning (e.what()); return NULL; diff --git a/code/nel/tools/3d/object_viewer/edit_ex.cpp b/code/nel/tools/3d/object_viewer/edit_ex.cpp index 71d5b8907..a48b4642f 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ex.cpp @@ -74,36 +74,36 @@ float CEditEx::getFloat() const std::string CEditEx::getString() const { - char buf[128]; + TCHAR buf[128]; GetWindowText(buf, sizeof(buf)); - return std::string(buf); + return tStrToUtf8(buf); } void CEditEx::setSInt(sint value) { nlassert(_Type == SIntType); - char buf[16]; - sprintf(buf, "%d", (int) value); + TCHAR buf[16]; + _tcprintf(buf, "%d", (int) value); setString(buf); } void CEditEx::setUInt(uint value) { nlassert(_Type == UIntType); - char buf[16]; - sprintf(buf, "%d", (int) value); + TCHAR buf[16]; + _tcprintf(buf, "%d", (int) value); setString(buf); } void CEditEx::setFloat(float value) { nlassert(_Type == FloatType); - char buf[16]; - sprintf(buf, "%g", (double) value); + TCHAR buf[16]; + _tcprintf(buf, "%g", (double) value); setString(buf); } -void CEditEx::setString(const char *value) +void CEditEx::setString(const TCHAR *value) { SetWindowText(value); } @@ -121,7 +121,7 @@ void CEditEx::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) } else { - MessageBox("Invalid value", "Error", MB_OK | MB_ICONEXCLAMATION); + MessageBox(_T("Invalid value"), _T("Error"), MB_OK | MB_ICONEXCLAMATION); } } CEdit::OnKeyDown(nChar, nRepCnt, nFlags); @@ -130,21 +130,25 @@ void CEditEx::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) bool CEditEx::isValid() { - int iValue; - float fValue; switch(_Type) { case SIntType: - return sscanf(getString().c_str(), "%d", &iValue) == 1; - break; + { + sint value; + return NLMISC::fromString(getString(), value); + } case UIntType: - return sscanf(getString().c_str(), "%d", &iValue) == 1 && iValue >= 0; - break; + { + uint value; + return NLMISC::fromString(getString(), value); + } case FloatType: - return sscanf(getString().c_str(), "%f", &fValue) == 1; - break; - default: - return true; - break; + { + float value; + return NLMISC::fromString(getString(), value); + } + default: break; } + + return true; } diff --git a/code/nel/tools/3d/object_viewer/edit_ex.h b/code/nel/tools/3d/object_viewer/edit_ex.h index 759b51f51..957960fcc 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.h +++ b/code/nel/tools/3d/object_viewer/edit_ex.h @@ -57,7 +57,7 @@ public: void setSInt(sint value); void setUInt(uint value); void setFloat(float value); - void setString(const char *value); + void setString(const TCHAR *value); // Overrides diff --git a/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp index 091e6413c..afcc75e34 100644 --- a/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp @@ -81,7 +81,7 @@ void CEditMorphMeshDlg::init(CWnd *pParent) //==================================================================== bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name) { - CFileDialog fd(TRUE, ".shape", "*.shape", 0, NULL, this); + CFileDialog fd(TRUE, _T(".shape"), _T("*.shape"), 0, NULL, this); if (fd.DoModal() == IDOK) { // Add to the path @@ -101,7 +101,7 @@ bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name) NLMISC::CPath::addSearchPath (path); */ - name = fd.GetPathName(); + name = tStrToUtf8(fd.GetPathName()); return true; } @@ -135,7 +135,7 @@ void CEditMorphMeshDlg::OnAdd() _CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); std::vector numVerts; _CM->getShapeNumVerts(numVerts); - m_MeshList.AddString(getShapeDescStr(index, numVerts[index]).c_str()); + m_MeshList.AddString(utf8ToTStr(getShapeDescStr(index, numVerts[index]))); GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); } touchPSState(); @@ -265,7 +265,7 @@ void CEditMorphMeshDlg::updateMeshList() m_MeshList.ResetContent(); for (uint k = 0; k < _CM->getNumShapes(); ++k) { - m_MeshList.AddString(getShapeDescStr(k, numVerts[k]).c_str()); + m_MeshList.AddString(utf8ToTStr(getShapeDescStr(k, numVerts[k]))); } m_MeshList.SetCurSel(0); updateValidFlag(); @@ -322,12 +322,12 @@ std::string CEditMorphMeshDlg::getShapeDescStr(uint shapeIndex, sint numVerts) c { CString verts; verts.LoadString(IDS_VERTICES); - std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + (LPCTSTR) verts + ")"; + std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + tStrToUtf8(verts) + ")"; return msg; } else { - std::string result = _CM->getShape(shapeIndex) + " (" + (LPCTSTR) CMeshDlg::getShapeErrorString(numVerts) + ")"; + std::string result = _CM->getShape(shapeIndex) + " (" + tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")"; return result; } } diff --git a/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp b/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp index 891818a43..40406c2fa 100644 --- a/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp @@ -195,7 +195,7 @@ void CEditPSSound::OnChangeSoundName() { nlassert(_Sound); UpdateData(); - _Sound->setSoundName(NLMISC::CSheetId((LPCTSTR)m_SoundName, "sound")); + _Sound->setSoundName(NLMISC::CSheetId(tStrToUtf8(m_SoundName), "sound")); updateModifiedFlag(); } @@ -209,7 +209,7 @@ void CEditPSSound::OnSpawn() // play the currently selected sound void CEditPSSound::OnPlaySound() { - CSoundSystem::play(std::string((LPCTSTR)m_SoundName)); + CSoundSystem::play(tStrToUtf8(m_SoundName)); } void CEditPSSound::OnMute() diff --git a/code/nel/tools/3d/object_viewer/editable_range.cpp b/code/nel/tools/3d/object_viewer/editable_range.cpp index b86b35a72..525d15ab7 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.cpp +++ b/code/nel/tools/3d/object_viewer/editable_range.cpp @@ -185,12 +185,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } diff --git a/code/nel/tools/3d/object_viewer/editable_range.h b/code/nel/tools/3d/object_viewer/editable_range.h index 485f57659..05e52857b 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.h +++ b/code/nel/tools/3d/object_viewer/editable_range.h @@ -133,7 +133,7 @@ public: // SPECIALIZE THAT. write value into the given CString static void value2CString(T value, CString &dest); // SPECIALIZE THAT. convert a CString into a value, return NULL if ok, or a pointer to an error message - static const char *string2value(const CString &value, T &result); + static const TCHAR *string2value(const CString &value, T &result); @@ -162,14 +162,13 @@ protected: void updateValueFromText(void) { T value; - const char *message = string2value(m_Value, value); + const TCHAR *message = string2value(m_Value, value); if (!message) { - const char *mess = validateUpperBound(value) - ,*mess2 = validateLowerBound(value); + const TCHAR *mess = validateUpperBound(value), *mess2 = validateLowerBound(value); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return; } @@ -179,7 +178,7 @@ protected: return; } - MessageBox(message, "error"); + MessageBox(message, _T("error")); } void selectRange(void) @@ -249,24 +248,23 @@ protected: { T upT, loT; - const char *message = string2value(lo, loT); + const TCHAR *message = string2value(lo, loT); if (message) { - ::MessageBox(NULL, message, "Range selection error", MB_OK); + ::MessageBox(NULL, message, _T("Range selection error"), MB_OK); return false; } - const char *mess = validateUpperBound(loT) - ,*mess2 = validateLowerBound(loT); + const TCHAR *mess = validateUpperBound(loT), *mess2 = validateLowerBound(loT); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return false; } message = string2value(up, upT); if (message) { - ::MessageBox(NULL, message, "Range selection error", MB_OK); + ::MessageBox(NULL, message, _T("Range selection error"), MB_OK); return false; } @@ -274,14 +272,14 @@ protected: mess2 = validateLowerBound(upT); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return false; } if (upT <= loT) { - ::MessageBox(NULL, "upper bound must be strictly greater than lower bound", "Range selection error", MB_OK); + ::MessageBox(NULL, _T("upper bound must be strictly greater than lower bound"), _T("Range selection error"), MB_OK); return false; } @@ -314,10 +312,10 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspac inline void CEditableRangeT::value2CString(float value, CString &dest) { - dest.Format("%g", (double) value); + dest.Format(_T("%g"), (double) value); } -inline const char *CEditableRangeT::string2value(const CString &value, float &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, float &result) { if (sscanf((LPCTSTR) value, "%f", &result) == 1) { @@ -325,7 +323,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, fl } else { - return "invalid value"; + return _T("invalid value"); } } @@ -340,17 +338,17 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspa inline void CEditableRangeT::value2CString(uint32 value, CString &dest) { - dest.Format("%d", value); + dest.Format(_T("%d"), value); } -inline const char *CEditableRangeT::string2value(const CString &value, uint32 &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, uint32 &result) { uint32 tmp; if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) { if (strchr((LPCTSTR) value, '-')) { - return "negative values not allowed"; + return _T("negative values not allowed"); } else { @@ -360,7 +358,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, u } else { - return "invalid value"; + return _T("invalid value"); } } @@ -376,10 +374,10 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspa inline void CEditableRangeT::value2CString(sint32 value, CString &dest) { - dest.Format("%d", value); + dest.Format(_T("%d"), value); } -inline const char *CEditableRangeT::string2value(const CString &value, sint32 &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, sint32 &result) { uint32 tmp; if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) @@ -389,7 +387,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, s } else { - return "invalid value"; + return _T("invalid value"); } } diff --git a/code/nel/tools/3d/object_viewer/emitter_dlg.cpp b/code/nel/tools/3d/object_viewer/emitter_dlg.cpp index 175756c6d..e4864cfe6 100644 --- a/code/nel/tools/3d/object_viewer/emitter_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/emitter_dlg.cpp @@ -85,7 +85,7 @@ void CEmitterDlg::initEmittedType() NL3D::CPSLocated *loc = dynamic_cast(ps->getProcess(k)); if (loc) // is this a located { - m_EmittedTypeCtrl.AddString(loc->getName().c_str()); + m_EmittedTypeCtrl.AddString(utf8ToTStr(loc->getName())); _LocatedList.push_back(loc); if (loc == _Emitter->getEmittedType()) { @@ -129,11 +129,11 @@ void CEmitterDlg::OnSelchangeEmittedType() { if (_Emitter->getOwner()->getOwner()->getBehaviourType() == NL3D::CParticleSystem::SpellFX || _Emitter->getOwner()->getOwner()->getBypassMaxNumIntegrationSteps()) { - MessageBox("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', and thus, should have a finite duration. This operation create a loop in the system, and so is forbidden.", "Error", MB_ICONEXCLAMATION); + MessageBox(_T("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', and thus, should have a finite duration. This operation create a loop in the system, and so is forbidden."), _T("Error"), MB_ICONEXCLAMATION); } else { - MessageBox("Loops with emitters are forbidden.", "Error", MB_ICONEXCLAMATION); + MessageBox(_T("Loops with emitters are forbidden."), _T("Error"), MB_ICONEXCLAMATION); } initEmittedType(); } @@ -267,7 +267,7 @@ BOOL CEmitterDlg::OnInitDialog() CStatic *s = new CStatic; pushWnd(s); - s->Create("Radius :", SS_LEFT, CRect(posX, posY + 10 , posX + 70, posY + 32), this); + s->Create(_T("Radius :"), SS_LEFT, CRect(posX, posY + 10 , posX + 70, posY + 32), this); s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); diff --git a/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp b/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp index 505f6c7b8..95f54acb7 100644 --- a/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp @@ -61,11 +61,11 @@ END_MESSAGE_MAP() void CGlobalWindDlg::updateView() { float a; - char str[256]; + TCHAR str[256]; // update Power. a= _ObjViewer->getGlobalWindPower(); - sprintf(str, "%.2f", a); + _tcprintf(str, "%.2f", a); StaticPower.SetWindowText(str); NLMISC::clamp(a, 0.f, 1.f); SliderPower.SetPos((sint)(a*NL_GLOBAL_WIND_SLIDER_RANGE)); @@ -113,11 +113,11 @@ void CGlobalWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) if( sliderCtrl==&SliderPower && nSBCode==SB_THUMBPOSITION || nSBCode==SB_THUMBTRACK) { float a; - char str[256]; + TCHAR str[256]; a= (float)nPos / NL_GLOBAL_WIND_SLIDER_RANGE; _ObjViewer->setGlobalWindPower(a); - sprintf(str, "%.2f", a); + _tcprintf(str, "%.2f", a); StaticPower.SetWindowText(str); } else diff --git a/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp b/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp index edf9f2547..9ea2d51a9 100644 --- a/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp @@ -55,32 +55,32 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CLBExternIDDlg message handlers -BOOL CLBExternIDDlg::OnInitDialog() +BOOL CLBExternIDDlg::OnInitDialog() { CDialog::OnInitDialog(); - + GetDlgItem(IDC_ID_VALUE)->EnableWindow(_ID != 0); ((CButton *) GetDlgItem(IDC_ENABLE_EXTERN_ID))->SetCheck(_ID != 0 ? 1 : 0); if (_ID) { - char val[5]; + TCHAR val[5]; for (uint k = 0; k < 4; ++k) { #ifdef NL_LITTLE_ENDIAN val[k] = (unsigned char) (_ID >> ((3 - k) << 3)); #else - val[k] = (unsigned char) (_ID >> (k << 3)); + val[k] = (unsigned char) (_ID >> (k << 3)); #endif } - val[4] = '\0'; + val[4] = '\0'; GetDlgItem(IDC_ID_VALUE)->SetWindowText(val); } else { _ID = 0; - } + } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -90,41 +90,41 @@ static uint32 StringToID(const char *buf) { uint32 id; #ifdef NL_LITTLE_ENDIAN - id = ((uint32) buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3]); + id = ((uint32) buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3]); #else - id = *(uint32 *) buf; + id = *(uint32 *) buf; #endif return id; } -void CLBExternIDDlg::OnEnableExternId() +void CLBExternIDDlg::OnEnableExternId() { if (_ID == 0) { GetDlgItem(IDC_ID_VALUE)->EnableWindow(TRUE); - _ID = StringToID("NONE"); - GetDlgItem(IDC_ID_VALUE)->SetWindowText("NONE"); + _ID = StringToID("NONE"); + GetDlgItem(IDC_ID_VALUE)->SetWindowText(_T("NONE")); } else { GetDlgItem(IDC_ID_VALUE)->EnableWindow(FALSE); - GetDlgItem(IDC_ID_VALUE)->SetWindowText(""); + GetDlgItem(IDC_ID_VALUE)->SetWindowText(_T("")); _ID = 0; - } + } } -void CLBExternIDDlg::OnChangeIdValue() -{ +void CLBExternIDDlg::OnChangeIdValue() +{ if (!((CButton *) GetDlgItem(IDC_ENABLE_EXTERN_ID))->GetCheck()) return; - char buf[6]; + TCHAR buf[6]; ::memset(buf, 0, 6); GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6); - _ID = StringToID(buf); + _ID = StringToID(tStrToUtf8(buf).c_str()); if (_ID) { GetDlgItem(IDOK)->EnableWindow(TRUE); - GetDlgItem(IDC_ENABLE_EXTERN_ID)->EnableWindow(TRUE); - if (::strlen(buf) > 4) + GetDlgItem(IDC_ENABLE_EXTERN_ID)->EnableWindow(TRUE); + if (::_tcslen(buf) > 4) { buf[4] = '\0'; GetDlgItem(IDC_ID_VALUE)->SetWindowText(buf); @@ -133,7 +133,7 @@ void CLBExternIDDlg::OnChangeIdValue() else { GetDlgItem(IDOK)->EnableWindow(FALSE); - GetDlgItem(IDC_ENABLE_EXTERN_ID)->EnableWindow(FALSE); + GetDlgItem(IDC_ENABLE_EXTERN_ID)->EnableWindow(FALSE); } } diff --git a/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp b/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp index 6472eb7c5..73337e3a5 100644 --- a/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp +++ b/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp @@ -42,7 +42,7 @@ #include "ribbon_dlg.h" -using NL3D::CPSLocatedBindable; +using NL3D::CPSLocatedBindable; ///////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ CLocatedBindableDialog::CLocatedBindableDialog(CParticleWorkspace::CNode *ownerN { //{{AFX_DATA_INIT(CLocatedBindableDialog) m_IndependantSizes = FALSE; - //}}AFX_DATA_INIT + //}}AFX_DATA_INIT } /// dtor @@ -78,7 +78,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) NL3D::CParticleSystem *ps = _Bindable->getOwner()->getOwner(); if (ps->isSharingEnabled()) - { + { GetDlgItem(IDC_NO_AUTO_LOD)->ShowWindow(TRUE); if (ps->isAutoLODEnabled() == false) { @@ -111,10 +111,10 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) NL3D::CPSMaterial *material = dynamic_cast(_Bindable); // blending mode m_BlendingMode.SetCurSel((uint) material->getBlendingMode() ); - // z-test + // z-test ((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED); // z-bias - GetDlgItem(IDC_ZBIAS)->SetWindowText(NLMISC::toString("%.2f", -material->getZBias()).c_str()); + GetDlgItem(IDC_ZBIAS)->SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", -material->getZBias()))); } else { @@ -126,7 +126,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) } GetDlgItem(IDC_ALIGN_ON_MOTION)->ShowWindow(SW_HIDE); GetDlgItem(IDC_ZALIGN)->ShowWindow(SW_HIDE); - // enable disable z-test + // enable disable z-test // if (dynamic_cast(_Bindable)) { @@ -147,12 +147,12 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) // check support for color if (dynamic_cast(_Bindable)) { - + CAttribDlgRGBA *ad = new CAttribDlgRGBA("PARTICLE_COLOR", _Node); pushWnd(ad); - _ColorWrapper.S = dynamic_cast(_Bindable); - ad->setWrapper(&_ColorWrapper); + _ColorWrapper.S = dynamic_cast(_Bindable); + ad->setWrapper(&_ColorWrapper); ad->setSchemeWrapper(&_ColorWrapper); HBITMAP bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_COLOR)); @@ -169,13 +169,13 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) // check support for angle 2D if (dynamic_cast(_Bindable)) { - + CAttribDlgFloat *ad = new CAttribDlgFloat("PARTICLE_ANGLE2D", _Node, 0.f, 256.f); pushWnd(ad); _Angle2DWrapper.S = dynamic_cast(_Bindable); - ad->setWrapper(&_Angle2DWrapper); - ad->setSchemeWrapper(&_Angle2DWrapper); + ad->setWrapper(&_Angle2DWrapper); + ad->setSchemeWrapper(&_Angle2DWrapper); HBITMAP bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_ANGLE)); ad->init(bmh, xPos, yPos, this); @@ -183,7 +183,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) yPos += rect.bottom + 3; } - + CAttribDlgPlaneBasis *pb = NULL; @@ -199,7 +199,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) pb->init(bmh, xPos, yPos, this); pb->GetClientRect(&rect); yPos += rect.bottom + 3; - + } // check support for precomputed rotations @@ -225,8 +225,8 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) CStatic *s = new CStatic; pushWnd(s); _MotionBlurWnd.push_back(s); - s->Create("Fake motion blur coeff.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->Create(_T("Fake motion blur coeff."), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); mbc->GetClientRect(&rect); yPos += rect.bottom + 3; @@ -236,14 +236,14 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) _MotionBlurThresholdWrapper.P = fla; mbc->setWrapper(&_MotionBlurThresholdWrapper); mbc->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); _MotionBlurWnd.push_back(s); - s->Create("Fake motion blur threshold.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Fake motion blur threshold."), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); mbc->GetClientRect(&rect); - yPos += rect.bottom + 3; + yPos += rect.bottom + 3; GetDlgItem(IDC_ALIGN_ON_MOTION)->ShowWindow(SW_SHOW); GetDlgItem(IDC_ZALIGN)->ShowWindow(SW_SHOW); ((CButton *) GetDlgItem(IDC_ALIGN_ON_MOTION))->SetCheck(fla->getAlignOnMotion()); @@ -256,14 +256,14 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) { NL3D::CPSShockWave *sw = static_cast(_Bindable); CEditableRangeFloat *rc = new CEditableRangeFloat(std::string("RADIUS CUT"), _Node, 0, 1); - pushWnd(rc); + pushWnd(rc); _RadiusCutWrapper.S = sw; rc->setWrapper(&_RadiusCutWrapper); rc->init(xPos + 140, yPos, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Radius cut.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->Create(_T("Radius cut."), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); @@ -277,9 +277,9 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) snbs->setWrapper(&_ShockWaveNbSegWrapper); snbs->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Nb segs", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Nb segs"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->ShowWindow(SW_SHOW); snbs->GetClientRect(&rect); @@ -291,13 +291,13 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) _ShockWaveUFactorWrapper.S = sw; uvd->setWrapper(&_ShockWaveUFactorWrapper); uvd->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Texture U factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Texture U factor :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->ShowWindow(SW_SHOW); uvd->GetClientRect(&rect); - yPos += rect.bottom + 3; - + yPos += rect.bottom + 3; + } // fanlight @@ -312,8 +312,8 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) nbf->init(xPos + 140, yPos, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Nb fan lights :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->Create(_T("Nb fan lights :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); nbf->GetClientRect(&rect); @@ -325,35 +325,35 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) _FanLightSmoothnessWrapper.P = static_cast(_Bindable); nbf->setWrapper(&_FanLightSmoothnessWrapper); nbf->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Phase smoothnes:", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Phase smoothnes:"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->ShowWindow(SW_SHOW); nbf->GetClientRect(&rect); yPos += rect.bottom + 3; CEditableRangeFloat *nbfp = new CEditableRangeFloat(std::string("FAN_LIGHT_PHASE"), _Node, 0, 4.f); - pushWnd(nbfp); + pushWnd(nbfp); _FanLightPhaseWrapper.P = static_cast(_Bindable); nbfp->setWrapper(&_FanLightPhaseWrapper); nbfp->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Fan light speed :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Fan light speed :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->ShowWindow(SW_SHOW); nbf->GetClientRect(&rect); yPos += rect.bottom + 3; nbfp = new CEditableRangeFloat(std::string("FAN_LIGHT_INTENSITY"), _Node, 0, 4.f); - pushWnd(nbfp); + pushWnd(nbfp); _FanLightIntensityWrapper.P = static_cast(_Bindable); nbfp->setWrapper(&_FanLightIntensityWrapper); nbfp->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Fan light intensity:", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Fan light intensity:"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->ShowWindow(SW_SHOW); nbf->GetClientRect(&rect); @@ -383,24 +383,24 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) { nbs->enableUpperBound(256, true); } - - + + _TailParticleWrapper.P = dynamic_cast(_Bindable); nbs->setWrapper(&_TailParticleWrapper); nbs->init(xPos + 140, yPos, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Nb segs :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); - s->ShowWindow(SW_SHOW); - + s->Create(_T("Nb segs :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->ShowWindow(SW_SHOW); + nbs->GetClientRect(&rect); yPos += rect.bottom + 3; CTailParticleDlg *tpd = new CTailParticleDlg(_Node, dynamic_cast(_Bindable)); pushWnd(tpd); tpd->init(this, xPos, yPos); - + tpd->GetClientRect(&rect); yPos += rect.bottom + 3; } @@ -429,7 +429,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) cmtd->GetClientRect(&rect); yPos += rect.bottom + 3; pushWnd(cmd); - pushWnd(cmtd); + pushWnd(cmtd); } @@ -440,9 +440,9 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) CTextureAnimDlg *td = new CTextureAnimDlg(_Node, dynamic_cast(_Bindable), dynamic_cast(_Bindable) - ); + ); pushWnd(td); - + td->init(xPos, yPos, this); td->GetClientRect(&rect); yPos += rect.bottom + 3; @@ -453,7 +453,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) { NL3D::CPSTexturedParticleNoAnim *tp = dynamic_cast(_Bindable); _TextureNoAnimWrapper.TP = tp; - CTextureChooser *tc = new CTextureChooser(dynamic_cast(_Bindable), _Node); + CTextureChooser *tc = new CTextureChooser(dynamic_cast(_Bindable), _Node); tc->enableRemoveButton(); tc->setWrapper(&_TextureNoAnimWrapper); pushWnd(tc); @@ -465,8 +465,8 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) // ribbon texture (doesn't support texture animation for now) if (dynamic_cast(_Bindable)) - { - + { + // add dialog for uv tuning with ribbon CEditableRangeFloat *uvd = new CEditableRangeFloat(std::string("RIBBON UFACTOR"), _Node, 0, 5); pushWnd(uvd); @@ -475,8 +475,8 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) uvd->init(xPos + 140, yPos, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Texture U factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->Create(_T("Texture U factor :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); uvd->GetClientRect(&rect); yPos += rect.bottom + 3; @@ -486,19 +486,19 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) _RibbonVFactorWrapper.R = static_cast(_Bindable); uvd->setWrapper(&_RibbonVFactorWrapper); uvd->init(xPos + 140, yPos, this); - s = new CStatic; + s = new CStatic; pushWnd(s); - s->Create("Texture V factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->Create(_T("Texture V factor :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); uvd->GetClientRect(&rect); yPos += rect.bottom + 3; - } + } if (dynamic_cast(_Bindable)) - { - + { + // add dialog for uv tuning with ribbon CEditableRangeFloat *sd = new CEditableRangeFloat(std::string("SEGMENT DURATION"), _Node, 0.05f, 0.5f); sd->enableLowerBound(0, true); @@ -508,19 +508,19 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) sd->init(xPos + 140, yPos, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Seg Duration :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); - s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); + s->Create(_T("Seg Duration :"), SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this); + s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); sd->GetClientRect(&rect); yPos += rect.bottom + 3; } - + // 'look at' independant sizes - bool isLookAt = dynamic_cast(_Bindable) != NULL; + bool isLookAt = dynamic_cast(_Bindable) != NULL; GetDlgItem(IDC_INDE_SIZES)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE); GetDlgItem(IDC_SIZE_WIDTH)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE); GetDlgItem(IDC_SIZE_HEIGHT)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE); - GetDlgItem(IDC_WIDTH_HEIGHT_BOX)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE); + GetDlgItem(IDC_WIDTH_HEIGHT_BOX)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE); ((CButton *) GetDlgItem(IDC_SIZE_WIDTH))->SetCheck(1); if (isLookAt) { @@ -539,8 +539,8 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) pushWnd(rd); rd->GetClientRect(&rect); yPos += rect.bottom + 3; - } - } + } + } UpdateData(); } @@ -580,7 +580,7 @@ END_MESSAGE_MAP() void CLocatedBindableDialog::touchPSState() { if (_Node && _Node->getPSModel()) - { + { _Node->getPSModel()->touchTransparencyState(); _Node->getPSModel()->touchLightableState(); } @@ -588,19 +588,19 @@ void CLocatedBindableDialog::touchPSState() //*********************************************************************************** -void CLocatedBindableDialog::OnSelchangeBlendingMode() +void CLocatedBindableDialog::OnSelchangeBlendingMode() { UpdateData(); NL3D::CPSMaterial *m = dynamic_cast(_Bindable); nlassert(m); - m->setBlendingMode( (NL3D::CPSMaterial::TBlendingMode) m_BlendingMode.GetCurSel()); - touchPSState(); + m->setBlendingMode( (NL3D::CPSMaterial::TBlendingMode) m_BlendingMode.GetCurSel()); + touchPSState(); updateModifiedFlag(); } //*********************************************************************************** -void CLocatedBindableDialog::updateIndependantSizes() +void CLocatedBindableDialog::updateIndependantSizes() { UpdateData(); // make sure we are dealing with 'LookAt' for now @@ -613,7 +613,7 @@ void CLocatedBindableDialog::updateIndependantSizes() //*********************************************************************************** // user asked for independant sizes -void CLocatedBindableDialog::OnIndeSizes() +void CLocatedBindableDialog::OnIndeSizes() { UpdateData(); // make sure we are dealing with 'LookAt' for now @@ -621,13 +621,13 @@ void CLocatedBindableDialog::OnIndeSizes() NL3D::CPSFaceLookAt *la = static_cast(_Bindable); la->setIndependantSizes(m_IndependantSizes ? true : false /* VCC warning*/); updateIndependantSizes(); - updateSizeControl(); + updateSizeControl(); updateModifiedFlag(); } //*********************************************************************************** uint CLocatedBindableDialog::updateSizeControl() -{ +{ HBITMAP bmh; if (!dynamic_cast(_Bindable)) return 0; // if a previous control was there, remove it @@ -645,7 +645,7 @@ uint CLocatedBindableDialog::updateSizeControl() int editWidth = (((CButton *) GetDlgItem(IDC_SIZE_WIDTH))->GetCheck()); _SizeCtrl = new CAttribDlgFloat(editWidth ? "PARTICLE_WIDTH" : "PARTICLE_HEIGHT", _Node, 0.f, 1.f); - + if (editWidth) // wrap to the wanted size { _SizeWrapper.S = fla; @@ -656,8 +656,8 @@ uint CLocatedBindableDialog::updateSizeControl() } _SizeCtrl->setWrapper(&_SizeWrapper); _SizeCtrl->setSchemeWrapper(&_SizeWrapper); - - bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(editWidth ? IDB_PARTICLE_WIDTH : IDB_PARTICLE_HEIGHT)); + + bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(editWidth ? IDB_PARTICLE_WIDTH : IDB_PARTICLE_HEIGHT)); } else // general case. Wrap to the size interface and the appropriate dialog { @@ -666,29 +666,29 @@ uint CLocatedBindableDialog::updateSizeControl() _SizeWrapper.S = dynamic_cast(_Bindable); _SizeCtrl->setWrapper(&_SizeWrapper); _SizeCtrl->setSchemeWrapper(&_SizeWrapper); - - bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_SIZE)); + + bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_SIZE)); } RECT rect; _SizeCtrl->init(bmh, _SizeCtrlX, _SizeCtrlY, this); _SizeCtrl->GetClientRect(&rect); - return rect.bottom + 3; + return rect.bottom + 3; } //*********************************************************************************** -void CLocatedBindableDialog::OnSizeWidth() +void CLocatedBindableDialog::OnSizeWidth() { - updateSizeControl(); + updateSizeControl(); } //*********************************************************************************** -void CLocatedBindableDialog::OnSizeHeight() +void CLocatedBindableDialog::OnSizeHeight() { - updateSizeControl(); + updateSizeControl(); } //*********************************************************************************** -void CLocatedBindableDialog::OnNoAutoLod() +void CLocatedBindableDialog::OnNoAutoLod() { NL3D::CPSParticle *p = NLMISC::safe_cast(_Bindable); p->disableAutoLOD(((CButton *) GetDlgItem(IDC_NO_AUTO_LOD))->GetCheck() != 0); @@ -696,8 +696,8 @@ void CLocatedBindableDialog::OnNoAutoLod() } //*********************************************************************************** -void CLocatedBindableDialog::OnGlobalColorLighting() -{ +void CLocatedBindableDialog::OnGlobalColorLighting() +{ NL3D::CPSParticle *p = NLMISC::safe_cast(_Bindable); p->enableGlobalColorLighting(((CButton *) GetDlgItem(ID_GLOBAL_COLOR_LIGHTING))->GetCheck() == 1); touchPSState(); @@ -705,12 +705,12 @@ void CLocatedBindableDialog::OnGlobalColorLighting() } //*********************************************************************************** -void CLocatedBindableDialog::OnAlignOnMotion() +void CLocatedBindableDialog::OnAlignOnMotion() { bool align = ((CButton *) GetDlgItem(IDC_ALIGN_ON_MOTION))->GetCheck() != 0; NL3D::CPSFaceLookAt *fla = NLMISC::safe_cast(_Bindable); fla->setAlignOnMotion(align); - updateValidWndForAlignOnMotion(align); + updateValidWndForAlignOnMotion(align); updateModifiedFlag(); } @@ -723,10 +723,10 @@ void CLocatedBindableDialog::updateValidWndForAlignOnMotion(bool align) CEditAttribDlg *ead = dynamic_cast(_MotionBlurWnd[k]); if (ead) { - ead->EnableWindow(enable); // enable window not virtual in CWnd ... + ead->EnableWindow(enable); // enable window not virtual in CWnd ... } else - { + { _MotionBlurWnd[k]->EnableWindow(enable); } } @@ -734,7 +734,7 @@ void CLocatedBindableDialog::updateValidWndForAlignOnMotion(bool align) } //*********************************************************************************** -void CLocatedBindableDialog::OnZtest() +void CLocatedBindableDialog::OnZtest() { UpdateData(); NL3D::CPSMaterial *mat = dynamic_cast(_Bindable); @@ -749,12 +749,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } //*************************************************************************************************************************** @@ -762,7 +762,7 @@ void CLocatedBindableDialog::updateZBias() { CString value; m_ZBias.GetWindowText(value); - float zbias = 0.f; + float zbias = 0.f; int dummy; // to test if end of string as no not wanted extra characters if (sscanf((LPCTSTR) (value + "\n0"), "%f\n%d", &zbias, &dummy) == 2) { @@ -773,8 +773,8 @@ void CLocatedBindableDialog::updateZBias() CString caption; CString mess; caption.LoadString(IDS_CAPTION_ERROR); - mess.LoadString(IDS_BAD_ZBIAS); - m_ZBias.SetWindowText("0.00"); + mess.LoadString(IDS_BAD_ZBIAS); + m_ZBias.SetWindowText(_T("0.00")); MessageBox((LPCTSTR) mess, (LPCTSTR) caption, MB_ICONERROR); NLMISC::safe_cast(_Bindable)->setZBias(0); updateModifiedFlag(); @@ -782,28 +782,28 @@ void CLocatedBindableDialog::updateZBias() } //*************************************************************************************************************************** -void CLocatedBindableDialog::OnChangeZbias() +void CLocatedBindableDialog::OnChangeZbias() { - UpdateData(); + UpdateData(); // Trick to track "Enter" keypress: CEdit are multiline. If GetLineCount()>1, then // user has press enter. if(m_ZBias.GetLineCount()>1) { // must ccat 2 lines of the CEdit. - concatEdit2Lines(m_ZBias); - updateZBias(); + concatEdit2Lines(m_ZBias); + updateZBias(); } } //*************************************************************************************************************************** -void CLocatedBindableDialog::OnKillfocusZbias() +void CLocatedBindableDialog::OnKillfocusZbias() { - updateZBias(); + updateZBias(); } //*************************************************************************************************************************** -void CLocatedBindableDialog::OnZalign() -{ +void CLocatedBindableDialog::OnZalign() +{ bool align = ((CButton *) GetDlgItem(IDC_ZALIGN))->GetCheck() != 0; NL3D::CPSFaceLookAt *fla = NLMISC::safe_cast(_Bindable); fla->setAlignOnZAxis(align); diff --git a/code/nel/tools/3d/object_viewer/located_properties.cpp b/code/nel/tools/3d/object_viewer/located_properties.cpp index 27ff466e1..b270e9d7f 100644 --- a/code/nel/tools/3d/object_viewer/located_properties.cpp +++ b/code/nel/tools/3d/object_viewer/located_properties.cpp @@ -322,7 +322,7 @@ void CLocatedProperties::goPostRender() _MaxNbParticles->update(); } // in all cases, show the current number of particles being used - GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(NLMISC::toString(_Located->getSize()).c_str()); + GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(utf8ToTStr(NLMISC::toString(_Located->getSize()))); } //**************************************************************************************************************** diff --git a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp index 9cb9fced1..fb84877ad 100644 --- a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp @@ -112,8 +112,8 @@ void CLocatedTargetDlg::OnAddTarget() nlassert(loc); _LBTarget->attachTarget(loc); m_AvailableTargets.DeleteString(indexs[k] - k); - int l = m_Targets.AddString(loc->getName().c_str()); - m_Targets.SetItemData(l, (DWORD) loc); + int l = m_Targets.AddString(utf8ToTStr(loc->getName())); + m_Targets.SetItemData(l, (DWORD_PTR) loc); } UpdateData(FALSE); // @@ -135,7 +135,7 @@ void CLocatedTargetDlg::OnRemoveTarget() nlassert(loc); _LBTarget->detachTarget(loc); m_Targets.DeleteString(indexs[k] - k); - int l = m_AvailableTargets.AddString(loc->getName().c_str()); + int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); m_AvailableTargets.SetItemData(l, (DWORD) loc); } @@ -227,7 +227,7 @@ BOOL CLocatedTargetDlg::OnInitDialog() rv->init(posX + 140, posY, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Radial viscosity : ", SS_LEFT, CRect(posX, posY, posX + 139, posY + 32), this); + s->Create(_T("Radial viscosity : "), SS_LEFT, CRect(posX, posY, posX + 139, posY + 32), this); s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); @@ -243,7 +243,7 @@ BOOL CLocatedTargetDlg::OnInitDialog() s = new CStatic; pushWnd(s); - s->Create("Tangential Viscosity : ", SS_LEFT, CRect(posX, posY, posX + 139, posY + 32), this); + s->Create(_T("Tangential Viscosity : "), SS_LEFT, CRect(posX, posY, posX + 139, posY + 32), this); s->ShowWindow(SW_SHOW); tv->GetClientRect(&r); @@ -273,7 +273,7 @@ BOOL CLocatedTargetDlg::OnInitDialog() rv->init(posX + 140, posY, this); CStatic *s = new CStatic; pushWnd(s); - s->Create("Parametric factor : ", SS_LEFT, CRect(posX, posY, posX + 139, posY + 40), this); + s->Create(_T("Parametric factor : "), SS_LEFT, CRect(posX, posY, posX + 139, posY + 40), this); s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); s->ShowWindow(SW_SHOW); diff --git a/code/nel/tools/3d/object_viewer/main_frame.cpp b/code/nel/tools/3d/object_viewer/main_frame.cpp index d063e202d..aa24efa36 100644 --- a/code/nel/tools/3d/object_viewer/main_frame.cpp +++ b/code/nel/tools/3d/object_viewer/main_frame.cpp @@ -293,41 +293,41 @@ void CMainFrame::registerValue (bool read) DWORD len=sizeof (BOOL); DWORD type; NLMISC::CRGBA bgCol ; - RegQueryValueEx (hKey, "ViewAnimation", 0, &type, (LPBYTE)&AnimationWindow, &len); + RegQueryValueEx (hKey, _T("ViewAnimation"), 0, &type, (LPBYTE)&AnimationWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewAnimationSet", 0, &type, (LPBYTE)&AnimationSetWindow, &len); + RegQueryValueEx (hKey, _T("ViewAnimationSet"), 0, &type, (LPBYTE)&AnimationSetWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewSlots", 0, &type, (LPBYTE)&MixerSlotsWindow, &len); + RegQueryValueEx (hKey, _T("ViewSlots"), 0, &type, (LPBYTE)&MixerSlotsWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewParticles", 0, &type, (LPBYTE)&ParticlesWindow, &len); + RegQueryValueEx (hKey, _T("ViewParticles"), 0, &type, (LPBYTE)&ParticlesWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewDayNight", 0, &type, (LPBYTE)&DayNightWindow, &len); + RegQueryValueEx (hKey, _T("ViewDayNight"), 0, &type, (LPBYTE)&DayNightWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewWaterPool", 0, &type, (LPBYTE)&WaterPoolWindow, &len); + RegQueryValueEx (hKey, _T("ViewWaterPool"), 0, &type, (LPBYTE)&WaterPoolWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewVegetable", 0, &type, (LPBYTE)&VegetableWindow, &len); + RegQueryValueEx (hKey, _T("ViewVegetable"), 0, &type, (LPBYTE)&VegetableWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewGlobalWind", 0, &type, (LPBYTE)&GlobalWindWindow, &len); + RegQueryValueEx (hKey, _T("ViewGlobalWind"), 0, &type, (LPBYTE)&GlobalWindWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewSoundAnimWind", 0, &type, (LPBYTE)&GlobalWindWindow, &len); + RegQueryValueEx (hKey, _T("ViewSoundAnimWind"), 0, &type, (LPBYTE)&GlobalWindWindow, &len); len=sizeof (float); - RegQueryValueEx (hKey, "MoveSpeed", 0, &type, (LPBYTE)&MoveSpeed, &len); + RegQueryValueEx (hKey, _T("MoveSpeed"), 0, &type, (LPBYTE)&MoveSpeed, &len); len=sizeof (uint); - RegQueryValueEx (hKey, "ObjectMode", 0, &type, (LPBYTE)&MoveMode, &len); + RegQueryValueEx (hKey, _T("ObjectMode"), 0, &type, (LPBYTE)&MoveMode, &len); len=sizeof(NLMISC::CRGBA) ; - RegQueryValueEx (hKey, "BackGroundColor", 0, &type, (LPBYTE)&BgColor, &len); + RegQueryValueEx (hKey, _T("BackGroundColor"), 0, &type, (LPBYTE)&BgColor, &len); len=sizeof (float); - RegQueryValueEx (hKey, "GlobalWindPower", 0, &type, (LPBYTE)&GlobalWindPower, &len); + RegQueryValueEx (hKey, _T("GlobalWindPower"), 0, &type, (LPBYTE)&GlobalWindPower, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewChooseFrameDelay", 0, &type, (LPBYTE)&ChooseFrameDelayWindow, &len); + RegQueryValueEx (hKey, _T("ViewChooseFrameDelay"), 0, &type, (LPBYTE)&ChooseFrameDelayWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewChooseBGColor", 0, &type, (LPBYTE)&ChooseBGColorWindow, &len); + RegQueryValueEx (hKey, _T("ViewChooseBGColor"), 0, &type, (LPBYTE)&ChooseBGColorWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewChooseSunColor", 0, &type, (LPBYTE)&ChooseSunColorWindow, &len); + RegQueryValueEx (hKey, _T("ViewChooseSunColor"), 0, &type, (LPBYTE)&ChooseSunColorWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewSkeletonScaleWindow", 0, &type, (LPBYTE)&SkeletonScaleWindow, &len); + RegQueryValueEx (hKey, _T("ViewSkeletonScaleWindow"), 0, &type, (LPBYTE)&SkeletonScaleWindow, &len); len=sizeof (BOOL); - RegQueryValueEx (hKey, "ViewTuneMRMWindow", 0, &type, (LPBYTE)&TuneMRMWindow, &len); + RegQueryValueEx (hKey, _T("ViewTuneMRMWindow"), 0, &type, (LPBYTE)&TuneMRMWindow, &len); } } else @@ -335,26 +335,26 @@ void CMainFrame::registerValue (bool read) HKEY hKey; if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_OBJ_VIEW_SCENE_DLG, &hKey)==ERROR_SUCCESS) { - RegSetValueEx(hKey, "ViewAnimation", 0, REG_BINARY, (LPBYTE)&AnimationWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewAnimationSet", 0, REG_BINARY, (LPBYTE)&AnimationSetWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewSlots", 0, REG_BINARY, (LPBYTE)&MixerSlotsWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewParticles", 0, REG_BINARY, (LPBYTE)&ParticlesWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewDayNight", 0, REG_BINARY, (LPBYTE)&DayNightWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewWaterPool", 0, REG_BINARY, (LPBYTE)&WaterPoolWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewDayNight", 0, REG_BINARY, (LPBYTE)&DayNightWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewVegetable", 0, REG_BINARY, (LPBYTE)&VegetableWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewGlobalWind", 0, REG_BINARY, (LPBYTE)&GlobalWindWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewSoundAnimWind", 0, REG_BINARY, (LPBYTE)&SoundAnimWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewLightGroupWind", 0, REG_BINARY, (LPBYTE)&LightGroupWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewChooseFrameDelay", 0, REG_BINARY, (LPBYTE)&ChooseFrameDelayWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewChooseBGColor", 0, REG_BINARY, (LPBYTE)&ChooseBGColorWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewChooseSunColor", 0, REG_BINARY, (LPBYTE)&ChooseSunColorWindow, sizeof(bool)); - RegSetValueEx(hKey, "MoveSpeed", 0, REG_BINARY, (LPBYTE)&MoveSpeed, sizeof(float)); - RegSetValueEx(hKey, "ObjectMode", 0, REG_BINARY, (LPBYTE)&MoveMode, sizeof(uint)); - RegSetValueEx(hKey, "BackGroundColor", 0, REG_BINARY, (LPBYTE)&BgColor, sizeof(NLMISC::CRGBA)); - RegSetValueEx(hKey, "GlobalWindPower", 0, REG_BINARY, (LPBYTE)&GlobalWindPower, sizeof(float)); - RegSetValueEx(hKey, "ViewSkeletonScaleWindow", 0, REG_BINARY, (LPBYTE)&SkeletonScaleWindow, sizeof(bool)); - RegSetValueEx(hKey, "ViewTuneMRMWindow", 0, REG_BINARY, (LPBYTE)&TuneMRMWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewAnimation"), 0, REG_BINARY, (LPBYTE)&AnimationWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewAnimationSet"), 0, REG_BINARY, (LPBYTE)&AnimationSetWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewSlots"), 0, REG_BINARY, (LPBYTE)&MixerSlotsWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewParticles"), 0, REG_BINARY, (LPBYTE)&ParticlesWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewDayNight"), 0, REG_BINARY, (LPBYTE)&DayNightWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewWaterPool"), 0, REG_BINARY, (LPBYTE)&WaterPoolWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewDayNight"), 0, REG_BINARY, (LPBYTE)&DayNightWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewVegetable"), 0, REG_BINARY, (LPBYTE)&VegetableWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewGlobalWind"), 0, REG_BINARY, (LPBYTE)&GlobalWindWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewSoundAnimWind"), 0, REG_BINARY, (LPBYTE)&SoundAnimWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewLightGroupWind"), 0, REG_BINARY, (LPBYTE)&LightGroupWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewChooseFrameDelay"), 0, REG_BINARY, (LPBYTE)&ChooseFrameDelayWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewChooseBGColor"), 0, REG_BINARY, (LPBYTE)&ChooseBGColorWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewChooseSunColor"), 0, REG_BINARY, (LPBYTE)&ChooseSunColorWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("MoveSpeed"), 0, REG_BINARY, (LPBYTE)&MoveSpeed, sizeof(float)); + RegSetValueEx(hKey, _T("ObjectMode"), 0, REG_BINARY, (LPBYTE)&MoveMode, sizeof(uint)); + RegSetValueEx(hKey, _T("BackGroundColor"), 0, REG_BINARY, (LPBYTE)&BgColor, sizeof(NLMISC::CRGBA)); + RegSetValueEx(hKey, _T("GlobalWindPower"), 0, REG_BINARY, (LPBYTE)&GlobalWindPower, sizeof(float)); + RegSetValueEx(hKey, _T("ViewSkeletonScaleWindow"), 0, REG_BINARY, (LPBYTE)&SkeletonScaleWindow, sizeof(bool)); + RegSetValueEx(hKey, _T("ViewTuneMRMWindow"), 0, REG_BINARY, (LPBYTE)&TuneMRMWindow, sizeof(bool)); } } } @@ -568,13 +568,13 @@ void CMainFrame::OnFileLoadconfig() update (); // Create a dialog - static char BASED_CODE szFilter[] = "NeL Object viewer config (*.ovcgf)|*.ovcgf|All Files (*.*)|*.*||"; - CFileDialog fileDlg( TRUE, ".ovcgf", "*.ovcgf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Object viewer config (*.ovcgf)|*.ovcgf|All Files (*.*)|*.*||"); + CFileDialog fileDlg( TRUE, _T(".ovcgf"), _T("*.ovcgf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { // Open the file CIFile file; - if (file.open ((const char*)fileDlg.GetPathName())) + if (file.open(tStrToUtf8(fileDlg.GetPathName()))) { try { @@ -590,17 +590,17 @@ void CMainFrame::OnFileLoadconfig() } } } - catch (Exception& e) + catch (const Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", (const char*)fileDlg.GetPathName()); - MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + CString msg; + msg.Format(_T("Can't open the file %s for reading."), (LPCTSTR)fileDlg.GetPathName()); + MessageBox (msg, _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -613,15 +613,15 @@ void CMainFrame::OnFileOpen() update (); // Create a dialog - static char BASED_CODE szFilter[] = - "All NeL Files (*.shape;*.ps;*.ig)\0*.shape;*.ps;*.ig\0" - "NeL Shape Files (*.shape)\0*.shape\0" - "NeL Particule System Files (*.ps)\0*.ps\0" - "NeL Instance Group Files (*.ig)\0*.ig\0" - "All Files (*.*)\0*.*\0\0"; + static TCHAR BASED_CODE szFilter[] = + _T("All NeL Files (*.shape;*.ps;*.ig)\0*.shape;*.ps;*.ig\0") + _T("NeL Shape Files (*.shape)\0*.shape\0") + _T("NeL Particule System Files (*.ps)\0*.ps\0") + _T("NeL Instance Group Files (*.ig)\0*.ig\0") + _T("All Files (*.*)\0*.*\0\0"); // Filename buffer - char buffer[65535]; + TCHAR buffer[65535]; buffer[0]=0; OPENFILENAME openFile; @@ -633,7 +633,7 @@ void CMainFrame::OnFileOpen() openFile.lpstrFile = buffer; openFile.nMaxFile = 65535; openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING|OFN_EXPLORER; - openFile.lpstrDefExt = "*.shape;*.ig;*.ps"; + openFile.lpstrDefExt = _T("*.shape;*.ig;*.ps"); if (GetOpenFileName(&openFile)) @@ -642,7 +642,7 @@ void CMainFrame::OnFileOpen() std::vector meshFilename; // Filename pointer - char *c=buffer; + TCHAR *c=buffer; // Read the path CString path = buffer; @@ -652,7 +652,7 @@ void CMainFrame::OnFileOpen() c[path.GetLength()+1]=0; // Path is empty - path = ""; + path.Empty(); } else { @@ -682,10 +682,10 @@ void CMainFrame::OnFileOpen() CString name = path + filename; // file is an ig ? - if (name.Find(".ig") != -1) + if (name.Find(_T(".ig")) != -1) { // Load the instance group - if (ObjView->loadInstanceGroup (name)) + if (ObjView->loadInstanceGroup (tStrToUtf8(name))) { // Reset the camera OnResetCamera(); @@ -697,7 +697,7 @@ void CMainFrame::OnFileOpen() else { // Add it in the array - meshFilename.push_back ((const char*)name); + meshFilename.push_back (tStrToUtf8(name)); } } @@ -705,12 +705,12 @@ void CMainFrame::OnFileOpen() if ( !meshFilename.empty() ) { // Create a dialog for the skel - static char BASED_CODE szFilter2[] = "NeL Skeleton Files (*.skel)|*.skel|All Files (*.*)|*.*||"; - CFileDialog fileDlg2 ( TRUE, ".skel", "*.skel", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter2); + static TCHAR BASED_CODE szFilter2[] = _T("NeL Skeleton Files (*.skel)|*.skel|All Files (*.*)|*.*||"); + CFileDialog fileDlg2 ( TRUE, _T(".skel"), _T("*.skel"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter2); if (fileDlg2.DoModal()==IDOK) { // Load the shape with a skeleton - if (ObjView->loadMesh (meshFilename, fileDlg2.GetPathName())) + if (ObjView->loadMesh (meshFilename, tStrToUtf8(fileDlg2.GetPathName()))) { // Reset the camera OnResetCamera(); @@ -741,11 +741,11 @@ void CMainFrame::OnFileSaveconfig() update (); // Create a dialog - static char BASED_CODE szFilter[] = "NeL Object viewer config (*.ovcgf)|*.ovcgf|All Files (*.*)|*.*||"; - CFileDialog fileDlg( FALSE, ".ovcgf", "*.ovcgf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Object viewer config (*.ovcgf)|*.ovcgf|All Files (*.*)|*.*||"); + CFileDialog fileDlg( FALSE, _T(".ovcgf"), _T("*.ovcgf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { - ObjView->ParticleWorkspaceFilename = ""; + ObjView->ParticleWorkspaceFilename.clear(); CParticleWorkspace *pw = ObjView->getParticleDialog()->getParticleWorkspace(); if (pw && pw->getNumNode() != 0) { @@ -756,23 +756,23 @@ void CMainFrame::OnFileSaveconfig() } // Open the file COFile file; - if (file.open ((const char*)fileDlg.GetPathName())) + if (file.open (tStrToUtf8(fileDlg.GetPathName()))) { try { ObjView->serial(file); } - catch (Exception& e) + catch (const Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for writing", (const char*)fileDlg.GetPathName()); - MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + CString msg; + msg.Format(_T("Can't open the file %s for writing"), (LPCTSTR)fileDlg.GetPathName()); + MessageBox (msg, _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -832,7 +832,7 @@ void CMainFrame::OnViewSetmovespeed() if (valueDlg.DoModal ()==IDOK) { // Get deflaut value - sscanf ((const char*)valueDlg.Value, "%f", &MoveSpeed); + NLMISC::fromString(tStrToUtf8(valueDlg.Value), MoveSpeed); } } @@ -1154,7 +1154,7 @@ void CMainFrame::OnHelpAboutobjectviewer() ///=========================================================================================== void CMainFrame::OnRemoveAllInstancesFromScene() { - if (MessageBox("Delete all instances from scene ?", "Object Viewer", MB_YESNO) == IDYES) + if (MessageBox(_T("Delete all instances from scene ?"), _T("Object Viewer"), MB_YESNO) == IDYES) { ObjView->removeAllInstancesFromScene(); @@ -1392,9 +1392,10 @@ void CMainFrame::OnViewSetSceneRotation() if (sceneRotDlg.DoModal() == IDOK) { // read value. - _LastSceneRotX= (float)atof(sceneRotDlg.RotX); - _LastSceneRotY= (float)atof(sceneRotDlg.RotY); - _LastSceneRotZ= (float)atof(sceneRotDlg.RotZ); + NLMISC::fromString(tStrToUtf8(sceneRotDlg.RotX), _LastSceneRotX); + NLMISC::fromString(tStrToUtf8(sceneRotDlg.RotY), _LastSceneRotY); + NLMISC::fromString(tStrToUtf8(sceneRotDlg.RotZ), _LastSceneRotZ); + float rotx= degToRad(_LastSceneRotX); float roty= degToRad(_LastSceneRotY); float rotz= degToRad(_LastSceneRotZ); @@ -1441,11 +1442,12 @@ void CMainFrame::OnUpdateSceneCamera(CCmdUI* pCmdUI) { CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST)); nlassert (instance->Camera); - pCmdUI->SetText (("Camera "+instance->Saved.ShapeFilename).c_str ()); + std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str()); + pCmdUI->SetText(utf8ToTStr(text)); } else { - pCmdUI->SetText ("No camera"); + pCmdUI->SetText (_T("No camera")); } } diff --git a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp index f0d62bd41..de59b9c2a 100644 --- a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp @@ -90,7 +90,7 @@ void CMeshDlg::touchPSState() void CMeshDlg::OnBrowseShape() { - CFileDialog fd(TRUE, ".shape", "*.shape", 0, NULL, this); + CFileDialog fd(TRUE, _T(".shape"), _T("*.shape"), 0, NULL, this); if (fd.DoModal() == IDOK) { // Add to the path @@ -112,9 +112,9 @@ void CMeshDlg::OnBrowseShape() m_ShapeName = (std::string(fname) + ext).c_str(); touchPSState(); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { - MessageBox(e.what(), "shape loading error"); + MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); } updateMeshErrorString(); } @@ -166,7 +166,7 @@ void CMeshDlg::updateForMorph() } else { - m_ShapeName = ""; + m_ShapeName.Empty(); } } updateMeshErrorString(); @@ -238,7 +238,7 @@ BOOL CMeshDlg::EnableWindow( BOOL bEnable) ///================================================================== void CMeshDlg::updateMeshErrorString() { - GetDlgItem(IDC_MESH_ERROR)->SetWindowText(""); + GetDlgItem(IDC_MESH_ERROR)->SetWindowText(_T("")); NL3D::CPSConstraintMesh *cm = dynamic_cast(_ShapeParticle); if (!cm) return; std::vector numVerts; diff --git a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp index d2d08e2cc..fc0c294ca 100644 --- a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp @@ -165,29 +165,28 @@ void CMultiTexDlg::readValues(bool alternate) char buf[128]; if (!alternate) { - sprintf(buf, "%.3f", _MTP->getScrollSpeed(0).x); GetDlgItem(IDC_U_SPEED_1)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getScrollSpeed(0).y); GetDlgItem(IDC_V_SPEED_1)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getScrollSpeed(1).x); GetDlgItem(IDC_U_SPEED_2)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getScrollSpeed(1).y); GetDlgItem(IDC_V_SPEED_2)->SetWindowText(buf); + GetDlgItem(IDC_U_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x))); + GetDlgItem(IDC_V_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y))); + GetDlgItem(IDC_U_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x))); + GetDlgItem(IDC_V_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y))); } else { if (_MTP->isAlternateTexEnabled()) { - sprintf(buf, "%.3f", _MTP->getAlternateScrollSpeed(0).x); GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getAlternateScrollSpeed(0).y); GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getAlternateScrollSpeed(1).x); GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(buf); - sprintf(buf, "%.3f", _MTP->getAlternateScrollSpeed(1).y); GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(buf); + GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x))); + GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y))); + GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x))); + GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y))); } else { - GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(""); - GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(""); - GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(""); - GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(""); + GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(_T("")); + GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(_T("")); + GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(_T("")); + GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(_T("")); } } - sprintf(buf, "%.3f", _MTP->getBumpFactor()); GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(buf); } @@ -204,7 +203,7 @@ void CMultiTexDlg::updateBumpFactorEnabled() //====================================================== void CMultiTexDlg::writeValues(bool alternate) { - char u1[10], u2[10], v1[10], v2[10]; + TCHAR u1[10], u2[10], v1[10], v2[10]; NLMISC::CVector2f vs1, vs2; @@ -215,10 +214,10 @@ void CMultiTexDlg::writeValues(bool alternate) GetDlgItem(IDC_U_SPEED_2)->GetWindowText(u2, 10); GetDlgItem(IDC_V_SPEED_2)->GetWindowText(v2, 10); - if (sscanf(u1, "%f", &vs1.x) == 1 && - sscanf(v1, "%f", &vs1.y) == 1 && - sscanf(u2, "%f", &vs2.x) == 1 && - sscanf(v2, "%f", &vs2.y) == 1) + if (_tcscanf(u1, "%f", &vs1.x) == 1 && + _tcscanf(v1, "%f", &vs1.y) == 1 && + _tcscanf(u2, "%f", &vs2.x) == 1 && + _tcscanf(v2, "%f", &vs2.y) == 1) { _MTP->setScrollSpeed(0, vs1); _MTP->setScrollSpeed(1, vs2); @@ -226,7 +225,7 @@ void CMultiTexDlg::writeValues(bool alternate) } else { - MessageBox("Invalid value(s)", "Error", MB_OK | MB_ICONEXCLAMATION); + MessageBox(_T("Invalid value(s)"), _T("Error"), MB_OK | MB_ICONEXCLAMATION); } } else @@ -237,10 +236,10 @@ void CMultiTexDlg::writeValues(bool alternate) GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->GetWindowText(v1, 10); GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->GetWindowText(u2, 10); GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->GetWindowText(v2, 10); - if (sscanf(u1, "%f", &vs1.x) == 1 && - sscanf(v1, "%f", &vs1.y) == 1 && - sscanf(u2, "%f", &vs2.x) == 1 && - sscanf(v2, "%f", &vs2.y) == 1) + if (_tcscanf(u1, "%f", &vs1.x) == 1 && + _tcscanf(v1, "%f", &vs1.y) == 1 && + _tcscanf(u2, "%f", &vs2.x) == 1 && + _tcscanf(v2, "%f", &vs2.y) == 1) { _MTP->setAlternateScrollSpeed(0, vs1); _MTP->setAlternateScrollSpeed(1, vs2); @@ -249,10 +248,10 @@ void CMultiTexDlg::writeValues(bool alternate) } } - char bumpFactorTxt[10]; + TCHAR bumpFactorTxt[10]; float bumpFactor; GetDlgItem(IDC_BUMP_FACTOR)->GetWindowText(bumpFactorTxt, 10); - if (sscanf(bumpFactorTxt, "%f", &bumpFactor) == 1) + if (_tcscanf(bumpFactorTxt, "%f", &bumpFactor) == 1) { _MTP->setBumpFactor(bumpFactor); updateModifiedFlag(); diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index c6f163146..4b78b9838 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -281,12 +281,13 @@ std::string CObjectViewer::getModulePath() const HMODULE hModule = AfxGetInstanceHandle(); nlassert(hModule); // shouldn't be null now anymore in any case nlassert(hModule != GetModuleHandle(NULL)); // if this is dll, the module handle can't be same as exe - char sModulePath[256]; + TCHAR sModulePath[256]; int res = GetModuleFileName(hModule, sModulePath, 256); nlassert(res); nldebug("Object viewer module path is '%s'", sModulePath); - _splitpath (sModulePath, SDrive, SDir, NULL, NULL); - _makepath (sModulePath, SDrive, SDir, "object_viewer", ".cfg"); - return sModulePath; + + std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)); + + return NLMISC::CPath::standardizeDosPath(path) + "object_viewer.cfg"; } @@ -317,7 +318,7 @@ void CObjectViewer::loadConfigFile() for (uint i=0; i<(uint)search_pathes.size(); i++) CPath::addSearchPath (search_pathes.asString(i)); } - catch(EUnknownVar &) + catch(const EUnknownVar &) {} try @@ -327,7 +328,7 @@ void CObjectViewer::loadConfigFile() for (uint i=0; i<(uint)recursive_search_pathes.size(); i++) CPath::addSearchPath (recursive_search_pathes.asString(i), true, false); } - catch(EUnknownVar &) + catch(const EUnknownVar &) {} // Add extension remapping @@ -344,7 +345,7 @@ void CObjectViewer::loadConfigFile() CPath::remapExtension(extensions_remapping.asString(i), extensions_remapping.asString(i+1), true); } } - catch (EUnknownVar &) + catch (const EUnknownVar &) { } @@ -381,7 +382,7 @@ void CObjectViewer::loadConfigFile() for (uint i=0; i<(uint)var.size(); i++) CSoundSystem::addSampleBank(var.asString(i).c_str());*/ } - catch (EUnknownVar &) + catch (const EUnknownVar &) { //::MessageBox(NULL, "warning : 'sample_path' or 'packed_sheet_path' variable not defined.\nSound will not work properly.", "Objectviewer.cfg", MB_OK|MB_ICONEXCLAMATION); } @@ -392,7 +393,7 @@ void CObjectViewer::loadConfigFile() CConfigFile::CVar &camera_focal = cf.getVar("camera_focal"); _CameraFocal = camera_focal.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { } @@ -403,7 +404,7 @@ void CObjectViewer::loadConfigFile() CConfigFile::CVar &var = cf.getVar("scene_light_enabled"); _SceneLightEnabled = var.asInt() !=0 ; } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _SceneLightEnabled= false; } @@ -414,7 +415,7 @@ void CObjectViewer::loadConfigFile() _SceneLightSunAmbiant.G = var.asInt(1); _SceneLightSunAmbiant.B = var.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _SceneLightSunAmbiant= NLMISC::CRGBA::Black; } @@ -425,7 +426,7 @@ void CObjectViewer::loadConfigFile() _SceneLightSunDiffuse.G = var.asInt(1); _SceneLightSunDiffuse.B = var.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _SceneLightSunDiffuse= NLMISC::CRGBA::White; } @@ -436,7 +437,7 @@ void CObjectViewer::loadConfigFile() _SceneLightSunSpecular.G = var.asInt(1); _SceneLightSunSpecular.B = var.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _SceneLightSunSpecular= NLMISC::CRGBA::White; } @@ -448,7 +449,7 @@ void CObjectViewer::loadConfigFile() _SceneLightSunDir.z = var.asFloat(2); _SceneLightSunDir.normalize(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _SceneLightSunDir.set(0, 1, -1); _SceneLightSunDir.normalize(); @@ -458,7 +459,7 @@ void CObjectViewer::loadConfigFile() CConfigFile::CVar &var = cf.getVar("object_light_test"); _ObjectLightTestShape= var.asString(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { } @@ -480,7 +481,7 @@ void CObjectViewer::loadConfigFile() } CNELU::Scene->setAutomaticAnimationSet(as.release()); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { //::MessageBox(NULL, "No automatic animation path specified, please set 'automatic_animation_path'", "warning", MB_OK); nlwarning("No automatic animation path specified"); @@ -492,7 +493,7 @@ void CObjectViewer::loadConfigFile() CConfigFile::CVar &var = cf.getVar("character_scale_pos"); _CharacterScalePos= var.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { } @@ -533,9 +534,9 @@ void CObjectViewer::loadConfigFile() if (var = cf.getVarPtr("cloud_wind_speed")) _CSS.WindSpeed = var->asFloat(); } - catch (Exception& e) + catch (const Exception& e) { - ::MessageBox (NULL, e.what(), "Objectviewer.cfg", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox (NULL, utf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK|MB_ICONEXCLAMATION); } } @@ -615,14 +616,14 @@ bool CObjectViewer::initUI (HWND parent) // The windows path uint dSize = ::GetWindowsDirectory(NULL, 0); nlverify(dSize); - char *wd = new char[dSize]; + + TCHAR *wd = new TCHAR[dSize]; nlverify(::GetWindowsDirectory(wd, dSize)); - _FontPath=wd; - _FontPath+="\\fonts\\arial.ttf"; + _FontPath = tStrToUtf8(wd) + "\\fonts\\arial.ttf"; + delete[] wd; // The font generator _FontGenerator = NL3D::newCFontGenerator ( _FontPath ); - delete[] wd; // The viewport CViewport viewport; @@ -654,7 +655,7 @@ bool CObjectViewer::initUI (HWND parent) // Create the window _MainFrame->CFrameWnd::Create (AfxRegisterWndClass(0, 0, NULL, hIcon), - "NeL object viewer", 0x00cfc000, /*WS_OVERLAPPEDWINDOW,*/ CFrameWnd::rectDefault, parentWndPtr, + _T("NeL object viewer"), 0x00cfc000, /*WS_OVERLAPPEDWINDOW,*/ CFrameWnd::rectDefault, parentWndPtr, MAKEINTRESOURCE(IDR_OBJECT_VIEWER_MENU), 0x00000300 /*WS_EX_ACCEPTFILES*/ /*|WS_EX_CLIENTEDGE*/); // Detach the hwnd @@ -821,9 +822,10 @@ bool CObjectViewer::initUI (HWND parent) { iF.serial(SchemeManager); } - catch (NLMISC::EStream &e) + catch (const NLMISC::EStream &e) { - ::MessageBox(NULL, ("Unable to load the default scheme bank file : " + std::string(e.what())).c_str(), "Object Viewer", MB_ICONEXCLAMATION); + std::string msg = toString("Unable to load the default scheme bank file : %s", e.what()); + ::MessageBox(NULL, utf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); } } iF.close(); @@ -836,9 +838,10 @@ bool CObjectViewer::initUI (HWND parent) { serial (iF); } - catch (Exception& e) + catch (const Exception& e) { - ::MessageBox (NULL, (std::string("error while loading default.ovcgf : ") + e.what()).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = toString("Error while loading default.ovcgf : %s", e.what()); + ::MessageBox (NULL, utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } @@ -1286,7 +1289,6 @@ void CObjectViewer::go () sint64 timeDiff = newTime - lastTime; float fps = timeDiff > 0 ? (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)) : 1000.0f; lastTime=newTime; - char msgBar[1024]; uint nbPlayingSources, nbSources; if (CSoundSystem::getAudioMixer()) { @@ -1299,30 +1301,32 @@ void CObjectViewer::go () } // Display std info. - sprintf (msgBar, "%s - Nb tri: %d -Texture used (Mo): %5.2f - Texture allocated (Mo): %5.2f - Distance: %5.0f - Sounds: %d/%d - Fps: %03.1f", - _Direct3d?"Direct3d":"OpenGL", - in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips, (float)CNELU::Driver->getUsedTextureMemory () / (float)(1024*1024), - (float)CNELU::Driver->profileAllocatedTextureMemory () / (float)(1024*1024), - (_SceneCenter-CNELU::Camera->getMatrix().getPos()).norm(), - nbPlayingSources, - nbSources, - fps - ); + std::string msgBar = toString("%s - Nb tri: %u - Texture used (MiB): %5.2f - Texture allocated (MiB): %5.2f - Distance: %5.0f - Sounds: %u/%u - Fps: %03.1f", + _Direct3d ? "Direct3d":"OpenGL", + in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips, + (float)CNELU::Driver->getUsedTextureMemory () / (float)(1024*1024), + (float)CNELU::Driver->profileAllocatedTextureMemory () / (float)(1024*1024), + (_SceneCenter-CNELU::Camera->getMatrix().getPos()).norm(), + nbPlayingSources, + nbSources, + fps + ); + // Display - _MainFrame->StatusBar.SetWindowText (msgBar); + _MainFrame->StatusBar.SetWindowText (utf8ToTStr(msgBar)); // Display Vegetable info. if(_VegetableDlg!=NULL) { if(_VegetableLandscape != NULL) { - char vegetMsgBar[1024]; - sprintf (vegetMsgBar, "%d", _VegetableLandscape->Landscape.getNumVegetableFaceRendered()); + CString vegetMsgBar; + vegetMsgBar.Format(_T("%u"), _VegetableLandscape->Landscape.getNumVegetableFaceRendered()); _VegetableDlg->StaticPolyCount.SetWindowText(vegetMsgBar); } else { - _VegetableDlg->StaticPolyCount.SetWindowText("0"); + _VegetableDlg->StaticPolyCount.SetWindowText(_T("0")); } } @@ -1564,23 +1568,23 @@ void CObjectViewer::releaseUI () // *************************************************************************** -void setRegisterWindowState (const CWnd *pWnd, const char* keyName) +void setRegisterWindowState (const CWnd *pWnd, const TCHAR* keyName) { HKEY hKey; if (RegCreateKey(HKEY_CURRENT_USER, keyName, &hKey)==ERROR_SUCCESS) { RECT rect; pWnd->GetWindowRect (&rect); - RegSetValueEx(hKey, "Left", 0, REG_DWORD, (LPBYTE)&rect.left, 4); - RegSetValueEx(hKey, "Right", 0, REG_DWORD, (LPBYTE)&rect.right, 4); - RegSetValueEx(hKey, "Top", 0, REG_DWORD, (LPBYTE)&rect.top, 4); - RegSetValueEx(hKey, "Bottom", 0, REG_DWORD, (LPBYTE)&rect.bottom, 4); + RegSetValueEx(hKey, _T("Left"), 0, REG_DWORD, (LPBYTE)&rect.left, 4); + RegSetValueEx(hKey, _T("Right"), 0, REG_DWORD, (LPBYTE)&rect.right, 4); + RegSetValueEx(hKey, _T("Top"), 0, REG_DWORD, (LPBYTE)&rect.top, 4); + RegSetValueEx(hKey, _T("Bottom"), 0, REG_DWORD, (LPBYTE)&rect.bottom, 4); } } // *************************************************************************** -void getRegisterWindowState (CWnd *pWnd, const char* keyName, bool resize) +void getRegisterWindowState (CWnd *pWnd, const TCHAR* keyName, bool resize) { HKEY hKey; if (RegOpenKeyEx(HKEY_CURRENT_USER, keyName, 0, KEY_READ, &hKey)==ERROR_SUCCESS) @@ -1588,10 +1592,10 @@ void getRegisterWindowState (CWnd *pWnd, const char* keyName, bool resize) DWORD len=4; DWORD type; RECT rect; - RegQueryValueEx (hKey, "Left", 0, &type, (LPBYTE)&rect.left, &len); - RegQueryValueEx (hKey, "Right", 0, &type, (LPBYTE)&rect.right, &len); - RegQueryValueEx (hKey, "Top", 0, &type, (LPBYTE)&rect.top, &len); - RegQueryValueEx (hKey, "Bottom", 0, &type, (LPBYTE)&rect.bottom, &len); + RegQueryValueEx (hKey, _T("Left"), 0, &type, (LPBYTE)&rect.left, &len); + RegQueryValueEx (hKey, _T("Right"), 0, &type, (LPBYTE)&rect.right, &len); + RegQueryValueEx (hKey, _T("Top"), 0, &type, (LPBYTE)&rect.top, &len); + RegQueryValueEx (hKey, _T("Bottom"), 0, &type, (LPBYTE)&rect.bottom, &len); // Set window pos pWnd->SetWindowPos (NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOOWNERZORDER|SWP_NOZORDER| @@ -1619,7 +1623,7 @@ void CObjectViewer::resetSlots (uint instance) // Set no animation in slot UI for (uint j=0; jSaved.SlotInfo[j].Animation = ""; + _ListInstance[instance]->Saved.SlotInfo[j].Animation.clear(); // Reset the animation list _ListInstance[instance]->Saved.AnimationFileName.clear (); @@ -1739,7 +1743,7 @@ void CObjectViewer::serial (NLMISC::IStream& f) { if (ver <=3) { - ParticleWorkspaceFilename = ""; + ParticleWorkspaceFilename.clear(); } // First instance uint firstInstance = (uint)_ListInstance.size(); @@ -1782,17 +1786,16 @@ void CObjectViewer::serial (NLMISC::IStream& f) { // Add the mesh if (readed[i].SkeletonId != 0xffffffff) - instance = addMesh (serialShape.getShapePointer(), readed[i].ShapeFilename.c_str(), readed[i].SkeletonId + firstInstance, (readed[i].BindBoneName=="")?NULL:readed[i].BindBoneName.c_str()); + instance = addMesh (serialShape.getShapePointer(), readed[i].ShapeFilename.c_str(), readed[i].SkeletonId + firstInstance, (readed[i].BindBoneName.empty())?NULL:readed[i].BindBoneName.c_str()); else - instance = addMesh (serialShape.getShapePointer(), readed[i].ShapeFilename.c_str(), 0xffffffff, (readed[i].BindBoneName=="")?NULL:readed[i].BindBoneName.c_str()); + instance = addMesh (serialShape.getShapePointer(), readed[i].ShapeFilename.c_str(), 0xffffffff, (readed[i].BindBoneName.empty())?NULL:readed[i].BindBoneName.c_str()); } } else { // Error message - char message[512]; - smprintf (message, 512, "File not found %s", readed[i].ShapeFilename.c_str()); - _MainFrame->MessageBox (message, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str()); + _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); // Stop loading break; @@ -1823,12 +1826,11 @@ void CObjectViewer::serial (NLMISC::IStream& f) for (uint slot=0; slotSaved.SlotInfo[slot] = readed[i].SlotInfo[slot]; } - catch (Exception &e) + catch (const Exception &e) { // Error message - char message[512]; - smprintf (message, 512, "Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what()); - _MainFrame->MessageBox (message, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what()); + _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); // Stop loading break; @@ -1872,20 +1874,12 @@ void CObjectViewer::serial (NLMISC::IStream& f) // *************************************************************************** -bool CObjectViewer::loadInstanceGroup(const char *igFilename) +bool CObjectViewer::loadInstanceGroup(const std::string &igFilename) { //AFX_MANAGE_STATE(AfxGetStaticModuleState()); - // Add to the path - char drive[256]; - char dir[256]; - char path[256]; - // Add search path for the mesh - _splitpath (igFilename, drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - CPath::addSearchPath (path); - + CPath::addSearchPath (NLMISC::CFile::getPath(igFilename)); // Open a file CIFile file; @@ -1902,20 +1896,19 @@ bool CObjectViewer::loadInstanceGroup(const char *igFilename) // Append the ig. addInstanceGroup(ig); } - catch (Exception& e) + catch (const Exception& e) { // clean delete ig; - _MainFrame->MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); return false; } } else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", igFilename); - _MainFrame->MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str()); + _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); return false; } @@ -1928,21 +1921,16 @@ bool CObjectViewer::loadInstanceGroup(const char *igFilename) // *************************************************************************** -bool CObjectViewer::loadMesh (std::vector &meshFilename, const char* skeleton) +bool CObjectViewer::loadMesh (std::vector &meshFilename, const std::string &skeleton) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Add to the path - char drive[256]; - char dir[256]; - char path[256]; // Add search path for the skeleton - if (skeleton) + if (skeleton.empty()) { - _splitpath (skeleton, drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - CPath::addSearchPath (path); + CPath::addSearchPath (NLMISC::CFile::getPath(skeleton)); } // Open a file @@ -1957,7 +1945,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const char bool skelError=false; // Continue ? - if (skeleton&&(strcmp (skeleton, "")!=0)) + if (!skeleton.empty()) { // Open a file @@ -1973,9 +1961,9 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const char // Add the shape shapeSkel=streamShape.getShapePointer(); } - catch (Exception& e) + catch (const Exception& e) { - _MainFrame->MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); // error skelError=true; @@ -1984,9 +1972,8 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const char else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", meshFilename); - _MainFrame->MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str()); + _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); // error skelError=true; @@ -2007,12 +1994,10 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const char for (uint i=0; i &meshFilename, const char // Add the shape shapeMesh=streamShape.getShapePointer(); } - catch (Exception& e) + catch (const Exception& e) { - _MainFrame->MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); continue; } } else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", fileName); - _MainFrame->MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); + _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); continue; } @@ -2097,7 +2081,7 @@ void CObjectViewer::resetCamera () // *************************************************************************** -uint CObjectViewer::addMesh (NL3D::IShape* pMeshShape, const char* meshName, uint skelIndex, const char* bindSkelName, bool createInstance) +uint CObjectViewer::addMesh (NL3D::IShape* pMeshShape, const std::string &meshName, uint skelIndex, const char* bindSkelName, bool createInstance) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -2167,7 +2151,7 @@ uint CObjectViewer::addMesh (NL3D::IShape* pMeshShape, const char* meshName, uin { // Bind bone name uint bindBone = 0xffffffff; - std::string boneName = ""; + std::string boneName; // Name is passed, look for bone if (bindSkelName) @@ -2195,8 +2179,7 @@ uint CObjectViewer::addMesh (NL3D::IShape* pMeshShape, const char* meshName, uin listBones.push_back (transformSkel->Bones[bone].getBoneName()); // Get name of the mesh - char nameMesh[512]; - _splitpath (meshName, NULL, NULL, nameMesh, NULL); + std::string nameMesh = NLMISC::CFile::getFilenameWithoutExtension(meshName); // Select a bones std::string message = "Select a bone to stick " + string (nameMesh); @@ -2280,7 +2263,7 @@ bool CObjectViewer::isSkeletonPresent() const // *************************************************************************** -uint CObjectViewer::addCamera (const NL3D::CCameraInfo &cameraInfo, const char* cameraName) +uint CObjectViewer::addCamera (const NL3D::CCameraInfo &cameraInfo, const std::string &cameraName) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -2315,7 +2298,7 @@ uint CObjectViewer::addCamera (const NL3D::CCameraInfo &cameraInfo, const char* // *************************************************************************** -uint CObjectViewer::addSkel (NL3D::IShape* pSkelShape, const char* skelName) +uint CObjectViewer::addSkel (NL3D::IShape* pSkelShape, const std::string &skelName) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -2380,7 +2363,7 @@ IObjectViewer* IObjectViewer::getInterface (int version) // Check version number if (version!=OBJECT_VIEWER_VERSION) { - MessageBox (NULL, "Bad version of object_viewer.dll.", "NeL object viewer", MB_ICONEXCLAMATION|MB_OK); + MessageBox (NULL, _T("Bad version of object_viewer.dll."), _T("NeL object viewer"), MB_ICONEXCLAMATION|MB_OK); return NULL; } else @@ -2398,7 +2381,7 @@ void IObjectViewer::releaseInterface (IObjectViewer* view) // *************************************************************************** -void CObjectViewer::setSingleAnimation (NL3D::CAnimation* pAnim, const char* name, uint instance) +void CObjectViewer::setSingleAnimation (NL3D::CAnimation* pAnim, const std::string &name, uint instance) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -2408,7 +2391,7 @@ void CObjectViewer::setSingleAnimation (NL3D::CAnimation* pAnim, const char* nam _SelectedObject = instance; // Add the animation - addAnimation (pAnim, (name+std::string(".anim")).c_str(), name, instance); + addAnimation (pAnim, name + ".anim", name, instance); // Add the animation to the animationSet _AnimationSetDlg->UpdateData (TRUE); @@ -2417,7 +2400,7 @@ void CObjectViewer::setSingleAnimation (NL3D::CAnimation* pAnim, const char* nam // Set the animation in the first slot _ListInstance[instance]->Saved.SlotInfo[0].Animation = name; - _ListInstance[instance]->Saved.SlotInfo[0].Skeleton = ""; + _ListInstance[instance]->Saved.SlotInfo[0].Skeleton.clear(); _ListInstance[instance]->Saved.SlotInfo[0].Offset = 0; _ListInstance[instance]->Saved.SlotInfo[0].StartTime = (int)(pAnim->getBeginTime()*_AnimationDlg->Speed); _ListInstance[instance]->Saved.SlotInfo[0].EndTime = (int)(pAnim->getEndTime()*_AnimationDlg->Speed); @@ -2628,9 +2611,9 @@ void CObjectViewer::evalSoundTrack (float lastTime, float currentTime) { CEdit *edit = (CEdit*) _SoundAnimDlg->GetDlgItem(tab[i]); nlassert(edit); - char str[1024]; + TCHAR str[1024]; edit->GetLine(0, str, 1024); - SoundContext.Args[i] = atoi (str); + SoundContext.Args[i] = _ttoi (str); } // get the position of the skel if a skel is available @@ -2866,7 +2849,7 @@ void CObjectViewer::enableDynamicObjectLightingTest(NLPACS::CGlobalRetriever *gl if (!_ObjectLightTestShape.empty()) { string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape; - ::MessageBox(NULL, str.c_str(), "Dynamic Object Light Test", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, utf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK|MB_ICONEXCLAMATION); } // disable. _ObjectLightTest= NULL; @@ -2916,7 +2899,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) for (uint i=0; i<(uint)zones.size(); i++) _VegetableLandscapeZoneNames.push_back(zones.asString(i).c_str()); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLandscapeTileBank.clear(); _VegetableLandscapeTileFarBank.clear(); @@ -2934,7 +2917,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) // clamp to avoid divide/0. _VegetableLandscapeThreshold= max(_VegetableLandscapeThreshold, 0.001f); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLandscapeThreshold= 0.003f; } @@ -2944,7 +2927,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &tileNear= cf.getVar("veget_landscape_tile_near"); _VegetableLandscapeTileNear= tileNear.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLandscapeTileNear= 50; } @@ -2956,7 +2939,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) _VegetableLandscapeAmbient.G= color.asInt(1); _VegetableLandscapeAmbient.B= color.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLandscapeAmbient.set(80, 80, 80); } @@ -2968,7 +2951,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) _VegetableLandscapeDiffuse.G= color.asInt(1); _VegetableLandscapeDiffuse.B= color.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLandscapeDiffuse.set(255, 255, 255); } @@ -2978,7 +2961,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &var= cf.getVar("veget_landscape_snap_height"); _VegetableSnapHeight= var.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableSnapHeight= 1.70f; } @@ -2993,9 +2976,9 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &var= cf.getVar("veget_texture"); _VegetableTexture= var.asString(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { - _VegetableTexture= ""; + _VegetableTexture.clear(); } // vegetable ambient @@ -3006,7 +2989,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) _VegetableAmbient.G= color.asInt(1); _VegetableAmbient.B= color.asInt(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableAmbient.set(80, 80, 80); } @@ -3019,7 +3002,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) sint G= color.asInt(1) - _VegetableAmbient.G; clamp(G, 0, 255); _VegetableDiffuse.G= G; sint B= color.asInt(2) - _VegetableAmbient.B; clamp(B, 0, 255); _VegetableDiffuse.B= B; } - catch (EUnknownVar &) + catch (const EUnknownVar &) { sint R= 255 - _VegetableAmbient.R; clamp(R, 0, 255); _VegetableDiffuse.R= R; sint G= 255 - _VegetableAmbient.G; clamp(G, 0, 255); _VegetableDiffuse.G= G; @@ -3034,7 +3017,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) _VegetableLightDir.z= var.asFloat(2); _VegetableLightDir.normalize(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableLightDir.set(0, 1, -1); _VegetableLightDir.normalize(); @@ -3048,7 +3031,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) _VegetableWindDir.y= var.asFloat(1); _VegetableWindDir.z= var.asFloat(2); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableWindDir.x= 0.5f; _VegetableWindDir.y= 0.5f; @@ -3060,7 +3043,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &var= cf.getVar("veget_wind_freq"); _VegetableWindFreq= var.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableWindFreq= 0.5; } @@ -3070,7 +3053,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &var= cf.getVar("veget_wind_power"); _VegetableWindPower= var.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableWindPower= 1; } @@ -3080,7 +3063,7 @@ void CObjectViewer::loadVegetableLandscapeCfg(NLMISC::CConfigFile &cf) CConfigFile::CVar &var= cf.getVar("veget_wind_bend_min"); _VegetableWindBendMin= var.asFloat(); } - catch (EUnknownVar &) + catch (const EUnknownVar &) { _VegetableWindBendMin= 0; } @@ -3105,7 +3088,7 @@ bool CObjectViewer::createVegetableLandscape() try { - if(_VegetableLandscapeTileBank=="") + if(_VegetableLandscapeTileBank.empty()) { throw Exception("Landscape CFG not fully defined"); } @@ -3113,7 +3096,7 @@ bool CObjectViewer::createVegetableLandscape() // Load The Bank files (copied from CLandscapeUser :) ). // ================ // progress - dlgProgress.ProgressText.SetWindowText("Loading TileBanks..."); + dlgProgress.ProgressText.SetWindowText(_T("Loading TileBanks...")); dlgProgress.ProgressBar.SetPos(0); // load CIFile bankFile(CPath::lookup(_VegetableLandscapeTileBank)); @@ -3140,7 +3123,7 @@ bool CObjectViewer::createVegetableLandscape() if(CNELU::Driver) { // progress - dlgProgress.ProgressText.SetWindowText("Loading Tiles..."); + dlgProgress.ProgressText.SetWindowText(_T("Loading Tiles...")); dlgProgress.ProgressBar.SetPos(0); // count nbText to load. @@ -3195,7 +3178,7 @@ bool CObjectViewer::createVegetableLandscape() bool zoneLoaded= false; CAABBox landscapeBBox; // progress - dlgProgress.ProgressText.SetWindowText("Loading Zones..."); + dlgProgress.ProgressText.SetWindowText(_T("Loading Zones...")); dlgProgress.ProgressBar.SetPos(0); uint nbZones= (uint)_VegetableLandscapeZoneNames.size(); for(uint i=0; isetLandscape(&_VegetableLandscape->Landscape); _VegetableCollisionEntity= _VegetableCollisionManager->createEntity(); } - catch (Exception &e) + catch (const Exception &e) { // close the progress dialog dlgProgress.DestroyWindow(); - MessageBox(_MainFrame->m_hWnd, e.what(), "Failed to Load landscape", MB_OK | MB_APPLMODAL); + MessageBox(_MainFrame->m_hWnd, utf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL); // remove first possibly created collisions objects. if(_VegetableCollisionEntity) @@ -3536,10 +3519,10 @@ void CObjectViewer::refreshAnimationListeners() } // *************************************************************************** -void CObjectViewer::addAnimation (NL3D::CAnimation* anim, const char* filename, const char* name, uint instance) +void CObjectViewer::addAnimation(NL3D::CAnimation* anim, const std::string &filename, const std::string &name, uint instance) { // Add an animation - uint id = _ListInstance[instance]->AnimationSet.addAnimation (name, anim); + uint id = _ListInstance[instance]->AnimationSet.addAnimation (name.c_str(), anim); _ListInstance[instance]->Saved.AnimationFileName.push_back (filename); // Rebuild the animationSet @@ -3553,15 +3536,14 @@ void CObjectViewer::addAnimation (NL3D::CAnimation* anim, const char* filename, } // *************************************************************************** -void CObjectViewer::loadAnimation (const char* fileName, uint instance) +void CObjectViewer::loadAnimation(const std::string &fileName, uint instance) { // Open the file CIFile file; if (file.open (fileName)) { // Get the animation name - char name[256]; - _splitpath (fileName, NULL, NULL, name, NULL); + std::string name = NLMISC::CFile::getFilenameWithoutExtension(fileName); // Make an animation CAnimation *anim=new CAnimation; @@ -3575,22 +3557,20 @@ void CObjectViewer::loadAnimation (const char* fileName, uint instance) else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", fileName); - _MainFrame->MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); + _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } // *************************************************************************** -void CObjectViewer::loadSWT (const char* fileName, uint instance) +void CObjectViewer::loadSWT (const std::string &fileName, uint instance) { // Open the file CIFile file; if (file.open (fileName)) { // Get the animation name - char name[256]; - _splitpath (fileName, NULL, NULL, name, NULL); + std::string name = NLMISC::CFile::getFilenameWithoutExtension(fileName); // Get the skeleton pointer CSkeletonWeight* skel=new CSkeletonWeight; @@ -3599,7 +3579,7 @@ void CObjectViewer::loadSWT (const char* fileName, uint instance) skel->serial (file); // Add an animation - _ListInstance[instance]->AnimationSet.addSkeletonWeight (name, skel); + _ListInstance[instance]->AnimationSet.addSkeletonWeight (name.c_str(), skel); // Add the filename in the list _ListInstance[instance]->Saved.SWTFileName.push_back (fileName); @@ -3607,9 +3587,8 @@ void CObjectViewer::loadSWT (const char* fileName, uint instance) else { // Create a message - char msg[512]; - _snprintf (msg, 512, "Can't open the file %s for reading.", fileName); - _MainFrame->MessageBox (msg, "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); + _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } @@ -3688,8 +3667,8 @@ float CObjectViewer::getGlobalWindPower() const void CObjectViewer::shootScene() { - static const char BASED_CODE szFilter[] = "Targa Files (*.tga)|*.tga|Jpeg Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"; - CFileDialog fileDlg ( FALSE, ".tga", "*.tga", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static const TCHAR BASED_CODE szFilter[] = _T("PNG Files (*.png)|*.png|Targa Files (*.tga)|*.tga|Jpeg Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"); + CFileDialog fileDlg ( FALSE, _T(".tga"), _T("*.tga"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal () == IDOK) { // Choose the size @@ -3712,8 +3691,8 @@ void CObjectViewer::shootScene() CNELU::Driver->setupViewport (CViewport ()); // The file name - string filename = NLMISC::CFile::getFilenameWithoutExtension ((const char*)fileDlg.GetPathName ()); - string extension = NLMISC::CFile::getExtension ((const char*)fileDlg.GetPathName ()); + string filename = NLMISC::CFile::getFilenameWithoutExtension(tStrToUtf8(fileDlg.GetPathName())); + string extension = NLMISC::CFile::getExtension (tStrToUtf8(fileDlg.GetPathName())); // The file name without extension bool jpeg = toLower (extension) == "jpg"; @@ -3792,13 +3771,15 @@ void CObjectViewer::shootScene() } else { - _MainFrame->MessageBox (("Can't open the file "+filenamefinal+" for writing.").c_str (), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str()); + _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); break; } } - catch (Exception &e) + catch (const Exception &e) { - _MainFrame->MessageBox (("Error during writing of the file "+filenamefinal+" : "+(string)e.what ()).c_str (), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what()); + _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); break; } } @@ -3815,7 +3796,7 @@ void CObjectViewer::drawFXUserMatrix() { CString fxUserMatrix; fxUserMatrix.LoadString(IDS_FX_USER_MATRIX); - fxUserMatrixStr = (LPCTSTR) fxUserMatrix; + fxUserMatrixStr = tStrToUtf8(fxUserMatrix); stringRetrieved = true; } nlassert(_ParticleDlg); @@ -3830,7 +3811,7 @@ void CObjectViewer::drawFXMatrix() { CString fx; fx.LoadString(IDS_FX_MATRIX); - fxStr = (LPCTSTR) fx; + fxStr = tStrToUtf8(fx); stringRetrieved = true; } drawNamedMatrix(_ParticleDlg->getPSWorldMatrix(), fxStr, NLMISC::CRGBA::Blue, -0.2f, 10.f); @@ -3844,7 +3825,7 @@ void CObjectViewer::drawSceneMatrix() { CString sceneMatrix; sceneMatrix.LoadString(IDS_SCENE_MATRIX); - sceneMatrixStr = (LPCTSTR) sceneMatrix; + sceneMatrixStr = tStrToUtf8(sceneMatrix); stringRetrieved = true; } drawNamedMatrix(_SceneRoot->getMatrix(), sceneMatrixStr, NLMISC::CRGBA::White, 0.f, 10.f); @@ -3882,7 +3863,6 @@ uint CObjectViewer::getNumCamera () const int localizedMessageBox(HWND parentWindow, int messageStringID, int captionStringID, UINT nType) { - CString caption; CString mess; caption.LoadString(captionStringID); @@ -3891,7 +3871,7 @@ int localizedMessageBox(HWND parentWindow, int messageStringID, int captionStrin // TODO : replace older call to ::MessageBox in the object viewer with that function } -int localizedMessageBox(HWND parentWindow, const char *message, int captionStringID, UINT nType) +int localizedMessageBox(HWND parentWindow, const TCHAR *message, int captionStringID, UINT nType) { CString caption; caption.LoadString(captionStringID); @@ -3907,7 +3887,7 @@ CString getStrRsc(uint stringID) bool browseFolder(const CString &caption, CString &destFolder, HWND parent) { - char chosenPath[MAX_PATH]; + TCHAR chosenPath[MAX_PATH]; // browse folder BROWSEINFO bi; bi.hwndOwner = parent; diff --git a/code/nel/tools/3d/object_viewer/object_viewer.h b/code/nel/tools/3d/object_viewer/object_viewer.h index bcf48d58f..c00c5490d 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.h +++ b/code/nel/tools/3d/object_viewer/object_viewer.h @@ -22,24 +22,24 @@ #endif // _MSC_VER > 1000 -#define REGKEY_OBJ_VIEW "Software\\Nevrax\\nel\\object_viewer" -#define REGKEY_OBJ_VIEW_OPENGL_WND "Software\\Nevrax\\nel\\object_viewer\\opengl_wnd" -#define REGKEY_OBJ_VIEW_SCENE_DLG "Software\\Nevrax\\nel\\object_viewer\\scene_dlg" -#define REGKEY_OBJ_VIEW_ANIMATION_DLG "Software\\Nevrax\\nel\\object_viewer\\animation_dlg" -#define REGKEY_OBJ_VIEW_ANIMATION_SET_DLG "Software\\Nevrax\\nel\\object_viewer\\animation_set_dlg" -#define REGKEY_OBJ_VIEW_SLOT_DLG "Software\\Nevrax\\nel\\object_viewer\\slot_dlg" -#define REGKEY_OBJ_PARTICLE_DLG "Software\\Nevrax\\nel\\object_viewer\\particle_dlg" -#define REGKEY_OBJ_DAYNIGHT_DLG "Software\\Nevrax\\nel\\object_viewer\\daynight_dlg" -#define REGKEY_OBJ_WATERPOOL_DLG "Software\\Nevrax\\nel\\object_viewer\\daynight_dlg" -#define REGKEY_OBJ_VIEW_VEGETABLE_DLG "Software\\Nevrax\\nel\\object_viewer\\vegetable_dlg" -#define REGKEY_OBJ_GLOBAL_WIND_DLG "Software\\Nevrax\\nel\\object_viewer\\global_wind_dlg" -#define REGKEY_OBJ_SOUND_ANIM_DLG "Software\\Nevrax\\nel\\object_viewer\\sound_anim_dlg" -#define REGKEY_OBJ_LIGHT_GROUP_DLG "Software\\Nevrax\\nel\\object_viewer\\light_group_dlg" -#define REGKEY_CHOOSE_FRAME_DELAY_DLG "Software\\Nevrax\\nel\\object_viewer\\choose_frame_delay_dlg" -#define REGKEY_CHOOSE_BG_COLOR_DLG "Software\\Nevrax\\nel\\object_viewer\\choose_bg_color_dlg" -#define REGKEY_CHOOSE_SUN_COLOR_DLG "Software\\Nevrax\\nel\\object_viewer\\choose_sun_color_dlg" -#define REGKEY_SKELETON_SCALE_DLG "Software\\Nevrax\\nel\\object_viewer\\skeleton_scale_dlg" -#define REGKEY_TUNE_MRM_DLG "Software\\Nevrax\\nel\\object_viewer\\tune_mrm_dlg" +#define REGKEY_OBJ_VIEW _T("Software\\Nevrax\\nel\\object_viewer") +#define REGKEY_OBJ_VIEW_OPENGL_WND _T("Software\\Nevrax\\nel\\object_viewer\\opengl_wnd") +#define REGKEY_OBJ_VIEW_SCENE_DLG _T("Software\\Nevrax\\nel\\object_viewer\\scene_dlg") +#define REGKEY_OBJ_VIEW_ANIMATION_DLG _T("Software\\Nevrax\\nel\\object_viewer\\animation_dlg") +#define REGKEY_OBJ_VIEW_ANIMATION_SET_DLG _T("Software\\Nevrax\\nel\\object_viewer\\animation_set_dlg") +#define REGKEY_OBJ_VIEW_SLOT_DLG _T("Software\\Nevrax\\nel\\object_viewer\\slot_dlg") +#define REGKEY_OBJ_PARTICLE_DLG _T("Software\\Nevrax\\nel\\object_viewer\\particle_dlg") +#define REGKEY_OBJ_DAYNIGHT_DLG _T("Software\\Nevrax\\nel\\object_viewer\\daynight_dlg") +#define REGKEY_OBJ_WATERPOOL_DLG _T("Software\\Nevrax\\nel\\object_viewer\\daynight_dlg") +#define REGKEY_OBJ_VIEW_VEGETABLE_DLG _T("Software\\Nevrax\\nel\\object_viewer\\vegetable_dlg") +#define REGKEY_OBJ_GLOBAL_WIND_DLG _T("Software\\Nevrax\\nel\\object_viewer\\global_wind_dlg") +#define REGKEY_OBJ_SOUND_ANIM_DLG _T("Software\\Nevrax\\nel\\object_viewer\\sound_anim_dlg") +#define REGKEY_OBJ_LIGHT_GROUP_DLG _T("Software\\Nevrax\\nel\\object_viewer\\light_group_dlg") +#define REGKEY_CHOOSE_FRAME_DELAY_DLG _T("Software\\Nevrax\\nel\\object_viewer\\choose_frame_delay_dlg") +#define REGKEY_CHOOSE_BG_COLOR_DLG _T("Software\\Nevrax\\nel\\object_viewer\\choose_bg_color_dlg") +#define REGKEY_CHOOSE_SUN_COLOR_DLG _T("Software\\Nevrax\\nel\\object_viewer\\choose_sun_color_dlg") +#define REGKEY_SKELETON_SCALE_DLG _T("Software\\Nevrax\\nel\\object_viewer\\skeleton_scale_dlg") +#define REGKEY_TUNE_MRM_DLG _T("Software\\Nevrax\\nel\\object_viewer\\tune_mrm_dlg") @@ -234,19 +234,19 @@ public: void releaseUI (); // Set single animtion. - void setSingleAnimation (NL3D::CAnimation* pAnim, const char* name, uint instance); + void setSingleAnimation (NL3D::CAnimation* pAnim, const std::string &name, uint instance); // Set automatic animation void setAutoAnimation (NL3D::CAnimationSet* pAnimSet); // Add a mesh - uint addMesh (NL3D::IShape* pMeshShape, const char* meshName, uint skelIndex, const char* bindSkelName = NULL, bool createInstance = true); + uint addMesh(NL3D::IShape* pMeshShape, const std::string &meshName, uint skelIndex, const char* bindSkelName = NULL, bool createInstance = true); // Add a camera - uint addCamera (const NL3D::CCameraInfo &cameraInfo, const char* cameraName); + uint addCamera (const NL3D::CCameraInfo &cameraInfo, const std::string &cameraName); // Add a skel - uint addSkel (NL3D::IShape* pSkelShape, const char* skelName); + uint addSkel (NL3D::IShape* pSkelShape, const std::string &skelName); // remove all instances from the scene void removeAllInstancesFromScene(); @@ -262,10 +262,10 @@ public: void shuffleTextureSet(); // Load a mesh - bool loadMesh (std::vector &meshFilename, const char* skeleton=""); + bool loadMesh (std::vector &meshFilename, const std::string &skeleton = ""); // Load an instance group - bool loadInstanceGroup(const char *igFilename); + bool loadInstanceGroup(const std::string &igFilename); // Set ambient color void setAmbientColor (const NLMISC::CRGBA& color); @@ -289,7 +289,7 @@ public: uint getNumInstance () const; // Add an animation - void addAnimation (NL3D::CAnimation* anim, const char* filename, const char* name, uint instance); + void addAnimation (NL3D::CAnimation* anim, const std::string &filename, const std::string &name, uint instance); // Update all objects that depend on the animation set void refreshAnimationListeners(); @@ -308,10 +308,10 @@ public: CChooseFrameDelay *getFrameDelayDlg() const { return _ChooseFrameDelayDlg; } // Load animation - void loadAnimation (const char* fileName, uint instance); + void loadAnimation(const std::string &fileName, uint instance); // Load a skeleton template - void loadSWT (const char* fileName, uint instance); + void loadSWT(const std::string &fileName, uint instance); /// Not exported @@ -387,7 +387,7 @@ public: /// inherited from CObjectViewerInterface void setWaterPoolManager(NL3D::CWaterPoolManager &wpm) { _Wpm = &wpm; } - NL3D::CWaterPoolManager &getWaterPoolManager() { return *_Wpm; } + NL3D::CWaterPoolManager &getWaterPoolManager() const { return *_Wpm; } // Reload textures void reloadTextures (); @@ -650,8 +650,8 @@ private: void drawNamedMatrix(const NLMISC::CMatrix &matrix, const std::string &name, NLMISC::CRGBA color, float textZOffset, float testSize); }; -void setRegisterWindowState (const CWnd *pWnd, const char* keyName); -void getRegisterWindowState (CWnd *pWnd, const char* keyName, bool resize); +void setRegisterWindowState (const CWnd *pWnd, const TCHAR* keyName); +void getRegisterWindowState (CWnd *pWnd, const TCHAR* keyName, bool resize); /** display a localized message box. Caption an message text are retrieved from the string table * \param parentWindow Pointer to initiator of the message box @@ -661,7 +661,7 @@ void getRegisterWindowState (CWnd *pWnd, const char* keyName, bool resize); * \return Same value than ::MessageBox */ int localizedMessageBox(HWND parentWindow, int messageStringID, int captionStringID, UINT nType); -int localizedMessageBox(HWND parentWindow, const char *message, int captionStringID, UINT nType); +int localizedMessageBox(HWND parentWindow, const TCHAR *message, int captionStringID, UINT nType); // Return a string from the string table CString getStrRsc(uint stringID); diff --git a/code/nel/tools/3d/object_viewer/object_viewer_interface.h b/code/nel/tools/3d/object_viewer/object_viewer_interface.h index a8eb696b3..e6df63394 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer_interface.h +++ b/code/nel/tools/3d/object_viewer/object_viewer_interface.h @@ -69,25 +69,25 @@ public: virtual void releaseUI () = 0; // Add a mesh - virtual uint addMesh (NL3D::IShape* pMeshShape, const char* meshName, uint skelIndex, const char* bindSkelName = NULL, bool createInstance = true) = 0; + virtual uint addMesh(NL3D::IShape* pMeshShape, const std::string &meshName, uint skelIndex, const char* bindSkelName = NULL, bool createInstance = true) = 0; // Add a skel - virtual uint addSkel (NL3D::IShape* pSkelShape, const char* skelName) = 0; + virtual uint addSkel (NL3D::IShape* pSkelShape, const std::string &skelName) = 0; // Add a camera - virtual uint addCamera (const NL3D::CCameraInfo &cameraInfo, const char* cameraName) = 0; + virtual uint addCamera (const NL3D::CCameraInfo &cameraInfo, const std::string &cameraName) = 0; // remove all the instance from the scene virtual void removeAllInstancesFromScene() = 0; // Load a mesh - virtual bool loadMesh (std::vector &meshFilename, const char* skeleton) = 0; + virtual bool loadMesh (std::vector &meshFilename, const std::string &skeleton) = 0; // Load a shape virtual void resetCamera () = 0; // Set single animation - virtual void setSingleAnimation (NL3D::CAnimation* pAnim, const char* name, uint instance) = 0; + virtual void setSingleAnimation (NL3D::CAnimation* pAnim, const std::string &name, uint instance) = 0; // Set automatic animation virtual void setAutoAnimation (NL3D::CAnimationSet* pAnimSet) = 0; diff --git a/code/nel/tools/3d/object_viewer/particle_dlg.cpp b/code/nel/tools/3d/object_viewer/particle_dlg.cpp index f56bfa1dd..8a886aa1f 100644 --- a/code/nel/tools/3d/object_viewer/particle_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/particle_dlg.cpp @@ -419,7 +419,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons psNode.setModified(false); setStatusBarText(CString(fullPath.c_str()) + " " + getStrRsc(IDS_SAVED)); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { if (askToContinueWhenError) { @@ -428,7 +428,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons } else { - ::MessageBox(parent, e.what(), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + ::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); return false; } } @@ -468,13 +468,13 @@ bool CParticleDlg::loadPS(HWND parent, CParticleWorkspace::CNode &psNode, TLoadP setStatusBarText(CString(psNode.getFullPath().c_str()) + " " + getStrRsc(IDS_LOADED)); } } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { switch(behav) { case Silent: return false; // no op case ReportError: - ::MessageBox(parent, e.what(), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); return true; break; case ReportErrorSkippable: @@ -547,9 +547,9 @@ void CParticleDlg::OnCreateNewPsWorkspace() { newPW->save(); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { - MessageBox(e.what(), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); } closeWorkspace(); _PW = newPW; @@ -563,11 +563,11 @@ void CParticleDlg::OnCreateNewPsWorkspace() void CParticleDlg::OnLoadPSWorkspace() { checkModifiedWorkSpace(); - static const char BASED_CODE szFilter[] = "particle workspaces(*.pws)|*.pws||"; - CFileDialog fd( TRUE, ".pws", "*.pws", 0, szFilter); + static const TCHAR BASED_CODE szFilter[] = _T("particle workspaces(*.pws)|*.pws||"); + CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter); INT_PTR result = fd.DoModal(); if (result != IDOK) return; - loadWorkspace((LPCTSTR) fd.GetPathName()); + loadWorkspace(tStrToUtf8(fd.GetPathName())); } //************************************************************************************************************************** @@ -583,9 +583,9 @@ void CParticleDlg::loadWorkspace(const std::string &fullPath) newPW->load(); setStatusBarText(CString(newPW->getFilename().c_str()) + " " + getStrRsc(IDS_LOADED)); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { - MessageBox(e.what(), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); return; } @@ -633,9 +633,9 @@ void CParticleDlg::saveWorkspaceStructure() _PW->save(); setStatusBarText(CString(_PW->getFilename().c_str()) + " " + getStrRsc(IDS_SAVED)); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { - localizedMessageBox(*this, e.what(), IDS_ERROR, MB_ICONEXCLAMATION); + localizedMessageBox(*this, utf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); } } diff --git a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp index 248a5cd1e..17b4892fe 100644 --- a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp +++ b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp @@ -34,12 +34,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } @@ -221,14 +221,16 @@ void CParticleSystemEdit::updateDieOnEventParams() ew = FALSE; } GetDlgItem(IDC_APPLY_AFTER_DELAY)->EnableWindow(ew); - char out[128]; + + CString out; + if (_Node->getPSPointer()->getDelayBeforeDeathConditionTest() >= 0) { - sprintf(out, "%.2g", _Node->getPSPointer()->getDelayBeforeDeathConditionTest()); + out.Format(_T("%.2g"), _Node->getPSPointer()->getDelayBeforeDeathConditionTest()); } else { - strcpy(out,"???"); + out = _T("???"); } GetDlgItem(IDC_APPLY_AFTER_DELAY)->SetWindowText(out); ((CButton *) GetDlgItem(IDC_AUTO_DELAY))->SetCheck(autoDelay ? 1 : 0); @@ -269,9 +271,9 @@ void CParticleSystemEdit::updatePrecomputedBBoxParams() if (!ew) { - m_BBoxX = ""; - m_BBoxY = ""; - m_BBoxZ = ""; + m_BBoxX.Empty(); + m_BBoxY.Empty(); + m_BBoxZ.Empty(); } else { @@ -394,13 +396,14 @@ void CParticleSystemEdit::OnEnableSlowDown() void CParticleSystemEdit::updateBBoxFromText() { NLMISC::CVector h; - char inX[128], inY[128], inZ[128]; + TCHAR inX[128], inY[128], inZ[128]; m_BBoxXCtrl.GetWindowText(inX, 128); m_BBoxYCtrl.GetWindowText(inY, 128); m_BBoxZCtrl.GetWindowText(inZ, 128); - if (sscanf(inX, "%f", &h.x) == 1 - && sscanf(inY, "%f", &h.y) == 1 - && sscanf(inZ, "%f", &h.z) == 1 + + if (_tcscanf(inX, "%f", &h.x) == 1 + && _tcscanf(inY, "%f", &h.y) == 1 + && _tcscanf(inZ, "%f", &h.z) == 1 ) { NLMISC::CAABBox b; @@ -409,7 +412,7 @@ void CParticleSystemEdit::updateBBoxFromText() } else { - MessageBox("Invalid entry","error", MB_OK); + MessageBox(_T("Invalid entry"), _T("error"), MB_OK); } } @@ -456,11 +459,12 @@ void CParticleSystemEdit::OnDieWhenOutOfFrustum() void CParticleSystemEdit::OnChangeApplyAfterDelay() { if (_Node->getPSPointer()->getAutoComputeDelayBeforeDeathConditionTest()) return; - // - char in[128]; - GetDlgItem(IDC_APPLY_AFTER_DELAY)->GetWindowText(in, 128); + + TCHAR in[128]; + GetDlgItem(IDC_APPLY_AFTER_DELAY)->GetWindowText(in, 128); + float value; - if (sscanf(in, "%f", &value) == 1) + if (_tcscanf(in, "%f", &value) == 1) { if (_Node->getPSPointer()->getDelayBeforeDeathConditionTest() != value) { @@ -728,7 +732,7 @@ void CParticleSystemEdit::OnEnableLoadBalancing() UpdateData(TRUE); if (m_EnableLoadBalancing == FALSE) { - int result = MessageBox("Are you sure ?", "Load balancing on/off", MB_OKCANCEL); + int result = MessageBox(_T("Are you sure ?"), _T("Load balancing on/off"), MB_OKCANCEL); if (result == IDOK) { _Node->getPSPointer()->enableLoadBalancing(false); @@ -791,7 +795,7 @@ void CParticleSystemEdit::OnBypassMaxNumSteps() UpdateData(TRUE); if (m_BypassMaxNumSteps && !_Node->getPSPointer()->canFinish()) { - MessageBox("The system must have a finite duration for this setting! Please check that.", "error", MB_ICONEXCLAMATION); + MessageBox(_T("The system must have a finite duration for this setting! Please check that."), _T("error"), MB_ICONEXCLAMATION); return; } _Node->getPSPointer()->setBypassMaxNumIntegrationSteps(m_BypassMaxNumSteps != FALSE); diff --git a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp index 9c58cd875..c392b1481 100644 --- a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp @@ -165,7 +165,7 @@ void CParticleTreeCtrl::rebuildLocatedInstance(CParticleWorkspace::CNode &node) CNodeType *newNt = new CNodeType(loc, k); _NodeTypes.push_back(newNt); // bind located instance icon - InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, "instance", PSIconLocatedInstance, PSIconLocatedInstance, 0, 0, (LPARAM) newNt, currLocated, TVI_LAST); + InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, _T("instance"), PSIconLocatedInstance, PSIconLocatedInstance, 0, 0, (LPARAM) newNt, currLocated, TVI_LAST); } currLocated = GetNextItem(currLocated, TVGN_NEXT); } @@ -213,7 +213,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H if (node.isLoaded()) { // bind particle system icon - HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, computeCaption(node).c_str(), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); + HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); // set the param (doesn't seems to work during first creation) SetItemData(psRoot, (LPARAM) nt); // now, create each located @@ -228,7 +228,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H else { // bind a bitmap that say that the PS hasn't been loaded - HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, computeCaption(node).c_str(), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); + HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); SetItemData(psRoot, (LPARAM) nt); return psRoot; } @@ -242,7 +242,7 @@ void CParticleTreeCtrl::buildTreeFromWorkSpace(CParticleWorkspace &ws) CNodeType *nt = new CNodeType(&ws); _NodeTypes.push_back(nt); // bind particle system icon - HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, computeCaption(ws).c_str(), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); + HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); // set the param (doesn't seems to work during first creation) SetItemData(rootHandle, (LPARAM) nt); // now, create each particle system @@ -259,7 +259,7 @@ void CParticleTreeCtrl::createNodeFromLocated(NL3D::CPSLocated *loc, HTREEITEM CNodeType *nt = new CNodeType(loc); _NodeTypes.push_back(nt); // bind located icon - HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM |TVIF_TEXT, loc->getName().c_str() , PSIconLocated, PSIconLocated, 0, 0, (LPARAM) nt, rootHandle, TVI_LAST); + HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM |TVIF_TEXT, utf8ToTStr(loc->getName()) , PSIconLocated, PSIconLocated, 0, 0, (LPARAM) nt, rootHandle, TVI_LAST); // now, insert each object that is bound to the located for (uint l = 0; l < loc->getNbBoundObjects(); ++l) { @@ -273,7 +273,7 @@ void CParticleTreeCtrl::createNodeFromLocatedBindable(NL3D::CPSLocatedBindable * // we ordered the image so that they match the type for a located bindable (force, particles, collision zones...) CNodeType *nt = new CNodeType(lb); _NodeTypes.push_back(nt); - InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , lb->getName().c_str() , lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM) nt, rootHandle, TVI_LAST); + InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , utf8ToTStr(lb->getName()) , lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM) nt, rootHandle, TVI_LAST); } @@ -995,30 +995,26 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA case IDM_MERGE_PS: { _ParticleDlg->StartStopDlg->stop(); - static char BASED_CODE szFilter[] = "ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"; - CFileDialog fd( TRUE, ".ps", "*.ps;*.shape", 0, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"); + CFileDialog fd( TRUE, _T(".ps"), _T("*.ps;*.shape"), 0, szFilter); if (fd.DoModal() == IDOK) { CParticleWorkspace::CNode *ownerNode = getOwnerNode(nt); nlassert(ownerNode); - // Add to the path - char drive[256]; - char dir[256]; - char path[256]; + // Add search path for the texture - _splitpath (fd.GetPathName(), drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - NLMISC::CPath::addSearchPath (path); + NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); + std::auto_ptr sb(new NL3D::CShapeBank); CParticleSystemModel *psm = NULL; try { NL3D::CShapeStream ss; NLMISC::CIFile inputFile; - inputFile.open((LPCTSTR) fd.GetPathName()); + inputFile.open(tStrToUtf8(fd.GetPathName())); ss.serial(inputFile); - std::string shapeName = NLMISC::CFile::getFilename((LPCTSTR) fd.GetPathName()); + std::string shapeName = NLMISC::CFile::getFilename(tStrToUtf8(fd.GetPathName())); sb->add(shapeName, ss.getShapePointer()); NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank(); CNELU::Scene->setShapeBank(sb.get()); @@ -1041,9 +1037,9 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA return false; } } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { - MessageBox(e.what(), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); return TRUE; } ownerNode->setResetAutoCountFlag(false); @@ -1099,11 +1095,11 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA { _ParticleDlg->StartStopDlg->stop(); std::string fileName = nt->PS->getFilename(); - static char BASED_CODE szFilter[] = "ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"; - CFileDialog fd(FALSE, ".ps", fileName.c_str(), OFN_OVERWRITEPROMPT, szFilter, this); + static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"); + CFileDialog fd(FALSE, _T(".ps"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this); if (fd.DoModal() == IDOK) { - _ParticleDlg->savePSAs(*this, *nt->PS, (LPCTSTR) fd.GetPathName(), false); + _ParticleDlg->savePSAs(*this, *nt->PS, tStrToUtf8(fd.GetPathName()), false); } } } @@ -1198,7 +1194,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA } if (!nt->Loc->bind(toCreate)) { - MessageBox("The system is flagged with 'No max Nb steps', or uses the preset 'Spell FX'. System must have finite duration. Can't add object. To solve this, set a limited life time for the father.", "Error", MB_ICONEXCLAMATION); + MessageBox(_T("The system is flagged with 'No max Nb steps', or uses the preset 'Spell FX'. System must have finite duration. Can't add object. To solve this, set a limited life time for the father."), _T("Error"), MB_ICONEXCLAMATION); delete toCreate; if (createLocAndBindable) { @@ -1253,7 +1249,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA } getOwnerNode(nt)->setModified(true); // TODO : an enum for CPSLocatedBindable::getType would be better... - InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, toCreate->getName().c_str(), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM) newNt, father, lastSon); + InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM) newNt, father, lastSon); touchPSState(nt); Invalidate(); _ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt)); @@ -1284,7 +1280,7 @@ std::pair CParticleTreeCtrl::createL CNodeType *newNt = new CNodeType(loc); _NodeTypes.push_back(newNt); // insert item in tree - HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, name.c_str(), PSIconLocated, PSIconLocated, 0, 0, (LPARAM) newNt, headItem, TVI_LAST); + HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM) newNt, headItem, TVI_LAST); touchPSState(newNt); return std::make_pair(newNt, insertedItem); } @@ -1303,7 +1299,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) { case CNodeType::workspace: { - nt->WS->setName(std::string(info->item.pszText)); + nt->WS->setName(tStrToUtf8(info->item.pszText)); workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter) } break; @@ -1315,10 +1311,10 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) } else { - nt->PS->getPSPointer()->setName(std::string(info->item.pszText)); + nt->PS->getPSPointer()->setName(tStrToUtf8(info->item.pszText)); nt->PS->setModified(true); } - this->SetItemText(info->item.hItem, computeCaption(*nt->PS).c_str()); + this->SetItemText(info->item.hItem, utf8ToTStr(computeCaption(*nt->PS))); } break; case CNodeType::located: @@ -1326,7 +1322,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) nlassert(getOwnerNode(nt)); getOwnerNode(nt)->setModified(true); this->SetItemText(info->item.hItem, info->item.pszText); - nt->Loc->setName(std::string(info->item.pszText)); + nt->Loc->setName(tStrToUtf8(info->item.pszText)); } break; case CNodeType::locatedBindable: @@ -1334,7 +1330,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) nlassert(getOwnerNode(nt)); getOwnerNode(nt)->setModified(true); this->SetItemText(info->item.hItem, info->item.pszText); - nt->Bind->setName(std::string(info->item.pszText)); + nt->Bind->setName(tStrToUtf8(info->item.pszText)); } break; } @@ -1470,7 +1466,7 @@ void CParticleTreeCtrl::updateCaption(CParticleWorkspace::CNode &node) HTREEITEM item = getTreeItem(&node); if (!item) return; // update name of ps to dipslay a star in front of it (this tells that the ps has been modified) - SetItemText(item, computeCaption(node).c_str()); + SetItemText(item, utf8ToTStr(computeCaption(node))); } //**************************************************************************************************************** @@ -1528,11 +1524,11 @@ std::string CParticleTreeCtrl::computeCaption(CParticleWorkspace &workspace) //**************************************************************************************************************** void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) { - static const char BASED_CODE szFilter[] = "NeL Particle systems (*.ps)|*.ps||"; - CFileDialog fd(TRUE, ".ps", "*.ps", OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST, szFilter, this); + static const TCHAR BASED_CODE szFilter[] = _T("NeL Particle systems (*.ps)|*.ps||"); + CFileDialog fd(TRUE, _T(".ps"), _T("*.ps"), OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST, szFilter, this); const uint MAX_NUM_CHAR = 65536; - char filenamesBuf[MAX_NUM_CHAR]; - strcpy(filenamesBuf, "*.ps"); + TCHAR filenamesBuf[MAX_NUM_CHAR]; + _tcscpy(filenamesBuf, _T("*.ps")); fd.m_ofn.lpstrFile = filenamesBuf; fd.m_ofn.nMaxFile = MAX_NUM_CHAR - 1; if (fd.DoModal() == IDOK) @@ -1547,7 +1543,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) while (pos) { CString path = fd.GetNextPathName(pos); - CParticleWorkspace::CNode *node = pws.addNode((LPCTSTR) path); + CParticleWorkspace::CNode *node = pws.addNode(tStrToUtf8(path)); if (!node) { if (diplayNodeAlreadyInserted) @@ -1560,7 +1556,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) } else { - MessageBox(NLMISC::CFile::getFilename((LPCTSTR)path).c_str() + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + MessageBox(CString(utf8ToTStr(NLMISC::CFile::getFilename(tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); } } continue; @@ -1595,7 +1591,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) } } // update modified state - SetItemText(GetRootItem(), computeCaption(pws).c_str()); + SetItemText(GetRootItem(), utf8ToTStr(computeCaption(pws))); } } @@ -1738,29 +1734,29 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult) switch (nt->Type) { case CNodeType::workspace: - pEdit->SetWindowText(nt->WS->getName().c_str()); + pEdit->SetWindowText(utf8ToTStr(nt->WS->getName())); break; case CNodeType::particleSystem: { if (!nt->PS->isLoaded()) { - pEdit->SetWindowText(""); + pEdit->SetWindowText(_T("")); //localizedMessageBox(*this, IDS_CANT_CHANGE_PS_NAME, IDS_ERROR, MB_OK|MB_ICONEXCLAMATION); } else { - pEdit->SetWindowText(nt->PS->getPSPointer()->getName().c_str()); + pEdit->SetWindowText(utf8ToTStr(nt->PS->getPSPointer()->getName())); } } break; case CNodeType::located: { - pEdit->SetWindowText(nt->Loc->getName().c_str()); + pEdit->SetWindowText(utf8ToTStr(nt->Loc->getName())); } break; case CNodeType::locatedBindable: { - pEdit->SetWindowText(nt->Bind->getName().c_str()); + pEdit->SetWindowText(utf8ToTStr(nt->Bind->getName())); } break; } @@ -1857,10 +1853,10 @@ void CParticleTreeCtrl::updateAllCaptions() switch(nt->Type) { case CNodeType::particleSystem: - SetItemText(curr, computeCaption(*nt->PS).c_str()); + SetItemText(curr, utf8ToTStr(computeCaption(*nt->PS))); break; case CNodeType::workspace: - SetItemText(curr, computeCaption(*nt->WS).c_str()); + SetItemText(curr, utf8ToTStr(computeCaption(*nt->WS))); break; case CNodeType::located: case CNodeType::locatedBindable: diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.cpp b/code/nel/tools/3d/object_viewer/particle_workspace.cpp index e5823d178..c94948d71 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.cpp +++ b/code/nel/tools/3d/object_viewer/particle_workspace.cpp @@ -100,8 +100,8 @@ void CParticleWorkspace::CNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel, void CParticleWorkspace::CNode::unstickPSFromSkeleton() { nlassert(_WS); - _ParentSkelName = ""; - _ParentBoneName = ""; + _ParentSkelName.clear(); + _ParentBoneName.clear(); if (!_PSM) return; if (_ParentSkel) { diff --git a/code/nel/tools/3d/object_viewer/pick_sound.cpp b/code/nel/tools/3d/object_viewer/pick_sound.cpp index 280a65326..2f67147a8 100644 --- a/code/nel/tools/3d/object_viewer/pick_sound.cpp +++ b/code/nel/tools/3d/object_viewer/pick_sound.cpp @@ -74,7 +74,7 @@ BOOL CPickSound::OnInitDialog() for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it) { - m_NameList.AddString((*it).toString().c_str()); + m_NameList.AddString(utf8ToTStr((*it).toString())); } _Timer = SetTimer (1, 100, NULL); @@ -107,11 +107,11 @@ BOOL CPickSound::OnInitDialog() void CPickSound::OnSelchange() { UpdateData(); - char str[1024]; + TCHAR str[1024]; nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024); m_NameList.GetText(m_NameList.GetCurSel(), str); - _CurrName = NLMISC::CSheetId(str, "sound"); + _CurrName = NLMISC::CSheetId(tStrToUtf8(str), "sound"); } @@ -123,7 +123,7 @@ void CPickSound::OnPlaySound() stopCurrSource(); CString sName; m_NameList.GetText(curSel, sName); - CSoundSystem::create(std::string( (LPCTSTR) sName)); + CSoundSystem::create(tStrToUtf8(sName)); } //======================================================================================== diff --git a/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp b/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp index 21a1a2fac..4f1374eb2 100644 --- a/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp @@ -85,7 +85,9 @@ void CPrecomputedRotationsDlg::updateFromReader(void) } else { - m_NbModels = m_RotSpeedMin = m_RotSpeedMax = ""; + m_NbModels.Empty(); + m_RotSpeedMin.Empty(); + m_RotSpeedMax.Empty(); } UpdateData(FALSE); @@ -124,7 +126,7 @@ void CPrecomputedRotationsDlg::OnUpdateMinRotSpeed() nlassert(_RotatedParticle); UpdateData(); float newValue, valueMin, valueMax; - if (sscanf(m_RotSpeedMin, "%f", &newValue) == 1) + if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMin), newValue)) { uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); valueMin = newValue; @@ -133,7 +135,7 @@ void CPrecomputedRotationsDlg::OnUpdateMinRotSpeed() } else { - MessageBox("invalid value !!"); + MessageBox(_T("invalid value !!")); } UpdateData(FALSE); updateModifiedFlag(); @@ -144,7 +146,7 @@ void CPrecomputedRotationsDlg::OnUpdateMaxRotSpeed() nlassert(_RotatedParticle); UpdateData(); float newValue, valueMin, valueMax; - if (sscanf(m_RotSpeedMax, "%f", &newValue) == 1) + if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMax), newValue)) { uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); valueMax = newValue; @@ -153,7 +155,7 @@ void CPrecomputedRotationsDlg::OnUpdateMaxRotSpeed() } else { - MessageBox("invalid value !!"); + MessageBox(_T("invalid value !!")); } UpdateData(FALSE); updateModifiedFlag(); @@ -165,7 +167,7 @@ void CPrecomputedRotationsDlg::OnUpdateNbModels() UpdateData(); float valueMin, valueMax; sint32 newNbModels; - bool valid = (sscanf(m_NbModels, "%d", &newNbModels) == 1 && newNbModels > 0); + bool valid = (NLMISC::fromString(tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0); if (dynamic_cast(_RotatedParticle)) { valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels); @@ -178,7 +180,7 @@ void CPrecomputedRotationsDlg::OnUpdateNbModels() } else { - MessageBox("invalid value !!"); + MessageBox(_T("invalid value !!")); } UpdateData(FALSE); updateModifiedFlag(); diff --git a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp index dce09b3dc..a916cee6f 100644 --- a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp @@ -46,9 +46,9 @@ CPSMoverDlg::CPSMoverDlg(CParticleWorkspace::CNode *ownerNode, CWnd *parent, NL3 const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; - m_X.Format("%.3g", pos.x); - m_Y.Format("%.3g", pos.y); - m_Z.Format("%.3g", pos.z); + m_X.Format(_T("%.3g"), pos.x); + m_Y.Format(_T("%.3g"), pos.y); + m_Z.Format(_T("%.3g"), pos.z); //{{AFX_DATA_INIT(CPSMoverDlg) //}}AFX_DATA_INIT @@ -84,9 +84,9 @@ void CPSMoverDlg::updatePosition(void) UpdateData(); const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; - m_X.Format("%.3g", pos.x); - m_Y.Format("%.3g", pos.y); - m_Z.Format("%.3g", pos.z); + m_X.Format(_T("%.3g"), pos.x); + m_Y.Format(_T("%.3g"), pos.y); + m_Z.Format(_T("%.3g"), pos.z); UpdateData(FALSE); } @@ -120,14 +120,14 @@ void CPSMoverDlg::OnUpdateXpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float x; - if (::sscanf(m_X, "%f", &x) == 1) + if (NLMISC::fromString(tStrToUtf8(m_X), x)) { pos.x = x; updateListener(); } else { - MessageBox("invalid entry", "error"); + MessageBox(_T("invalid entry"), _T("error")); } UpdateData(FALSE); } @@ -137,14 +137,14 @@ void CPSMoverDlg::OnUpdateYpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float y; - if (::sscanf(m_Y, "%f", &y) == 1) + if (NLMISC::fromString(tStrToUtf8(m_Y), y)) { pos.y = y; updateListener(); } else { - MessageBox("invalid entry", "error"); + MessageBox(_T("invalid entry"), _T("error")); } UpdateData(FALSE); } @@ -154,14 +154,14 @@ void CPSMoverDlg::OnUpdateZpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float z; - if (::sscanf(m_Z, "%f", &z) == 1) + if (NLMISC::fromString(tStrToUtf8(m_Z), z)) { pos.z = z; updateListener(); } else { - MessageBox("invalid entry", "error"); + MessageBox(_T("invalid entry"), _T("error")); } UpdateData(FALSE); } @@ -235,7 +235,7 @@ void CPSMoverDlg::createScaleControls(void) _Scale->init(100 + xPos, yPos, this); _ScaleText = new CStatic; - _ScaleText ->Create("Scale : ", SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); + _ScaleText ->Create(_T("Scale : "), SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); _ScaleText ->ShowWindow(SW_SHOW); _Scale->GetClientRect(&r); @@ -254,7 +254,7 @@ void CPSMoverDlg::createScaleControls(void) _XScale->GetClientRect(&r); _XScaleText = new CStatic; - _XScaleText ->Create("x Scale : ", SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); + _XScaleText ->Create(_T("x Scale : "), SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); _XScaleText ->ShowWindow(SW_SHOW); yPos += r.bottom; @@ -269,7 +269,7 @@ void CPSMoverDlg::createScaleControls(void) _YScaleText = new CStatic; - _YScaleText ->Create("y Scale : ", SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); + _YScaleText ->Create(_T("y Scale : "), SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); _YScaleText ->ShowWindow(SW_SHOW); yPos += r.bottom; @@ -283,7 +283,7 @@ void CPSMoverDlg::createScaleControls(void) _ZScale->GetClientRect(&r); _ZScaleText = new CStatic; - _ZScaleText ->Create("z Scale : ", SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); + _ZScaleText ->Create(_T("z Scale : "), SS_LEFT, CRect(xPos, yPos + 10, xPos + 60, yPos + 32), this); _ZScaleText ->ShowWindow(SW_SHOW); } diff --git a/code/nel/tools/3d/object_viewer/range_selector.cpp b/code/nel/tools/3d/object_viewer/range_selector.cpp index dca002b13..d809c7d11 100644 --- a/code/nel/tools/3d/object_viewer/range_selector.cpp +++ b/code/nel/tools/3d/object_viewer/range_selector.cpp @@ -32,8 +32,8 @@ CRangeSelector::CRangeSelector(const CString &lowerBound, const CString &upperBo : CDialog(CRangeSelector::IDD, pParent), _EditableRange(er) { //{{AFX_DATA_INIT(CRangeSelector) - m_LowerBound = _T(lowerBound); - m_UpperBound = _T(upperBound); + m_LowerBound = lowerBound; + m_UpperBound = upperBound; //}}AFX_DATA_INIT } diff --git a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp index 65d1b8205..2db27bc35 100644 --- a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp @@ -84,8 +84,8 @@ void CSchemeBankDlg::buildList() SchemeManager.getSchemes(_Type, schemes); for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it) { - int index = m_SchemeList.AddString(it->first.c_str()); - m_SchemeList.SetItemData(index, (unsigned long) it->second); + int index = m_SchemeList.AddString(utf8ToTStr(it->first)); + m_SchemeList.SetItemData(index, (DWORD_PTR) it->second); } UpdateData(FALSE); @@ -93,30 +93,24 @@ void CSchemeBankDlg::buildList() void CSchemeBankDlg::OnSaveBank() { - static char BASED_CODE szFilter[] = "scheme bank files(*.scb)|*.scb||"; - CFileDialog fd( FALSE, NULL, "default.scb", 0, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("scheme bank files(*.scb)|*.scb||"); + CFileDialog fd( FALSE, NULL, _T("default.scb"), 0, szFilter); if (fd.DoModal() == IDOK) { - // Add to the path - char drive[256]; - char dir[256]; - char path[256]; - // Add search path for the texture - _splitpath (fd.GetPathName(), drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - NLMISC::CPath::addSearchPath (path); + NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); try { NLMISC::COFile iF; - iF.open(std::string( (LPCTSTR) fd.GetFileName())); + iF.open(tStrToUtf8(fd.GetFileName())); iF.serial(SchemeManager); } - catch (std::exception &e) + catch (const std::exception &e) { - MessageBox(("Error saving scheme bank :" + std::string(e.what())).c_str(), "Object viewer", MB_ICONEXCLAMATION | MB_OK); + std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what()); + MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); return; } } @@ -124,32 +118,26 @@ void CSchemeBankDlg::OnSaveBank() void CSchemeBankDlg::OnLoadBank() { - static char BASED_CODE szFilter[] = "scheme bank files(*.scb)|*.scb||"; - CFileDialog fd( TRUE, NULL, "*.scb", 0, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("scheme bank files(*.scb)|*.scb||"); + CFileDialog fd( TRUE, NULL, _T("*.scb"), 0, szFilter); if (fd.DoModal() == IDOK) { - // Add to the path - char drive[256]; - char dir[256]; - char path[256]; - // Add search path for the texture - _splitpath (fd.GetPathName(), drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - NLMISC::CPath::addSearchPath (path); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); CSchemeManager sm; try { NLMISC::CIFile iF; - iF.open(NLMISC::CPath::lookup(std::string((LPCTSTR) fd.GetFileName()))); + iF.open(NLMISC::CPath::lookup(tStrToUtf8(fd.GetFileName()))); iF.serial(sm); SchemeManager.swap(sm); } - catch (std::exception &e) + catch (const std::exception &e) { - MessageBox(("Error loading scheme bank :" + std::string(e.what())).c_str(), "Object viewer", MB_ICONEXCLAMATION | MB_OK); + std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what()); + MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); return; } buildList(); @@ -179,7 +167,7 @@ void CSchemeBankDlg::OnRename() SchemeManager.rename(scheme, cn.getName()); int curSel = m_SchemeList.GetCurSel(); m_SchemeList.DeleteString(curSel); - int insertedPos = m_SchemeList.InsertString(curSel, cn.getName().c_str()); + int insertedPos = m_SchemeList.InsertString(curSel, utf8ToTStr(cn.getName())); m_SchemeList.SetCurSel(insertedPos); m_SchemeList.Invalidate(); } diff --git a/code/nel/tools/3d/object_viewer/select_string.cpp b/code/nel/tools/3d/object_viewer/select_string.cpp index 4ff61c23b..f506d905b 100644 --- a/code/nel/tools/3d/object_viewer/select_string.cpp +++ b/code/nel/tools/3d/object_viewer/select_string.cpp @@ -23,7 +23,7 @@ // CSelectString dialog -CSelectString::CSelectString(const std::vector& vectString, const char* title, CWnd* pParent, bool empty) +CSelectString::CSelectString(const std::vector& vectString, const std::string &title, CWnd* pParent, bool empty) : CDialog(CSelectString::IDD, pParent) { //{{AFX_DATA_INIT(CSelectString) @@ -77,14 +77,14 @@ BOOL CSelectString::OnInitDialog() CDialog::OnInitDialog(); // Change title - SetWindowText (Title.c_str()); + SetWindowText (utf8ToTStr(Title)); // Empty button ? EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE); // Add string for (uint s=0; s& vectString, const char* title, CWnd* pParent, bool empty); // standard constructor + CSelectString(const std::vector& vectString, const std::string &title, CWnd* pParent, bool empty); // standard constructor // Dialog Data //{{AFX_DATA(CSelectString) diff --git a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp index 75e20064f..a7d2b022a 100644 --- a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp @@ -206,7 +206,7 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std while((boneId=_SkeletonModel->Bones[boneId].getFatherId())!=-1) name= tabStr + name; // append to the list - _BoneList.AddString(name.c_str()); + _BoneList.AddString(utf8ToTStr(name)); } } @@ -216,8 +216,8 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std { _ScaleSliders[i]->SetRange(0, NL_SSD_SLIDER_SIZE); _ScaleSliders[i]->SetPos(NL_SSD_SLIDER_SIZE/2); - *_ScaleEdits[i]= ""; - _StaticScaleMarkers[i]->SetWindowText("100%"); + _ScaleEdits[i]->Empty(); + _StaticScaleMarkers[i]->SetWindowText(_T("100%")); } // ensure no problem with scale and ALT-TAB _SliderEdited= SidNone; @@ -338,7 +338,7 @@ void CSkeletonScaleDlg::onSliderReleased(TScaleId sid) // And reset the slider _ScaleSliders[_SliderEdited]->SetPos(NL_SSD_SLIDER_SIZE/2); - _StaticScaleMarkers[_SliderEdited]->SetWindowText("100%"); + _StaticScaleMarkers[_SliderEdited]->SetWindowText(_T("100%")); _SliderEdited= SidNone; // push an undo/redo only at release of slide. push the value of scale before slide @@ -400,9 +400,8 @@ void CSkeletonScaleDlg::applyScaleSlider(sint scrollValue) refreshTextViews(); // update marker text - char str[256]; - sprintf(str, "%d%%", (sint)(factor*100)); - _StaticScaleMarkers[_SliderEdited]->SetWindowText(str); + std::string str = NLMISC::toString("%d%%", (sint)(factor*100)); + _StaticScaleMarkers[_SliderEdited]->SetWindowText(utf8ToTStr(str)); } // *************************************************************************** @@ -503,7 +502,7 @@ void CSkeletonScaleDlg::refreshTextViewWithScale(TScaleId sid, float scale, flo // if different values selected, diff if(diff) { - *_ScaleEdits[sid]= ""; + _ScaleEdits[sid]->Empty(); } // else display text else @@ -592,12 +591,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } @@ -715,7 +714,7 @@ void CSkeletonScaleDlg::updateScalesFromText(UINT ctrlId) return; // get the scale info - std::string str= (const char*)(*_ScaleEdits[sid]); + std::string str = tStrToUtf8(*_ScaleEdits[sid]); if(str.empty()) return; float f; @@ -833,7 +832,7 @@ void CSkeletonScaleDlg::OnSsdButtonSave() } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } @@ -866,7 +865,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } } @@ -905,9 +904,9 @@ bool CSkeletonScaleDlg::saveCurrentInStream(NLMISC::IStream &f) ss.serial(f); delete skelShape; } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); return false; } @@ -1225,18 +1224,20 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale() // choose the file std::string defaultFileName= _SkeletonFileName; NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); - CFileDialog fd(FALSE, "scale", defaultFileName.c_str(), OFN_OVERWRITEPROMPT, "SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||", this) ; - fd.m_ofn.lpstrTitle= "Save As Skeleton Scale File"; + + CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; + fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File"); + if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open((const char*)fd.GetPathName()) ) + if (f.open(tStrToUtf8(fd.GetPathName()))) { saveSkelScaleInStream(f); } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } } @@ -1251,18 +1252,20 @@ void CSkeletonScaleDlg::OnSsdButtonLoadScale() // choose the file std::string defaultFileName= _SkeletonFileName; NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); - CFileDialog fd(TRUE, "scale", defaultFileName.c_str(), 0, "SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||", this) ; - fd.m_ofn.lpstrTitle= "Load a Skeleton Scale File"; + + CFileDialog fd(TRUE, _T("scale"), utf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; + fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File"); + if (fd.DoModal() == IDOK) { NLMISC::CIFile f; - if( f.open((const char*)fd.GetPathName()) ) + if (f.open(tStrToUtf8(fd.GetPathName()))) { loadSkelScaleFromStream(f); } else { - MessageBox("Failed to open file for read!"); + MessageBox(_T("Failed to open file for read!")); } } } @@ -1307,9 +1310,9 @@ bool CSkeletonScaleDlg::saveSkelScaleInStream(NLMISC::IStream &f) sint32 ver= f.serialVersion(0); f.serialCont(boneScales); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); return false; } @@ -1353,9 +1356,9 @@ bool CSkeletonScaleDlg::loadSkelScaleFromStream(NLMISC::IStream &f) // and update display refreshTextViews(); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); return false; } diff --git a/code/nel/tools/3d/object_viewer/slot_dlg.cpp b/code/nel/tools/3d/object_viewer/slot_dlg.cpp index d6c707125..507c9b4e8 100644 --- a/code/nel/tools/3d/object_viewer/slot_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/slot_dlg.cpp @@ -420,7 +420,7 @@ void CSlotDlg::OnSetAnimation() updateScrollBar (); } else - getSlotInformation ()->Animation = ""; + getSlotInformation ()->Animation.clear(); } refresh (TRUE); } @@ -444,7 +444,7 @@ void CSlotDlg::OnSetSkeleton() if (select.Selection!=-1) getSlotInformation ()->Skeleton = vectString[select.Selection].c_str(); else - getSlotInformation ()->Skeleton = ""; + getSlotInformation ()->Skeleton.clear(); setWindowName (); Invalidate (); @@ -455,26 +455,24 @@ void CSlotDlg::OnSetSkeleton() void CSlotDlg::setWindowName () { - char tmp[512]; - _snprintf (tmp, 512, "Slot %d : ", Id); + std::string tmp = NLMISC::toString("Slot %d : ", Id); + if (isEmpty()) - strcat (tmp, "empty"); + tmp += "empty"; else - strcat (tmp, getSlotInformation ()->Animation .c_str()); + tmp += getSlotInformation ()->Animation; CSlotInfo *information = getSlotInformation (); if (information) { std::string SkeletonName = information->Skeleton; - if (SkeletonName != "") + if (!SkeletonName.empty()) { - strcat (tmp, " ("); - strcat (tmp, SkeletonName.c_str()); - strcat (tmp, ")"); + tmp += " (" + SkeletonName + ")"; } } - GetDlgItem (IDC_SLOT_NAME)->SetWindowText (tmp); + GetDlgItem (IDC_SLOT_NAME)->SetWindowText (utf8ToTStr(tmp)); } // *************************************************************************** diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp index 0d256573c..a8125f43b 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -42,7 +42,7 @@ -#define NEL_OV_SNAPSHOT_TOOL_REGKEY "Software\\Nevrax\\nel\\object_viewer\\snapshot_dlg" +#define NEL_OV_SNAPSHOT_TOOL_REGKEY _T("Software\\Nevrax\\nel\\object_viewer\\snapshot_dlg") using namespace NLMISC; @@ -109,7 +109,7 @@ void CSnapshotToolDlg::DoDataExchange(CDataExchange* pDX) } //**************************************************************************************** -void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const char *name, CString &dest, const CString &defaultStr) +void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString &dest, const CString &defaultStr) { DWORD type; DWORD size; @@ -119,20 +119,22 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const char *name, CString & dest = defaultStr; return; } - std::string tmpDest; - tmpDest.resize(size); - result = RegQueryValueEx(hKey, name, NULL, &type, (unsigned char *) &tmpDest[0], &size); + + std::auto_ptr tmpDest(new TCHAR[size]); + result = RegQueryValueEx(hKey, name, NULL, &type, (BYTE*)tmpDest.get(), &size); + if (result != ERROR_SUCCESS) { dest = defaultStr; return; } - dest = tmpDest.c_str(); + + dest = *tmpDest; } //**************************************************************************************** -template void integralTypeFromRegistry(HKEY hKey, const char *name, T &dest, const U &defaultValue) +template void integralTypeFromRegistry(HKEY hKey, const TCHAR *name, T &dest, const U &defaultValue) { if (hKey == 0) { @@ -163,32 +165,34 @@ void CSnapshotToolDlg::fromRegistry() { HKEY hKey = 0; RegOpenKeyEx(HKEY_CURRENT_USER, NEL_OV_SNAPSHOT_TOOL_REGKEY, 0, KEY_READ, &hKey); - stringFromRegistry(hKey, "InputPath", m_InputPath, ""); - stringFromRegistry(hKey, "OutputPath", m_OutputPath, ""); + stringFromRegistry(hKey, _T("InputPath"), m_InputPath, ""); + stringFromRegistry(hKey, _T("OutputPath"), m_OutputPath, ""); + CString filters; - stringFromRegistry(hKey, "Filters", filters, "*.shape"); - std::string stdFilters((LPCTSTR) filters); + stringFromRegistry(hKey, _T("Filters"), filters, "*.shape"); + std::vector filterList; - NLMISC::splitString(stdFilters, ",", filterList); + NLMISC::splitString(tStrToUtf8(filters), ",", filterList); + m_Filters.ResetContent(); for (uint k = 0; k < filterList.size(); ++k) { - m_Filters.AddString(filterList[k].c_str()); + m_Filters.AddString(utf8ToTStr(filterList[k])); } - integralTypeFromRegistry(hKey, "RecurseSubFolder", (int &) m_RecurseSubFolder, FALSE); - integralTypeFromRegistry(hKey, "DumpTextureSets", (int &) m_DumpTextureSets, TRUE); - integralTypeFromRegistry(hKey, "PostFixViewName", (int &) m_PostFixViewName, TRUE); - integralTypeFromRegistry(hKey, "ViewBack", (int &) m_ViewBack, FALSE); - integralTypeFromRegistry(hKey, "ViewBottom", (int &) m_ViewBottom, FALSE); - integralTypeFromRegistry(hKey, "ViewFront", (int &) m_ViewFront, TRUE); - integralTypeFromRegistry(hKey, "ViewLeft", (int &) m_ViewLeft, FALSE); - integralTypeFromRegistry(hKey, "ViewRight", (int &) m_ViewRight, FALSE); - integralTypeFromRegistry(hKey, "ViewTop", (int &) m_ViewTop, FALSE); - integralTypeFromRegistry(hKey, "OutputWidth", m_OutputWidth, 128); - integralTypeFromRegistry(hKey, "OutputHeight", m_OutputHeight, 128); - integralTypeFromRegistry(hKey, "Format", m_Format, 0); - integralTypeFromRegistry(hKey, "OutputPathOption", m_OutputPathOption, 1); + integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE); + integralTypeFromRegistry(hKey, _T("DumpTextureSets"), (int &) m_DumpTextureSets, TRUE); + integralTypeFromRegistry(hKey, _T("PostFixViewName"), (int &) m_PostFixViewName, TRUE); + integralTypeFromRegistry(hKey, _T("ViewBack"), (int &) m_ViewBack, FALSE); + integralTypeFromRegistry(hKey, _T("ViewBottom"), (int &) m_ViewBottom, FALSE); + integralTypeFromRegistry(hKey, _T("ViewFront"), (int &) m_ViewFront, TRUE); + integralTypeFromRegistry(hKey, _T("ViewLeft"), (int &) m_ViewLeft, FALSE); + integralTypeFromRegistry(hKey, _T("ViewRight"), (int &) m_ViewRight, FALSE); + integralTypeFromRegistry(hKey, _T("ViewTop"), (int &) m_ViewTop, FALSE); + integralTypeFromRegistry(hKey, _T("OutputWidth"), m_OutputWidth, 128); + integralTypeFromRegistry(hKey, _T("OutputHeight"), m_OutputHeight, 128); + integralTypeFromRegistry(hKey, _T("Format"), m_Format, 0); + integralTypeFromRegistry(hKey, _T("OutputPathOption"), m_OutputPathOption, 1); UpdateData(FALSE); updateUIEnabledState(); } @@ -200,8 +204,8 @@ void CSnapshotToolDlg::toRegistry() HKEY hKey; if (RegCreateKey(HKEY_CURRENT_USER, NEL_OV_SNAPSHOT_TOOL_REGKEY, &hKey)==ERROR_SUCCESS) { - RegSetValueEx(hKey, "InputPath", 0, REG_SZ, (unsigned char *) (LPCTSTR) m_InputPath, m_InputPath.GetLength() + 1); - RegSetValueEx(hKey, "OutputPath", 0, REG_SZ, (unsigned char *) (LPCTSTR) m_OutputPath, m_OutputPath.GetLength() + 1); + RegSetValueEx(hKey, _T("InputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_InputPath, m_InputPath.GetLength() + 1); + RegSetValueEx(hKey, _T("OutputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_OutputPath, m_OutputPath.GetLength() + 1); CString filters; for (uint k = 0; k < (uint) m_Filters.GetCount(); ++k) { @@ -210,7 +214,8 @@ void CSnapshotToolDlg::toRegistry() m_Filters.GetText(k, filter); filters += filter; } - RegSetValueEx(hKey, "Filters", 0, REG_SZ, (unsigned char *) (LPCTSTR) filters, filters.GetLength() + 1); + + RegSetValueEx(hKey, _T("Filters"), 0, REG_SZ, (BYTE*) (LPCTSTR) filters, filters.GetLength() + 1); DWORD recurseSubFolder = m_RecurseSubFolder; DWORD dumpTextureSets = m_DumpTextureSets; DWORD views [] = @@ -227,19 +232,19 @@ void CSnapshotToolDlg::toRegistry() DWORD format = m_Format; DWORD outputPathOption = m_OutputPathOption; DWORD postFixViewName = m_PostFixViewName; - integralTypeFromRegistry(hKey, "PostFixViewName", (int &) m_PostFixViewName, TRUE); - RegSetValueEx(hKey, "ViewBack", 0, REG_DWORD, (const BYTE *) &m_ViewBack, sizeof(DWORD)); - RegSetValueEx(hKey, "ViewBottom", 0, REG_DWORD, (const BYTE *) &m_ViewBottom, sizeof(DWORD)); - RegSetValueEx(hKey, "ViewFront", 0, REG_DWORD, (const BYTE *) &m_ViewFront, sizeof(DWORD)); - RegSetValueEx(hKey, "ViewLeft", 0, REG_DWORD, (const BYTE *) &m_ViewLeft, sizeof(DWORD)); - RegSetValueEx(hKey, "ViewRight", 0, REG_DWORD, (const BYTE *) &m_ViewRight, sizeof(DWORD)); - RegSetValueEx(hKey, "ViewTop", 0, REG_DWORD, (const BYTE *) &m_ViewTop, sizeof(DWORD)); - RegSetValueEx(hKey, "RecurseSubFolder", 0, REG_DWORD, (const BYTE *) &recurseSubFolder, sizeof(DWORD)); - RegSetValueEx(hKey, "DumpTextureSets", 0, REG_DWORD, (const BYTE *) &dumpTextureSets, sizeof(DWORD)); - RegSetValueEx(hKey, "OutputWidth", 0, REG_DWORD, (const BYTE *) &width, sizeof(DWORD)); - RegSetValueEx(hKey, "OutputHeight", 0, REG_DWORD, (const BYTE *) &height, sizeof(DWORD)); - RegSetValueEx(hKey, "Format", 0, REG_DWORD, (const BYTE *) &format, sizeof(DWORD)); - RegSetValueEx(hKey, "OutputPathOption", 0, REG_DWORD, (const BYTE *) &outputPathOption, sizeof(DWORD)); + integralTypeFromRegistry(hKey, _T("PostFixViewName"), (int &) m_PostFixViewName, TRUE); + RegSetValueEx(hKey, _T("ViewBack"), 0, REG_DWORD, (const BYTE *) &m_ViewBack, sizeof(DWORD)); + RegSetValueEx(hKey, _T("ViewBottom"), 0, REG_DWORD, (const BYTE *) &m_ViewBottom, sizeof(DWORD)); + RegSetValueEx(hKey, _T("ViewFront"), 0, REG_DWORD, (const BYTE *) &m_ViewFront, sizeof(DWORD)); + RegSetValueEx(hKey, _T("ViewLeft"), 0, REG_DWORD, (const BYTE *) &m_ViewLeft, sizeof(DWORD)); + RegSetValueEx(hKey, _T("ViewRight"), 0, REG_DWORD, (const BYTE *) &m_ViewRight, sizeof(DWORD)); + RegSetValueEx(hKey, _T("ViewTop"), 0, REG_DWORD, (const BYTE *) &m_ViewTop, sizeof(DWORD)); + RegSetValueEx(hKey, _T("RecurseSubFolder"), 0, REG_DWORD, (const BYTE *) &recurseSubFolder, sizeof(DWORD)); + RegSetValueEx(hKey, _T("DumpTextureSets"), 0, REG_DWORD, (const BYTE *) &dumpTextureSets, sizeof(DWORD)); + RegSetValueEx(hKey, _T("OutputWidth"), 0, REG_DWORD, (const BYTE *) &width, sizeof(DWORD)); + RegSetValueEx(hKey, _T("OutputHeight"), 0, REG_DWORD, (const BYTE *) &height, sizeof(DWORD)); + RegSetValueEx(hKey, _T("Format"), 0, REG_DWORD, (const BYTE *) &format, sizeof(DWORD)); + RegSetValueEx(hKey, _T("OutputPathOption"), 0, REG_DWORD, (const BYTE *) &outputPathOption, sizeof(DWORD)); } } @@ -403,7 +408,7 @@ void CSnapshotToolDlg::OnGo() MessageBox(getStrRsc(IDS_SNAPSHOT_EMPTY_INPUT_PATH), getStrRsc(IDS_OBJECT_VIEWER), MB_ICONEXCLAMATION); return; } - if (!NLMISC::CFile::isDirectory(LPCTSTR(m_InputPath))) + if (!NLMISC::CFile::isDirectory(tStrToUtf8(m_InputPath))) { MessageBox(getStrRsc(IDS_SNAPSHOT_EMPTY_INPUT_PATH_NOT_FOUND), getStrRsc(IDS_OBJECT_VIEWER), MB_ICONEXCLAMATION); return; @@ -413,13 +418,13 @@ void CSnapshotToolDlg::OnGo() MessageBox(getStrRsc(IDS_SNAPSHOT_EMPTY_OUTPUT_PATH), getStrRsc(IDS_OBJECT_VIEWER), MB_ICONEXCLAMATION); return; } - if (m_OutputPathOption == OutputPath_Custom && !NLMISC::CFile::isDirectory(LPCTSTR(m_OutputPath))) + if (m_OutputPathOption == OutputPath_Custom && !NLMISC::CFile::isDirectory(tStrToUtf8(m_OutputPath))) { if (MessageBox(getStrRsc(IDS_SNAPSHOT_CREATE_OUTPUT_DIRECTORY), getStrRsc(IDS_OBJECT_VIEWER), MB_OKCANCEL) != IDOK) { return; } - if(!NLMISC::CFile::createDirectoryTree(LPCTSTR(m_OutputPath))) + if(!NLMISC::CFile::createDirectoryTree(tStrToUtf8(m_OutputPath))) { MessageBox(getStrRsc(IDS_SNAPSHOT_OUTPUT_PATH_CREATION_FAILED), getStrRsc(IDS_OBJECT_VIEWER), MB_ICONEXCLAMATION); return; @@ -440,7 +445,7 @@ void CSnapshotToolDlg::OnGo() m_Log.ResetContent(); m_Log.AddString(getStrRsc(IDS_GETTING_PATH_CONTENT)); std::vector files; - CPath::getPathContent((LPCTSTR) m_InputPath, m_RecurseSubFolder == TRUE, false, true, files); + CPath::getPathContent(tStrToUtf8(m_InputPath), m_RecurseSubFolder == TRUE, false, true, files); if (files.empty()) { m_Log.AddString(getStrRsc(IDS_SNAPSHOT_NO_FILES_FOUND)); @@ -454,7 +459,7 @@ void CSnapshotToolDlg::OnGo() CString wildCard; m_Filters.GetText(l, wildCard); wildCard.MakeLower(); - if (testWildCard(toLower(NLMISC::CFile::getFilename(files[k])).c_str(), (LPCTSTR) wildCard)) + if (testWildCard(toLower(NLMISC::CFile::getFilename(files[k])).c_str(), tStrToUtf8(wildCard).c_str())) { _FilteredFiles.push_back(files[k]); break; @@ -596,7 +601,7 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) try { CShapeStream ss; - m_Log.AddString(_FilteredFiles[0].c_str()); + m_Log.AddString(utf8ToTStr(_FilteredFiles[0])); CIFile stream(_FilteredFiles[0]); ss.serial(stream); nlassert(ss.getShapePointer()); @@ -704,10 +709,10 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) switch(m_OutputPathOption) { case OutputPath_Custom: // custom output path - outputFilename = LPCTSTR(m_OutputPath) + std::string("\\") + NLMISC::CFile::getFilename(outputFilename); + outputFilename = tStrToUtf8(m_OutputPath) + "\\" + NLMISC::CFile::getFilename(outputFilename); break; case OutputPath_SameAsInput: // Input path - outputFilename = LPCTSTR(m_InputPath) + std::string("\\") + NLMISC::CFile::getFilename(outputFilename); + outputFilename = tStrToUtf8(m_InputPath) + "\\" + NLMISC::CFile::getFilename(outputFilename); break; case OutputPath_CurrShapeDirectory: // current path // no op @@ -730,7 +735,7 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) } sb.reset(); } - catch(std::exception &e) + catch(const std::exception &e) { nlwarning(e.what()); diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h index c696163d5..72df1dea5 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h @@ -137,7 +137,7 @@ private: void fromRegistry(); // Save the options chosen in the snapshot tool ui into the registry. void toRegistry(); - void stringFromRegistry(HKEY hKey, const char *name, CString &dest, const CString &defaultStr); + void stringFromRegistry(HKEY hKey, const TCHAR *name, CString &dest, const CString &defaultStr); void updateUIEnabledState(); static void setCamFromView(uint view, NL3D::CCamera *cam, const NLMISC::CAABBox &bbox); diff --git a/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp b/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp index 965ad3d90..893a6a011 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp @@ -76,10 +76,9 @@ BOOL CSoundAnimDlg::OnInitDialog() void CSoundAnimDlg::handle() { - char text[256]; float sec = _AnimationDlg->getTime(); - _snprintf(text, 256, "time: %.3f", sec); - GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(text); + std::string text = toString("time: %.3f", sec); + GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(utf8ToTStr(text)); _AnimView.updateCursor(); } @@ -137,7 +136,7 @@ void CSoundAnimDlg::updateSounds() for (iter = sounds.begin(); iter != sounds.end(); iter++) { - list->AddString((*iter).toString().c_str()); + list->AddString(utf8ToTStr((*iter).toString())); } list->UpdateData(); @@ -177,14 +176,13 @@ void CSoundAnimDlg::OnRemoveSound() { if (_SelectedMarker != 0) { - char s[256]; - CListBox* list = (CListBox*) GetDlgItem(IDC_SOUND_ANIM_LIST); + TCHAR s[256]; + CListBox* list = (CListBox*) GetDlgItem(IDC_SOUND_ANIM_LIST); if (list->GetText(list->GetCurSel(), s) != LB_ERR) { - string name(s); - _SelectedMarker->removeSound(NLMISC::CSheetId(name, "sound")); - updateSounds(); + _SelectedMarker->removeSound(NLMISC::CSheetId(tStrToUtf8(s), "sound")); + updateSounds(); } } } diff --git a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp index 84998ad81..af4326cd7 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp @@ -67,7 +67,7 @@ bool CSoundAnimView::registerClass() _WndClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH) ::GetStockObject(WHITE_BRUSH)); // Do some additional initialization of static veriables - _Font.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); + _Font.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Arial")); _FillBrush.CreateSolidBrush(RGB(230, 245, 245)); _MarkerBrush.CreateSolidBrush(RGB(0, 0, 0)); _SelectBrush.CreateSolidBrush(RGB(0, 210, 210)); @@ -113,7 +113,7 @@ void CSoundAnimView::Create(CObjectViewer* objView, CAnimationDlg* animDlg, CSou } - CWnd::Create((LPCTSTR) _WndClass, "Sound Animation", WS_CHILD | WS_VISIBLE, rect, (CWnd*) sndDlg, ++_WndId); + CWnd::Create((LPCTSTR) _WndClass, _T("Sound Animation"), WS_CHILD | WS_VISIBLE, rect, (CWnd*) sndDlg, ++_WndId); } // ******************************************************** @@ -216,12 +216,12 @@ void CSoundAnimView::save() filename.append(anim->getName()).append(".sound_anim"); // Create a dialog - char BASED_CODE szFilter[] = "NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"; - CFileDialog fileDlg( FALSE, ".sound_anim", filename.c_str(), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"); + CFileDialog fileDlg( FALSE, _T(".sound_anim"), utf8ToTStr(filename), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal() == IDOK) { - filename = (const char*) fileDlg.GetPathName(); + filename = tStrToUtf8(fileDlg.GetPathName()); } else { @@ -234,9 +234,9 @@ void CSoundAnimView::save() { CSoundAnimManager::instance()->saveAnimation(anim, filename); } - catch (Exception& e) + catch (const Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -328,7 +328,7 @@ void CSoundAnimView::refresh(BOOL update) else soundAnim = animManager->findAnimation(name); } - catch (exception& e) + catch (const exception& e) { nlwarning("Couldn't find sound animation <%s>: %s", name.c_str(), e.what()); needCreate = true; diff --git a/code/nel/tools/3d/object_viewer/sound_system.cpp b/code/nel/tools/3d/object_viewer/sound_system.cpp index 69e10ea18..5a79c3af3 100644 --- a/code/nel/tools/3d/object_viewer/sound_system.cpp +++ b/code/nel/tools/3d/object_viewer/sound_system.cpp @@ -67,7 +67,7 @@ void CSoundSystem::initSoundSystem () _AudioMixer->setPackedSheetOption(_PackedSheetPath, true); _AudioMixer->init(32, true, false, NULL, true); } - catch(NLMISC::Exception &e) + catch(const NLMISC::Exception &e) { // in case of exeption during mixer init, the mixer is destroyed ! string mess = string("Unable to init sound :") + e.what(); @@ -82,7 +82,7 @@ void CSoundSystem::initSoundSystem () // TODO : boris : Hum, as far as I know, throwing exeption in constructor is a very BAD idea... _AnimManager = new CSoundAnimManager(_AudioMixer); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { string mess = string("Unable to init sound :") + e.what(); nlwarning ("Init sound: %s", mess.c_str()); @@ -109,7 +109,7 @@ void CSoundSystem::initSoundSystem () //_AudioMixer->loadSampleBank(NLMISC::CPath::lookup(*it).c_str()); _AudioMixer->loadSampleBank(false, (*it1)); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { string mess = "Unable to load sound file :" + *it1 + "\n" + e.what(); @@ -126,7 +126,7 @@ void CSoundSystem::initSoundSystem () //_AudioMixer->loadSoundBank(NLMISC::CPath::lookup(*it).c_str()); _AudioMixer->loadSoundBank((*it2).c_str()); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { string mess = "Unable to load sound file :" + *it2 + "\n" + e.what(); @@ -178,7 +178,7 @@ void CSoundSystem::play(const string &soundName) } else { - MessageBox(NULL, "Can't play the sound (perhaps it's contextual sound)", "warning", MB_OK|MB_ICONWARNING ); + MessageBox(NULL, _T("Can't play the sound (perhaps it's contextual sound)"), _T("warning"), MB_OK|MB_ICONWARNING ); } } } @@ -198,7 +198,7 @@ USource *CSoundSystem::create(const std::string &soundName) } else { - MessageBox(NULL, "Can't play the sound (perhaps it's contextual sound)", "warning", MB_OK|MB_ICONWARNING ); + MessageBox(NULL, _T("Can't play the sound (perhaps it's contextual sound)"), _T("warning"), MB_OK|MB_ICONWARNING ); } return NULL; } return NULL; diff --git a/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp b/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp index 450b8b714..923c35ed1 100644 --- a/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp +++ b/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp @@ -210,7 +210,7 @@ void CStartStopParticleSystem::updateUIFromState() if (!getCurrPS()) { GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(getStrRsc(IDS_NO_ACTIVE_PS)); - GetDlgItem(IDC_STICK_BONE)->SetWindowText(""); + GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T("")); GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(FALSE); GetDlgItem(IDC_RESET_COUNT)->EnableWindow(FALSE); ((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(0); @@ -225,19 +225,19 @@ void CStartStopParticleSystem::updateUIFromState() GetDlgItem(IDC_BROWSE_ANIM)->EnableWindow(FALSE); GetDlgItem(IDC_DISPLAY_HELPERS)->EnableWindow(FALSE); GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(FALSE); - m_TriggerAnim = ""; + m_TriggerAnim.Empty(); } else { if (!_ActiveNode->getParentSkelName().empty()) { - GetDlgItem(IDC_STICK_BONE)->SetWindowText((_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName()).c_str()); + GetDlgItem(IDC_STICK_BONE)->SetWindowText(utf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName())); } else { - GetDlgItem(IDC_STICK_BONE)->SetWindowText(""); + GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T("")); } - GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(_ActiveNode->getFilename().c_str()); + GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(utf8ToTStr(_ActiveNode->getFilename())); GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE); ((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0); GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE); @@ -844,7 +844,7 @@ void CStartStopParticleSystem::OnLinkToSkeleton() uint boneIndex; std::string parentSkelName; std::string parentBoneName; - if (ov->chooseBone((LPCTSTR) chooseBoneForPS, skel, boneIndex, &parentSkelName, &parentBoneName)) + if (ov->chooseBone(tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName)) { _ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName); } @@ -1017,11 +1017,11 @@ void CStartStopParticleSystem::OnBrowseAnim() } } std::vector animList(animSet.begin(), animSet.end()); - CSelectString st(animList, (LPCTSTR) getStrRsc(IDS_SELECT_ANIMATION), this, false); + CSelectString st(animList, tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false); if (st.DoModal() == IDOK && st.Selection != -1) { m_TriggerAnim = animList[st.Selection].c_str(); - _ActiveNode->setTriggerAnim((LPCTSTR) m_TriggerAnim); + _ActiveNode->setTriggerAnim(tStrToUtf8(m_TriggerAnim)); GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty()); } _ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode); @@ -1033,7 +1033,7 @@ void CStartStopParticleSystem::OnBrowseAnim() void CStartStopParticleSystem::OnClearAnim() { // TODO: Add your control notification handler code here - m_TriggerAnim = ""; + m_TriggerAnim.Empty(); _ActiveNode->setTriggerAnim(""); _ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode); UpdateData(FALSE); diff --git a/code/nel/tools/3d/object_viewer/texture_anim_dlg.cpp b/code/nel/tools/3d/object_viewer/texture_anim_dlg.cpp index 31babe7b3..79a05ad8f 100644 --- a/code/nel/tools/3d/object_viewer/texture_anim_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/texture_anim_dlg.cpp @@ -332,13 +332,13 @@ void CTextureAnimDlg::CGradientInterface::CTextureWrapper::set(NL3D::ITexture *t if (t->getWidth() != tex->getWidth() || t->getHeight() != tex->getHeight()) { - ::MessageBox(NULL, "All textures must have the same size !", "error", MB_OK); + ::MessageBox(NULL, _T("All textures must have the same size !"), _T("error"), MB_OK); return; } if (t->PixelFormat != tex->PixelFormat) { - ::MessageBox(NULL, "All textures must have the same pixel format !", "error", MB_OK); + ::MessageBox(NULL, _T("All textures must have the same pixel format !"), _T("error"), MB_OK); return; } } diff --git a/code/nel/tools/3d/object_viewer/texture_chooser.cpp b/code/nel/tools/3d/object_viewer/texture_chooser.cpp index 65407aca1..70cc151b0 100644 --- a/code/nel/tools/3d/object_viewer/texture_chooser.cpp +++ b/code/nel/tools/3d/object_viewer/texture_chooser.cpp @@ -179,29 +179,22 @@ void CTextureChooser::OnBrowseTexture() { texName = (static_cast(_Wrapper->get()))->getFileName(); } - CFileDialog fd(TRUE, ".tga", texName.c_str(), 0, NULL, this); + CFileDialog fd(TRUE, _T(".tga"), utf8ToTStr(texName), 0, NULL, this); if (fd.DoModal() == IDOK) { - // Add to the path - char drive[256]; - char dir[256]; - char path[256]; - // Add search path for the texture - _splitpath (fd.GetPathName(), drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); - NLMISC::CPath::addSearchPath (path); + NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); try { - NL3D::CTextureFile *tf = new NL3D::CTextureFile(std::string(fd.GetFileName())); + NL3D::CTextureFile *tf = new NL3D::CTextureFile(tStrToUtf8(fd.GetFileName())); _Wrapper->setAndUpdateModifiedFlag(tf); _Texture = tf; textureToBitmap(); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { - MessageBox(e.what(), "error loading texture"); + MessageBox(utf8ToTStr(e.what()), _T("error loading texture")); } } diff --git a/code/nel/tools/3d/object_viewer/value_gradient_dlg.cpp b/code/nel/tools/3d/object_viewer/value_gradient_dlg.cpp index ccddc5833..5eff39642 100644 --- a/code/nel/tools/3d/object_viewer/value_gradient_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/value_gradient_dlg.cpp @@ -100,7 +100,7 @@ void CValueGradientDlg::OnAddValue() UpdateData(); ++_Size; _ClientInterface->modifyGradient(IValueGradientDlgClient::Add, 0); - m_GradientList.AddString("value"); + m_GradientList.AddString(_T("value")); m_RemoveCtrl.EnableWindow(TRUE); m_GradientList.SetCurSel(_Size - 1); @@ -116,7 +116,7 @@ void CValueGradientDlg::OnInsertValue() uint oldIndex = m_GradientList.GetCurSel(); ++_Size; _ClientInterface->modifyGradient(IValueGradientDlgClient::Insert, m_GradientList.GetCurSel()); - m_GradientList.InsertString(m_GradientList.GetCurSel(), "value"); + m_GradientList.InsertString(m_GradientList.GetCurSel(), _T("value")); m_GradientList.Invalidate(); m_GradientList.SetCurSel(oldIndex); OnSelchangeGradientList(); @@ -185,7 +185,7 @@ BOOL CValueGradientDlg::OnInitDialog() m_GradientList.InitStorage(_Size, 16); for (uint k = 0; k < _Size; ++k) { - m_GradientList.AddString("value"); + m_GradientList.AddString(_T("value")); } m_RemoveCtrl.EnableWindow(_Size > _MinSize ? TRUE : FALSE); m_GradientList.SetCurSel(0); diff --git a/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp index 4e3162559..05e0ab1fd 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp @@ -249,7 +249,7 @@ BOOL CVegetableCopyDlg::OnInitDialog() uint num= _VegetableDlg->getNumVegetables(); for(uint i=0; igetVegetableName(i).c_str()); + VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); } @@ -289,7 +289,7 @@ void CVegetableCopyDlg::OnOK() } else { - MessageBox("Select a vegetable to copy first", "Error", MB_OK | MB_ICONWARNING); + MessageBox(_T("Select a vegetable to copy first"), _T("Error"), MB_OK | MB_ICONWARNING); } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp index 2db682bcd..d8f9c2d75 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp @@ -100,7 +100,7 @@ void CVegetableDensityPage::setVegetableToEdit(NL3D::CVegetable *vegetable) { // Init ShapeName // ---------- - StaticVegetableShape.SetWindowText(_Vegetable->ShapeName.c_str()); + StaticVegetableShape.SetWindowText(utf8ToTStr(_Vegetable->ShapeName)); // init Creation Distance. // ---------- @@ -198,8 +198,9 @@ void CVegetableDensityPage::updateViewAngleMin() sint pos= (sint)(angle/(NLMISC::Pi/2) * NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE); NLMISC::clamp(pos, -NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE, NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE); AngleMinSlider.SetPos(pos); - char stmp[256]; - sprintf(stmp, "%.2f", (double)(angle*180/NLMISC::Pi)); + + CString stmp; + stmp.Format(_T("%.2f"), (double)(angle*180/NLMISC::Pi)); AngleMinEdit.SetWindowText(stmp); } @@ -213,8 +214,9 @@ void CVegetableDensityPage::updateViewAngleMax() sint pos= (sint)(angle/(NLMISC::Pi/2) * NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE); NLMISC::clamp(pos, -NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE, NL_VEGETABLE_EDIT_ANGLE_SLIDER_SIZE); AngleMaxSlider.SetPos(pos); - char stmp[256]; - sprintf(stmp, "%.2f", (double)(angle*180/NLMISC::Pi)); + + CString stmp; + stmp.Format(_T("%.2f"), (double)(angle * 180 / NLMISC::Pi)); AngleMaxEdit.SetWindowText(stmp); } @@ -223,10 +225,10 @@ void CVegetableDensityPage::updateViewAngleMax() void CVegetableDensityPage::updateAngleMinFromEditText() { // get angles edited. - char stmp[256]; + TCHAR stmp[256]; AngleMinEdit.GetWindowText(stmp, 256); float angleMin; - NLMISC::fromString(stmp, angleMin); + NLMISC::fromString(tStrToUtf8(stmp), angleMin); NLMISC::clamp(angleMin, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f); @@ -247,10 +249,10 @@ void CVegetableDensityPage::updateAngleMinFromEditText() void CVegetableDensityPage::updateAngleMaxFromEditText() { // get angles edited. - char stmp[256]; + TCHAR stmp[256]; AngleMaxEdit.GetWindowText(stmp, 256); float angleMax; - NLMISC::fromString(stmp, angleMax); + NLMISC::fromString(tStrToUtf8(stmp), angleMax); NLMISC::clamp(angleMax, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f); @@ -320,7 +322,7 @@ BOOL CVegetableDensityPage::OnInitDialog() // Init ShapeName - StaticVegetableShape.SetWindowText(""); + StaticVegetableShape.SetWindowText(_T("")); return TRUE; // return TRUE unless you set the focus to a control @@ -477,12 +479,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } void CVegetableDensityPage::OnChangeEditAngleMin() @@ -515,27 +517,25 @@ void CVegetableDensityPage::OnChangeEditAngleMax() // *************************************************************************** void CVegetableDensityPage::OnButtonVegetableBrowse() { - CFileDialog fd(TRUE, "veget", "*.veget", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= "Open Vegetable Shape"; + CFileDialog fd(TRUE, _T("veget"), _T("*.veget"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = _T("Open Vegetable Shape"); + if (fd.DoModal() == IDOK) { // Add to the path - char drive[256]; - char dir[256]; - char path[256]; + std::string fileName = tStrToUtf8(fd.GetFileName()); // Add search path for the .veget - _splitpath (fd.GetPathName(), drive, dir, NULL, NULL); - _makepath (path, drive, dir, NULL, NULL); + std::string path = NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); NLMISC::CPath::addSearchPath (path); try { // verify the file can be opened. - NLMISC::CPath::lookup((const char*)fd.GetFileName()); + NLMISC::CPath::lookup(fileName); // update shapeName and view - _Vegetable->ShapeName= std::string(fd.GetFileName()); + _Vegetable->ShapeName = fileName; StaticVegetableShape.SetWindowText(fd.GetFileName()); // update the name in the list-box @@ -544,9 +544,9 @@ void CVegetableDensityPage::OnButtonVegetableBrowse() // update 3D view _VegetableDlg->refreshVegetableDisplay(); } - catch (NLMISC::EPathNotFound &ep) + catch (const NLMISC::EPathNotFound &ep) { - MessageBox(ep.what(), "Can't open file"); + MessageBox(utf8ToTStr(ep.what()), _T("Can't open file")); } } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp index 09aa67ea4..7611b543b 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp @@ -293,7 +293,7 @@ void CVegetableDlg::CVegetableDesc::initVegetable(const NL3D::CVegetable &veget void CVegetableDlg::CVegetableDesc::updateVegetableName() { // Build the vegetable Name according to the ShapeName - if(Vegetable->ShapeName=="") + if(Vegetable->ShapeName.empty()) { VegetableName= NL_DefaultVegetName; } @@ -336,13 +336,13 @@ void CVegetableDlg::clearVegetables() // *************************************************************************** -bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const char *title) +bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const TCHAR *title) { vegetSet.clear(); bool ok= false; - CFileDialog fd(TRUE, ".vegetset", "*.vegetset", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= title; + CFileDialog fd(TRUE, _T(".vegetset"), _T("*.vegetset"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = title; if (fd.DoModal() == IDOK) { NLMISC::CIFile f; @@ -358,16 +358,16 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const // bkup fileName. _LastVegetSetName= (const char*)fd.GetFileName(); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { ok= false; - MessageBox("Failed to load file!"); + MessageBox(_T("Failed to load file!")); } } else { ok= false; - MessageBox("Failed to open file!"); + MessageBox(_T("Failed to open file!")); } } @@ -385,7 +385,7 @@ void CVegetableDlg::buildVegetableSet(NL3D::CTileVegetableDesc &vegetSet, bool for(uint i=0;i<_Vegetables.size();i++) { // if don't want to keep ShapeNames, skip them. - if(!keepDefaultShapeName && _Vegetables[i].Vegetable->ShapeName=="") + if(!keepDefaultShapeName && _Vegetables[i].Vegetable->ShapeName.empty()) continue; // if don't want to keep hiden vegetables, skip them. if(!keepHiden && !_Vegetables[i].Visible) @@ -540,7 +540,7 @@ void CVegetableDlg::OnButtonVegetableClear() if(_Vegetables.size()==0) return; - if( MessageBox("Clear all the list?", "Clear List", MB_OKCANCEL | MB_ICONWARNING | MB_APPLMODAL)==IDOK ) + if( MessageBox(_T("Clear all the list?"), _T("Clear List"), MB_OKCANCEL | MB_ICONWARNING | MB_APPLMODAL)==IDOK ) { clearVegetables(); @@ -605,8 +605,8 @@ void CVegetableDlg::OnButtonVegetableRemove() // *************************************************************************** void CVegetableDlg::OnButtonVegetableLoadDesc() { - CFileDialog fd(TRUE, ".vegetdesc", "*.vegetdesc", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= "Open Vegetable Descriptor"; + CFileDialog fd(TRUE, _T(".vegetdesc"), _T("*.vegetdesc"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = _T("Open Vegetable Descriptor"); if (fd.DoModal() == IDOK) { NLMISC::CIFile f; @@ -629,14 +629,14 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() // update 3D view refreshVegetableDisplay(); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to load file!"); + MessageBox(_T("Failed to load file!")); } } else { - MessageBox("Failed to open file!"); + MessageBox(_T("Failed to open file!")); } } @@ -664,14 +664,14 @@ void CVegetableDlg::OnButtonVegetableSaveDesc() // save the vegetable f.serial(veget); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); } } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } } @@ -684,7 +684,7 @@ void CVegetableDlg::OnButtonVegetableLoadSet() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(loadVegetableSet(vegetSet, "Load Vegetable Set")) + if(loadVegetableSet(vegetSet, _T("Load Vegetable Set"))) { // Delete all vegetables. clearVegetables(); @@ -702,7 +702,7 @@ void CVegetableDlg::OnButtonVegetableAppendSet() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(loadVegetableSet(vegetSet, "Append Vegetable Set")) + if(loadVegetableSet(vegetSet, _T("Append Vegetable Set"))) { // Do not Delete any vegetables. // build them from list. @@ -735,14 +735,14 @@ void CVegetableDlg::OnButtonVegetableSaveSet() // save the vegetable set f.serial(vegetSet); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); } } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.h b/code/nel/tools/3d/object_viewer/vegetable_dlg.h index 37a263630..72d588259 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.h +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.h @@ -144,10 +144,10 @@ protected: // clear all vegetables. void clearVegetables(); // load a vegetSet with a FileDialog - bool loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const char *title); + bool loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const TCHAR *title); /** build the vegetSet from the current _Vegetables * NB: transform Rotate Angle in Radians. - * \param keepDefaultShapeName if true, then vegetables with a ShapeName=="" are kept. + * \param keepDefaultShapeName if true, then vegetables with a ShapeName.empty() are kept. * \param keepHiden if true, then vegetables maked as hiden in ObjectViewer are kept. */ void buildVegetableSet(NL3D::CTileVegetableDesc &vegetSet, bool keepDefaultShapeName= true, bool keepHiden= true ); diff --git a/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp b/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp index f5c7a2372..41305b38c 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp @@ -216,8 +216,7 @@ void CVegetableListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT) ); } - dc.DrawText( - (const char*)str, + dc.DrawText(str, str.GetLength(), &lpDrawItemStruct->rcItem, DT_LEFT|DT_SINGLELINE|DT_VCENTER); diff --git a/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp b/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp index 4e272e7d3..ec27c7352 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp @@ -134,7 +134,7 @@ void CVegetableListColor::clear() void CVegetableListColor::addValue(CRGBA color) { // Append a dummy string to the list box. - AddString(" "); + AddString(_T(" ")); // append a color to the array. _Colors.push_back(color); @@ -149,7 +149,7 @@ void CVegetableListColor::insertValueBeforeCurSel(CRGBA color) else { // insert a dummy string to the list box. - InsertString(id, " "); + InsertString(id, _T(" ")); // insert a color to the array. _Colors.insert(_Colors.begin()+id, color); diff --git a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp index 0c04d33c8..fb9bf1a1e 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp @@ -203,7 +203,7 @@ void CVegetableNoiseValueDlg::OnReleasedcaptureSliderVegetableScaleNoise(NMHDR* // And reset SliderNoiseValue.SetPos(NL_VEGETABLE_EDIT_SLIDER_NVS_SIZE/2); _EnteringScalerSlider= false; - StaticScaleMarker.SetWindowText("100%"); + StaticScaleMarker.SetWindowText(_T("100%")); // Must update display. _VegetableRefresh->refreshVegetableDisplay(); diff --git a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp index 601c5c907..3b68ae0e5 100644 --- a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp +++ b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp @@ -304,7 +304,7 @@ void CWaterPoolEditor::OnAddPool() { if (_Wpm->hasPool(cpi.PoolID) ) { - MessageBox("Pool already exists", "error"); + MessageBox(_T("Pool already exists"), _T("error")); } else { @@ -324,7 +324,7 @@ void CWaterPoolEditor::OnDeletePool() UpdateData(); if (m_PoolList.GetCount() == 1) { - MessageBox("Must have at least one water pool", "error"); + MessageBox(_T("Must have at least one water pool"), _T("error")); } else { @@ -350,8 +350,8 @@ void CWaterPoolEditor::OnSelchangeMapSize() void CWaterPoolEditor::OnLoadPool() { - static char BASED_CODE szFilter[] = "NeL Water Pool Files (*.wpf)|*.wpf||"; - CFileDialog fileDlg( TRUE, ".wpf", "*.wpf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Water Pool Files (*.wpf)|*.wpf||"); + CFileDialog fileDlg( TRUE, _T(".wpf"), _T("*.wpf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { try @@ -378,7 +378,7 @@ void CWaterPoolEditor::OnLoadPool() MessageBox (("Unable to open file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); } } - catch (NLMISC::Exception& e) + catch (const NLMISC::Exception& e) { MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); } @@ -388,8 +388,8 @@ void CWaterPoolEditor::OnLoadPool() void CWaterPoolEditor::OnSavePool() { - static char BASED_CODE szFilter[] = "NeL Water Pool Files (*.wpf)|*.wpf||"; - CFileDialog fileDlg( TRUE, ".wpf", "*.wpf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Water Pool Files (*.wpf)|*.wpf||"); + CFileDialog fileDlg( TRUE, _T(".wpf"), _T("*.wpf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { try @@ -415,7 +415,7 @@ void CWaterPoolEditor::OnSavePool() MessageBox (("Unable to open file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); } } - catch (NLMISC::Exception& e) + catch (const NLMISC::Exception& e) { MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index 54bc1cc19..fbc379d95 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -502,7 +502,7 @@ namespace NLQT // load and set search paths from config //Modules::config().configSearchPaths(); - _CurrentInstance = ""; + _CurrentInstance.clear(); nlinfo("Scene cleared"); } diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt index a93decee5..9a14d59a6 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt @@ -16,7 +16,7 @@ NL_ADD_RUNTIME_FLAGS(nel_3dsmax_shared) NL_ADD_LIB_SUFFIX(nel_3dsmax_shared) #SET_TARGET_PROPERTIES(nel_export PROPERTIES SUFFIX ".dlx") -ADD_DEFINITIONS(-DNEL_3DSMAX_SHARED_EXPORTS) +ADD_DEFINITIONS(-DNEL_3DSMAX_SHARED_EXPORTS ${MAXSDK_DEFINITIONS}) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_3dsmax_shared ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) diff --git a/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt index 4fb8b4455..2787a7645 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt @@ -25,6 +25,8 @@ NL_ADD_RUNTIME_FLAGS(nel_export) NL_ADD_LIB_SUFFIX(nel_export) SET_TARGET_PROPERTIES(nel_export PROPERTIES SUFFIX ".dlu") +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_export ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 3a3e40810..3a4722063 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -364,7 +364,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Error message char sErrorMsg[512]; sprintf (sErrorMsg, "Error exporting the vegetable %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (hWnd, sErrorMsg, _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -737,7 +737,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP } theIP->RedrawViews(time); } - catch(std::exception &e) + catch(const std::exception &e) { ::MessageBox(hWnd, e.what(), "Error", MB_OK | MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp index 46d88757b..b26464f3a 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp @@ -36,15 +36,15 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) { // Result to return bool bRet = false; - char tempFileName[MAX_PATH] = { 0 }; - char tempPathBuffer[MAX_PATH] = { 0 }; + TCHAR tempFileName[MAX_PATH] = { 0 }; + TCHAR tempPathBuffer[MAX_PATH] = { 0 }; try { - DWORD dwRetVal = GetTempPathA(MAX_PATH, tempPathBuffer); + DWORD dwRetVal = GetTempPath(MAX_PATH, tempPathBuffer); if (dwRetVal > MAX_PATH || (dwRetVal == 0)) nlerror("GetTempPath failed"); - UINT uRetVal = GetTempFileNameA(tempPathBuffer, TEXT("_nel_export_mesh_"), 0, tempFileName); + UINT uRetVal = GetTempFileName(tempPathBuffer, _T("_nel_export_mesh_"), 0, tempFileName); if (uRetVal == 0) nlerror("GetTempFileName failed"); @@ -233,7 +233,7 @@ bool CNelExport::exportVegetable (const char *sPath, INode& node, TimeValue time // All is good bRet=true; } - catch (Exception &e) + catch (const Exception &e) { // Message box const char *message = e.what(); @@ -340,7 +340,7 @@ bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, T bRet = false; } } - catch (Exception& e) + catch (const Exception& e) { if (_ErrorInDialog) MessageBox (NULL, e.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); @@ -408,7 +408,7 @@ bool CNelExport::exportSkeleton (const char *sPath, INode* pNode, TimeValue time // All is good bRet=true; } - catch (Exception &e) + catch (const Exception &e) { nlwarning (e.what()); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index e65449409..0eeebfa52 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -2332,11 +2332,11 @@ INT_PTR CALLBACK MiscDialogCallback ( break; case IDOK: { - currentParam->FloatingObject=SendMessage (GetDlgItem (hwndDlg, IDC_FLOATING_OBJECT), BM_GETCHECK, 0, 0); + currentParam->FloatingObject = SendMessage (GetDlgItem (hwndDlg, IDC_FLOATING_OBJECT), BM_GETCHECK, 0, 0); // Ligoscape currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0); - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512); currentParam->LigoRotate = tmp; @@ -2365,7 +2365,7 @@ INT_PTR CALLBACK MiscDialogCallback ( // Skeleton Scale currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512); - currentParam->ExportBoneScaleNameExt= tmp; + currentParam->ExportBoneScaleNameExt = wideToUtf8(tmp); // remanence currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0); @@ -2650,7 +2650,7 @@ void CNelExport::OnNodeProperties (const std::set &listNode) { // Get a string std::string nameLod=CExportNel::getScriptAppData (node, NEL3D_APPDATA_LOD_NAME+name, ""); - if (nameLod!="") + if (!nameLod.empty()) { param.ListLodName.push_back (nameLod); } @@ -2854,7 +2854,7 @@ void CNelExport::OnNodeProperties (const std::set &listNode) param.SoundGroup = DIFFERENT_VALUE_STRING; if (CExportNel::getScriptAppData(node, NEL3D_APPDATA_ENV_FX, "no fx") != param.EnvironmentFX) { - param.EnvironmentFX = ""; + param.EnvironmentFX.clear(); } if ( param.LightGroup != CExportNel::getScriptAppData (node, NEL3D_APPDATA_LM_LIGHT_GROUP, 0) ) @@ -2871,7 +2871,7 @@ void CNelExport::OnNodeProperties (const std::set &listNode) if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_IGNAME, "")!=param.InstanceGroupName) param.InstanceGroupName = DIFFERENT_VALUE_STRING; if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_INTERFACE_FILE, "")!=param.InterfaceFileName) - param.InterfaceFileName = ""; + param.InterfaceFileName.clear(); if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_INTERFACE_THRESHOLD, 0.1f)!=param.InterfaceThreshold) param.InterfaceThreshold = -1; if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS, 0)!=param.GetInterfaceNormalsFromSceneObjects) @@ -2942,7 +2942,7 @@ void CNelExport::OnNodeProperties (const std::set &listNode) { // Get a string std::string nameLod=CExportNel::getScriptAppData (node, NEL3D_APPDATA_LOD_NAME+name, ""); - if (nameLod!="") + if (!nameLod.empty()) { tmplist.push_back (nameLod); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp index 1a007cb8b..af1047d0c 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp @@ -56,7 +56,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector& vectNode) pIG->serial (file); // All is good } - catch (Exception &c) + catch (const Exception &c) { // Cannot save the file MessageBox (NULL, c.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp index c5457786e..71892b417 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp @@ -112,7 +112,7 @@ Value* export_shape_cf (Value** arg_list, int count) if (theCNelExport.exportMesh (sPath, *node, ip->GetTime())) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportShape) %s", e.what()); } @@ -187,7 +187,7 @@ Value* export_shape_ex_cf (Value** arg_list, int count) if (theCNelExport.exportMesh (sPath.c_str(), *node, ip->GetTime())) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportShapeEx) %s", e.what()); } @@ -231,7 +231,7 @@ Value* export_skeleton_cf (Value** arg_list, int count) if (theCNelExport.exportSkeleton (sPath, node, ip->GetTime())) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportSkeleton) %s", e.what()); } @@ -302,7 +302,7 @@ Value* export_animation_cf (Value** arg_list, int count) } } } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportAnimation) %s", e.what()); } @@ -360,7 +360,7 @@ Value* export_ig_cf (Value** arg_list, int count) } } } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportInstanceGroup) %s", e.what()); } @@ -419,7 +419,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) } } } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportSkeletonWeight) %s", e.what()); } @@ -445,7 +445,7 @@ Value* view_shape_cf (Value** arg_list, int count) theCNelExport.viewMesh (ip->GetTime()); } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR %s", e.what()); } @@ -555,7 +555,7 @@ Value* export_vegetable_cf (Value** arg_list, int count) if (theCNelExport.exportVegetable (sPath, *node, ip->GetTime())) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportVegetable) %s", e.what()); } @@ -648,7 +648,7 @@ Value* export_collision_cf (Value** arg_list, int count) if (theCNelExport.exportCollision (sPath.c_str(), nodes, time)) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportCollision) %s", e.what()); } @@ -705,7 +705,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count) if (theCNelExport.exportPACSPrimitives (sPath.c_str(), nodes, time)) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportPACSPrimitives) %s", e.what()); } @@ -752,7 +752,7 @@ Value* export_lod_character_cf (Value** arg_list, int count) if (theCNelExport.exportLodCharacter (sPath, *node, ip->GetTime())) ret = &true_value; } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("ERROR (NelExportLodCharacter) %s", e.what()); } @@ -873,7 +873,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count) check_arg_count(NeLGetFileModificationDate , 1, count); // Check to see if the arguments match up to what we expect - char *message = "date NeLGetFileModificationDate [filename] - If an error occured, returns undefined."; + char *message = "date NeLGetFileModificationDate [filename] - If an error occurred, returns undefined."; //type_check type_check (arg_list[0], String, message); @@ -911,7 +911,7 @@ Value* set_file_modification_date_cf (Value** arg_list, int count) check_arg_count(NeLSetFileModificationDate , 2, count); // Check to see if the arguments match up to what we expect - char *message = "bool NeLSetFileModificationDate [filename] [date] - If an error occured, returns false."; + char *message = "bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false."; //type_check type_check (arg_list[0], String, message); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp index 496db99ec..d1c47c00e 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp @@ -86,7 +86,7 @@ bool CNelExport::exportSWT(const char *sPath, std::vector& vectNode) // All is good return true; } - catch (Exception &e) + catch (const Exception &e) { nlwarning (e.what()); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp index f4d5fdaf2..6a0587a22 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp @@ -128,7 +128,7 @@ void regsiterOVPath () for (uint i=0; i<(uint)search_pathes.size(); i++) CPath::addSearchPath (search_pathes.asString(i)); } - catch(EUnknownVar &) + catch(const EUnknownVar &) {} try @@ -138,7 +138,7 @@ void regsiterOVPath () for (uint i=0; i<(uint)recursive_search_pathes.size(); i++) CPath::addSearchPath (recursive_search_pathes.asString(i), true, false); } - catch(EUnknownVar &) + catch(const EUnknownVar &) {} // Add extension remapping @@ -155,7 +155,7 @@ void regsiterOVPath () CPath::remapExtension(extensions_remapping.asString(i), extensions_remapping.asString(i+1), true); } } - catch (EUnknownVar &) + catch (const EUnknownVar &) { } } @@ -369,7 +369,7 @@ void CNelExport::viewMesh (TimeValue time) string sTmp = "Object Name: "; sTmp += pNode->GetName(); ProgBar.setLine (0, sTmp); - sTmp = ""; + sTmp.clear(); for (uint32 i = 1; i < 10; ++i) ProgBar.setLine (i, sTmp); sTmp = "Last Error"; @@ -582,8 +582,8 @@ void CNelExport::viewMesh (TimeValue time) NLMISC::clamp(slInfo.CellSurfaceLightSize, 0.001f, 1000000.f); slInfo.CellRaytraceDeltaZ= theExportSceneStruct.SurfaceLightingDeltaZ; // no more add any prefix to the colision identifier. - slInfo.ColIdentifierPrefix= ""; - slInfo.ColIdentifierSuffix= ""; + slInfo.ColIdentifierPrefix.clear(); + slInfo.ColIdentifierSuffix.clear(); // Build RetrieverBank and GlobalRetriever from collisions in scene _ExportNel->computeCollisionRetrieverFromScene(time, slInfo.RetrieverBank, slInfo.GlobalRetriever, slInfo.ColIdentifierPrefix.c_str(), slInfo.ColIdentifierSuffix.c_str(), slInfo.IgFileName); diff --git a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp index 167a4fc14..3f6a2e824 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp @@ -66,7 +66,7 @@ INT_PTR CALLBACK CalculatingDialogCallback ( SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (long)temp); SendMessage (GetDlgItem (hwndDlg, IDC_BUTTONCANCEL), WM_PAINT, 0, 0); } - string all = ""; + string all; for (uint32 i = 0; i < 14; ++i) all += pClass->sInfoProgress[i] + "\n"; SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (long)all.c_str()); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt index 3c96760a8..e8222ad54 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt @@ -8,6 +8,8 @@ NL_DEFAULT_PROPS(nel_mesh_lib "MAX Plugin: NeL Mesh Library") NL_ADD_RUNTIME_FLAGS(nel_mesh_lib) NL_ADD_LIB_SUFFIX(nel_mesh_lib) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_mesh_lib ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index d82e2a394..ef84390a1 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -2436,7 +2436,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { string sTmp = "Placement"; gOptions.FeedBack->setLine (3, sTmp); - sTmp = ""; + sTmp.clear(); for(i=4;i<10;++i) gOptions.FeedBack->setLine (i, sTmp); gOptions.FeedBack->update (); @@ -2628,7 +2628,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB pLightMap->writeTGA (f, 32); } } - catch(Exception &e) + catch(const Exception &e) { if (gOptions.FeedBack != NULL) { diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp index 06e3c051d..1416d287f 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp @@ -1761,7 +1761,7 @@ ITrack* CExportNel::buildATrack (CAnimation& animation, Control& c, TNelValueTyp } else { - MessageBox (NULL, "Warning: no pos track exported!", "Tmp NEL", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("Warning: no pos track exported!"), _T("Tmp NEL"), MB_OK|MB_ICONEXCLAMATION); } } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp index 0a01a9fb8..d7db650cb 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp @@ -263,7 +263,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector & // report warnings if (!warnings.empty()) { - string message = "Warning(s) occured during collision export\n(defective links may result) error"; + string message = "Warning(s) occurred during collision export\n(defective links may result) error"; for (i=0; i & // report warnings if (!errors.empty()) { - string message = "Error(s) occured during collision export\n(edge issues)"; + string message = "Error(s) occurred during collision export\n(edge issues)"; for (i=0; i & pCollisionMeshBuild = NULL; } - // Return the shape pointer or NULL if an error occured. + // Return the shape pointer or NULL if an error occurred. return pCollisionMeshBuild; } @@ -391,7 +391,7 @@ void CExportNel::computeCollisionRetrieverFromScene(TimeValue time, // Default: empty retrieverBank/globalRetriever retrieverBank= NULL; globalRetriever= NULL; - retIgName= ""; + retIgName.clear(); // get list of nodes from scene std::vector nodes; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp index bd48be1ea..0a0d8c522 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp @@ -116,7 +116,7 @@ CMesh::CMeshBuild* CExportNel::createMeshBuild(INode& node, TimeValue tvTime, CM } } - // Return the shape pointer or NULL if an error occured. + // Return the shape pointer or NULL if an error occurred. return pMeshBuild; } @@ -467,7 +467,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP retShape->setDistMax (distmax); } - // Return the shape pointer or NULL if an error occured. + // Return the shape pointer or NULL if an error occurred. return retShape; } @@ -1421,7 +1421,7 @@ IMeshGeom *CExportNel::buildMeshGeom (INode& node, TimeValue time, const TInodeP if (InfoLog) InfoLog->display("End of %s \n", node.GetName()); - // Return the shape pointer or NULL if an error occured. + // Return the shape pointer or NULL if an error occurred. return meshGeom; } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index 5997006d5..a745970eb 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -946,11 +946,11 @@ std::string CExportNel::getAnimatedLight (INode *node) { std::string ret = CExportNel::getScriptAppData (node, NEL3D_APPDATA_LM_ANIMATED_LIGHT, NEL3D_APPDATA_LM_ANIMATED_LIGHT_DEFAULT); if (ret == "Sun") - ret = ""; + ret.clear(); if (ret == "GlobalLight") - ret = ""; + ret.clear(); if (ret == "(Use NelLight Modifier)") - ret = ""; + ret.clear(); return ret; } @@ -1111,7 +1111,7 @@ static void restoreDecimalSeparator() ///======================================================================= -float toFloatMax(const char *src) +float toFloatMax(const TCHAR *src) { float result = 0.f; if (toFloatMax(src, result)) return result; @@ -1119,7 +1119,7 @@ float toFloatMax(const char *src) } -bool toFloatMax(const char *src, float &dest) +bool toFloatMax(const TCHAR *src, float &dest) { setDecimalSeparatorAsPoint(); std::string str(src); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h index 11e762099..7421fad49 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h @@ -1092,9 +1092,9 @@ private: /** replacment for sprintf scanf (because of localisation in max) */ -float toFloatMax(const char *src); +float toFloatMax(const TCHAR *src); // Same as to float max, but returns true if succeed -bool toFloatMax(const char *src, float &dest); +bool toFloatMax(const TCHAR *src, float &dest); std::string toStringMax(float value); std::string toStringMax(int value); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp index 820f03b06..21f557562 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp @@ -715,7 +715,7 @@ void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, I sTmp += pNode->GetName(); if (progress) progress->setLine (0, sTmp); - sTmp = ""; + sTmp.clear(); for (uint32 i = 1; i < 10; ++i) { if (progress) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt index c173232b3..178e70f5d 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt @@ -18,4 +18,6 @@ NL_DEFAULT_PROPS(nel_patch_converter "MAX Plugin: NeL Patch Converter") NL_ADD_RUNTIME_FLAGS(nel_patch_converter) NL_ADD_LIB_SUFFIX(nel_patch_converter) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_converter RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h index d91777070..5ca665591 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h @@ -50,7 +50,7 @@ class PO2RPO : public Modifier { HWND hRollup; // From Animatable - TCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } //From Modifier //TODO: Add the channels that the modifier needs to perform its modification diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/rykolscript.txt b/code/nel/tools/3d/plugin_max/nel_patch_converter/rykolscript.txt index 1a73ba02f..526870762 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/rykolscript.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/rykolscript.txt @@ -261,6 +261,6 @@ If file0 doesn't exist the function return true If date (file0) <= date (file1) the function return true If date (file0) > date (file1) the function return false If file1 doesn't exist the function return undefined -If an error occured, the function return undefined +If an error occurred, the function return undefined ********************************************** diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 80e715f21..5f492473c 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -284,7 +284,7 @@ Value* import_zone_cf (Value** arg_list, int count) // Redraw the viewports ip->RedrawViews(ip->GetTime()); } - catch (Exception& e) + catch (const Exception& e) { // Error message errorMessage (("Error when loading file "+filename+": "+e.what()).c_str(), "NeL import zone", *ip, dialog); @@ -1627,7 +1627,7 @@ load_bank_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' std::string bankName = GetBankPathName (); - if (bankName!="") + if (!bankName.empty()) { try { @@ -1649,7 +1649,7 @@ load_bank_cf(Value** arg_list, int count) mprintf ("Error: can't open bank file %s\n", bankName.c_str()); } } - catch (Exception& e) + catch (const Exception& e) { // Error message mprintf ("Error: %s\n", e.what()); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt index 20a3635e4..bc2f81f33 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt @@ -18,6 +18,8 @@ NL_DEFAULT_PROPS(nel_patch_edit "MAX Plugin: NeL Patch Editor") NL_ADD_RUNTIME_FLAGS(nel_patch_edit) NL_ADD_LIB_SUFFIX(nel_patch_edit) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_patch_edit ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt index 63f0a5bcc..127b7fba2 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt @@ -8,4 +8,6 @@ NL_DEFAULT_PROPS(nel_patch_lib "MAX Plugin: NeL Patch Library") NL_ADD_RUNTIME_FLAGS(nel_patch_lib) NL_ADD_LIB_SUFFIX(nel_patch_lib) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_lib RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h index 42d514eb3..e9f3b6b3f 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h @@ -434,7 +434,6 @@ class CBankManager public: CBankManager () { - _lastPath=""; } const NL3D::CTileBank& getBank (std::string& path=GetBankPathName ()) { @@ -449,7 +448,7 @@ public: _bank.serial (file); } } - catch (NLMISC::EStream& excp) + catch (const NLMISC::EStream& excp) { MessageBox (NULL, excp.what(), "Load error", MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp index c2fd487dc..3acaf28bb 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp @@ -45,7 +45,7 @@ class RPOClassDesc:public ClassDesc } const TCHAR * ClassName() { - return "RklPatch"; + return _T("RklPatch"); } SClass_ID SuperClassID() { @@ -57,7 +57,7 @@ class RPOClassDesc:public ClassDesc } const TCHAR* Category() { - return "Rykol Tools"; + return _T("Rykol Tools"); } }; @@ -381,7 +381,7 @@ void RPO::GetCollapseTypes(Tab &clist,Tab &nlist) //TODO: Append any any other collapse type the plugin supports Class_ID id = RYKOLPATCHOBJ_CLASS_ID; - TSTR *name = new TSTR("Rykol Patch Mesh"); + TSTR *name = new TSTR(_T("Rykol Patch Mesh")); clist.Append(1,&id); nlist.Append(1,&name); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h index 0dfde7454..4464ce10f 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h @@ -83,14 +83,14 @@ class RPO : public PatchObject int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt); void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt); //TODO: Return the name that will appear in the history browser (modifier stack) - TCHAR *GetObjectName() { return "Rykol Patch Object";} + const MCHAR *GetObjectName() { return _T("Rykol Patch Object");} void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel ); //TODO: Return the default name of the node when it is created. - void InitNodeName(TSTR& s) { s = "Rykol Patch Object"; } + void InitNodeName(TSTR& s) { s.FromUTF8("Rykol Patch Object"); } // From Object BOOL HasUVW(); @@ -206,10 +206,10 @@ class RPO : public PatchObject ? true : PatchObject::IsSubClassOf(classID); } SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; } - void GetClassName(TSTR& s) {s = "Rykol Patch Object";} + void GetClassName(TSTR& s) {s.FromUTF8("Rykol Patch Object");} RefTargetHandle Clone ( RemapDir &remap ); - RefResult NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message); + RefResult NotifyRefChanged (const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); int NumSubs() { diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp index a80b2d0e9..55e8a8c55 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp @@ -175,7 +175,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo // Get the bank name std::string sName=GetBankPathName (); - if (sName!="") + if (!sName.empty()) { // Open the bank CIFile file; @@ -191,9 +191,9 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo // Ok loaded = true; } - catch (EStream& stream) + catch (const EStream& e) { - MessageBox (NULL, stream.what(), "Error", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, stream.what(), _T("Error"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -202,7 +202,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo if (loaded == false) { nlwarning ("Can't load any tile bank. Select on with the tile_utility plug-in"); - mprintf ("Can't load any tile bank. Select on with the tile_utility plug-in"); + mprintf (_T("Can't load any tile bank. Select on with the tile_utility plug-in")); return false; } } @@ -398,7 +398,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } @@ -422,7 +422,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } @@ -439,7 +439,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } @@ -451,7 +451,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo isrcedge=getEdge(pPM,srcpatch,srcpatch->v[nv],icv); if (isrcedge==-1) { - mprintf ("Invalid edge"); + mprintf (_T("Invalid edge")); nlwarning ("Invalid bind"); return false; } @@ -595,7 +595,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo sym.invert (); if (!CPatchInfo::transform (patchinfo, zoneSymmetry, bank, symmetry, rotate, snapCell, weldThreshold, sym)) { - mprintf ("Can't transform the zone"); + mprintf (_T("Can't transform the zone")); nlwarning ("Invalid bind"); return false; } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt index de6310d18..388e8b8ef 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt @@ -22,5 +22,7 @@ NL_DEFAULT_PROPS(nel_patch_paint "MAX Plugin: NeL Patch Painter") NL_ADD_RUNTIME_FLAGS(nel_patch_paint) NL_ADD_LIB_SUFFIX(nel_patch_paint) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_paint RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) INSTALL(FILES keys.cfg DESTINATION maxplugin/plugins ) \ No newline at end of file diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp index 73bb142b1..a9426ed05 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp @@ -3979,7 +3979,7 @@ void EPM_PaintCMode::DoPaint () std::string sName=GetBankPathName (); - if (sName!="") + if (!sName.empty()) { CIFile file; if (file.open (sName)) @@ -3990,7 +3990,7 @@ void EPM_PaintCMode::DoPaint () bank.serial (file); bank.computeXRef (); } - catch (EStream& stream) + catch (const EStream& stream) { MessageBox (NULL, stream.what(), "Error", MB_OK|MB_ICONEXCLAMATION); } @@ -4075,7 +4075,7 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it) // ok return true; } - catch (Exception& e) + catch (const Exception& e) { // Print an error message char msg[512]; @@ -4370,7 +4370,7 @@ DWORD WINAPI myThread (LPVOID vData) delete pData; } - catch (Exception& e) + catch (const Exception& e) { MessageBox (NULL, e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp index b8503c137..10554f8da 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp @@ -168,7 +168,7 @@ void CTileSetCont::build (CTileBank& bank, uint tileSet) std::string fileName=bank.getAbsPath()+bank.getTile (set->getTile128(0))->getRelativeFileName (CTile::diffuse); // Valid name? - if (fileName!="") + if (!fileName.empty()) { // Create it MainBitmap=new CTextureFile (fileName); @@ -193,7 +193,7 @@ void CTileSetCont::build (CTileBank& bank, uint tileSet) std::string fileName=bank.getAbsPath()+pTile->getRelativeFileName (CTile::diffuse); // Valid name? - if (fileName!="") + if (!fileName.empty()) { // Create it if (GroupBitmap[group]==NULL) @@ -218,7 +218,7 @@ void CTileSetCont::build (CTileBank& bank, uint tileSet) std::string fileName=bank.getAbsPath()+pTile->getRelativeFileName (CTile::diffuse); // Valid name? - if (fileName!="") + if (!fileName.empty()) { // Create it if (GroupBitmap[group]==NULL) @@ -250,10 +250,10 @@ void CTileSetCont::build (CTileBank& bank, uint tileSet) // Get the name std::string fileName = bank.getDisplacementMap(dispTile); if (fileName=="EmptyDisplacementMap") - fileName=""; + fileName.clear(); // Valid name? - if (fileName!="") + if (!fileName.empty()) { // Create it DisplaceBitmap[displace]=new CTextureFile (bank.getAbsPath()+fileName); @@ -440,7 +440,7 @@ void LoadKeyCfg () // Get value PainterKeys[key]=value.asInt (); } - catch (EConfigFile &e) + catch (const EConfigFile &e) { // Something goes wrong... catch that const char* what=e.what(); @@ -489,7 +489,7 @@ void LoadVarCfg () LightDirection.z = light_direction.asFloat (2); } } - catch (EConfigFile &) + catch (const EConfigFile &) { } @@ -504,7 +504,7 @@ void LoadVarCfg () LightDiffuse.B = light_diffuse.asInt (2); } } - catch (EConfigFile &) + catch (const EConfigFile &) { } @@ -519,7 +519,7 @@ void LoadVarCfg () LightAmbiant.B = light_ambiant.asInt (2); } } - catch (EConfigFile &) + catch (const EConfigFile &) { } @@ -529,7 +529,7 @@ void LoadVarCfg () CConfigFile::CVar &light_multiply= cf.getVar ("LightMultiply"); LightMultiply = light_multiply.asFloat (); } - catch (EConfigFile &) + catch (const EConfigFile &) { } @@ -539,7 +539,7 @@ void LoadVarCfg () CConfigFile::CVar &zoom_speed= cf.getVar ("ZoomSpeed"); ZoomSpeed = zoom_speed.asFloat (); } - catch (EConfigFile &) + catch (const EConfigFile &) { } } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp index 27255ce46..e29b00999 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp @@ -409,7 +409,7 @@ bool CPaintColor::loadBrush (const char *brushFileName) return false; } } - catch (Exception &e) + catch (const Exception &e) { // Error message MessageBox ((HWND)CNELU::Driver->getDisplay(), e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt index 9c4f6deb2..dc5b6a284 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt @@ -19,4 +19,6 @@ NL_DEFAULT_PROPS(nel_vertex_tree_paint "MAX Plugin: NeL Vertex Tree Painter") NL_ADD_RUNTIME_FLAGS(nel_vertex_tree_paint) NL_ADD_LIB_SUFFIX(nel_vertex_tree_paint) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_vertex_tree_paint RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_assets_png_batched.ms b/code/nel/tools/3d/plugin_max/scripts/nel_assets_png_batched.ms index 7a4783027..cb6c339c8 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_assets_png_batched.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_assets_png_batched.ms @@ -322,7 +322,7 @@ rollout assets_png_rollout "Properties" -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. - -- The function should retun -1 if an arror occured, else the count of modification done + -- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_assets_ps_batched.ms b/code/nel/tools/3d/plugin_max/scripts/nel_assets_ps_batched.ms index f8165e25e..c4bc56800 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_assets_ps_batched.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_assets_ps_batched.ms @@ -105,7 +105,7 @@ rollout assets_ps_rollout "Properties" -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. - -- The function should retun -1 if an arror occured, else the count of modification done + -- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave.ms b/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave.ms index ab9e45325..dcd8fde63 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave.ms @@ -46,7 +46,7 @@ rollout assets_resave_rollout "Properties" -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. - -- The function should retun -1 if an arror occured, else the count of modification done + -- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave_hard.ms b/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave_hard.ms index 05220c7a5..50bd4efe9 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave_hard.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_assets_resave_hard.ms @@ -46,7 +46,7 @@ rollout assets_resave_rollout "Properties" -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. - -- The function should retun -1 if an arror occured, else the count of modification done + -- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_batched_mergesave.ms b/code/nel/tools/3d/plugin_max/scripts/nel_batched_mergesave.ms index cbf17a097..511056bff 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_batched_mergesave.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_batched_mergesave.ms @@ -3,7 +3,7 @@ -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. --- The function should retun -1 if an arror occured, else the count of modification done +-- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_batched_script.ms b/code/nel/tools/3d/plugin_max/scripts/nel_batched_script.ms index 628aa916b..be53ce06f 100644 --- a/code/nel/tools/3d/plugin_max/scripts/nel_batched_script.ms +++ b/code/nel/tools/3d/plugin_max/scripts/nel_batched_script.ms @@ -3,7 +3,7 @@ -- To use this script -- Include it in your script into the rollout at the beginning. -- Implement a do_it function to do the job in your rollout. --- The function should retun -1 if an arror occured, else the count of modification done +-- The function should retun -1 if an arror occurred, else the count of modification done -- It the function returns <1, the project will not be overwritten Group "Running properties" diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp index b1e0583e8..7c4605b38 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp @@ -302,7 +302,7 @@ void Tile_utility::Load (const std::string& path) SetBankPathName (path); } } - catch (EStream stream) + catch (const EStream &stream) { char tmp[1024]; sprintf (tmp, "Error while loading %s:\n\n%s", path, stream.what()); @@ -443,7 +443,7 @@ bool Tile_utility::SetupMaterial () const mtl->SetShininess (0.0, t); mtl->SetSpecular (Color (0,0,0), t); - if ((tile->getRelativeFileName(CTile::diffuse)!="")||(tile->getRelativeFileName(CTile::additive)!="")) + if (!tile->getRelativeFileName(CTile::diffuse).empty() || !tile->getRelativeFileName(CTile::additive).empty()) { bActive=true; Texmap* rgb=(Texmap*)GetRGBAddDesc()->Create (FALSE); @@ -452,7 +452,7 @@ bool Tile_utility::SetupMaterial () const mtl->SetSubTexmap (ID_DI, rgb); mtl->SubTexmapOn (ID_DI); - if (tile->getRelativeFileName(CTile::diffuse)!="") + if (!tile->getRelativeFileName(CTile::diffuse).empty()) { // New BitmapTex BitmapTex* tex=NewDefaultBitmapTex(); @@ -472,7 +472,7 @@ bool Tile_utility::SetupMaterial () const mtl->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); } - if (tile->getRelativeFileName(CTile::additive)!="") + if (!tile->getRelativeFileName(CTile::additive).empty()) { // New BitmapTex BitmapTex* tex=NewDefaultBitmapTex(); diff --git a/code/nel/tools/3d/shape2obj/main.cpp b/code/nel/tools/3d/shape2obj/main.cpp index 66d9dd6c4..7d106a887 100644 --- a/code/nel/tools/3d/shape2obj/main.cpp +++ b/code/nel/tools/3d/shape2obj/main.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) // Add the shape shapeMesh = streamShape.getShapePointer(); } - catch (Exception& e) + catch (const Exception& e) { cout << "Error : " << e.what() << endl; diff --git a/code/nel/tools/3d/shapes_exporter/main.cpp b/code/nel/tools/3d/shapes_exporter/main.cpp index 56249e357..a77161849 100644 --- a/code/nel/tools/3d/shapes_exporter/main.cpp +++ b/code/nel/tools/3d/shapes_exporter/main.cpp @@ -292,7 +292,7 @@ sint main(int argc, char **argv) } else { - // an error occured, try to delete directory + // an error occurred, try to delete directory nlwarning("can't export shape"); CFile::deleteDirectory(output_path); } diff --git a/code/nel/tools/3d/tile_edit/Browse.cpp b/code/nel/tools/3d/tile_edit/Browse.cpp index 7c4f6d745..9b9b8942e 100644 --- a/code/nel/tools/3d/tile_edit/Browse.cpp +++ b/code/nel/tools/3d/tile_edit/Browse.cpp @@ -546,7 +546,7 @@ unsigned long Browse::MyControllingFunction( void* pParam ) rot = tileBank2.getTile (index)->getRotAlpha (); } else - path = ""; + path.clear(); } break; case 3: @@ -576,7 +576,7 @@ unsigned long Browse::MyControllingFunction( void* pParam ) break; } - if ((path!="") && _LoadBitmap(tileBank2.getAbsPath() + path, pBmp, *bits, pAlpha, rot)) + if (!path.empty() && _LoadBitmap(tileBank2.getAbsPath() + path, pBmp, *bits, pAlpha, rot)) { *ld=1; int iFV,iLV; br->m_ctrl.GetVisibility(iFV, iLV, br->m_128x128); @@ -633,7 +633,7 @@ void Browse::Init() value=256; type=REG_SZ; if (RegQueryValueEx(regkey,REGKEY_LASTPATH,0,&type,(unsigned char *)&sWindowpl,&value)!=ERROR_SUCCESS) - m_ctrl.LastPath=""; + m_ctrl.LastPath.clear(); else m_ctrl.LastPath=(const char*)sWindowpl; value=4; @@ -916,7 +916,7 @@ void Browse::OnBatchLoad () // Transition to patch CTileSetTransition* trans=tileBank2.getTileSet (land)->getTransition (transition); - if (tileBank2.getTile (trans->getTile())->getRelativeFileName (CTile::alpha)=="") + if (tileBank2.getTile (trans->getTile())->getRelativeFileName (CTile::alpha).empty()) { // Continue ? int ok; @@ -958,7 +958,7 @@ void Browse::OnBatchLoad () // Transition to patch CTileSetTransition* trans=tileBank2.getTileSet (land)->getTransition (transition); - if (tileBank2.getTile (trans->getTile())->getRelativeFileName (m_ctrl.Texture==1?CTile::diffuse:CTile::additive)=="") + if (tileBank2.getTile (trans->getTile())->getRelativeFileName (m_ctrl.Texture==1?CTile::diffuse:CTile::additive).empty()) { // Try to load a tile with a file name like /tiletransition0.tga char sName2[256]; @@ -1409,7 +1409,7 @@ void Browse::OnExportBorder() else error=true; } - catch (Exception& e) + catch (const Exception& e) { const char *toto=e.what (); error=true; @@ -1454,7 +1454,7 @@ void Browse::OnImportBorder() else error=true; } - catch (Exception& e) + catch (const Exception& e) { const char *toto=e.what (); error=true; diff --git a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp index f82eef8c2..a7493c62e 100644 --- a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp +++ b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp @@ -98,7 +98,7 @@ void SelectionTerritoire::OnAddTerritoire() CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE); if (list->FindStringExact(0,GetStr.name)!=LB_ERR) { - MessageBox("Ce nom existe deja","Error",MB_ICONERROR); + MessageBox(_T("Ce nom existe deja","Error"), MB_ICONERROR); } else { @@ -163,7 +163,7 @@ void SelectionTerritoire::OnEditTerritoire() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } @@ -179,7 +179,7 @@ void SelectionTerritoire::OnRemoveTerritoire() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -197,7 +197,7 @@ void SelectionTerritoire::OnAddTileSet() CListBox *list=(CListBox*)GetDlgItem(IDC_TILE_SET); if (list->FindStringExact(0,GetStr.name)!=LB_ERR) { - MessageBox("Ce nom existe deja","Error",MB_ICONERROR); + MessageBox(_T("Ce nom existe deja") , _T("Error"), MB_ICONERROR); } else { @@ -268,7 +268,7 @@ void SelectionTerritoire::OnEditTileSet() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } @@ -284,7 +284,7 @@ void SelectionTerritoire::OnRemoveTileSet() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -315,7 +315,7 @@ void SelectionTerritoire::OnMonter() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -346,7 +346,7 @@ void SelectionTerritoire::OnDescendre() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -355,9 +355,8 @@ void SelectionTerritoire::OnSelect() // TODO: Add your control notification handler code here CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE); CListBox *list2=(CListBox*)GetDlgItem(IDC_TILE_SET); - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"; - CFileDialog sFile(true, "bank", "main.bank",0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = _T("NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"); + CFileDialog sFile(true, _T("bank"), _T("main.bank"), 0, szFilter, this); if (sFile.DoModal()==IDOK) { POSITION p = sFile.GetStartPosition(); @@ -425,7 +424,7 @@ LRESULT SelectionTerritoire::WindowProc(UINT message, WPARAM wParam, LPARAM lPar void SelectionTerritoire::OnOK() { // TODO: Add extra validation here - if (::MessageBox (NULL, "Are you sure you want to quit?", "Quit", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + if (::MessageBox (NULL, _T("Are you sure you want to quit?"), _T("Quit"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) { CDialog::OnOK(); } @@ -453,9 +452,8 @@ void SelectionTerritoire::Save(const char* path, CTileBank &toSave) void SelectionTerritoire::OnSaveAs() { // TODO: Add your control notification handler code here - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"; - CFileDialog sFile(false, "bank", DefautPath+MainFileName, 0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = _T("NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"); + CFileDialog sFile(false, _T("bank"), DefautPath+MainFileName, 0, szFilter, this); if (sFile.DoModal()==IDOK) { Save (sFile.GetPathName(), tileBank); @@ -482,7 +480,7 @@ void SelectionTerritoire::OnSaveAs() void SelectionTerritoire::OnCancel() { // TODO: Add extra cleanup here - if (::MessageBox (NULL, "Are you sure you want to quit?", "Quit", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + if (::MessageBox (NULL, _T("Are you sure you want to quit?"), _T("Quit"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) { CDialog::OnCancel(); } @@ -543,7 +541,7 @@ void SelectionTerritoire::OnPath() // Last check char msg[512]; sprintf (msg, "Do you really want to set %s as base path of the bank ?", path); - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDYES) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDYES) { // Set as default path.. @@ -579,7 +577,7 @@ void SelectionTerritoire::OnPath() const std::string& bitmapPath=tileBank.getTile(tiles)->getRelativeFileName ((CTile::TBitmap)type); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Check the path if (CheckPath (bitmapPath, path)==false) @@ -591,7 +589,7 @@ void SelectionTerritoire::OnPath() sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath.c_str()); // Message - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDNO) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) break; } } @@ -620,7 +618,7 @@ void SelectionTerritoire::OnPath() sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath); // Message - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDNO) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) break; } } @@ -650,7 +648,7 @@ void SelectionTerritoire::OnPath() std::string bitmapPath=tileBank.getTile(tiles)->getRelativeFileName ((CTile::TBitmap)type); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Remove the absolute path bool res=RemovePath (bitmapPath, path); @@ -670,7 +668,7 @@ void SelectionTerritoire::OnPath() std::string bitmapPath=tileBank.getDisplacementMap (noise); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Remove the absolute path bool res=RemovePath (bitmapPath, path); @@ -683,7 +681,7 @@ void SelectionTerritoire::OnPath() } else // Info message - MessageBox ("Can't set the path.", "TileEdit", MB_OK|MB_ICONINFORMATION); + MessageBox (_T("Can't set the path."), _T("TileEdit"), MB_OK|MB_ICONINFORMATION); } @@ -706,9 +704,9 @@ void SelectionTerritoire::OnPath() void SelectionTerritoire::OnExport() { // TODO: Add your control notification handler code here - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||"; - CFileDialog sFile(false, "*.smallbank", DefautPath+"*.smallbank", 0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = + _T("NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||"); + CFileDialog sFile(false, _T("*.smallbank"), DefautPath+ _T("*.smallbank"), 0, szFilter, this); if (sFile.DoModal()==IDOK) { // Copy the bank @@ -737,7 +735,7 @@ void SelectionTerritoire::OnChooseVeget() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } diff --git a/code/nel/tools/3d/tile_edit/View.cpp b/code/nel/tools/3d/tile_edit/View.cpp index 81f5fe784..d6d24d47c 100644 --- a/code/nel/tools/3d/tile_edit/View.cpp +++ b/code/nel/tools/3d/tile_edit/View.cpp @@ -101,7 +101,7 @@ static bool loadPic(const string &path, std::vector &tampon, uint return true; } } - catch (NLMISC::Exception& ) { } + catch (const NLMISC::Exception& ) { } return false; } @@ -432,7 +432,7 @@ int TileList::setDisplacement (int tile, const std::string& name) if (RemovePath (troncated, tileBank2.getAbsPath ().c_str())) { // load it - if (troncated!="") + if (!troncated.empty()) { // not loaded theListDisplacement[tile].loaded=0; @@ -670,7 +670,7 @@ const std::string& TileInfo::getRelativeFileName (CTile::TBitmap type, int index bool TileInfo::Load (int index, std::vector* Alpha) { bool bRes=true; - if (!loaded && getRelativeFileName (CTile::diffuse, index)!="") + if (!loaded && !getRelativeFileName (CTile::diffuse, index).empty()) { if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index), &BmpInfo, Bits, Alpha, 0)) { @@ -680,7 +680,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) else loaded=1; } - if (!nightLoaded && getRelativeFileName (CTile::additive, index)!="") + if (!nightLoaded && !getRelativeFileName (CTile::additive, index).empty()) { if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index), &nightBmpInfo, nightBits, Alpha, 0)) { @@ -690,7 +690,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) else nightLoaded=1; } - if (!alphaLoaded && getRelativeFileName (CTile::alpha, index)!="") + if (!alphaLoaded && !getRelativeFileName (CTile::alpha, index).empty()) { if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::alpha, index), &alphaBmpInfo, alphaBits, NULL, tileBank2.getTile (index)->getRotAlpha ())) @@ -1205,7 +1205,7 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n) if (index!=-1) pth = i->getRelativeFileName ((CTile::TBitmap)(Texture-1), index); else - pth = ""; + pth.clear(); } break; case 3: diff --git a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp index e1a652675..7afa0c1e0 100644 --- a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp +++ b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp @@ -77,8 +77,8 @@ BOOL CChooseVegetSet::OnInitDialog() { CDialog::OnInitDialog(); - if (FileName != "") - Name.SetWindowText (FileName.c_str()); + if (!FileName.empty()) + Name.SetWindowText (utf8ToTStr(FileName)); else Name.SetWindowText ("Browse..."); @@ -88,6 +88,6 @@ BOOL CChooseVegetSet::OnInitDialog() void CChooseVegetSet::OnReset() { - FileName = ""; - Name.SetWindowText ("Browse..."); + FileName.clear(); + Name.SetWindowText (_T("Browse...")); } diff --git a/code/nel/tools/3d/tile_edit_qt/browser_model.cpp b/code/nel/tools/3d/tile_edit_qt/browser_model.cpp index 68c28dbb8..eab1b193e 100644 --- a/code/nel/tools/3d/tile_edit_qt/browser_model.cpp +++ b/code/nel/tools/3d/tile_edit_qt/browser_model.cpp @@ -51,7 +51,7 @@ static bool loadPic(const string &path, std::vector &tampon, uint return true; } } - catch (NLMISC::Exception& ) { } + catch (const NLMISC::Exception& ) { } return false; } @@ -149,7 +149,7 @@ void TileInfo::Init(int id, TileType tileType) bool TileInfo::Load (int index, std::vector* Alpha) { bool bRes=true; - if (!loaded && getRelativeFileName (Diffuse, index)!="") + if (!loaded && !getRelativeFileName (Diffuse, index).empty()) { path = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (Diffuse, index)); @@ -164,7 +164,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) else loaded=1; } - if (!nightLoaded && getRelativeFileName (Additive, index)!="") + if (!nightLoaded && !getRelativeFileName (Additive, index).empty()) { nightPath = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (Additive, index)); if (!loadPixmapBuffer( nightPath, nightBits, Alpha, 0)) @@ -175,7 +175,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) else nightLoaded=1; } - if (!alphaLoaded && getRelativeFileName (::Alpha, index)!="") + if (!alphaLoaded && !getRelativeFileName (::Alpha, index).empty()) { alphaPath = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (::Alpha, index)); if (!loadPixmapBuffer( alphaPath, alphaBits, NULL, tileBankBrowser.getTile (index)->getRotAlpha ())) @@ -234,7 +234,7 @@ const std::string TileInfo::getRelativeFileName (TileTexture texture, int index) //TODO titegus: remove MAGIC STRING "EmptyDisplacementMap" in Nel \tile_bank.cpp\void CTileNoise::setEmpty () or add an IsEmpty() method !!!! if (currentPath == "EmptyDisplacementMap") - currentPath = ""; + currentPath.clear(); } } diff --git a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp index 063b4cf47..2d1ca4cbe 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp @@ -421,7 +421,7 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() // Transition to patch CTileSetTransition* trans=tileBankBrowser.getTileSet (tileSetIndex)->getTransition (transition); - if (tileBankBrowser.getTile (trans->getTile())->getRelativeFileName (CTile::alpha)=="") + if (tileBankBrowser.getTile (trans->getTile())->getRelativeFileName (CTile::alpha).empty()) { // Continue ? int ok; @@ -465,7 +465,7 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() // Transition to patch //CTileSetTransition* trans=tileBankBrowser.getTileSet (tileSetIndex)->getTransition (transition); - //if (tileBankBrowser.getTile (trans->getTile())->getRelativeFileName ((CTile::TBitmap)tileTextureButtonGroup->checkedId())=="") + //if (tileBankBrowser.getTile (trans->getTile())->getRelativeFileName ((CTile::TBitmap)tileTextureButtonGroup->checkedId()).empty()) //{ // // Try to load a tile with a file name like /tiletransition0.tga // char sName2[256]; @@ -543,7 +543,7 @@ void CTile_browser_dlg::on_exportBorderPushButton_clicked() else error=true; } - catch (Exception& e) + catch (const Exception& e) { const char *toto=e.what (); error=true; @@ -592,7 +592,7 @@ void CTile_browser_dlg::on_importBorderPushButton_clicked() else error=true; } - catch (Exception& e) + catch (const Exception& e) { const char *toto=e.what (); error=true; diff --git a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp index 2b6612e9c..bd5bb625a 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp @@ -514,7 +514,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() const std::string& bitmapPath=tileBank.getTile(tiles)->getRelativeFileName ((CTile::TBitmap)type); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Check the path if ( CheckPath( bitmapPath, path.toUtf8() ) == false ) @@ -583,7 +583,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() std::string bitmapPath=tileBank.getTile(tiles)->getRelativeFileName ((CTile::TBitmap)type); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Remove the absolute path bool res=RemovePath (bitmapPath, path.toUtf8()); @@ -603,7 +603,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() std::string bitmapPath=tileBank.getDisplacementMap (noise); // not empty ? - if (bitmapPath!="") + if (!bitmapPath.empty()) { // Remove the absolute path bool res=RemovePath (bitmapPath, path.toUtf8()); diff --git a/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp b/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp index f7fa710aa..88832a515 100644 --- a/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp +++ b/code/nel/tools/3d/zone_check_bind/zone_check_bind.cpp @@ -89,7 +89,7 @@ typedef CQuadGrid TPVQuadGrid; /** Load the given zone (name without extension) * return a pointer to the zone, or NULL if not found - * Throw an exception if a read error occured + * Throw an exception if a read error occurred */ static CZone *LoadZone(uint16 xPos, uint16 yPos, std::string zoneExt) { diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index c5f4419a4..fc8e00a4c 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -135,7 +135,6 @@ struct CViewerConfig LandscapeThreshold = 0.001f; LandscapeNoise = true; - HeightFieldName= ""; HeightFieldMaxZ= 100; HeightFieldOriginX= 16000; HeightFieldOriginY= -24000; @@ -344,7 +343,7 @@ void displayZones() CBitmap heightBitmap; CIFile file(ViewerCfg.HeightFieldName); - if( ViewerCfg.HeightFieldName!="" && heightBitmap.load(file) ) + if( !ViewerCfg.HeightFieldName.empty() && heightBitmap.load(file) ) { CHeightMap heightMap; heightMap.buildFromBitmap(heightBitmap); @@ -373,7 +372,7 @@ void displayZones() nlerror (tmp.c_str()); } - if ((Landscape->Landscape.TileBank.getAbsPath ()=="")&&(ViewerCfg.TilesPath!="")) + if ((Landscape->Landscape.TileBank.getAbsPath ().empty())&&(!ViewerCfg.TilesPath.empty())) Landscape->Landscape.TileBank.setAbsPath (ViewerCfg.TilesPath + "/"); if (ViewerCfg.UseDDS) diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms index cfb51d0e0..a3b28bc02 100755 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms @@ -375,7 +375,7 @@ fn runNelMaxExportSub inputMaxFile retryCount = ( -- Error nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile) - nlerror("FAIL Mysterious error occured") + nlerror("FAIL Mysterious error occurred") NelForceQuitRightNow() ) ) diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms index 2db696b7f..289e9e8b6 100755 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms @@ -91,7 +91,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting '%PreGenFileExtension%' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -116,7 +116,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms b/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms index fc1eda5f9..8ebded952 100755 --- a/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms +++ b/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms @@ -235,7 +235,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'anim' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -260,7 +260,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms b/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms index 02856d2c7..f2dad66ce 100755 --- a/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms +++ b/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms @@ -292,7 +292,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'clod' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -317,7 +317,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms b/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms index e91732391..5bcdfd42b 100755 --- a/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms +++ b/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms @@ -342,7 +342,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'ig' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -367,7 +367,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms index d0d7c7ce4..66b1a9df5 100755 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms @@ -215,7 +215,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -240,7 +240,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms b/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms index 4949f7c60..969691b9e 100755 --- a/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms +++ b/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms @@ -227,7 +227,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'cmb' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -252,7 +252,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms b/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms index f97419aa7..375fe8eea 100755 --- a/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms +++ b/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms @@ -451,7 +451,7 @@ fn runNelMaxExportSub inputMaxFile retryCount = ( -- Error nlerror("ERROR exporting 'shape': can't open the file " + inputMaxFile) - nlerror("FAIL Mysterious error occured") + nlerror("FAIL Mysterious error occurred") NelForceQuitRightNow() ) ) @@ -559,7 +559,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'shape' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -584,7 +584,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms b/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms index 1b8154530..acc81e21e 100755 --- a/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms +++ b/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms @@ -282,7 +282,7 @@ catch ( -- Error nlerror("ERROR Fatal error exporting 'veget' in folder %MaxSourceDirectory%") - nlerror("FAIL Fatal error occured") + nlerror("FAIL Fatal error occurred") NelForceQuitRightNow() removeRunningTag = false ) @@ -307,7 +307,7 @@ if (removeRunningTag) then ) else ( - nlerror("FAIL One or more issues occured") + nlerror("FAIL One or more issues occurred") NelForceQuitRightNow() ) diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index 99dd920ef..29fb393c9 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -933,7 +933,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType if ( idm==dirmapDirs.end() ) { nlinfo( "Directory mapping not found for %s (index %u)", filebase.c_str(), letterIndex ); - dirbase = ""; // put into root + dirbase.clear(); // put into root } } else @@ -953,7 +953,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType { // Load sheet (skip if failed) - dirbase = ""; + dirbase.clear(); filename = (*it).second; // whole path form = (CForm*)formLoader->loadForm( filename.c_str() ); if (form == NULL) diff --git a/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.cpp b/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.cpp index 0b91c41f4..baf34938c 100644 --- a/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.cpp +++ b/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.cpp @@ -578,7 +578,7 @@ BOOL CLogic_editorDoc::OnSaveDocument( LPCTSTR fileName ) // Close the file file.close (); } - catch (Exception &) + catch (const Exception &) { } @@ -646,7 +646,7 @@ BOOL CLogic_editorDoc::load( LPCTSTR fileName ) // Close the file file.close (); } - catch (Exception &) + catch (const Exception &) { } diff --git a/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.h b/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.h index 39fd90d7e..1fa9156a0 100644 --- a/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.h +++ b/code/nel/tools/logic/logic_editor_dll/logic_editorDoc.h @@ -53,7 +53,7 @@ public: * change a variable name (all it's occurence) * \param CString old the old name of the var (not a reference because we may delete the string when deleting the variable !!) * \param CString &newName the new name of the var - * \return BOOL TRUE if the change has been made, FALSE if an error occured + * \return BOOL TRUE if the change has been made, FALSE if an error occurred */ BOOL changeVarName( CString old, const CString &newName); @@ -67,7 +67,7 @@ public: * change a counter name (all it's occurence) * \param CString old the old name of the counter * \param CString &newName the new name of the counter - * \return BOOL TRUE if the change has been made, FALSE if an error occured + * \return BOOL TRUE if the change has been made, FALSE if an error occurred */ BOOL changeCounterName( CString old, const CString &newName); @@ -82,7 +82,7 @@ public: * change a condition name (all it's occurence) * \param CString old the old name of the condition * \param CString &newName the new name of the condition - * \return BOOL TRUE if the change has been made, FALSE if an error occured + * \return BOOL TRUE if the change has been made, FALSE if an error occurred */ BOOL changeConditionName( CString old, const CString &newName); @@ -97,7 +97,7 @@ public: * change a state name (all it's occurence) * \param CString old the old name of the state * \param CString &newName the new name of the state - * \return BOOL TRUE if the change has been made, FALSE if an error occured + * \return BOOL TRUE if the change has been made, FALSE if an error occurred */ BOOL changeStateName( CString old, const CString &newName); diff --git a/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp b/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp index cfcd82c9f..b3e65653c 100644 --- a/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp +++ b/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp @@ -688,8 +688,8 @@ void CBranch_patcherDlg::OnButtonExtractTokens() m_TargetDirLabel = "Target Dir"; m_SrcDir = SrcDirBackup; m_DestDir = TargetDirBackup; - m_Filename = ""; - ((CButton*)GetDlgItem( IDC_ButtonExtractTokens ))->SetWindowText( "Enter Tokens" ); + m_Filename.Empty(); + ((CButton*)GetDlgItem( IDC_ButtonExtractTokens ))->SetWindowText( _T("Enter Tokens") ); GetDlgItem( IDC_TopText )->ShowWindow( SW_SHOW ); GetDlgItem( IDC_ButtonClearTokens )->EnableWindow( TRUE ); GetDlgItem( IDC_ButtonPatch )->ShowWindow( SW_SHOW ); @@ -703,8 +703,8 @@ void CBranch_patcherDlg::OnButtonExtractTokens() void CBranch_patcherDlg::OnButtonClearTokens() { - Token1 = ""; - Token2 = ""; + Token1.Empty(); + Token2.Empty(); displayTokens(); } diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.ui b/code/nel/tools/misc/crash_report/crash_report_widget.ui index da1e38618..2dbc1e044 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.ui +++ b/code/nel/tools/misc/crash_report/crash_report_widget.ui @@ -20,7 +20,7 @@ - What were you doing when the crash occured? + What were you doing when the crash occurred? diff --git a/code/nel/tools/misc/data_mirror/data_mirror.cpp b/code/nel/tools/misc/data_mirror/data_mirror.cpp index 930e23873..99a87f547 100644 --- a/code/nel/tools/misc/data_mirror/data_mirror.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirror.cpp @@ -198,7 +198,7 @@ BOOL CData_mirrorApp::InitInstance() } } } - catch (Exception &e) + catch (const Exception &e) { MessageBox (NULL, e.what (), "NeL Data Mirror", MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp index ae7c6ce00..34e7459cb 100644 --- a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp +++ b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp @@ -188,7 +188,7 @@ BOOL CLog_analyserDlg::OnInitDialog() cf.load( "log_analyser.cfg" ); LogDateString = cf.getVar( "LogDateString" ).asString().c_str(); } - catch ( EConfigFile& ) + catch (const EConfigFile& ) {*/ LogDateString = "Log Starting ["; AnalyseFunc = NULL; @@ -517,7 +517,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) view->Filenames = filenames; } - view->LogSessionStartDate = ""; + view->LogSessionStartDate.Empty(); LogSessionsDialog.clear(); if ( ((CButton*)GetDlgItem( IDC_CheckSessions ))->GetCheck() == 1 ) diff --git a/code/ryzom/client/src/bg_downloader_access.cpp b/code/ryzom/client/src/bg_downloader_access.cpp index 1603cae0f..1a479849e 100644 --- a/code/ryzom/client/src/bg_downloader_access.cpp +++ b/code/ryzom/client/src/bg_downloader_access.cpp @@ -213,7 +213,7 @@ void CBGDownloaderAccess::resumeBackgroundDownload() //===================================================== void CBGDownloaderAccess::CDownloadCoTask::run() { - Parent->_ErrorMsg = ""; + Parent->_ErrorMsg.clear(); try { // don't restart downloader before @@ -385,7 +385,7 @@ bool CBGDownloaderAccess::CDownloadCoTask::isDownloaderProcessRunning() { // the downloader creates a system-wide mutex, so if present, assume that the downloader is running // - HANDLE mutex = CreateMutex (NULL, FALSE, BGDownloader::DownloaderMutexName); + HANDLE mutex = CreateMutexW (NULL, FALSE, BGDownloader::DownloaderMutexName); if (mutex) { if (GetLastError() == ERROR_ALREADY_EXISTS) diff --git a/code/ryzom/client/src/bug_report/bug_reportDlg.cpp b/code/ryzom/client/src/bug_report/bug_reportDlg.cpp index fce9975d0..322b494f8 100644 --- a/code/ryzom/client/src/bug_report/bug_reportDlg.cpp +++ b/code/ryzom/client/src/bug_report/bug_reportDlg.cpp @@ -548,7 +548,7 @@ void CBug_reportDlg::sendReport (bool withScreenshot) } else { - MessageBox ("An error occured when sending the report. Report wasn't sent, look log.log for more info", "Error"); + MessageBox ("An error occurred when sending the report. Report wasn't sent, look log.log for more info", "Error"); } } diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index 5d949b201..c66b80576 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -183,7 +183,7 @@ extern UCamera MainCam; //////////// // STATIC // //////////// -const std::string CCharacterCL::_EmptyString = ""; +const std::string CCharacterCL::_EmptyString; const uint8 CCharacterCL::_BadHairIndex = 0xFF; H_AUTO_DECL ( RZ_Client_Character_CL_Update_Pos_Combat_Float ) diff --git a/code/ryzom/client/src/client_sheets/race_stats_sheet.cpp b/code/ryzom/client/src/client_sheets/race_stats_sheet.cpp index 3a0723f7d..651e9a8ec 100644 --- a/code/ryzom/client/src/client_sheets/race_stats_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/race_stats_sheet.cpp @@ -38,7 +38,7 @@ using namespace std; ///////////// // METHODS // ///////////// -const string CGenderInfo::UnknownItemName = ""; +const string CGenderInfo::UnknownItemName; // description of a visual slot that must be read by CGenderInfo struct CSlotInfo diff --git a/code/ryzom/client/src/client_sheets/unblock_titles_sheet.cpp b/code/ryzom/client/src/client_sheets/unblock_titles_sheet.cpp index 5ed97b2da..6a94f9c7a 100644 --- a/code/ryzom/client/src/client_sheets/unblock_titles_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/unblock_titles_sheet.cpp @@ -44,7 +44,7 @@ static void tokenize (const string &zeString, vector &tokens) if ((nextseppos1 == string::npos) && (nextseppos2 == string::npos)) { tokens.push_back(sTmp); - sTmp = ""; + sTmp.clear(); } else { diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 87e052cec..6ea0b055b 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -5236,7 +5236,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std: { // Build the final string static string finalArgs; - finalArgs = ""; + finalArgs.clear(); uint i; uint index = 0; const vector &keywords = mode->Keywords; diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index e20e05140..3d8fbc75c 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -902,7 +902,7 @@ void updateBGDownloaderUI() } if (prevSuccess != LuaBGDSuccessFlag) { - nlwarning("Some scipt error occured"); + nlwarning("Some scipt error occurred"); } } @@ -1976,7 +1976,7 @@ public: } } - NewKeysCharNameValidated = ""; + NewKeysCharNameValidated.clear(); NetMngr.push(out); NetMngr.send(NetMngr.getCurrentServerTick()); @@ -2304,8 +2304,8 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - NewKeysCharNameWanted = ""; - NewKeysCharNameValidated = ""; + NewKeysCharNameWanted.clear(); + NewKeysCharNameValidated.clear(); GameKeySet = "keys.xml"; RingEditorKeySet = "keys_r2ed.xml"; First = true; @@ -3121,10 +3121,10 @@ class CAHLoadScenario : public IActionHandler launchScenarioFromRingAccessPoint = true; } - string rules="", level="", title=""; - string initialIsland="", initialEntryPoint="", initialSeason = ""; - std::string lang="", scenarioType=""; - std::string otherCharAccess=""; + string rules, level, title; + string initialIsland, initialEntryPoint, initialSeason; + std::string lang, scenarioType; + std::string otherCharAccess; std::string nevraxScenario = "0"; std::string trialAllowed = "0"; for(uint i=0; ideleteInstance(Loading); - LoadingName = ""; + LoadingName.clear(); } // if the new instance is NULL, then clean ALL @@ -193,7 +193,7 @@ bool CEntityCL::SInstanceCL::createLoading(const string &strShapeName, const str { releaseStaticFXs(); Scene->deleteInstance(Current); - CurrentName = ""; + CurrentName.clear(); } } // else setup into loading @@ -347,7 +347,7 @@ void CEntityCL::SInstanceCL::updateCurrentFromLoading(NL3D::USkeleton Skeleton) if (!Current.empty()) { Scene->deleteInstance(Current); - CurrentName = ""; + CurrentName.clear(); } @@ -355,7 +355,7 @@ void CEntityCL::SInstanceCL::updateCurrentFromLoading(NL3D::USkeleton Skeleton) Current = Loading; CurrentName = LoadingName; Loading = NULL; - LoadingName = ""; + LoadingName.clear(); // If there is a skeleton, bind the skin to the skeleton. @@ -533,7 +533,6 @@ CEntityCL::CEntityCL() _SelectionFX = NULL; _MouseOverFX = NULL; _StateFX = NULL; - _StateFXName = ""; _GMTitle = _InvalidGMTitleCode; _LastLocalSelectBoxComputeTime = 0; _InSceneInterfaceEnabled = true; @@ -603,7 +602,7 @@ CEntityCL::~CEntityCL() if (!_StateFX.empty() && Scene) { Scene->deleteInstance(_StateFX); - _StateFXName = ""; + _StateFXName.clear(); } if (!_SelectionFX.empty() && Scene) { @@ -751,7 +750,7 @@ void CEntityCL::init() _GroundTypeCache= 0; _StateFX = NULL; - _StateFXName = ""; + _StateFXName.clear(); _SelectionFX = NULL; _MouseOverFX = NULL; @@ -3599,7 +3598,7 @@ void CEntityCL::removeStateFx() if (!_StateFX.empty() && Scene) { Scene->deleteInstance(_StateFX); - _StateFXName = ""; + _StateFXName.clear(); } } diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index 1c43a0d79..7e8b62001 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -395,7 +395,7 @@ void CLoginStateMachine::run() } else { - // return to login menu if an error occured + // return to login menu if an error occurred _CurrentState = st_login; } diff --git a/code/ryzom/client/src/fx_cl.cpp b/code/ryzom/client/src/fx_cl.cpp index 7a5418c3a..e1f29fd77 100644 --- a/code/ryzom/client/src/fx_cl.cpp +++ b/code/ryzom/client/src/fx_cl.cpp @@ -205,7 +205,7 @@ void CFxCL::updateVisualPropertyPos(const NLMISC::TGameCycle &/* gameCycle */, c if (_Instance.getPos() != prevPos) { - // a move or init occured -> must update cluster system + // a move or init occurred -> must update cluster system UGlobalPosition gPos; if( _Primitive ) { diff --git a/code/ryzom/client/src/ground_fx_manager.cpp b/code/ryzom/client/src/ground_fx_manager.cpp index aaadd257b..beca9b9bd 100644 --- a/code/ryzom/client/src/ground_fx_manager.cpp +++ b/code/ryzom/client/src/ground_fx_manager.cpp @@ -209,7 +209,7 @@ struct CCmpGroundIDPred void CGroundFXManager::CInstance::getFXNameFromGroundType(uint32 groundID, std::string &fxName) const { H_AUTO_USE(RZ_GroundFXManager) - fxName= ""; + fxName.clear(); if (!Entity) return; const CEntitySheet *es; es = SheetMngr.get(Entity->sheetId()); diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 3f22ed956..267042b7e 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -370,7 +370,7 @@ void selectTipsOfTheDay (uint /* tips */) TipsOfTheDay = title+CI18N::get ("uiTips"+toString (tips));*/ // todo tips of the day remove //trap TipsOfTheDay = CI18N::get ("uiMessageOfTheDay"); - TipsOfTheDay = ""; //trap + TipsOfTheDay.clear(); //trap } // *************************************************************************** @@ -1648,7 +1648,7 @@ void postlogInit() else { // To have the same number of newMessage in client light - nmsg = ""; + nmsg.clear(); ProgressBar.newMessage (nmsg); ProgressBar.newMessage (nmsg); ProgressBar.newMessage (nmsg); diff --git a/code/ryzom/client/src/init_main_loop.cpp b/code/ryzom/client/src/init_main_loop.cpp index 8e2c88c69..d5cfda429 100644 --- a/code/ryzom/client/src/init_main_loop.cpp +++ b/code/ryzom/client/src/init_main_loop.cpp @@ -1191,7 +1191,7 @@ void initMainLoop() } else { - nmsg = ""; + nmsg.clear(); ProgressBar.newMessage (nmsg); ProgressBar.newMessage (nmsg); } diff --git a/code/ryzom/client/src/interface_v3/action_handler_item.cpp b/code/ryzom/client/src/interface_v3/action_handler_item.cpp index f6dec2d1f..79e0999e7 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -329,7 +329,7 @@ void CInterfaceItemEdition::CItemEditionWindow::end() // remove infos waiter (if not already canceled) getInventory().removeItemInfoWaiter(this); _CurrItemSheet = NULL; - WindowName = ""; + WindowName.clear(); // hide the dialog CInterfaceManager *pIM = CInterfaceManager::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 88b01a8e9..47248ee2a 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -928,7 +928,7 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(ucstring &inOut) } } else - inOut = ""; + inOut.clear(); return true; } diff --git a/code/ryzom/client/src/interface_v3/character_3d.cpp b/code/ryzom/client/src/interface_v3/character_3d.cpp index f9d4e36c2..c01760115 100644 --- a/code/ryzom/client/src/interface_v3/character_3d.cpp +++ b/code/ryzom/client/src/interface_v3/character_3d.cpp @@ -62,8 +62,8 @@ SCharacter3DSetup::SCharacter3DSetup () Parts[Char3DPart_Face].Name = "TR_HOM_visage.shape"; Parts[Char3DPart_Head].Name = "FY_HOM_cheveux_medium01.shape"; Parts[Char3DPart_Hands].Name = "TR_HOM_underwear_hand.shape"; - Parts[Char3DPart_HandRightItem].Name = ""; - Parts[Char3DPart_HandLeftItem].Name = ""; + Parts[Char3DPart_HandRightItem].Name.clear(); + Parts[Char3DPart_HandLeftItem].Name.clear(); for (uint32 i = 0; i < NB_CHARACTER3D_PARTS; ++i) { Parts[i].Color = 0; @@ -609,11 +609,11 @@ CCharacter3D::CCharacter3D() _PlayList = NULL; _FacePlayList = NULL; // Clear the cache to make it work with 1st init - _CurrentSetup.Skeleton = ""; + _CurrentSetup.Skeleton.clear(); _CurrentSetup.AnimPlayed = -1; for (uint32 i = 0; i < NB_CHARACTER3D_PARTS; ++i) { - _CurrentSetup.Parts[i].Name = ""; + _CurrentSetup.Parts[i].Name.clear(); _CurrentSetup.Parts[i].Color = -1; _CurrentSetup.Parts[i].Quality = -1; } diff --git a/code/ryzom/client/src/interface_v3/chat_displayer.h b/code/ryzom/client/src/interface_v3/chat_displayer.h index 5c46c81ca..9d09e4c38 100644 --- a/code/ryzom/client/src/interface_v3/chat_displayer.h +++ b/code/ryzom/client/src/interface_v3/chat_displayer.h @@ -69,7 +69,7 @@ public: } else { - str = ""; + str.clear(); mode = CInterfaceManager::InfoMsg; } diff --git a/code/ryzom/client/src/interface_v3/group_html_cs.cpp b/code/ryzom/client/src/interface_v3/group_html_cs.cpp index ef72eaae6..66ac1006e 100644 --- a/code/ryzom/client/src/interface_v3/group_html_cs.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_cs.cpp @@ -39,7 +39,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CGroupHTMLCS, std::string, "cs_html"); CGroupHTMLCS::CGroupHTMLCS(const TCtorParam ¶m) : CGroupHTML(param) { - Home = ""; + Home.clear(); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 64c81df66..cbcbf4690 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -774,7 +774,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { SMap island; island.Name = completeIslands[k].Island; - island.ContinentName = ""; // no access to world map for now ... + island.ContinentName.clear(); // no access to world map for now ... island.MinX = (float) completeIslands[k].XMin; island.MinY = (float) completeIslands[k].YMin; island.MaxX = (float) completeIslands[k].XMax; diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index a22c8dbc5..1867ea927 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -278,7 +278,7 @@ void CGuildManager::update() // Guild stuff uint32 oldName = _Guild.NameID; _Guild.NameID = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:GUILD:NAME")->getValue32(); - _Guild.Name = ""; + _Guild.Name.clear(); _InGuild = (_Guild.NameID != 0); if (!_InGuild) closeAllInterfaces(); diff --git a/code/ryzom/client/src/interface_v3/input_handler_manager.h b/code/ryzom/client/src/interface_v3/input_handler_manager.h index 51d7dcf42..0e11bdb7d 100644 --- a/code/ryzom/client/src/interface_v3/input_handler_manager.h +++ b/code/ryzom/client/src/interface_v3/input_handler_manager.h @@ -88,7 +88,7 @@ public: /** * read the input config file. * \param fileName : name of the config file - * \return true if no error occured + * \return true if no error occurred */ bool readInputConfigFile(const std::string & fileName); diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index bb15d8d4b..6d3d7d5fe 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -792,7 +792,7 @@ bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) return false; CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"dblink")); - _DBLink = ""; + _DBLink.clear(); if (ptr) _DBLink = (const char *)ptr; CVector pos(0,0,0), rot(0,0,0); diff --git a/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 61fe71958..5fe4cc569 100644 --- a/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -1148,7 +1148,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc) if (pOBS && pOBS->OBType == COutpostBuildingSheet::OB_Empty) { // Don't display description if the building is an empty slot - name = ""; + name.clear(); } else { diff --git a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp index 1fef759ea..9e7c42888 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -451,8 +451,8 @@ void CModalContainerEditCmd::setTitle(const std::string &uistr) void CModalContainerEditCmd::activate() { CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); - CurrentEditCmdLine.ActionName.Name = ""; - CurrentEditCmdLine.ActionName.Argu = ""; + CurrentEditCmdLine.ActionName.Name.clear(); + CurrentEditCmdLine.ActionName.Argu.clear(); CurrentEditCmdNb = -1; Win->setActive(true); Win->launch(); @@ -618,7 +618,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std (((noParam == nbRealParam-1) && (rP.Type != CBaseAction::CParameter::Hidden)) && (i == (pBA->Parameters.size()-1)))) { sTmp = curStr; - curStr = ""; + curStr.clear(); } else { @@ -807,7 +807,7 @@ void CModalContainerEditCmd::validCurrentCommand() // Build couple (name,param) that define a command CurrentEditCmdLine.ActionName.Name = rBA.Name; - CurrentEditCmdLine.ActionName.Argu = ""; + CurrentEditCmdLine.ActionName.Argu.clear(); uint noParam = 0; for (uint i = 0; i < rBA.Parameters.size(); ++i) { diff --git a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 5fc2872dd..8d4ccb4c5 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -365,7 +365,6 @@ void CMacroCmdManager::addActionManagerEntries() CBaseAction::CParameter p; p.Type = CBaseAction::CParameter::Constant; - p.Name = ""; p.LocalizedName = "uiMacroName"; uint i; diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 71cb5f7ec..75a29cba7 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -532,7 +532,7 @@ void CPeopleInterraction::createTeamList() // NB: use an intermediate temp var, to avoid show of the window each time a new team member enters string sExpr = "@UI:VARIABLES:IS_TEAM_PRESENT"; string sAction = "set"; - string sCond = ""; + string sCond; string sParams = "target_property=ui:interface:team_list:active|value=@UI:VARIABLES:IS_TEAM_PRESENT"; if (TeamChat) @@ -794,7 +794,6 @@ void CPeopleInterraction::createTheUserChat() chatDesc.Id = "user_chat"; chatDesc.ChatTemplate = "filtered_chat_id"; chatDesc.AHOnActive = "user_chat_active"; - chatDesc.AHOnActiveParams = ""; chatDesc.AHOnCloseButton = "set"; chatDesc.AHOnCloseButtonParams = "dblink=UI:SAVE:ISDETACHED:USER_CHAT|value=0"; @@ -845,7 +844,7 @@ void CPeopleInterraction::createChatGroup() CChatWindowDesc chatDesc; chatDesc.FatherContainer = "ui:interface"; chatDesc.Listener = NULL; - chatDesc.Title= ""; // NB: the chatgroup is the only one that can be not named (because of uniqueness title test) + chatDesc.Title.clear(); // NB: the chatgroup is the only one that can be not named (because of uniqueness title test) chatDesc.Localize = true; chatDesc.Savable = true; chatDesc.ChatTemplate = "main_chat_group"; diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 3433d1154..6d6355421 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -133,7 +133,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha if (chat) { CChatWindowDesc chatDesc = *chat; - chatDesc.FatherContainer = ""; + chatDesc.FatherContainer.clear(); _ChatWindow = getChatWndMgr().createChatWindow(chatDesc); if (!_ChatWindow) { diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 2b2a227d6..4636da11f 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -1897,7 +1897,7 @@ int CPatchManager::downloadProgressFunc(void *foo, double t, double d, double ul if (d != t) { // In the case of progress = 1, don't update because, this will be called in case of error to signal the end of the download, though - // no download actually occured. Instead, we set progress to 1.f at the end of downloadWithCurl if everything went fine + // no download actually occurred. Instead, we set progress to 1.f at the end of downloadWithCurl if everything went fine return validateProgress(foo, t, d, ultotal, ulnow); } return 0; diff --git a/code/ryzom/client/src/login_progress_post_thread.cpp b/code/ryzom/client/src/login_progress_post_thread.cpp index 788877980..08503f875 100644 --- a/code/ryzom/client/src/login_progress_post_thread.cpp +++ b/code/ryzom/client/src/login_progress_post_thread.cpp @@ -99,7 +99,7 @@ static uint64 getVideoDriverVersion() { static std::string ret; uint64 version=0; - ret = ""; + ret.clear(); bool ok = CSystemInfo::getVideoInfo(ret, version); if (ok) { diff --git a/code/ryzom/client/src/login_xdelta.cpp b/code/ryzom/client/src/login_xdelta.cpp index 5cb1ddc7d..e6b4bde28 100644 --- a/code/ryzom/client/src/login_xdelta.cpp +++ b/code/ryzom/client/src/login_xdelta.cpp @@ -246,7 +246,7 @@ bool CXDPFileReader::readBool(bool &val) bool CXDPFileReader::readString(std::string &s) { uint32 nLen; - s = ""; + s.clear(); if (!readUInt(nLen)) return false; for (uint32 i = 0; i < nLen; ++i) { @@ -452,8 +452,8 @@ bool CXDeltaPatch::load(const string &sFilename) uint32 nFromNameLen = vHeader[1] >> 16; uint32 nToNameLen = vHeader[1] & 0xffff; - _FromName = ""; - _ToName = ""; + _FromName.clear(); + _ToName.clear(); for (i = 0; i < nFromNameLen; ++i) { @@ -738,7 +738,7 @@ CXDeltaPatch::TApplyResult CXDeltaPatch::apply(const std::string &sFileToPatch, */ return ApplyResult_Error; } - errorMsg = ""; + errorMsg.clear(); return ApplyResult_Ok; } diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index bb3625c4b..18fa2a754 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -298,7 +298,7 @@ bool mode2Anim(MBEHAV::EMode mode, string &result) // No animset for the mode. else { - mode2AnimArray[i] = ""; + mode2AnimArray[i].clear(); nlwarning("mode2Anim: no animset associated to the mode %d'%s'.", i, modeName.c_str()); } } diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index b949263e7..42285a167 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -290,7 +290,7 @@ static void readPrivileges(NLMISC::CBitMemStream &impulse) catch(const EStreamOverflow &) { nlwarning("User privileges not serialised, assuming none"); - UserPrivileges = ""; + UserPrivileges.clear(); } } @@ -850,7 +850,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } } } - finalString = ""; + finalString.clear(); } else { @@ -1049,7 +1049,7 @@ string getInterfaceNameFromId (sint botType, sint interfaceId) case BOTCHATTYPE::NeutralMainPage: interfaceName += "neutral_main"; break; case BOTCHATTYPE::NastyMainPage: interfaceName += "nasty_main"; break; case BOTCHATTYPE::MoreNewsPage: interfaceName += "more_news"; break; - case BOTCHATTYPE::Done: nlinfo ("end of bot chat"); interfaceName = ""; break; + case BOTCHATTYPE::Done: nlinfo ("end of bot chat"); interfaceName.clear(); break; } return interfaceName; } @@ -3285,7 +3285,7 @@ private: } else { - contentStr = ""; + contentStr.clear(); i = digitStart; } } diff --git a/code/ryzom/client/src/network_connection.h b/code/ryzom/client/src/network_connection.h index da47f925e..5bfaeae36 100644 --- a/code/ryzom/client/src/network_connection.h +++ b/code/ryzom/client/src/network_connection.h @@ -304,7 +304,7 @@ public: /** * Connects to the front-end (using or not the login system, depending on what was specified at init()) * \param result the message returned in case of an error - * Returns true if no error occured. + * Returns true if no error occurred. */ bool connect(std::string &result); diff --git a/code/ryzom/client/src/permanent_ban.cpp b/code/ryzom/client/src/permanent_ban.cpp index cbd39d93f..dab097c79 100644 --- a/code/ryzom/client/src/permanent_ban.cpp +++ b/code/ryzom/client/src/permanent_ban.cpp @@ -25,8 +25,8 @@ using namespace NLMISC; -#define REGKEY_RYZOM_PATH "Software\\Nevrax\\ryzom" -#define REGKEY_PERMANENT_BAN "PB" +#define REGKEY_RYZOM_PATH L"Software\\Nevrax\\ryzom" +#define REGKEY_PERMANENT_BAN L"PB" // ************************************************************ @@ -36,10 +36,11 @@ static void setPermanentBanRegistryKey(bool on) nlinfo("Not implemented"); #else HKEY hKey; - if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_RYZOM_PATH, &hKey)==ERROR_SUCCESS) + if (RegCreateKeyW(HKEY_CURRENT_USER, REGKEY_RYZOM_PATH, &hKey)==ERROR_SUCCESS) { DWORD permanentBan = on ? 1 : 0; - LONG result = RegSetValueEx(hKey, REGKEY_PERMANENT_BAN, 0, REG_DWORD, (LPBYTE)&permanentBan, 4); + LONG result = RegSetValueExW(hKey, REGKEY_PERMANENT_BAN, 0, REG_DWORD, (LPBYTE)&permanentBan, 4); + if (result != ERROR_SUCCESS) { nlwarning("pb key not created"); @@ -59,17 +60,20 @@ static bool getPermanentBanRegistryKey() return false; // not implemented #else HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_RYZOM_PATH, 0, KEY_READ, &hKey)==ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CURRENT_USER, REGKEY_RYZOM_PATH, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { DWORD permanentBan; DWORD type; DWORD dataSize = sizeof(DWORD); - RegQueryValueEx (hKey, REGKEY_PERMANENT_BAN, 0, &type, (LPBYTE)&permanentBan, &dataSize); + + RegQueryValueExW(hKey, REGKEY_PERMANENT_BAN, 0, &type, (LPBYTE)&permanentBan, &dataSize); + if (type == REG_DWORD && dataSize == sizeof(DWORD)) { return permanentBan != 0; } } + return false; #endif } diff --git a/code/ryzom/client/src/player_cl.cpp b/code/ryzom/client/src/player_cl.cpp index a086855ab..bfcb30f0e 100644 --- a/code/ryzom/client/src/player_cl.cpp +++ b/code/ryzom/client/src/player_cl.cpp @@ -733,8 +733,12 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * // Invalidate instances cache for (uint i = 0; i < _Instances.size(); ++i) - _Instances[i].CurrentName = _Instances[i].LoadingName = ""; - _Face.CurrentName = _Face.LoadingName = ""; + { + _Instances[i].CurrentName.clear(); + _Instances[i].LoadingName.clear(); + } + _Face.CurrentName.clear(); + _Face.LoadingName.clear(); } // Check the skeleton. if(skeleton() && !ClientCfg.Light) @@ -859,11 +863,11 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * if (!_Face.Loading.empty()) Scene->deleteInstance(_Face.Loading); _Face.Loading = NULL; - _Face.LoadingName = ""; + _Face.LoadingName.clear(); if (!_Face.Current.empty()) Scene->deleteInstance(_Face.Current); _Face.Current = NULL; - _Face.CurrentName = ""; + _Face.CurrentName.clear(); } // Now we have a skeleton, we can update VpB and VpC. sint64 vB, vC; diff --git a/code/ryzom/client/src/player_r2_cl.cpp b/code/ryzom/client/src/player_r2_cl.cpp index b4269dd54..e587e4baa 100644 --- a/code/ryzom/client/src/player_r2_cl.cpp +++ b/code/ryzom/client/src/player_r2_cl.cpp @@ -474,8 +474,13 @@ void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle // Invalidate instances cache for (uint i = 0; i < _Instances.size(); ++i) - _Instances[i].CurrentName = _Instances[i].LoadingName = ""; - _Face.CurrentName = _Face.LoadingName = ""; + { + _Instances[i].CurrentName.clear(); + _Instances[i].LoadingName.clear(); + } + + _Face.CurrentName.clear(); + _Face.LoadingName.clear(); } // Check the skeleton. if(skeleton() && !ClientCfg.Light) @@ -614,11 +619,11 @@ void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle if (!_Face.Loading.empty()) Scene->deleteInstance(_Face.Loading); _Face.Loading = NULL; - _Face.LoadingName = ""; + _Face.LoadingName.clear(); if (!_Face.Current.empty()) Scene->deleteInstance(_Face.Current); _Face.Current = NULL; - _Face.CurrentName = ""; + _Face.CurrentName.clear(); } // Now we have a skeleton, we can update VpB and VpC. sint64 vB, vC; diff --git a/code/ryzom/client/src/r2/dmc/action_historic.cpp b/code/ryzom/client/src/r2/dmc/action_historic.cpp index d4504d3d8..4ad984778 100644 --- a/code/ryzom/client/src/r2/dmc/action_historic.cpp +++ b/code/ryzom/client/src/r2/dmc/action_historic.cpp @@ -70,7 +70,7 @@ void CActionHistoric::cancelAction() _NewAction = NULL; _NewActionIsPending = false; _SubActionCount = 1; - _NewActionName = ""; + _NewActionName.clear(); getEditor().callEnvMethod("onCancelActionInHistoric", 0, 0); } diff --git a/code/ryzom/client/src/r2/dmc/property_accessor.cpp b/code/ryzom/client/src/r2/dmc/property_accessor.cpp index 2db78ad14..a7037201a 100644 --- a/code/ryzom/client/src/r2/dmc/property_accessor.cpp +++ b/code/ryzom/client/src/r2/dmc/property_accessor.cpp @@ -141,7 +141,7 @@ const CObject *CPropertyAccessor::getPropertyValue(const CObject* componentParam } else { - str =""; + str.clear(); } } diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 8e7e13597..f9c047fd5 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -168,7 +168,7 @@ bool ReloadUIFlag = true; // by default, CEditor loads its own UI bool ResetScenarioWanted = false; bool ReloadScenarioWanted = false; bool ConnectionWanted = false; -std::string CEditor::_ScenarioToLoadWhenEntreringIntoAnimation=""; +std::string CEditor::_ScenarioToLoadWhenEntreringIntoAnimation; bool CEditor::_IsStartingScenario=false; // ********************************************************************************************************* diff --git a/code/ryzom/client/src/r2/tool_pick.cpp b/code/ryzom/client/src/r2/tool_pick.cpp index a34d3ccdf..835fcd8ea 100644 --- a/code/ryzom/client/src/r2/tool_pick.cpp +++ b/code/ryzom/client/src/r2/tool_pick.cpp @@ -73,7 +73,7 @@ void CToolPick::setIgnoreInstances(const std::string & ignoreInstances) while(!tmp.empty() && tmp[tmp.size()]==' ') { if(tmp.size()==1) - tmp=""; + tmp.clear(); else tmp = tmp.substr(0,tmp.size()-1); } diff --git a/code/ryzom/client/src/rosace.cpp b/code/ryzom/client/src/rosace.cpp index 71e41929b..75b896255 100644 --- a/code/ryzom/client/src/rosace.cpp +++ b/code/ryzom/client/src/rosace.cpp @@ -493,7 +493,7 @@ CRosace::~CRosace() void CRosace::init() { _Mode = CRosacePage::CursorAngleMode; - _Selected = ""; + _Selected.clear(); }// init // //----------------------------------------------- diff --git a/code/ryzom/client/src/seven_zip/7zArcIn.cpp b/code/ryzom/client/src/seven_zip/7zArcIn.cpp index ca2d5f6eb..2beed3d5c 100644 --- a/code/ryzom/client/src/seven_zip/7zArcIn.cpp +++ b/code/ryzom/client/src/seven_zip/7zArcIn.cpp @@ -1,5 +1,5 @@ /* 7zArcIn.c -- 7z Input functions -2016-03-31 : Igor Pavlov : Public domain */ +2016-05-16 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -1100,13 +1100,11 @@ static SRes SzReadHeader2( ISzAlloc *allocTemp ) { - UInt64 type; - UInt32 numFiles = 0; - UInt32 numEmptyStreams = 0; CSubStreamInfo ssi; - const Byte *emptyStreams = NULL; - const Byte *emptyFiles = NULL; +{ + UInt64 type; + SzData_Clear(&ssi.sdSizes); SzData_Clear(&ssi.sdCRCs); SzData_Clear(&ssi.sdNumSubStreams); @@ -1120,9 +1118,9 @@ static SRes SzReadHeader2( { for (;;) { - UInt64 type; - RINOK(ReadID(sd, &type)); - if (type == k7zIdEnd) + UInt64 type2; + RINOK(ReadID(sd, &type2)); + if (type2 == k7zIdEnd) break; RINOK(SkipData(sd)); } @@ -1160,6 +1158,13 @@ static SRes SzReadHeader2( if (type != k7zIdFilesInfo) return SZ_ERROR_ARCHIVE; +} + +{ + UInt32 numFiles = 0; + UInt32 numEmptyStreams = 0; + const Byte *emptyStreams = NULL; + const Byte *emptyFiles = NULL; RINOK(SzReadNumber32(sd, &numFiles)); p->NumFiles = numFiles; @@ -1458,7 +1463,7 @@ static SRes SzReadHeader2( if (ssi.sdNumSubStreams.Data && ssi.sdNumSubStreams.Size != 0) return SZ_ERROR_ARCHIVE; } - +} return SZ_OK; } diff --git a/code/ryzom/client/src/seven_zip/7zVersion.h b/code/ryzom/client/src/seven_zip/7zVersion.h index e884fc679..4f15081de 100644 --- a/code/ryzom/client/src/seven_zip/7zVersion.h +++ b/code/ryzom/client/src/seven_zip/7zVersion.h @@ -1,9 +1,9 @@ #define MY_VER_MAJOR 16 -#define MY_VER_MINOR 02 +#define MY_VER_MINOR 04 #define MY_VER_BUILD 0 -#define MY_VERSION_NUMBERS "16.02" -#define MY_VERSION "16.02" -#define MY_DATE "2016-05-21" +#define MY_VERSION_NUMBERS "16.04" +#define MY_VERSION "16.04" +#define MY_DATE "2016-10-04" #undef MY_COPYRIGHT #undef MY_VERSION_COPYRIGHT_DATE #define MY_AUTHOR_NAME "Igor Pavlov" diff --git a/code/ryzom/client/src/seven_zip/Aes.cpp b/code/ryzom/client/src/seven_zip/Aes.cpp index 7c100c55d..b10b9e58a 100644 --- a/code/ryzom/client/src/seven_zip/Aes.cpp +++ b/code/ryzom/client/src/seven_zip/Aes.cpp @@ -1,5 +1,5 @@ /* Aes.c -- AES encryption / decryption -2015-02-23 : Igor Pavlov : Public domain */ +2016-05-21 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -167,10 +167,10 @@ void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize) { UInt32 r = w[i]; w[i] = - D[ Sbox[gb0(r)]] ^ - D[0x100 + Sbox[gb1(r)]] ^ - D[0x200 + Sbox[gb2(r)]] ^ - D[0x300 + Sbox[gb3(r)]]; + D[ (unsigned)Sbox[gb0(r)]] ^ + D[0x100 + (unsigned)Sbox[gb1(r)]] ^ + D[0x200 + (unsigned)Sbox[gb2(r)]] ^ + D[0x300 + (unsigned)Sbox[gb3(r)]]; } } diff --git a/code/ryzom/client/src/seven_zip/CpuArch.h b/code/ryzom/client/src/seven_zip/CpuArch.h index f6a28ba7e..e42ce2814 100644 --- a/code/ryzom/client/src/seven_zip/CpuArch.h +++ b/code/ryzom/client/src/seven_zip/CpuArch.h @@ -1,5 +1,5 @@ /* CpuArch.h -- CPU specific code -2015-12-01: Igor Pavlov : Public domain */ +2016-06-09: Igor Pavlov : Public domain */ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H @@ -66,6 +66,7 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem || defined(__MIPSEL__) \ || defined(__MIPSEL) \ || defined(_MIPSEL) \ + || defined(__BFIN__) \ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) #define MY_CPU_LE #endif diff --git a/code/ryzom/client/src/seven_zip/Lzma86Dec.cpp b/code/ryzom/client/src/seven_zip/Lzma86Dec.cpp index 7d89b2fcd..21031745c 100644 --- a/code/ryzom/client/src/seven_zip/Lzma86Dec.cpp +++ b/code/ryzom/client/src/seven_zip/Lzma86Dec.cpp @@ -1,5 +1,5 @@ /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder -2015-11-08 : Igor Pavlov : Public domain */ +2016-05-16 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -9,9 +9,6 @@ #include "Bra.h" #include "LzmaDec.h" -static void *SzAlloc(void *p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); } -static void SzFree(void *p, void *address) { UNUSED_VAR(p); MyFree(address); } - SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) { unsigned i; @@ -25,7 +22,6 @@ SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) { - ISzAlloc g_Alloc = { SzAlloc, SzFree }; SRes res; int useFilter; SizeT inSizePure; diff --git a/code/ryzom/client/src/seven_zip/Lzma86Enc.cpp b/code/ryzom/client/src/seven_zip/Lzma86Enc.cpp index bfb7727d5..a15b58d6c 100644 --- a/code/ryzom/client/src/seven_zip/Lzma86Enc.cpp +++ b/code/ryzom/client/src/seven_zip/Lzma86Enc.cpp @@ -1,5 +1,5 @@ /* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder -2015-11-08 : Igor Pavlov : Public domain */ +2016-05-16 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -13,13 +13,9 @@ #define SZE_OUT_OVERFLOW SZE_DATA_ERROR -static void *SzAlloc(void *p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); } -static void SzFree(void *p, void *address) { UNUSED_VAR(p); MyFree(address); } - int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, int level, UInt32 dictSize, int filterMode) { - ISzAlloc g_Alloc = { SzAlloc, SzFree }; size_t outSize2 = *destLen; Byte *filteredStream; Bool useFilter; diff --git a/code/ryzom/client/src/seven_zip/LzmaDec.cpp b/code/ryzom/client/src/seven_zip/LzmaDec.cpp index 27efbaba9..12dce11fb 100644 --- a/code/ryzom/client/src/seven_zip/LzmaDec.cpp +++ b/code/ryzom/client/src/seven_zip/LzmaDec.cpp @@ -1,5 +1,5 @@ /* LzmaDec.c -- LZMA Decoder -2015-06-23 : Igor Pavlov : Public domain */ +2016-05-16 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -294,14 +294,14 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte #ifdef _LZMA_SIZE_OPT { - unsigned limit, offset; + unsigned lim, offset; CLzmaProb *probLen = prob + LenChoice; IF_BIT_0(probLen) { UPDATE_0(probLen); probLen = prob + LenLow + (posState << kLenNumLowBits); offset = 0; - limit = (1 << kLenNumLowBits); + lim = (1 << kLenNumLowBits); } else { @@ -312,17 +312,17 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte UPDATE_0(probLen); probLen = prob + LenMid + (posState << kLenNumMidBits); offset = kLenNumLowSymbols; - limit = (1 << kLenNumMidBits); + lim = (1 << kLenNumMidBits); } else { UPDATE_1(probLen); probLen = prob + LenHigh; offset = kLenNumLowSymbols + kLenNumMidSymbols; - limit = (1 << kLenNumHighBits); + lim = (1 << kLenNumHighBits); } } - TREE_DECODE(probLen, limit, len); + TREE_DECODE(probLen, lim, len); len += offset; } #else diff --git a/code/ryzom/client/src/seven_zip/LzmaEnc.cpp b/code/ryzom/client/src/seven_zip/LzmaEnc.cpp index b4b7e0d16..0845691cf 100644 --- a/code/ryzom/client/src/seven_zip/LzmaEnc.cpp +++ b/code/ryzom/client/src/seven_zip/LzmaEnc.cpp @@ -1,5 +1,5 @@ /* LzmaEnc.c -- LZMA Encoder -2015-11-08 : Igor Pavlov : Public domain */ +2016-05-16 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -110,7 +110,7 @@ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) #define kDicLogSizeMaxCompress 32 -#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } +#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); } static UInt32 GetPosSlot1(UInt32 pos) { @@ -147,19 +147,19 @@ static void LzmaEnc_FastPosInit(Byte *g_FastPos) /* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */ /* -#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ +#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ - res = p->g_FastPos[pos >> i] + (i * 2); } + res = p->g_FastPos[pos >> zz] + (zz * 2); } */ /* -#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ +#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \ (0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \ - res = p->g_FastPos[pos >> i] + (i * 2); } + res = p->g_FastPos[pos >> zz] + (zz * 2); } */ -#define BSR2_RET(pos, res) { UInt32 i = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \ - res = p->g_FastPos[pos >> i] + (i * 2); } +#define BSR2_RET(pos, res) { UInt32 zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \ + res = p->g_FastPos[pos >> zz] + (zz * 2); } /* #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ @@ -985,12 +985,17 @@ static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) { - UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; - UInt32 matchPrice, repMatchPrice, normalMatchPrice; + UInt32 lenEnd, cur; UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; UInt32 *matches; + + { + + UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, len; + UInt32 matchPrice, repMatchPrice, normalMatchPrice; const Byte *data; Byte curByte, matchByte; + if (p->optimumEndIndex != p->optimumCurrentIndex) { const COptimal *opt = &p->opt[p->optimumCurrentIndex]; @@ -1178,8 +1183,11 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) } #endif + } + for (;;) { + UInt32 numAvail; UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; Bool nextIsChar; @@ -1467,6 +1475,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) for (lenTest = /*2*/ startLen; ; lenTest++) { UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; + { UInt32 lenToPosState = GetLenToPosState(lenTest); COptimal *opt; if (curBack < kNumFullDistances) @@ -1482,6 +1491,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) opt->backPrev = curBack + LZMA_NUM_REPS; opt->prev1IsChar = False; } + } if (/*_maxMode && */lenTest == matches[offs]) { @@ -1511,15 +1521,15 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) /* for (; lenTest2 >= 2; lenTest2--) */ { UInt32 offset = cur + lenTest + 1 + lenTest2; - UInt32 curAndLenPrice; + UInt32 curAndLenPrice2; COptimal *opt; while (lenEnd < offset) p->opt[++lenEnd].price = kInfinityPrice; - curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + curAndLenPrice2 = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); opt = &p->opt[offset]; - if (curAndLenPrice < opt->price) + if (curAndLenPrice2 < opt->price) { - opt->price = curAndLenPrice; + opt->price = curAndLenPrice2; opt->posPrev = cur + lenTest + 1; opt->backPrev = 0; opt->prev1IsChar = True; @@ -1720,7 +1730,6 @@ static void FillDistancesPrices(CLzmaEnc *p) { UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; - UInt32 i; for (i = 0; i < kStartPosModelIndex; i++) distancesPrices[i] = posSlotPrices[i]; for (; i < kNumFullDistances; i++) diff --git a/code/ryzom/client/src/seven_zip/Ppmd7.cpp b/code/ryzom/client/src/seven_zip/Ppmd7.cpp index 7ef84d47b..eda8eb70a 100644 --- a/code/ryzom/client/src/seven_zip/Ppmd7.cpp +++ b/code/ryzom/client/src/seven_zip/Ppmd7.cpp @@ -1,5 +1,5 @@ /* Ppmd7.c -- PPMdH codec -2015-09-28 : Igor Pavlov : Public domain +2016-05-21 : Igor Pavlov : Public domain This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ #include "Precomp.h" @@ -639,10 +639,10 @@ CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *escFreq) unsigned nonMasked = p->MinContext->NumStats - numMasked; if (p->MinContext->NumStats != 256) { - see = p->See[p->NS2Indx[nonMasked - 1]] + + see = p->See[(unsigned)p->NS2Indx[nonMasked - 1]] + (nonMasked < (unsigned)SUFFIX(p->MinContext)->NumStats - p->MinContext->NumStats) + - 2 * (p->MinContext->SummFreq < 11 * p->MinContext->NumStats) + - 4 * (numMasked > nonMasked) + + 2 * (unsigned)(p->MinContext->SummFreq < 11 * p->MinContext->NumStats) + + 4 * (unsigned)(numMasked > nonMasked) + p->HiBitsFlag; { unsigned r = (see->Summ >> see->Shift); diff --git a/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua b/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua index e4fbd4632..9f856dd23 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua @@ -927,7 +927,7 @@ end ------------------------------------------------------------------------------------------------------------ -- get a form from its name function r2:getForm(name) - assert(name) -- why is nam nil??? + assert(name) -- why is name nil??? return getUI("ui:interface:r2ed_form_" .. name) end diff --git a/code/ryzom/common/src/game_share/bg_downloader_msg.cpp b/code/ryzom/common/src/game_share/bg_downloader_msg.cpp index 8f00b4c3f..297770ddb 100644 --- a/code/ryzom/common/src/game_share/bg_downloader_msg.cpp +++ b/code/ryzom/common/src/game_share/bg_downloader_msg.cpp @@ -24,7 +24,7 @@ namespace BGDownloader { -const char *DownloaderMutexName = "RyzomBgDownloader"; +const wchar_t *DownloaderMutexName = L"RyzomBgDownloader"; ucstring getWrittenSize(uint32 nSize) { diff --git a/code/ryzom/common/src/game_share/bg_downloader_msg.h b/code/ryzom/common/src/game_share/bg_downloader_msg.h index e33224b70..da903493f 100644 --- a/code/ryzom/common/src/game_share/bg_downloader_msg.h +++ b/code/ryzom/common/src/game_share/bg_downloader_msg.h @@ -133,7 +133,7 @@ const uint RYZOM_PID_SHM_ID = 0x6b833f31; // name of the background downloader system-wide mutex -extern const char *DownloaderMutexName; +extern const wchar_t *DownloaderMutexName; // get patch written size in megabytes diff --git a/code/ryzom/common/src/game_share/cst_loader.cpp b/code/ryzom/common/src/game_share/cst_loader.cpp index 87e587ba1..f4d4c4da0 100644 --- a/code/ryzom/common/src/game_share/cst_loader.cpp +++ b/code/ryzom/common/src/game_share/cst_loader.cpp @@ -227,7 +227,7 @@ void CSTLoader::generateDerivedClasses(const std::list< std::pair - -const char *CLoginRegistry::AppRegEntry = "Software\\Nevrax\\RyzomInstall"; -static const char *LoginStepKeyHandle = "LoginStep"; -static const char *InstallIdKeyHandle = "InstallId"; +static const wchar_t *AppRegEntry = L"Software\\Nevrax\\RyzomInstall"; +static const wchar_t *LoginStepKeyHandle = L"LoginStep"; +static const wchar_t *InstallIdKeyHandle = L"InstallId"; //=========================================================================================== std::string CLoginRegistry::getProductInstallId() { - - // read value HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, AppRegEntry, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CURRENT_USER, AppRegEntry, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { const uint keyMaxLength = 1024; DWORD dwType = 0L; DWORD dwSize = keyMaxLength; - char buffer[keyMaxLength]; - if(RegQueryValueEx(hKey, InstallIdKeyHandle, NULL, &dwType, (unsigned char *) buffer, &dwSize) == ERROR_SUCCESS && dwType == REG_SZ) + wchar_t buffer[keyMaxLength]; + if (RegQueryValueExW(hKey, InstallIdKeyHandle, NULL, &dwType, (BYTE *) buffer, &dwSize) == ERROR_SUCCESS && dwType == REG_SZ) { RegCloseKey(hKey); - return buffer; + return wideToUtf8(buffer); } RegCloseKey(hKey); } + DWORD dwDisp; + // do not exist, create a new key - if(RegCreateKeyEx(HKEY_CURRENT_USER, AppRegEntry, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS) + if (RegCreateKeyExW(HKEY_CURRENT_USER, AppRegEntry, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS) { srand((uint32)nl_time(0)); uint32 r = rand(); r <<= 16; r |= rand(); + std::string id = NLMISC::toString(r); - if (RegSetValueEx(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *) id.c_str(), (DWORD)(id.size())+1) == ERROR_SUCCESS) + + if (RegSetValueExW(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *) utf8ToWice(id), (DWORD)(id.size())+1) == ERROR_SUCCESS) { return id; } } + return ""; } @@ -67,17 +69,18 @@ std::string CLoginRegistry::getProductInstallId() uint CLoginRegistry::getLoginStep() { HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, AppRegEntry, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CURRENT_USER, AppRegEntry, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { DWORD loginStep = 0; DWORD type; DWORD dataSize = sizeof(DWORD); - RegQueryValueEx (hKey, LoginStepKeyHandle, 0, &type, (LPBYTE) &loginStep, &dataSize); + RegQueryValueExW(hKey, LoginStepKeyHandle, 0, &type, (LPBYTE) &loginStep, &dataSize); if (type == REG_DWORD && dataSize == sizeof(DWORD)) { return (uint) loginStep; } } + return 0; } @@ -86,10 +89,10 @@ void CLoginRegistry::setLoginStep(uint step) { HKEY hKey; DWORD dwDisp; - if(RegCreateKeyEx(HKEY_CURRENT_USER, AppRegEntry, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS) + if (RegCreateKeyExW(HKEY_CURRENT_USER, AppRegEntry, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp) == ERROR_SUCCESS) { DWORD loginStep = step; - RegSetValueEx(hKey, LoginStepKeyHandle, 0L, REG_DWORD, (const BYTE *) &loginStep, sizeof(DWORD)); + RegSetValueExW(hKey, LoginStepKeyHandle, 0L, REG_DWORD, (const BYTE *) &loginStep, sizeof(DWORD)); } } diff --git a/code/ryzom/common/src/game_share/login_registry.h b/code/ryzom/common/src/game_share/login_registry.h index 954b48e7c..a0520b0cc 100644 --- a/code/ryzom/common/src/game_share/login_registry.h +++ b/code/ryzom/common/src/game_share/login_registry.h @@ -19,8 +19,6 @@ struct CLoginRegistry { - // key for the login registry infos - static const char *AppRegEntry; // Utility function to get a unique install id from the registry static std::string getProductInstallId(); // retrieve login step from the registry (0 if no step yet) diff --git a/code/ryzom/common/src/game_share/mainland_summary.h b/code/ryzom/common/src/game_share/mainland_summary.h index 24bba104c..a6ed6a9ca 100644 --- a/code/ryzom/common/src/game_share/mainland_summary.h +++ b/code/ryzom/common/src/game_share/mainland_summary.h @@ -33,8 +33,6 @@ struct CMainlandSummary { CMainlandSummary(): Id(0) { - Name = ""; - Description = ""; LanguageCode = "en"; Online = false; } diff --git a/code/ryzom/common/src/game_share/mirror_prop_value.h b/code/ryzom/common/src/game_share/mirror_prop_value.h index b9bc7956e..1ff2ae6e4 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value.h @@ -847,7 +847,7 @@ public: private: /** The previous value known is stored. If we stored the timestamp instead, we could not see a change - * if it occured after but at the same cycle as resetChangeFlag(). + * if it occurred after but at the same cycle as resetChangeFlag(). */ T _PreviousValue; }; @@ -911,7 +911,7 @@ public: private: /** The previous value known is stored. If we stored the timestamp instead, we could not see a change - * if it occured after but at the same cycle as resetChangeFlag(). + * if it occurred after but at the same cycle as resetChangeFlag(). */ T _PreviousValue; }; diff --git a/code/ryzom/common/src/game_share/mirrored_data_set.cpp b/code/ryzom/common/src/game_share/mirrored_data_set.cpp index 69884afee..b30df0f1c 100644 --- a/code/ryzom/common/src/game_share/mirrored_data_set.cpp +++ b/code/ryzom/common/src/game_share/mirrored_data_set.cpp @@ -1418,7 +1418,7 @@ void storeDatasetPtToQuickArray( uint16 bitIndex, CMirroredDataSet *dataSet ) const char *getBlankChars( const string& leftstr ) { static string blank; - blank = ""; + blank.clear(); for ( sint i=0; i!=max((sint32)(19-leftstr.size()),(sint32)0)+1; ++i ) { blank += " "; diff --git a/code/ryzom/common/src/game_share/msg_client_server.h b/code/ryzom/common/src/game_share/msg_client_server.h index cf521a02d..08dc0e171 100644 --- a/code/ryzom/common/src/game_share/msg_client_server.h +++ b/code/ryzom/common/src/game_share/msg_client_server.h @@ -677,7 +677,6 @@ public: SenderNameId = 0; ChatMode = 0; PhraseId = 0; - CustomTxt = ""; } void serial(NLMISC::CBitMemStream &f) diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index dddb6b270..f914085e4 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -520,7 +520,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si if (isTable() && getAttr("InstanceId")) { instanceId = getAttr("InstanceId")->toString(); - attrName = ""; + attrName.clear(); position = -1; return true; } diff --git a/code/ryzom/common/src/game_share/persistent_data_tree.cpp b/code/ryzom/common/src/game_share/persistent_data_tree.cpp index feefbad1c..d10f01013 100644 --- a/code/ryzom/common/src/game_share/persistent_data_tree.cpp +++ b/code/ryzom/common/src/game_share/persistent_data_tree.cpp @@ -816,7 +816,7 @@ bool CPersistentDataTree::writeToPdr(CPersistentDataRecord& pdr) const ok= _Child->getChildren()[i]->writeToPdr(pdr); } - // if an error occured during write then clear out the result pdr and return false + // if an error occurred during write then clear out the result pdr and return false if (!ok) pdr.clear(); diff --git a/code/ryzom/common/src/game_share/ring_access.cpp b/code/ryzom/common/src/game_share/ring_access.cpp index c191f8c83..9e0ba8ce4 100644 --- a/code/ryzom/common/src/game_share/ring_access.cpp +++ b/code/ryzom/common/src/game_share/ring_access.cpp @@ -349,7 +349,7 @@ std::string CRingAccess::upgradeRingAccess(const std::string& defaultValue, cons } // return the new value as string - std::string toRet =""; + std::string toRet; { std::map::const_iterator first(defaultMap.begin()), last(defaultMap.end()); diff --git a/code/ryzom/common/src/game_share/scenario.cpp b/code/ryzom/common/src/game_share/scenario.cpp index 120b422d2..e2437eac2 100644 --- a/code/ryzom/common/src/game_share/scenario.cpp +++ b/code/ryzom/common/src/game_share/scenario.cpp @@ -853,8 +853,8 @@ bool CScenarioValidator::setScenarioToLoad( const std::string& filename, CScenar // Scenario without header if (_ScenarioBody.size() < headerLen ||_ScenarioBody.substr(0, headerLen) != header ) { - md5 = ""; - signature = ""; + md5.clear(); + signature.clear(); inf.close(); return true; } @@ -1108,8 +1108,8 @@ bool CUserComponentValidator::setUserComponentToLoad( const std::string& filenam // Scenario without header if (_UserComponentBody.size() < headerLen ||_UserComponentBody.substr(0, headerLen) != header ) { - md5 = ""; - signature = ""; + md5.clear(); + signature.clear(); inf.close(); return true; } diff --git a/code/ryzom/common/src/game_share/seeds.cpp b/code/ryzom/common/src/game_share/seeds.cpp index 92ffbf6bc..a4cc18061 100644 --- a/code/ryzom/common/src/game_share/seeds.cpp +++ b/code/ryzom/common/src/game_share/seeds.cpp @@ -30,7 +30,7 @@ typedef CSeeds::TBigUInt TBigUInt; static inline void addAndCheckOverFlow(TUInt &dest, TUInt src, TUInt &overflow) { TBigUInt newValue = (TBigUInt) src + (TBigUInt) dest; - if (newValue > (TBigUInt) CSeeds::MaxUIntValue) // has an overflow occured ? + if (newValue > (TBigUInt) CSeeds::MaxUIntValue) // has an overflow occurred ? { dest= (TUInt) (newValue - (TBigUInt) CSeeds::MaxUIntValue); overflow = (TUInt) CSeeds::MaxUIntValue; diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 199a983ef..fbeb5516f 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -543,7 +543,7 @@ void CAnimationSession::updateActPositionDescriptions(TActPositionDescriptions& { actPositionDescription.Name = act->Name; actPositionDescription.Season = 0; - actPositionDescription.Island = ""; + actPositionDescription.Island.clear(); actPositionDescription.LocationId = 0; } actPositionDescriptions.push_back(actPositionDescription); diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index 924f23497..1ab30148c 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -486,7 +486,7 @@ using namespace R2; //----------------- -------------------------------------------- void CKeysHolder::resetPolicies() { - _CurrentKey = ""; + _CurrentKey.clear(); _Keys.clear(); } @@ -2128,7 +2128,7 @@ void CServerEditionModule::onScenarioUploadAsked(NLNET::IModuleProxy *senderModu TSessionId sessionId = found->second; scenario->setHighLevel( scenarioHl ); - getSession(sessionId)->RingAccess = ""; + getSession(sessionId)->RingAccess.clear(); scenario->setInitialActIndex(1); if (mustBroadCast) { @@ -2819,7 +2819,7 @@ void CServerEditionModule::createSession(NLNET::IModuleProxy *sender, TCharId ow info.setSessionAnimatorCharId( ownerCharId); if ( !nevraxScenario ) { - missionTag = ""; + missionTag.clear(); trialAllowed = false; } @@ -2976,11 +2976,11 @@ void CServerEditionModule::resetSession(NLNET::IModuleProxy *sender, TSessionId return; } - session->RingAccess = ""; + session->RingAccess.clear(); if (!reconnect) // reset { scenario->setHighLevel( 0 ); - getSession(sessionId)->RingAccess = ""; + getSession(sessionId)->RingAccess.clear(); scenario->setMode(0); @@ -3869,7 +3869,7 @@ void CServerEditionModule::startScenario(NLNET::IModuleProxy *senderModuleProxy, info.setSessionAnimatorCharId( charId); if ( !nevraxScenario ) { - missionTag = ""; + missionTag.clear(); trialAllowed = false; } @@ -5581,7 +5581,7 @@ const NLNET::TModuleProxyPtr * CServerEditionModule::getClientProxyPtr(TCharId c void CServerEditionModule::getTpContext(TCharId charId, std::string& tpCancelTextId, R2::TTeleportContext& tpContext) { - tpCancelTextId = ""; + tpCancelTextId.clear(); tpContext = R2::TPContext_Unknown; TSessionId sessionId = getSessionIdByCharId(charId); @@ -5967,13 +5967,13 @@ void CServerEditionModule::addKeyPolicy(NLNET::IModuleProxy *sender, const std:: std::string key = keyName; if (key == "EMPTY") { - key = ""; + key.clear(); } std::string privateKey = privateKeyValue; if (privateKey == "EMPTY") { - privateKey = ""; + privateKey.clear(); } _KeysHolder->addKeyPolicy(key, privateKey, p); diff --git a/code/ryzom/common/src/game_share/string_mgr_module.cpp b/code/ryzom/common/src/game_share/string_mgr_module.cpp index df74f35d1..6e29e66f6 100644 --- a/code/ryzom/common/src/game_share/string_mgr_module.cpp +++ b/code/ryzom/common/src/game_share/string_mgr_module.cpp @@ -449,7 +449,7 @@ void CStringManagerModule::unregisterTableRequested(TSessionId sessionId) static std::string formatString(std::string str,std::vector args) { uint32 size = (uint32)args.size(); - std::string ret=""; + std::string ret; { std::string::size_type pos = 0; CSString cstring(str); diff --git a/code/ryzom/server/src/ags_test/command_event_manager.cpp b/code/ryzom/server/src/ags_test/command_event_manager.cpp index 5ded5a5f5..c55018429 100644 --- a/code/ryzom/server/src/ags_test/command_event_manager.cpp +++ b/code/ryzom/server/src/ags_test/command_event_manager.cpp @@ -858,7 +858,7 @@ bool CCommandEventManager::CScript::run() CScriptNode::EState state = Root->execute(Environment); if (state == CScriptNode::Error) { - nlwarning("[%s] An error occured in script, script ended", Name.c_str()); + nlwarning("[%s] An error occurred in script, script ended", Name.c_str()); return false; } else if (state == CScriptNode::Ok) diff --git a/code/ryzom/server/src/ai_service/script_compiler.cpp b/code/ryzom/server/src/ai_service/script_compiler.cpp index 8e28d0c9f..7ba10f149 100644 --- a/code/ryzom/server/src/ai_service/script_compiler.cpp +++ b/code/ryzom/server/src/ai_service/script_compiler.cpp @@ -1666,7 +1666,7 @@ void CSubRuleTracer::removeInvalidTracers() CSmartPtr CSubRuleTracer::codifyTree() { - if (getHigherParent()==this) // an error occured. + if (getHigherParent()==this) // an error occurred. { bool errorAppened=false; // Check. diff --git a/code/ryzom/server/src/entities_game_service/cdb_group.h b/code/ryzom/server/src/entities_game_service/cdb_group.h index 4361049f6..69947c3be 100644 --- a/code/ryzom/server/src/entities_game_service/cdb_group.h +++ b/code/ryzom/server/src/entities_game_service/cdb_group.h @@ -96,7 +96,7 @@ public: /** * Add a recipient. * - recipient must be ready for writing (e.g. at state 1 of above tutorial), because it will - * be filled immediately with the modifications that occured before its arrival. + * be filled immediately with the modifications that occurred before its arrival. * //Obsolete: * //- recipient must neither move in memory nor be removed between calls of addRecipient() and * //removeRecipient(). Beware with vectors and reallocation. diff --git a/code/ryzom/server/src/entities_game_service/common_shard_callbacks.cpp b/code/ryzom/server/src/entities_game_service/common_shard_callbacks.cpp index 4febd07d0..bdac3f1a6 100644 --- a/code/ryzom/server/src/entities_game_service/common_shard_callbacks.cpp +++ b/code/ryzom/server/src/entities_game_service/common_shard_callbacks.cpp @@ -53,7 +53,7 @@ void cbStallShard( NLNET::CMessage& msgin, const std::string &serviceName, NLNET msgin.serial( filename ); nlwarning("Backup service send Stall order when trying write %s file", filename.c_str() ); - PlayerManager.broadcastMessage( 2, 0, 5, "Technical problem occured on the server,"); + PlayerManager.broadcastMessage( 2, 0, 5, "Technical problem occurred on the server,"); PlayerManager.broadcastMessage( 2, 0, 5, "All non administrator accounts are disconnected immediately."); PlayerManager.broadcastMessage( 2, 0, 5, "Customer Support is already working on it."); PlayerManager.broadcastMessage( 2, 0, 5, "Sorry for any inconveniences."); diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index 01b9607c7..1b7f0c901 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -1898,7 +1898,7 @@ void CPlayerService::release() //--------------------------------------------------- void cbConnection( const std::string &serviceName, NLNET::TServiceId serviceId, void *arg ) { - // inform player about the service event that occured + // inform player about the service event that occurred #if !FINAL_VERSION PlayerManager.broadcastMessage( 1, 0, 0, string("System event : Service UP : ")+serviceName); #endif diff --git a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h index 40503f16c..3dac33ef7 100644 --- a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h +++ b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h @@ -353,7 +353,7 @@ public: * Set the value of a var * \param var is the name of the variable * \param value is the new value for the variable - * \return true if the value has been set, false if an error occured + * \return true if the value has been set, false if an error occurred */ bool setValue( const std::string& var, const std::string& value ); @@ -361,7 +361,7 @@ public: * Modify the value of a var * \param var is the name of the variable * \param value is the modification value - * \return true if the value has been changed, false if an error occured + * \return true if the value has been changed, false if an error occurred */ bool modifyValue( const std::string& var, const std::string& value ); diff --git a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost.h b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost.h index f08cf4fe2..f48670ada 100644 --- a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost.h +++ b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost.h @@ -317,9 +317,9 @@ public: private: - /// an event affecting outpost state occured + /// an event affecting outpost state occurred void eventTriggered(OUTPOSTENUMS::TOutpostEvent event, void* eventParams = NULL); - /// an event affecting outpost state occured and has not been handled + /// an event affecting outpost state occurred and has not been handled /// WARNING: it should only be called from eventTriggered void eventException(OUTPOSTENUMS::TOutpostEvent event, void* eventParams); diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/area_effect.h b/code/ryzom/server/src/entities_game_service/phrase_manager/area_effect.h index b41207825..4d08ab354 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/area_effect.h +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/area_effect.h @@ -114,7 +114,7 @@ public: str = NLMISC::toString("Chain, max target %d, factor %f range %f", Chain.MaxTargets, Chain.Factor, Chain.Range); break; default: - str = "unkown area type"; + str = "unknown area type"; }; return str; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.h b/code/ryzom/server/src/entities_game_service/player_manager/character.h index b0067a5e0..b060bc0f2 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.h @@ -600,7 +600,7 @@ public: * Set the value of a var * \param var is the name of the variable * \param value is the new value for the variable - * \return true if the value has been set, false if an error occured + * \return true if the value has been set, false if an error occurred */ bool setValue( std::string var, std::string value ); @@ -608,7 +608,7 @@ public: * Modify the value of a var * \param var is the name of the variable * \param value is the modification value - * \return true if the value has been changed, false if an error occured + * \return true if the value has been changed, false if an error occurred */ bool modifyValue( std::string var, std::string value ); @@ -2913,7 +2913,7 @@ private: * \param phraseId the phrase sheet id * \param knownPhraseIndex index of the phrase in phrase book * \param testRestrictions if true then test if player match phrase requirements - * \return true if the phrase has been bought, false if an error occured + * \return true if the phrase has been bought, false if an error occurred */ bool buyRolemasterPhrase( const NLMISC::CSheetId &phraseId, uint16 knownPhraseIndex, bool testRestrictions ); @@ -3839,7 +3839,7 @@ public: /// Test the character against mission prerequisits for the specified list of mission giver NPCs void sendNpcMissionGiverIconDesc( const std::vector& npcKeys ); - /// Inform the client that an event that might change mission availability just occured + /// Inform the client that an event that might change mission availability just occurred void sendEventForMissionAvailabilityCheck(); /// Send the current timer period if is different from the default or force is true diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp index ab1d65971..feb961a23 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp @@ -2381,7 +2381,7 @@ void CPlayerManager::broadcastMessageUpdate() else if( _Stall == true ) { forceDisconnectUserWithoutPrivileges(); - broadcastMessage( 2, 0, 5, "Technical problem occured on the server,"); + broadcastMessage( 2, 0, 5, "Technical problem occurred on the server,"); broadcastMessage( 2, 0, 5, "All non administrator accounts are disconnected immediately."); broadcastMessage( 2, 0, 5, "Customer Support is already working on it."); broadcastMessage( 2, 0, 5, "Sorry for any inconveniences."); diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h index a1ed2a336..ba99c31fd 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h @@ -77,7 +77,7 @@ private: ///\name interface callbacks //@{ - /// callback when user potentially leaves PVP. Return false if an error occured + /// callback when user potentially leaves PVP. Return false if an error occurred virtual bool leavePVP( CCharacter * user, IPVP::TEndType type) = 0; /// callback when a player hurts another, does nothing by default diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager.cpp index 7f0ce4ed3..14bf94371 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager.cpp @@ -888,7 +888,7 @@ void CPVPManager::askForPVPChallenge( const NLMISC::CEntityId & userId ) ++it; } } - // problem occured : bail out + // problem occurred : bail out if ( problem ) return; diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp index 0eb5b3c5b..c7231fe4b 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp @@ -1418,7 +1418,7 @@ void CPVPManager2::askForDuel( const NLMISC::CEntityId & userId ) ++it; } } - // problem occured : bail out + // problem occurred : bail out if ( problem ) return; diff --git a/code/ryzom/server/src/frontend_service/vision_provider.cpp b/code/ryzom/server/src/frontend_service/vision_provider.cpp index 2354d63c2..28350abd7 100644 --- a/code/ryzom/server/src/frontend_service/vision_provider.cpp +++ b/code/ryzom/server/src/frontend_service/vision_provider.cpp @@ -364,7 +364,7 @@ bool CVisionProvider::addPair( TClientId clientid, const TEntityIndex& entity //TEMP //flog.displayRawNL( "ADD C%hu E%u, slot %hu, id %s", clientid, entityindex, slot, CFrontEndPropertyReceiver::getEntity(entityindex)->id.toString().c_str() ); - /* 1. Associate Entity Index to a new TCLEntityId (or get exiting association if this new association occured before a dissociation acknowledge from the client) + /* 1. Associate Entity Index to a new TCLEntityId (or get exiting association if this new association occurred before a dissociation acknowledge from the client) */ if ( slot < MAX_SEEN_ENTITIES_PER_CLIENT ) diff --git a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp index 2aa3c896b..c13c0a987 100644 --- a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp +++ b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp @@ -620,7 +620,7 @@ bool CStringManager::parseBlock(const ucstring &block, CPhrase &phrase) TParamId *pparamId; if (!findParam(phrase, rep[k].ParamName, pparamId)) { - nlwarning("Text in clause %d use parameter [%s] that is unkown in block", count, rep[k].ParamName.c_str()); + nlwarning("Text in clause %d use parameter [%s] that is unknown in block", count, rep[k].ParamName.c_str()); return false; } } diff --git a/code/ryzom/server/src/mail_forum_service/hof_generator.cpp b/code/ryzom/server/src/mail_forum_service/hof_generator.cpp index a46557b3d..77cde5442 100644 --- a/code/ryzom/server/src/mail_forum_service/hof_generator.cpp +++ b/code/ryzom/server/src/mail_forum_service/hof_generator.cpp @@ -269,7 +269,7 @@ void CHoFGenerator::processGenerationStep() if (HoFVerbose.get()) nlwarning("script generation from '%s' failed for shard %u", getCurrentHDTFile().c_str(), getCurrentSDBReader().getShardId()); - // skip the SDB reader if an error occured + // skip the SDB reader if an error occurred setNextSDBReader(); return; } diff --git a/code/ryzom/server/src/persistant_data_service/pds_database.cpp b/code/ryzom/server/src/persistant_data_service/pds_database.cpp index c3617f55a..912d059d1 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_database.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_database.cpp @@ -1587,7 +1587,7 @@ bool CDatabase::buildDelta(const CTimestamp& starttime, const CTimestamp& endtim // } // catch (const Exception& e) // { -// PDS_WARNING("buildDelta(): exception occured while saving straight log : %s", e.what()); +// PDS_WARNING("buildDelta(): exception occurred while saving straight log : %s", e.what()); // } // } // else diff --git a/code/ryzom/server/src/persistant_data_service/pds_table.h b/code/ryzom/server/src/persistant_data_service/pds_table.h index c9137f95c..2a1310abb 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_table.h +++ b/code/ryzom/server/src/persistant_data_service/pds_table.h @@ -315,14 +315,14 @@ public: /** * Get data as a Set - * Return an accessor on a set, which is valid only if not issue occured + * Return an accessor on a set, which is valid only if not issue occurred * Thus, you are able to modify the list own your own, add/remove items... */ RY_PDS::CSetMap::CAccessor getSet(); /** * Get data as a Set - * Return an accessor on a set, which is valid only if not issue occured + * Return an accessor on a set, which is valid only if not issue occurred */ const RY_PDS::CSetMap::CAccessor getSet() const; diff --git a/code/ryzom/server/src/persistant_data_service/pds_table_inline.h b/code/ryzom/server/src/persistant_data_service/pds_table_inline.h index 1fd46f1c4..a02c6d5cd 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_table_inline.h +++ b/code/ryzom/server/src/persistant_data_service/pds_table_inline.h @@ -630,7 +630,7 @@ inline bool CTable::CDataAccessor::setIndex(const RY_PDS::CObjectIndex &index) /* * Get data as a Set - * Return an accessor on a set, which is valid only if not issue occured + * Return an accessor on a set, which is valid only if not issue occurred * Thus, you are able to modify the list own your own, add/remove items... */ inline RY_PDS::CSetMap::CAccessor CTable::CDataAccessor::getSet() @@ -655,7 +655,7 @@ inline RY_PDS::CSetMap::CAccessor CTable::CDataAccessor::getSet() /* * Get data as a Set - * Return an accessor on a set, which is valid only if not issue occured + * Return an accessor on a set, which is valid only if not issue occurred */ inline const RY_PDS::CSetMap::CAccessor CTable::CDataAccessor::getSet() const { diff --git a/code/ryzom/server/src/shard_unifier_service/login_service.cpp b/code/ryzom/server/src/shard_unifier_service/login_service.cpp index c56897d07..5ded2eafa 100644 --- a/code/ryzom/server/src/shard_unifier_service/login_service.cpp +++ b/code/ryzom/server/src/shard_unifier_service/login_service.cpp @@ -442,7 +442,7 @@ namespace LS { // invalid user ! nldebug("on_logout : invalid user %u", userId); - logoutResult(from, 1, "unkown user"); + logoutResult(from, 1, "unknown user"); return; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp index 4768632c6..2d497b31a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp @@ -186,7 +186,7 @@ void CDownloader::downloadFile() if (m_listener) { QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); - m_listener->operationFail(tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_fullPath)); + m_listener->operationFail(tr("Error '%1' occurred when trying to check free disk space on %2.").arg(error).arg(m_fullPath)); } return; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp index b1ef5de67..a41ebffff 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp @@ -137,7 +137,7 @@ void CInstallDialog::accept() { int error = NLMISC::getLastError(); - nlwarning("Error '%s' (%d) occured when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory)); + nlwarning("Error '%s' (%d) occurred when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory)); } const CServer &server = CConfigFile::getInstance()->getServer(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index ad95075e3..a2ea81f00 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) // define commandline arguments QCommandLineParser parser; - parser.setApplicationDescription(QApplication::tr("Instalation and launcher tool for Ryzom")); + parser.setApplicationDescription(QApplication::tr("Installation and launcher tool for Ryzom")); parser.addHelpOption(); QCommandLineOption uninstallOption(QStringList() << "u" << "uninstall", QApplication::tr("Uninstall")); diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index 31792522e..1629ae670 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -130,7 +130,7 @@ void CMigrateDialog::accept() { int error = NLMISC::getLastError(); - nlwarning("Error '%s' (%d) occured when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory)); + nlwarning("Error '%s' (%d) occurred when trying to check free disk space on %s, continue anyway", NLMISC::formatErrorMessage(error).c_str(), error, Q2C(m_dstDirectory)); } // compare with exact size of current directory diff --git a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_de.ts b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_de.ts index f60cc497a..69c36c3bb 100644 --- a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_de.ts +++ b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_de.ts @@ -854,7 +854,7 @@ Drücke Weiter und folge den verschiedenen Schritten bis zum Ende. - Instalation and launcher tool for Ryzom + Installation and launcher tool for Ryzom Installations- und Startprogramm für Ryzom diff --git a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_es.ts b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_es.ts index f8d6885d5..3ecb5391f 100644 --- a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_es.ts +++ b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_es.ts @@ -663,7 +663,7 @@ Just press Continue button and follow the different steps until everything is do - Instalation and launcher tool for Ryzom + Installation and launcher tool for Ryzom diff --git a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts index 1a0432db5..2361048bf 100644 --- a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts +++ b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_fr.ts @@ -865,7 +865,7 @@ Vous n'avez qu'à cliquer sur Suivant et suivre les différentes étap - Instalation and launcher tool for Ryzom + Installation and launcher tool for Ryzom Outil d'installation et lanceur pour Ryzom diff --git a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_ru.ts b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_ru.ts index 1ff77b91a..322327841 100644 --- a/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_ru.ts +++ b/code/ryzom/tools/client/ryzom_installer/translations/ryzom_installer_ru.ts @@ -831,7 +831,7 @@ Just press Continue button and follow the different steps until everything is do - Instalation and launcher tool for Ryzom + Installation and launcher tool for Ryzom Программа установки и запуска Ryzom diff --git a/code/ryzom/tools/leveldesign/alias_synchronizer/alias_synchronizer.cpp b/code/ryzom/tools/leveldesign/alias_synchronizer/alias_synchronizer.cpp index 5bfd98eae..4c6d2ffa3 100644 --- a/code/ryzom/tools/leveldesign/alias_synchronizer/alias_synchronizer.cpp +++ b/code/ryzom/tools/leveldesign/alias_synchronizer/alias_synchronizer.cpp @@ -302,7 +302,7 @@ struct TSetLastFolder if (!folders.empty()) str = folders.back(); else - str = ""; + str.clear(); } }; diff --git a/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp b/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp index 941db4100..409f8ecbc 100644 --- a/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp +++ b/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp @@ -314,21 +314,21 @@ private: mode=PARA; closeFooters(); paraName=rest; - paras[paraName] = ""; + paras[paraName].clear(); } else if (keyword=="header") { mode=HEADER; closeFooters(); paraName=rest; - headers[paraName] = ""; + headers[paraName].clear(); } else if (keyword=="footer") { mode=FOOTER; closeFooters(); paraName=rest; - footers[paraName] = ""; + footers[paraName].clear(); } else if (keyword=="file_header") { diff --git a/code/ryzom/tools/leveldesign/georges_dll/action.cpp b/code/ryzom/tools/leveldesign/georges_dll/action.cpp index 3bb3483a1..86eb13080 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/action.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/action.cpp @@ -616,7 +616,7 @@ bool CActionStringVector::doAction (CGeorgesEditDoc &doc, bool redo, bool &modif modified = true; } - catch (Exception &e) + catch (const Exception &e) { ok = false; char message[512]; diff --git a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp index 1acd105fd..38ed1ec9c 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp @@ -378,9 +378,9 @@ void CDfnEditListCtrl::getNewItemText (uint item, uint subItem, std::string &ret else if (subItem == 2) ret = theApp.DefaultType; else if (subItem == 3) - ret = ""; + ret.clear(); else if (subItem == 4) - ret = ""; + ret.clear(); } // *************************************************************************** diff --git a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h index 4dc4d1ddf..59dd044f8 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h @@ -86,9 +86,9 @@ public: virtual TItemEdit getItemEditMode (uint item, uint subItem) {return EditFixedCombo;} virtual void getComboBoxStrings (uint item, uint subItem, std::vector &retStrings); - virtual void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse) { regAdr = ""; browse = false; } + virtual void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse) { regAdr.clear(); browse = false; } virtual void getNewItemText (uint item, uint subItem, std::string &ret) { ret = "new"; } - virtual void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter) { defExt=""; defFilename=""; filter=""; defDir="";} + virtual void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter) { defExt.clear(); defFilename.clear(); filter.clear(); defDir.clear();} virtual void onItemChanged (uint item, uint subItem) {} void memComboBoxAsChange (bool selChange); diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index a770c8b8c..60a555797 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -864,12 +864,8 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) CGeorgesEditDoc *doc = View->GetDocument (); if (doc) { - // Build the filter string - char filter[512]; - smprintf (filter, 512, "Dfn Files (*.dfn)|*.dfn|All Files(*.*)|*.*|"); - // Open the dialog - CFileDialog dlgFile (TRUE, "*.dfn", "*.dfn", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, theApp.m_pMainWnd); + CFileDialog dlgFile (TRUE, _T("*.dfn"), _T("*.dfn"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Dfn Files (*.dfn)|*.dfn|All Files(*.*)|*.*|"), theApp.m_pMainWnd); if (dlgFile.DoModal () == IDOK) { combo->Combo.UpdateData (); @@ -1182,7 +1178,7 @@ void CFormDialog::getDfnName (string &result) const result = (*extension == '.') ? extension+1 : extension; } else - result = ""; + result.clear(); } // *************************************************************************** @@ -2350,7 +2346,7 @@ void CColorEdit::getValue (std::string &result) } else { - result = ""; + result.clear(); } } @@ -2807,7 +2803,7 @@ void CIconWidget::onOk () void CIconWidget::getValue (std::string &result) { - result = ""; + result.clear(); } // *************************************************************************** diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp index c1bffe96c..549c953e4 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp @@ -586,7 +586,7 @@ bool CGeorgesEditApp::loadCfg () if (superuser) Superuser = superuser->asInt () != 0; } - catch (Exception &) + catch (const Exception &) { char message[512]; smprintf (message, 512, "Can't load georges.cfg config file."); @@ -647,14 +647,14 @@ bool CGeorgesEditApp::saveCfg () { cf.save (); } - catch (Exception &) + catch (const Exception &) { char message[512]; smprintf (message, 512, "Can't save georges.cfg config file."); outputError (message); } } - catch (Exception &) + catch (const Exception &) { char message[512]; smprintf (message, 512, "Can't load georges.cfg config file."); @@ -1197,7 +1197,7 @@ bool CGeorgesEditApp::SerialIntoMemStream (const char *formName, CGeorgesEditDoc // Ok return true; } - catch (Exception &) + catch (const Exception &) { nlstop; } @@ -1454,7 +1454,7 @@ bool CGeorgesEditApp::SerialFromMemStream (const char *formName, CGeorgesEditDoc return true; } } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("Error while paste: %s", e.what()); } diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp index 035113bcd..7ecae14db 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp @@ -508,7 +508,7 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) return TRUE; } - catch (Exception &e) + catch (const Exception &e) { char message[512]; smprintf (message, 512, "Error while loading Type file: %s", e.what()); @@ -534,7 +534,7 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) return TRUE; } - catch (Exception &e) + catch (const Exception &e) { char message[512]; smprintf (message, 512, "Error while loading Type file: %s", e.what()); @@ -623,7 +623,7 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) return FALSE; } } - catch (Exception &e) + catch (const Exception &e) { char message[512]; smprintf (message, 512, "Error while loading Type file: %s", e.what()); @@ -815,7 +815,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName) } } - catch (Exception &e) + catch (const Exception &e) { char message[512]; smprintf (message, 512, "Error while loading file: %s", e.what()); diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp index 73fa3fcd9..0cc61ec26 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp @@ -454,7 +454,7 @@ BOOL CGeorgesImpl::PreTranslateMessage (MSG *pMsg) { ploader->SetTypPredef( _sxfilename, vsx ); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { std::string tmp = std::string(e.what()) + "(" + _sxfilename + ")"; theApp.m_pMainWnd->MessageBox(tmp.c_str(), "Georges_Lib", MB_ICONERROR | MB_OK); @@ -515,7 +515,7 @@ void CGeorgesImpl::MakeTyp( const std::string& filename, TType type, TUI ui, con // Write t.write (outputXml.getDocument ()); } - catch (Exception &e) + catch (const Exception &e) { nlwarning ("Error during writing file '%s' : ", filename.c_str (), e.what ()); } @@ -581,7 +581,7 @@ void CGeorgesImpl::LoadDocument( const std::string& _sxfullname ) { theApp.OpenDocumentFile(_sxfullname.c_str()); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")"; theApp.m_pMainWnd->MessageBox(tmp.c_str(), "Georges_Lib", MB_ICONERROR | MB_OK); diff --git a/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp b/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp index de9dcaad7..5a28d65e6 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp @@ -28,7 +28,7 @@ using namespace NLMISC; using namespace std; -string CIconWnd::IconPath = ""; +string CIconWnd::IconPath; CIconWnd::CIconWnd() diff --git a/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h b/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h index 97b667824..7fa525a6e 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h +++ b/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h @@ -128,7 +128,7 @@ public: * * \param dfnName is the name of the DFN. Can't be NULL. * \param pathName is the file name of the created document. Can be NULL. - * \return the document pointer or NULL if a problem occured. + * \return the document pointer or NULL if a problem occurred. */ virtual IEditDocument *createDocument (const char *dfnName, const char *pathName) = 0; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.cpp index decd2baca..2b0e9e351 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.cpp @@ -103,9 +103,9 @@ void CPageSimple::onDocChanged() if (!valid) { // This is not a valid simple sound... - _AudioFormat = ""; - _Filename = ""; - _Filesize = ""; + _AudioFormat.Empty(); + _Filename.Empty(); + _Filesize.Empty(); UpdateData(FALSE); } } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp index 292b008ed..dd76b9f9e 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp @@ -47,7 +47,7 @@ __declspec( dllexport ) IEditPlugin *IGeorgesEditGetInterface (int version, NLGE { return new CSoundPlugin(globalInterface); } - catch (std::exception &e) + catch (const std::exception &e) { string reason = e.what(); MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp index 5ef070cfe..e7c6b844c 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp @@ -86,7 +86,7 @@ CSoundPlugin::CSoundPlugin(IEdit *globalInterface) CLoadingDialog loadDlg; loadDlg.Create(IDD_DIALOG_LOADING); - loadDlg.Message = ""; + loadDlg.Message.Empty(); loadDlg.UpdateData(FALSE); loadDlg.ShowWindow(SW_SHOW); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp index 0bf9693cc..9cea31379 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp @@ -121,7 +121,7 @@ BOOL CMissionCompilerFeApp::InitInstance() mc.installCompiledMission(dlg.LigoConfig, fileName); nbMission += mc.getMissionsCount(); } - catch(EParseException e) + catch(const EParseException &e) { string msg; msg + "\r\n"; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp index d9097d4cf..1d7396ee0 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp @@ -479,7 +479,7 @@ void CMissionCompilerFeDlg::compile(BOOL publish) mc.publishFiles(ServerPathPrim[i], ServerPathText[i], LocalTextPath); } } - catch(EParseException e) + catch(const EParseException &e) { string msg; msg + "\r\n"; @@ -695,7 +695,7 @@ void CMissionCompilerFeDlg::OnSpecialRuncompilertest() system((string("\"C:\\Program Files\\Beyond Compare 2\\bc2.exe\" ")+string(tmp)+"/compiled_mission.script "+ReferenceScript).c_str()); } - catch(EParseException e) + catch(const EParseException &e) { string msg = "In primitive "; msg += buildPrimPath(e.Primitive) +" : "+e.Why; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp index 1c596e837..b4bb6d77c 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/main.cpp @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) ::fclose(fp); // TODO: set diff program in .cfg - std::string compareApp = ""; + std::string compareApp; std::string command = NLMISC::toString("%s %s/compiled_mission.script test_compilateur.script", compareApp.c_str(), tmp); sint error = system(command.c_str()); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index 09d9fc723..39354138d 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -278,7 +278,7 @@ bool GenderExtractor::parseMarkup(const std::string& literal, const std::string bool changed = false; std::string oldPhrase = literal; - newPhrase = ""; + newPhrase.clear(); do { std::string before; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h index bae7f8142..46e0cc575 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h @@ -54,12 +54,12 @@ inline void untagVar(std::string &var) if (!var.empty()) { if (var[0] != '$') - var = ""; + var.clear(); else { var = var.substr(1); if (var[var.size()-1] != '$') - var = ""; + var.clear(); else var = var.substr(0, var.size()-1); } diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index eed001ac7..15740d477 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -206,7 +206,7 @@ void InitCreatureMP() { code = ligneN.firstWord(); nom = ligneM.firstWord(); - ligneN = ""; + ligneN.clear(); } // save items to generate for each new creature name found @@ -1166,7 +1166,7 @@ void NewMP( CSString& ligne ) special = ligne; if ( !special.firstWord().empty() ) specialNames.insert( special ); - ligne = ""; + ligne.clear(); } else { diff --git a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h index 3048daaea..f80449a79 100644 --- a/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h +++ b/code/ryzom/tools/leveldesign/variable_parser/lua_helper.h @@ -80,7 +80,7 @@ public: virtual std::string luaWhat() const throw() {return NLMISC::toString("LUAError: %s", what());} }; -// A parse error occured +// A parse error occurred class ELuaParseError : public ELuaError { public: @@ -107,7 +107,7 @@ protected: std::string _Reason; }; -// A execution error occured +// A execution error occurred class ELuaExecuteError : public ELuaError { public: @@ -118,7 +118,7 @@ public: virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaExecuteError: %s", what());} }; -// A bad cast occured when using lua_checkcast +// A bad cast occurred when using lua_checkcast class ELuaBadCast : public ELuaError { public: diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/action.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/action.cpp index 0baa3deb2..b288f9f0c 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/action.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/action.cpp @@ -191,13 +191,13 @@ bool CActionLigoResize::redo () // By default data.PosX = 0; data.PosY = 0; - data.ZoneName = ""; + data.ZoneName.clear(); data.Rot = 0; data.Flip = 0; - data.SharingMatNames[0] = ""; - data.SharingMatNames[1] = ""; - data.SharingMatNames[2] = ""; - data.SharingMatNames[3] = ""; + data.SharingMatNames[0].clear(); + data.SharingMatNames[1].clear(); + data.SharingMatNames[2].clear(); + data.SharingMatNames[3].clear(); data.SharingCutEdges[0] = 0; data.SharingCutEdges[1] = 0; data.SharingCutEdges[2] = 0; @@ -520,7 +520,7 @@ bool CActionImportPrimitive::redo () return false; } } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading the file (%s) : (%s).", _Filename.c_str (), e.what ()); return false; @@ -610,7 +610,7 @@ bool CActionLoadPrimitive::redo () return false; } } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading the file (%s) : (%s).", _Filename.c_str (), e.what ()); return false; @@ -2488,7 +2488,7 @@ bool CActionAddLandscape::redo () result = false; } } - catch (Exception& e) + catch (const Exception& e) { getMainFrame ()->terminateLoadingDialog (); theApp.errorMessage ("Error reading file %s : %s", _Filename.c_str (), e.what ()); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp index 99d8bb881..ffdfe4d60 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp @@ -355,7 +355,7 @@ NLMISC::CBitmap *CDataBase::loadBitmap (const std::string &fileName) nlwarning ("Bitmap not found : %s", fileName.c_str()); } } - catch (Exception& e) + catch (const Exception& e) { pBitmap->makeDummy(); theApp.errorMessage ("Error while loading bitmap %s : %s", fileName.c_str(), e.what()); @@ -428,10 +428,10 @@ void CBuilderZone::calcMask() CBuilderZone::CBuilderZone (uint bitmapSize) : _DataBase (bitmapSize) { // Set Current Filter - _FilterType1 = STRING_UNUSED; _FilterValue1 = ""; - _FilterType2 = STRING_UNUSED; _FilterValue2 = ""; - _FilterType3 = STRING_UNUSED; _FilterValue3 = ""; - _FilterType4 = STRING_UNUSED; _FilterValue4 = ""; + _FilterType1 = STRING_UNUSED; + _FilterType2 = STRING_UNUSED; + _FilterType3 = STRING_UNUSED; + _FilterType4 = STRING_UNUSED; _FilterOperator2 = 0; _FilterOperator3 = 0; _FilterOperator4 = 0; @@ -450,7 +450,6 @@ CBuilderZone::CBuilderZone (uint bitmapSize) : _DataBase (bitmapSize) _ApplyCycleSelection = 0; _NotPropagate = false; _Force = false; - _LastPathName = ""; _ToolsZone = NULL; } @@ -1647,7 +1646,7 @@ string CBuilderZone::getZoneName (sint32 x, sint32 y) return sRet; } } - sRet = ""; + sRet.clear(); return sRet; } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp index e39994fc4..8fa0266e7 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp @@ -1121,7 +1121,7 @@ bool CDialogProperties::CWidget::toParameter (const CDatabaseLocatorPointer &loc // Get the value string value; /* todo hulud remove if (Default) - value = ""; + value.clear(); else*/ getValue (value); @@ -1150,7 +1150,7 @@ void CDialogProperties::CWidget::getValue (std::string &result) const else if (CheckBox.GetCheck() == 0) result = "false"; else - result = ""; + result.clear(); } else if (Parameter.Type == CPrimitiveClass::CParameter::ConstString) { @@ -1192,7 +1192,7 @@ void CDialogProperties::CWidget::getValue (std::vector &result) con if (*strP == '\n') { result.push_back (dst); - dst = ""; + dst.clear(); } else if (*strP != '\r') { @@ -1390,10 +1390,10 @@ void CDialogProperties::CWidget::getFilename (string &result) { CString cstr; ListEditBox.GetText (sel, cstr); - result = (const char*)cstr; + result = tStrToUtf8(cstr); } else - result = ""; + result.clear(); } else { @@ -1659,7 +1659,7 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam) std::vector result; widget->getValue (result); uint i; - string text = ""; + string text; for (i=0; iMultipleValues = false; string fromWhere; @@ -3225,7 +3225,7 @@ void CDialogProperties::setDefaultValue (CWidget *widget, string &value) } if (widget->FromWhere != fromWhere) { - widget->FromWhere = ""; + widget->FromWhere.clear(); } } else @@ -3287,7 +3287,7 @@ void CDialogProperties::setDefaultValue (CWidget *widget, std::vectorFromWhere != fromWhere) { - widget->FromWhere = ""; + widget->FromWhere.clear(); } } else @@ -3483,7 +3483,7 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg ) // Erase key buffer ? sint64 time = NLMISC::CTime::getLocalTime (); if (time - _LastStrokeTime > COMBO_STROKE_DELAI) - _LastString = ""; + _LastString.clear(); // Add this char _LastString.push_back (tolower((TCHAR) pMsg->wParam)); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp index 09763d27c..a1c1836a0 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp @@ -3875,7 +3875,7 @@ void CPrimTexture::buildFromFile(const std::string &filename) _Width = (uint) width; _Height = (uint) height; } - catch (NLMISC::EStream) + catch (const NLMISC::EStream &) { nlwarning("Couldn't retrieve size for %s", filename.c_str()); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/editor_primitive.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/editor_primitive.cpp index 896cd1aee..232d405c7 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/editor_primitive.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/editor_primitive.cpp @@ -925,7 +925,7 @@ NL3D::CTextureBlank *CPrimBitmap::getTexture () const theApp.errorMessage ("Can't read bitmap %s", filename.c_str ()); } } - catch (Exception &e) + catch (const Exception &e) { theApp.errorMessage ("Error reading bitmap %s : %s", filename.c_str (), e.what ()); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp index c15fbf4b9..87e5d553c 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp @@ -179,7 +179,7 @@ void CFindPrimitiveDlg::OnFindNext() // Init locator _Locator.getRoot (0); - PrimitiveName = ""; + PrimitiveName.Empty(); } UpdateData (FALSE); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp index 17fd397da..24096f690 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp @@ -812,7 +812,7 @@ void CMainFrame::displayStatusBarInfo () if (Selection.size()) sTmp = getDocument()->getPathOfSelectedPrimitive(); else - sTmp = ""; + sTmp.clear(); m_wndStatusBar.SetPaneText (6, sTmp.c_str()); } @@ -858,7 +858,7 @@ void CMainFrame::uninit () fileOut.serial(_Environnement); fileOut.close(); } - catch (Exception& e) + catch (const Exception& e) { MessageBox (e.what(), "Warning"); } @@ -1293,7 +1293,6 @@ struct CViewerConfig LandscapeTileNear = 50.0f; LandscapeThreshold = 0.001f; - HeightFieldName= ""; HeightFieldMaxZ= 100; HeightFieldOriginX= 16000; HeightFieldOriginY= -24000; @@ -1441,7 +1440,7 @@ struct CViewerConfig } } - catch (EConfigFile &e) + catch (const EConfigFile &e) { printf ("Problem in config file : %s\n", e.what ()); } @@ -4163,7 +4162,7 @@ bool CMainFrame::buildNLBitmapFromTGARsc(HRSRC bm, HMODULE hm, NLMISC::CBitmap & ms.seek(0, NLMISC::IStream::begin); tmpBitmap.load(ms); } - catch(EStream &) + catch(const EStream &) { return false; } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp index c71ed31f5..3a1b37d5c 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp @@ -231,8 +231,8 @@ void CNameDlg::updateAssignBox() } else { - m_assignGn = ""; - m_assignIg = ""; + m_assignGn.Empty(); + m_assignIg.Empty(); } checkNewGn(); @@ -282,7 +282,8 @@ void CNameDlg::OnBtnReset() m_botNames.Data.clear(); // clear assign box fields - m_assignGn = m_assignIg = ""; + m_assignGn.Empty(); + m_assignIg.Empty(); // load worksheets STRING_MANAGER::loadExcelSheet(m_dataDir + "bot_names.txt", m_botNames, true); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp index 3b6a2fe1f..9029f7dfd 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp @@ -168,7 +168,7 @@ BOOL CWorldEditorApp::InitInstance() // set the primitive context CPrimitiveContext::instance().CurrentLigoConfig = &Config; } - catch (Exception& e) + catch (const Exception& e) { ::MessageBox (NULL, e.what(), "Warning", MB_OK|MB_ICONEXCLAMATION); @@ -588,7 +588,7 @@ bool CWorldEditorApp::initPath (const char *filename, CSplashScreen &splashScree syntaxError (filename, root, "Wrong root node, should be NEL_WORLD_EDITOR_CONFIG"); } } - catch (Exception &e) + catch (const Exception &e) { errorMessage ("File read error (%s):%s", filename, e.what ()); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp index 6e9cd9d39..6153027cc 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp @@ -96,8 +96,8 @@ bool CWorldEditorDoc::newDocument () PropertiesDialogs.clear(); - _DataDir = ""; - _Context = ""; + _DataDir.clear(); + _Context.clear(); // Erase all editable root primitive CDatabaseList::iterator ite = _DataHierarchy.begin(); @@ -372,7 +372,7 @@ bool CWorldEditorDoc::loadDocument (const char *filename) } } } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -415,7 +415,7 @@ bool CWorldEditorDoc::loadDocument (const char *filename) } } } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -436,7 +436,7 @@ bool CWorldEditorDoc::loadDocument (const char *filename) clearModifications (); } } - catch (Exception &e) + catch (const Exception &e) { theApp.errorMessage ("Error reading file %s : %s", filename, e.what ()); @@ -578,7 +578,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName) _DataHierarchy[i].LastModifedTime = NLMISC::CFile::getFileModificationDate (_DataHierarchy[i].Filename); } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error writing file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -646,7 +646,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName) _DataHierarchy[i].LastModifedTime = NLMISC::CFile::getFileModificationDate (_DataHierarchy[i].Filename); } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error writing file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -720,7 +720,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName) // Last time file.close (); } - catch (Exception &e) + catch (const Exception &e) { theApp.errorMessage ("Error writing file %s : %s", lpszPathName, e.what ()); @@ -1423,7 +1423,7 @@ void CWorldEditorDoc::initPrimitiveParameters (const CPrimitiveClass &primClass, } else { - str->StringArray[i] = ""; + str->StringArray[i].clear(); } } primitive.addPropertyByName (parameter.Name.c_str (), str); @@ -1532,7 +1532,7 @@ const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocat if (primClass->Type == CPrimitiveClass::Bitmap) { // Create a dialog file - CFileDialogEx dialog (BASE_REGISTRY_KEY, "image", TRUE, primClass->FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, + CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, primClass->FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, (primClass->FileType+" (*."+primClass->FileExtension+")|*."+primClass->FileExtension+"|All Files (*.*)|*.*||").c_str (), getMainFrame ()); if (dialog.DoModal() == IDOK) { @@ -1674,7 +1674,7 @@ void CWorldEditorDoc::updateFiles () // Last time _DataHierarchy[i].LastModifedTime = NLMISC::CFile::getFileModificationDate (_DataHierarchy[i].Filename); } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -1710,7 +1710,7 @@ void CWorldEditorDoc::updateFiles () theApp.errorMessage ("Can't open file %s for reading.", _DataHierarchy[i].Filename.c_str ()); } } - catch (Exception& e) + catch (const Exception& e) { theApp.errorMessage ("Error reading file %s : %s", _DataHierarchy[i].Filename.c_str (), e.what ()); } @@ -2149,7 +2149,7 @@ bool CWorldEditorDoc::updateDefaultValuesInternal (NLLIGO::IPrimitive &primitive primitive.removePropertyByName (_class->Parameters[i].Name.c_str ()); // Set the value - result[j] = ""; + result[j].clear(); // Add the new property array primitive.addPropertyByName (_class->Parameters[i].Name.c_str (), new CPropertyStringArray (result)); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.h index f3f5d4b47..4d124eeab 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.h @@ -23,7 +23,6 @@ #include #include -#include #if _MSC_VER > 1000 #pragma once diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp index 048678b14..f21400421 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp @@ -209,7 +209,7 @@ void CGraphPlugin::refreshPrimitives() } AfxMessageBox(err.c_str()); } - catch (exception e) //catch a possible exception from getRootFileName + catch (const exception &e) //catch a possible exception from getRootFileName { AfxMessageBox(e.what()); } @@ -939,7 +939,7 @@ void CGraphPlugin::doSelection(const string& primPath) _PluginAccess->setCurrentSelection(resSet); - }catch(exception e){ + }catch(const exception &e){ GraphDlg->MessageBox(e.what()); } } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/world_editor_graph_plugin_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/world_editor_graph_plugin_dlg.cpp index f21ead4f5..0525edd5b 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/world_editor_graph_plugin_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/world_editor_graph_plugin_dlg.cpp @@ -582,7 +582,7 @@ void CWorldEditorGraphPluginDlg::OnLButtonDown(UINT nFlags, CPoint point) tok.top=atoi(strRes2.at(1).c_str()); tok.right=atoi(strRes3.at(0).c_str()); tok.bottom=atoi(strRes3.at(1).c_str()); - }catch (exception e) {return;} + }catch (const exception &e) {return;} diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/plugin.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/plugin.cpp index 14a076694..6765efff5 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/plugin.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/plugin.cpp @@ -675,7 +675,7 @@ void CPlugin::init(IPluginAccess *pluginAccess) } } - catch (Exception &e) + catch (const Exception &e) { errorMessage (e.what ()); } @@ -728,7 +728,7 @@ void CPlugin::connectDisconnect() CInetAddress addr(_SHost+":48888"); _Client->connect(addr); } - catch(ESocket &e) + catch(const ESocket &e) { errorMessage (e.what ()); return; @@ -777,7 +777,7 @@ void CPlugin::connectDisconnect() } updateConnectionState(); } - catch (Exception &e) + catch (const Exception &e) { errorMessage (e.what ()); delete _Client; @@ -1157,8 +1157,8 @@ void CPlugin::infoMessage (const char *format, ... ) void CPlugin::updateConnectionState() { _DialogFlag->UpdateData (); - _DialogFlag->Sent = ""; - _DialogFlag->Received = ""; + _DialogFlag->Sent.Empty(); + _DialogFlag->Received.Empty(); _DialogFlag->DownloadValue = (toString("%.1f kB/s", _DialogFlag->Download/1024.0)).c_str(); if (!_Client || !_Client->connected()) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp index 83c9ab58a..0d1e0cbe7 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp @@ -118,7 +118,7 @@ void CDialogFlags::init(CSoundPlugin *plugin) for (uint i =0; i(GetDlgItem(BG_FLAG_ID[i]))->SetCheck(flags.Flags[i] ? 1 : 0); - GetDlgItem(BG_FLAG_ID[i])->SetWindowText(_Mixer->getBackgroundFlagName(i).c_str()); + GetDlgItem(BG_FLAG_ID[i])->SetWindowText(utf8ToTStr(_Mixer->getBackgroundFlagName(i))); } @@ -127,14 +127,14 @@ void CDialogFlags::init(CSoundPlugin *plugin) col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; col.fmt = LVCFMT_LEFT; col.cx = 140; - col.pszText = "bank names"; - col.cchTextMax = sizeof("bank names"); + col.pszText = _T("bank names"); + col.cchTextMax = _tcslen(col.pszText)+1; _SbList.InsertColumn(0, &col); col.fmt = LVCFMT_RIGHT; col.cx = 50; - col.pszText = "size"; - col.cchTextMax = sizeof("size"); + col.pszText = _T("size"); + col.cchTextMax = _tcslen(col.pszText)+1; _SbList.InsertColumn(1, &col); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/sound_plugin.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/sound_plugin.cpp index 45e93d731..c92e90918 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/sound_plugin.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/sound_plugin.cpp @@ -195,7 +195,7 @@ void CSoundPlugin::ReInit() } catch(...) { - MessageBox(NULL, "Error while initializing audio mixer.\n", "ERROR", MB_ICONERROR); + MessageBox(NULL, _T("Error while initializing audio mixer.\n"), _T("ERROR"), MB_ICONERROR); exit(1); } diff --git a/code/ryzom/tools/pd_parser/parser.cpp b/code/ryzom/tools/pd_parser/parser.cpp index 4b5e9f5c1..e1c564c33 100644 --- a/code/ryzom/tools/pd_parser/parser.cpp +++ b/code/ryzom/tools/pd_parser/parser.cpp @@ -366,13 +366,13 @@ bool CDbNode::epilog() readyDb.init("ready"); readyDb.IsInline = false; - readyDb.Proto = ""; + readyDb.Proto.clear(); readyDb.Type = "bool"; readyDb.Description = "Tells if database engine is ready to work.\nEngine may not be ready because PDS is down, not yet ready\nor message queue to PDS is full."; updateDb.init("update"); updateDb.IsInline = false; - updateDb.Proto = ""; + updateDb.Proto.clear(); updateDb.Type = "void"; updateDb.Description = "Update the database engine.\nCall this method once per tick, only if engine is ready (see also ready() above)."; @@ -390,7 +390,7 @@ bool CDbNode::epilog() releaseDb.init("release"); releaseDb.IsInline = false; - releaseDb.Proto = ""; + releaseDb.Proto.clear(); releaseDb.Type = "void"; releaseDb.Description = "Release the whole database engine.\nCall this function at service release."; @@ -2350,7 +2350,7 @@ bool CClassNode::generateContent() UnregisterId.add(unregisterAttributesFunction + "();"); - oeid = ""; + oeid.clear(); if (useEntityId()) { oeid = ", "+getClassKey()->cppName(); diff --git a/code/ryzom/tools/pd_parser/templatizer.cpp b/code/ryzom/tools/pd_parser/templatizer.cpp index cb392ad27..21eb9d765 100644 --- a/code/ryzom/tools/pd_parser/templatizer.cpp +++ b/code/ryzom/tools/pd_parser/templatizer.cpp @@ -111,7 +111,7 @@ TTemplatizerToken getToken(CTemplatizerParser& t, bool skipspc, std::string* val TTemplatizerToken retToken = Identifier; if (value != NULL) - *value = ""; + value->clear(); do { while (isalpha(*t)) @@ -480,7 +480,7 @@ CTemplatizerParser ITemplatizerBloc::parseInternal(CTemplatizerParser ptr) */ CTemplatizerParser CTemplatizerTextBloc::parseInternal(CTemplatizerParser ptr) { - Text = ""; + Text.clear(); ptr = skipSpace(ptr); diff --git a/code/ryzom/tools/scripts/linux/utilities b/code/ryzom/tools/scripts/linux/utilities index f79792362..59c50a7a7 100755 --- a/code/ryzom/tools/scripts/linux/utilities +++ b/code/ryzom/tools/scripts/linux/utilities @@ -130,7 +130,7 @@ step() fi } -# call verify_steps() when you want to stop if error(s) occured in previous steps +# call verify_steps() when you want to stop if error(s) occurred in previous steps verify_steps() { if [ $STEPS_FAILURES -eq 0 ] diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index aacfe41f1..3b7d27a05 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -383,7 +383,7 @@ bool mergeStringDiff(vector &strings, const string &language, const nlassertex(diffInfo.Index2 < strings.size(), ("Index %u out of max Range %u", diffInfo.Index2, strings.size())); swap(strings[diffInfo.Index1], strings[diffInfo.Index2]); // remove the swap from the comments - diff[j].Comments = diff[j].Comments.substr(diff[j].Comments.find(nl)+2); + diff[j].Comments = diff[j].Comments.substr(diff[j].Comments.find(nl)+nl.length()); if (!diff[j].Comments.empty()) j--; break; @@ -3073,25 +3073,23 @@ int injectClause() vector::iterator first(phrases.begin()); vector::iterator last(phrases.end()); + for ( ; first != last; ++first) { - vector::iterator firstClause( first->Clauses.begin()); vector::iterator lastClause( first->Clauses.end()); for ( ; firstClause != lastClause; ++firstClause) { - uint64 hashValue = CI18N::makeHash(firstClause->Text); vector::iterator firstRefClause(clauses.begin()); vector::iterator lastRefClause(clauses.end()); for ( ; firstRefClause != lastRefClause ; ++firstRefClause) { - if (hashValue == firstRefClause->HashValue && firstClause->Text != firstRefClause->Text) + if (firstClause->Identifier == firstRefClause->Identifier && firstClause->Text != firstRefClause->Text) { firstClause->Text = firstRefClause->Text; firstClause->HashValue = CI18N::makeHash(firstClause->Text); firstRefClause->HashValue = firstClause->HashValue; - nlinfo("update clause %s from clause file %s.", firstClause->Identifier.c_str(), clausePath.c_str()); } } @@ -3107,7 +3105,6 @@ int injectClause() CI18N::writeTextFile(desDir + clausePath, str); } - return 0; } diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index efadd3949..e7e9c99c0 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -93,9 +93,9 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : try{ m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); } - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { - nlinfo( "Exception occured during Mission Compiler LIGO startup: %s", e.what() ); + nlinfo( "Exception occurred during Mission Compiler LIGO startup: %s", e.what() ); } NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; diff --git a/code/web/public_php/ams/js/jquery.js b/code/web/public_php/ams/js/jquery.js index 00c4e23a2..a4a29e87d 100644 --- a/code/web/public_php/ams/js/jquery.js +++ b/code/web/public_php/ams/js/jquery.js @@ -8097,7 +8097,7 @@ if ( jQuery.support.ajax ) { xml; // Firefox throws exceptions when accessing properties - // of an xhr when a network error occured + // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { diff --git a/code/web/public_php/ams/misc/elfinder-connector/elFinderVolumeMySQL.class.php b/code/web/public_php/ams/misc/elfinder-connector/elFinderVolumeMySQL.class.php index 52861155d..f6f3fef35 100644 --- a/code/web/public_php/ams/misc/elfinder-connector/elFinderVolumeMySQL.class.php +++ b/code/web/public_php/ams/misc/elfinder-connector/elFinderVolumeMySQL.class.php @@ -178,7 +178,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver { /** * Perform sql query and return result. - * Increase sqlCnt and save error if occured + * Increase sqlCnt and save error if occurred * * @param string $sql query * @return misc diff --git a/code/web/public_php/api/data/js/jquery-1.7.1.js b/code/web/public_php/api/data/js/jquery-1.7.1.js index 8ccd0ea78..49dbf5895 100644 --- a/code/web/public_php/api/data/js/jquery-1.7.1.js +++ b/code/web/public_php/api/data/js/jquery-1.7.1.js @@ -8111,7 +8111,7 @@ if ( jQuery.support.ajax ) { xml; // Firefox throws exceptions when accessing properties - // of an xhr when a network error occured + // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { diff --git a/code/web/public_php/webtt/cake/console/libs/tasks/plugin.php b/code/web/public_php/webtt/cake/console/libs/tasks/plugin.php index 94d9e261c..9a76eb212 100644 --- a/code/web/public_php/webtt/cake/console/libs/tasks/plugin.php +++ b/code/web/public_php/webtt/cake/console/libs/tasks/plugin.php @@ -108,7 +108,7 @@ class PluginTask extends Shell { } if (!$this->bake($plugin)) { - $this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . Inflector::underscore($pluginPath))); + $this->err(sprintf(__("An error occurred trying to bake: %s in %s", true), $plugin, $this->path . Inflector::underscore($pluginPath))); } } diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/controller/component.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/controller/component.test.php index 770aacc2c..a069a6571 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/controller/component.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/controller/component.test.php @@ -508,7 +508,7 @@ class ComponentTest extends CakeTestCase { $Controller->constructClasses(); $Controller->Component->initialize($Controller); $expected = array('setting' => array('itemx'), 'colour' => 'blood orange'); - $this->assertEqual($Controller->Orange->settings, $expected, 'Params duplication has occured %s'); + $this->assertEqual($Controller->Orange->settings, $expected, 'Params duplication has occurred %s'); } /** diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/controller/controller_merge_vars.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/controller/controller_merge_vars.test.php index b98aff1ff..4d4ef9773 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/controller/controller_merge_vars.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/controller/controller_merge_vars.test.php @@ -155,7 +155,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { $Controller->constructClasses(); $expected = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false)); - $this->assertEqual($Controller->components, $expected, 'Duplication of settings occured. %s'); + $this->assertEqual($Controller->components, $expected, 'Duplication of settings occurred. %s'); } /** @@ -182,7 +182,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { $Controller->constructClasses(); $expected = array('MergeVar' => array('format' => 'html', 'terse')); - $this->assertEqual($Controller->helpers, $expected, 'Duplication of settings occured. %s'); + $this->assertEqual($Controller->helpers, $expected, 'Duplication of settings occurred. %s'); } /** diff --git a/code/web/public_php/webtt/cake/tests/cases/libs/model/model_validation.test.php b/code/web/public_php/webtt/cake/tests/cases/libs/model/model_validation.test.php index d0b3fb648..6f42d6fec 100644 --- a/code/web/public_php/webtt/cake/tests/cases/libs/model/model_validation.test.php +++ b/code/web/public_php/webtt/cake/tests/cases/libs/model/model_validation.test.php @@ -574,7 +574,7 @@ class ModelValidationTest extends BaseModelTest { $Something->create(); $result = $Something->save($data); - $this->assertFalse($result, 'Save occured even when with models failed. %s'); + $this->assertFalse($result, 'Save occurred even when with models failed. %s'); $this->assertEqual($JoinThing->validationErrors, $expectedError); $count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id']))); $this->assertIdentical($count, 0); @@ -593,7 +593,7 @@ class ModelValidationTest extends BaseModelTest { ); $Something->create(); $result = $Something->save($data); - $this->assertFalse($result, 'Save occured even when with models failed. %s'); + $this->assertFalse($result, 'Save occurred even when with models failed. %s'); $joinRecords = $JoinThing->find('count', array( 'conditions' => array('JoinThing.something_id' => $data['Something']['id']) diff --git a/code/web/public_php/webtt/plugins/debug_kit/vendors/debug_kit_debugger.php b/code/web/public_php/webtt/plugins/debug_kit/vendors/debug_kit_debugger.php index 862ce627d..5ba573359 100644 --- a/code/web/public_php/webtt/plugins/debug_kit/vendors/debug_kit_debugger.php +++ b/code/web/public_php/webtt/plugins/debug_kit/vendors/debug_kit_debugger.php @@ -377,8 +377,8 @@ class DebugKitDebugger extends Debugger { * @param string $error Name of error * @param string $code Code of error * @param string $description Description of error - * @param string $file File error occured in - * @param string $line Line error occured on + * @param string $file File error occurred in + * @param string $line Line error occurred on * @param string $trace Stack trace at time of error * @param string $context context of error * @return void