CVSROOT: /cvsroot/wesnoth Module name: wesnoth Branch: Changes by: ott <[EMAIL PROTECTED]> 05/06/04 19:16:06
Modified files: src : about.cpp about.hpp actions.cpp actions.hpp ai.cpp ai.hpp ai_attack.cpp ai_interface.hpp ai_move.cpp animated.cpp animated.hpp array.hpp astarnode.cpp astarnode.hpp builder.cpp builder.hpp cavegen.cpp cavegen.hpp checksum.cpp checksum.hpp clipboard.cpp config.cpp config.hpp cursor.cpp dialogs.cpp dialogs.hpp display.cpp display.hpp events.cpp filechooser.cpp filesystem.cpp filesystem.hpp font.cpp font.hpp game.cpp game_config.cpp game_config.hpp game_errors.hpp game_events.cpp game_events.hpp gamestatus.cpp gamestatus.hpp halo.cpp help.cpp help.hpp hotkeys.cpp hotkeys.hpp image.cpp image.hpp intro.cpp intro.hpp key.cpp key.hpp language.cpp language.hpp leader_list.cpp leader_list.hpp map.cpp map.hpp mapgen.cpp mapgen_dialog.cpp mouse.cpp mouse.hpp multiplayer.cpp multiplayer.hpp multiplayer_connect.cpp multiplayer_connect.hpp multiplayer_create.cpp multiplayer_create.hpp multiplayer_lobby.cpp multiplayer_lobby.hpp multiplayer_ui.cpp multiplayer_ui.hpp multiplayer_wait.cpp multiplayer_wait.hpp network.cpp network.hpp network_worker.cpp pathfind.cpp pathfind.hpp pathutils.hpp playcampaign.cpp playcampaign.hpp playlevel.cpp playlevel.hpp playturn.cpp playturn.hpp preferences.cpp preferences.hpp race.cpp random.cpp random.hpp replay.cpp replay.hpp reports.cpp reports.hpp scoped_resource.hpp sdl_utils.cpp sdl_utils.hpp show_dialog.cpp show_dialog.hpp sound.cpp sound.hpp statistics.hpp team.cpp team.hpp terrain.cpp terrain.hpp theme.cpp theme.hpp thread.cpp thread.hpp titlescreen.cpp tooltips.cpp tstring.cpp tstring.hpp unit.cpp unit.hpp unit_display.cpp unit_types.cpp unit_types.hpp util.hpp variable.cpp variable.hpp video.cpp video.hpp wassert.cpp wassert.hpp src/campaign_server: campaign_server.cpp src/editor : editor.cpp editor.hpp editor_dialogs.cpp editor_dialogs.hpp editor_layout.cpp editor_layout.hpp editor_main.cpp editor_palettes.cpp editor_palettes.hpp editor_undo.cpp editor_undo.hpp map_manip.cpp map_manip.hpp src/serialization: binary_wml.cpp parser.cpp preprocessor.cpp string_utils.cpp string_utils.hpp tokenizer.cpp tokenizer.hpp src/server : game.cpp game.hpp input_stream.cpp server.cpp src/tools : cutter.cpp exploder.cpp exploder_composer.cpp exploder_cutter.cpp exploder_utils.cpp exploder_utils.hpp src/widgets : button.cpp button.hpp combo.cpp combo.hpp file_chooser.cpp file_chooser.hpp label.cpp label.hpp menu.cpp menu.hpp scrollbar.cpp scrollpane.cpp scrollpane.hpp slider.cpp slider.hpp textbox.cpp textbox.hpp widget.hpp src/zipios++ : xcoll.cpp xcoll.hpp doc/doxygen : doxygen.cpp Log message: ran codeclean against files CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.cpp.diff?tr1=1.129&tr2=1.130&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.hpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.227&tr2=1.228&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.hpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.153&tr2=1.154&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.hpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_attack.cpp.diff?tr1=1.62&tr2=1.63&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_interface.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_move.cpp.diff?tr1=1.61&tr2=1.62&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/animated.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/animated.hpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/array.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/astarnode.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/astarnode.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.cpp.diff?tr1=1.51&tr2=1.52&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.hpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cavegen.cpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cavegen.hpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/checksum.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/checksum.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/clipboard.cpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.138&tr2=1.139&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.61&tr2=1.62&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cursor.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.104&tr2=1.105&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.hpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.321&tr2=1.322&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.103&tr2=1.104&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/events.cpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filechooser.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.cpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.hpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.144&tr2=1.145&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.hpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.251&tr2=1.252&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.cpp.diff?tr1=1.98&tr2=1.99&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.hpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_errors.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.cpp.diff?tr1=1.148&tr2=1.149&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gamestatus.cpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gamestatus.hpp.diff?tr1=1.45&tr2=1.46&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/halo.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.105&tr2=1.106&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.hpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/hotkeys.cpp.diff?tr1=1.77&tr2=1.78&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/hotkeys.hpp.diff?tr1=1.60&tr2=1.61&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/image.cpp.diff?tr1=1.79&tr2=1.80&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/image.hpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.hpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/key.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/key.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/language.cpp.diff?tr1=1.91&tr2=1.92&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/language.hpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/leader_list.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/leader_list.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.cpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.hpp.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.64&tr2=1.65&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen_dialog.cpp.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mouse.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mouse.hpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.159&tr2=1.160&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.37&tr2=1.38&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.cpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.cpp.diff?tr1=1.63&tr2=1.64&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.hpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network_worker.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathfind.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathfind.hpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathutils.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playcampaign.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playcampaign.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playlevel.cpp.diff?tr1=1.207&tr2=1.208&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playlevel.hpp.diff?tr1=1.23&tr2=1.24&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.379&tr2=1.380&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.hpp.diff?tr1=1.68&tr2=1.69&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.159&tr2=1.160&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.hpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/race.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/random.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/random.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.112&tr2=1.113&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.hpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/scoped_resource.hpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.hpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.132&tr2=1.133&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.hpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sound.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sound.hpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/statistics.hpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.cpp.diff?tr1=1.89&tr2=1.90&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.hpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/terrain.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/terrain.hpp.diff?tr1=1.23&tr2=1.24&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.cpp.diff?tr1=1.37&tr2=1.38&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.hpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/thread.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/thread.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.42&tr2=1.43&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tooltips.cpp.diff?tr1=1.23&tr2=1.24&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tstring.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tstring.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.153&tr2=1.154&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.hpp.diff?tr1=1.69&tr2=1.70&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_display.cpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.103&tr2=1.104&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.hpp.diff?tr1=1.69&tr2=1.70&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/util.hpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/variable.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/variable.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/wassert.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/wassert.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/campaign_server/campaign_server.cpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.104&tr2=1.105&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.hpp.diff?tr1=1.42&tr2=1.43&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.cpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_layout.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_layout.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_main.cpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.hpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_undo.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_undo.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/map_manip.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/map_manip.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_wml.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/parser.cpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.cpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/string_utils.cpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/string_utils.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/tokenizer.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/tokenizer.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/game.cpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/game.hpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/input_stream.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/server.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/cutter.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_composer.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_cutter.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_utils.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_utils.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.hpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.cpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.94&tr2=1.95&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.hpp.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.hpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.cpp.diff?tr1=1.40&tr2=1.41&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.hpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.81&tr2=1.82&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.hpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.hpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/zipios++/xcoll.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/zipios++/xcoll.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/doc/doxygen/doxygen.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text Patches: Index: wesnoth/doc/doxygen/doxygen.cpp diff -u wesnoth/doc/doxygen/doxygen.cpp:1.2 wesnoth/doc/doxygen/doxygen.cpp:1.3 --- wesnoth/doc/doxygen/doxygen.cpp:1.2 Sun Mar 27 23:06:16 2005 +++ wesnoth/doc/doxygen/doxygen.cpp Sat Jun 4 19:16:06 2005 @@ -301,7 +301,7 @@ and fix the bug. If you wish to work on something else, you should probably explain on the -<a href="http://wesnoth.whitevine.net/forum/phpBB2/">forum</a> +<a href="http://www.wesnoth.org/forum/phpBB2/">forum</a> what you wish to do before doing any actual development. Do make sure you have read the projects <a href="http://wesnoth.slack.it/?CodingStandards">coding standards</a>. Index: wesnoth/src/about.cpp diff -u wesnoth/src/about.cpp:1.129 wesnoth/src/about.cpp:1.130 --- wesnoth/src/about.cpp:1.129 Sat Jun 4 11:16:32 2005 +++ wesnoth/src/about.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: about.cpp,v 1.129 2005/06/04 11:16:32 ettin Exp $ */ +/* $Id: about.cpp,v 1.130 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -168,7 +168,7 @@ "_" N_("+English (GB) Translation"), "- ott", - + "_" N_("+Estonian Translation"), "- Mart Tõnso", @@ -224,7 +224,7 @@ "- Federico Tomassetti", "- isazi", "- RokStar", - + "_" N_("+Japanese Translation"), "- Naoki Iimura", "- Nobuhito Okada", @@ -264,10 +264,10 @@ "_" N_("+Serbian Translation"), "- Srecko Toroman (FreeCraft)", - + "_" N_("+Slovak Translation"), "- Viliam Bur", - + "_" N_("+Slovenian Translation"), "- Jaka Kranjc (lynx)", @@ -284,11 +284,11 @@ "- Stefan Bergström (tephlon)", "- Susanna Björverud (sanna)", "- wint3r", - + "_" N_("+Turkish Translation"), "- İhsan Akın", "- Selim FarsakoÄlu", - + "_" N_("+Contributors"), "- Frédéric Wagner", Index: wesnoth/src/about.hpp diff -u wesnoth/src/about.hpp:1.15 wesnoth/src/about.hpp:1.16 --- wesnoth/src/about.hpp:1.15 Thu Mar 24 21:35:50 2005 +++ wesnoth/src/about.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: about.hpp,v 1.15 2005/03/24 21:35:50 ydirson Exp $ */ +/* $Id: about.hpp,v 1.16 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/actions.cpp diff -u wesnoth/src/actions.cpp:1.227 wesnoth/src/actions.cpp:1.228 --- wesnoth/src/actions.cpp:1.227 Sat Jun 4 07:14:46 2005 +++ wesnoth/src/actions.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: actions.cpp,v 1.227 2005/06/04 07:14:46 silene Exp $ */ +/* $Id: actions.cpp,v 1.228 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -72,15 +72,15 @@ // check_victory, but shouldn't be passed to that function as parameters, // since it is called from a variety of places. namespace victory_conditions -{ +{ bool when_enemies_defeated = true; - void set_victory_when_enemies_defeated(bool on) + void set_victory_when_enemies_defeated(bool on) { when_enemies_defeated = on; } - bool victory_when_enemies_defeated() + bool victory_when_enemies_defeated() { return when_enemies_defeated; } @@ -117,7 +117,7 @@ if(need_castle && map.on_board(recruit_location)) { castle_cost_calculator calc(map); - const paths::route& rt = a_star_search(u->first, recruit_location, 100.0, &calc, map.x(), map.y()); + const paths::route& rt = a_star_search(u->first, recruit_location, 100.0, &calc, map.x(), map.y()); if(rt.steps.empty() || units.find(recruit_location) != units.end() || !map.is_castle(recruit_location)) { recruit_location = gamemap::location(); @@ -175,7 +175,7 @@ ((*ran_results)["checksum"], 0); if((*ran_results)["checksum"].empty() || rc != cs.checksum()) { ERR_NW << "SYNC: In recruit " << new_unit.type().id() << - ": has checksum " << cs.checksum() << + ": has checksum " << cs.checksum() << " while datasource has checksum " << rc << "\n"; @@ -355,9 +355,9 @@ } static const std::string plague_string("plague"); - res.attacker_plague = !d->second.type().not_living() && - (res.attacker_special.substr(0,6) == plague_string) && - strcmp(d->second.type().undead_variation().c_str(),"null") && + res.attacker_plague = !d->second.type().not_living() && + (res.attacker_special.substr(0,6) == plague_string) && + strcmp(d->second.type().undead_variation().c_str(),"null") && !map.is_village(defender); if(res.attacker_special.size()>8){ //plague(type) used res.attacker_plague_type=res.attacker_special.substr(7,res.attacker_special.size()-8); @@ -426,7 +426,7 @@ const int base_damage = defend.damage(); const int resistance_modifier = a->second.damage_against(defend); - + if (strings) { std::stringstream str_base; str_base << _("base damage") << COLUMN_SEPARATOR << base_damage; @@ -504,7 +504,7 @@ res.amount_defender_drains = 0; } - res.defender_plague = !a->second.type().not_living() && + res.defender_plague = !a->second.type().not_living() && (res.defender_special.substr(0,6) == plague_string) && strcmp(a->second.type().undead_variation().c_str(),"null") && !map.is_village(attacker); @@ -555,7 +555,7 @@ int leader_bonus = 0; if (under_leadership(units,attacker,&leader_bonus).valid()) { bonus += leader_bonus; - + if (strings) { std::stringstream str; str << _("leadership") << EMPTY_COLUMN << '+' << leader_bonus << '%'; @@ -672,7 +672,7 @@ return s.str(); } -void attack(display& gui, const gamemap& map, +void attack(display& gui, const gamemap& map, std::vector<team>& teams, gamemap::location attacker, gamemap::location defender, @@ -825,15 +825,15 @@ //plague units make new units on the target hex if(stats.attacker_plague) { - a = units.find(attacker_loc); + a = units.find(attacker_loc); game_data::unit_type_map::const_iterator reanimitor; LOG_NG<<"trying to reanimate "<<stats.attacker_plague_type<<std::endl; reanimitor = info.unit_types.find(stats.attacker_plague_type); LOG_NG<<"found unit type:"<<reanimitor->second.id()<<std::endl; - + if(reanimitor != info.unit_types.end()) { unit newunit=unit(&reanimitor->second,a->second.side(),true,true); - //apply variation + //apply variation if(strcmp(undead_variation.c_str(),"null")){ config mod; config& variation=mod.add_child("effect"); @@ -965,7 +965,7 @@ d->second.heal(stats.amount_defender_drains); } } - + if(dies) {//defender kills attacker defenderxp = game_config::kill_experience*a->second.type().level(); if(a->second.type().level() == 0) @@ -991,12 +991,12 @@ //plague units make new units on the target hex. if(stats.defender_plague) { - d = units.find(defender_loc); + d = units.find(defender_loc); game_data::unit_type_map::const_iterator reanimitor; LOG_NG<<"trying to reanimate "<<stats.defender_plague_type<<std::endl; reanimitor = info.unit_types.find(stats.defender_plague_type); LOG_NG<<"found unit type:"<<reanimitor->second.id()<<std::endl; - + if(reanimitor != info.unit_types.end()) { unit newunit=unit(&reanimitor->second,d->second.side(),true,true); //apply variation @@ -1296,7 +1296,7 @@ for(i = units.begin(); i != units.end(); ++i) { if(i->second.side() == side) { - if(i->second.hitpoints() < i->second.max_hitpoints() || + if(i->second.hitpoints() < i->second.max_hitpoints() || i->second.poisoned()){ if(i->second.is_resting()) { const std::map<gamemap::location,int>::iterator u = @@ -1347,7 +1347,7 @@ if(halo_image.empty() || preferences::show_haloes()) { healer.set_healing(true); - if(halo_image.empty() == false) { + if(halo_image.empty() == false) { int height_adjust = healer.is_flying() ? 0 : int(map.get_terrain_info(map.get_terrain(i->second)). unit_height_adjust() * disp.zoom()); @@ -1394,7 +1394,7 @@ if(h->second <= 0) continue; } - + if(h->second < 0) { if(show_healing) { sound::play_sound("groan.wav"); @@ -1455,7 +1455,7 @@ disp.draw_tile(i->second.x,i->second.y); } - + disp.draw_tile(loc.x,loc.y); disp.update_display(); } @@ -1627,7 +1627,7 @@ //returns true iff some shroud is cleared //seen_units will return new units that have been seen by this unit //if known_units is NULL, seen_units can be NULL and will not be changed -bool clear_shroud_unit(const gamemap& map, +bool clear_shroud_unit(const gamemap& map, const gamestatus& status, const game_data& gamedata, const unit_map& units, const gamemap::location& loc, @@ -1676,7 +1676,7 @@ } void recalculate_fog(const gamemap& map, const gamestatus& status, - const game_data& gamedata, const unit_map& units, + const game_data& gamedata, const unit_map& units, std::vector<team>& teams, int team) { teams[team].refog(); @@ -1694,7 +1694,7 @@ } } -bool clear_shroud(display& disp, const gamestatus& status, +bool clear_shroud(display& disp, const gamestatus& status, const gamemap& map, const game_data& gamedata, const unit_map& units, std::vector<team>& teams, int team) { @@ -1723,7 +1723,7 @@ return result; } -size_t move_unit(display* disp, const game_data& gamedata, +size_t move_unit(display* disp, const game_data& gamedata, const gamestatus& status, const gamemap& map, unit_map& units, std::vector<team>& teams, std::vector<gamemap::location> route, @@ -1750,7 +1750,7 @@ team& team = teams[team_num]; const bool check_shroud = should_clear_shroud && team.auto_shroud_updates() && (team.uses_shroud() || team.uses_fog()); - + //if we use shroud/fog of war, count out the units we can currently see std::set<gamemap::location> known_units; if(check_shroud) { @@ -1772,7 +1772,7 @@ const gamemap::TERRAIN terrain = map[step->x][step->y]; const unit_map::const_iterator enemy_unit = units.find(*step); - + const int mv = u.movement_cost(map,terrain); if(discovered_unit || continue_move == false && seen_units.empty() == false || mv > moves_left || enemy_unit != units.end() && team.is_enemy(enemy_unit->second.side())) { @@ -1855,7 +1855,7 @@ } else { u.set_interrupted_move(gamemap::location()); } - + if(steps.size() < 2) { return 0; } @@ -1968,7 +1968,7 @@ std::stringstream msg; msg << gettext(msg_id); - + if(steps.size() < route.size()) { //see if the "Continue Move" action has an associated hotkey const hotkey::hotkey_item& hk = hotkey::get_hotkey(hotkey::HOTKEY_CONTINUE_MOVE); @@ -1998,7 +1998,7 @@ { const unit_map::const_iterator u_it = units.find(loc); wassert(u_it != units.end()); - + const unit& u = u_it->second; const team& current_team = teams[u.side()-1]; @@ -2021,7 +2021,7 @@ return true; } } - + if(u.movement_cost(map,map[locs[n].x][locs[n].y]) <= u.movement_left()) { return true; } @@ -2051,7 +2051,7 @@ //we're not really going to mutate the unit, just temporarily //set its moves to maximum, but then switch them back const unit_movement_resetter move_resetter(const_cast<unit&>(un->affected_unit)); - + std::vector<gamemap::location>::const_iterator step; for(step = un->route.begin(); step != un->route.end(); ++step) { //we have to swap out any unit that is already in the hex, so we can put our Index: wesnoth/src/actions.hpp diff -u wesnoth/src/actions.hpp:1.50 wesnoth/src/actions.hpp:1.51 --- wesnoth/src/actions.hpp:1.50 Tue Mar 29 17:41:09 2005 +++ wesnoth/src/actions.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: actions.hpp,v 1.50 2005/03/29 17:41:09 darthfool Exp $ */ +/* $Id: actions.hpp,v 1.51 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -187,8 +187,8 @@ //steps. If the unit cannot make it completely along the path this turn, //a goto order will be set. If move_recorder is not NULL, the move will //be recorded in it. If undos is not NULL, undo information will be added. -size_t move_unit(display* disp, const game_data& gamedata, - const gamestatus& status, const gamemap& map, +size_t move_unit(display* disp, const game_data& gamedata, + const gamestatus& status, const gamemap& map, unit_map& units, std::vector<team>& teams, std::vector<gamemap::location> steps, replay* move_recorder, undo_list* undos, @@ -217,7 +217,7 @@ const gamemap& map, const std::vector<team>& teams); -namespace victory_conditions { +namespace victory_conditions { void set_victory_when_enemies_defeated(bool on); bool victory_when_enemies_defeated(); } Index: wesnoth/src/ai.cpp diff -u wesnoth/src/ai.cpp:1.153 wesnoth/src/ai.cpp:1.154 --- wesnoth/src/ai.cpp:1.153 Thu Jun 2 20:50:26 2005 +++ wesnoth/src/ai.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: ai.cpp,v 1.153 2005/06/02 20:50:26 isaaccp Exp $ */ +/* $Id: ai.cpp,v 1.154 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -105,7 +105,7 @@ int choose_weapon(const location& attacker, const location& defender) { const unit_map::const_iterator att = get_info().units.find(attacker); wassert(att != get_info().units.end()); - + const std::vector<attack_type>& attacks = att->second.attacks(); int best_attack_rating = -1; @@ -214,7 +214,7 @@ user_interact(); const int min_gold = 0; - + log_scope2(ai, "recruiting troops"); LOG_AI << "recruiting " << usage << "\n"; @@ -303,7 +303,7 @@ return true; } else { const team_data data = calculate_team_data(current_team(),info_.team_num,info_.units); - LOG_AI << + LOG_AI << "recruit UNconfirmed: team=" << (info_.team_num) << " units=" << data.units << " gold=" << data.gold << @@ -530,7 +530,7 @@ const paths unit_paths(map_,state_,gameinfo_,units_,via,teams_,false,false); LOG_AI << "found " << unit_paths.routes.size() << " moves for temp leader\n"; - + //see if this leader could make it back to the keep if(unit_paths.routes.count(to) != 0) { LOG_AI << "can make it back to the keep\n"; @@ -609,7 +609,7 @@ return true; } } - + return false; } @@ -637,7 +637,7 @@ } //we can't see where invisible enemy units might move - if(enemy && un_it->second.invisible(info_.map.underlying_terrain(info_.map.get_terrain(un_it->first)), + if(enemy && un_it->second.invisible(info_.map.underlying_terrain(info_.map.get_terrain(un_it->first)), info_.state.get_time_of_day().lawful_bonus,un_it->first,info_.units,info_.teams)) { continue; } @@ -1059,7 +1059,7 @@ if(owned && !current_team().is_enemy(n+1)) { want_village = false; } - + if(owned) { break; } @@ -1179,7 +1179,7 @@ LOG_AI << "chose village " << dst << '\n'; } } - + ++it.first; } @@ -1358,7 +1358,7 @@ } } } - + const location arrived_at = move_unit(move.first,move.second,possible_moves); @@ -1373,7 +1373,7 @@ //if we're going to attack someone if(u_it != units_.end() && u_it->second.stone() == false && weapon != -1) { - attack_enemy(move.second,target,weapon); + attack_enemy(move.second,target,weapon); } //don't allow any other units to move onto the tile our unit @@ -1536,7 +1536,7 @@ LOG_AI << "targets: " << targets.size() << "\n"; std::map<std::string,int> best_scores; - + for(std::set<std::string>::const_iterator i = recruits.begin(); i != recruits.end(); ++i) { const game_data::unit_type_map::const_iterator info = gameinfo_.unit_types.find(*i); if(info == gameinfo_.unit_types.end()) { @@ -1702,7 +1702,7 @@ } LOG_AI << "Doing recruitment before goals\n"; - + do_recruitment(); shortest_path_calculator calc(leader->second, current_team(), units_, teams_, map_, state_); @@ -1716,7 +1716,7 @@ std::map<gamemap::location,paths> possible_moves; possible_moves.insert(std::pair<gamemap::location,paths>(leader->first,leader_paths)); - + gamemap::location loc; for(std::vector<gamemap::location>::const_iterator itor = route.steps.begin(); itor != route.steps.end(); ++itor) { if(leader_paths.routes.count(*itor) == 1 && power_projection(*itor,enemy_srcdst,enemy_dstsrc) < double(leader->second.hitpoints()/2)) { @@ -1799,7 +1799,7 @@ //which we might be able to reach in two turns. if(map_.is_village(i->first) && current_team().owns_village(i->first) && int(distance_between(i->first,leader->first)) <= leader->second.total_movement()*2) { - + int current_distance = distance_between(i->first,leader->first); location current_loc; @@ -1885,7 +1885,7 @@ //find where the leader can move const paths leader_paths(map_,state_,gameinfo_,units_,leader->first,teams_,false,false); - + return leader_paths.routes.count(start_pos) > 0; } Index: wesnoth/src/ai.hpp diff -u wesnoth/src/ai.hpp:1.57 wesnoth/src/ai.hpp:1.58 --- wesnoth/src/ai.hpp:1.57 Sun Nov 28 10:29:30 2004 +++ wesnoth/src/ai.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: ai.hpp,v 1.57 2004/11/28 10:29:30 silene Exp $ */ +/* $Id: ai.hpp,v 1.58 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/ai_attack.cpp diff -u wesnoth/src/ai_attack.cpp:1.62 wesnoth/src/ai_attack.cpp:1.63 --- wesnoth/src/ai_attack.cpp:1.62 Mon May 2 19:42:04 2005 +++ wesnoth/src/ai_attack.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: ai_attack.cpp,v 1.62 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: ai_attack.cpp,v 1.63 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -172,7 +172,7 @@ best_vulnerability = vulnerability/surround_bonus; best_support = support*surround_bonus; } - + if(cur_position != -1) { units.erase(units.begin() + i); @@ -280,7 +280,7 @@ const unit_map::const_iterator d_itor = units_.find(def); int d_hitpoints = d_itor->second.hitpoints(); int a_hitpoints = itor->second.hitpoints(); - + for(size_t a = 0; a != attacks.size(); ++a) { const battle_stats stats = evaluate_battle_stats(map_, att, def, a, units_, state_, terrain); @@ -479,7 +479,7 @@ } else if(atthp == 0) { avg_losses += cost; } - + //if the attacker moved onto a village, reward it for doing so else if(on_village) { atthp += game_config::cure_amount*2; //double reward to emphasize getting onto villages @@ -572,7 +572,7 @@ if(uses_leader && ai_obj.leader_can_reach_keep() && ai_obj.current_team().gold() > 20) { value -= double(ai_obj.current_team().gold())*0.5; } - + //prefer to attack already damaged targets value += ((target_starting_damage/3 + avg_damage_inflicted) - (1.0-aggression)*avg_damage_taken)/10.0; @@ -630,7 +630,7 @@ //attack anyone who is on the enemy side, and who is not invisible or turned to stone if(current_team().is_enemy(j->second.side()) && j->second.stone() == false && - j->second.invisible(map_.underlying_terrain(map_[j->first.x][j->first.y]), + j->second.invisible(map_.underlying_terrain(map_[j->first.x][j->first.y]), state_.get_time_of_day().lawful_bonus,j->first, units_,teams_) == false) { location adjacent[6]; @@ -678,7 +678,7 @@ typedef move_map::const_iterator Itor; typedef std::pair<Itor,Itor> Range; Range its = dstsrc.equal_range(locs[i]); - + gamemap::location* const beg_used = used_locs; gamemap::location* end_used = used_locs + num_used_locs; @@ -706,7 +706,7 @@ } else if(un.type().alignment() == unit_type::CHAOTIC) { tod_modifier = -lawful_bonus; } - + const double hp = double(un.hitpoints())/ double(un.max_hitpoints()); int most_damage = 0; Index: wesnoth/src/ai_interface.hpp diff -u wesnoth/src/ai_interface.hpp:1.4 wesnoth/src/ai_interface.hpp:1.5 --- wesnoth/src/ai_interface.hpp:1.4 Wed Mar 9 21:21:37 2005 +++ wesnoth/src/ai_interface.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: ai_interface.hpp,v 1.4 2005/03/09 21:21:37 ydirson Exp $ */ +/* $Id: ai_interface.hpp,v 1.5 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/ai_move.cpp diff -u wesnoth/src/ai_move.cpp:1.61 wesnoth/src/ai_move.cpp:1.62 --- wesnoth/src/ai_move.cpp:1.61 Mon May 2 19:42:04 2005 +++ wesnoth/src/ai_move.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: ai_move.cpp,v 1.61 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: ai_move.cpp,v 1.62 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -28,7 +28,7 @@ { move_cost_calculator(const unit& u, const gamemap& map, const game_data& data, - const unit_map& units, + const unit_map& units, const gamemap::location& loc, const ai::move_map& dstsrc, const ai::move_map& enemy_dstsrc) @@ -502,13 +502,13 @@ u->second.movement_left() <= 0 || u->second.is_guardian() || u->second.incapacitated()) { continue; } - + user_interact(); - + const move_cost_calculator calc(u->second, map_, gameinfo_, units_, u->first, dstsrc, enemy_dstsrc); const double locStopValue = minimum(best_target->value / best_rating, 100.0); paths::route cur_route = a_star_search(u->first, best_target->loc, locStopValue, &calc, map_.x(), map_.y()); - + if (cur_route.move_left < locStopValue) { // if this unit can move to that location this turn, it has a very very low cost @@ -521,7 +521,7 @@ ++locRange.first; } } - + double rating = best_target->value/maximum<int>(1,cur_route.move_left); //for 'support' targets, they are rated much higher if we can get there within two turns, @@ -585,7 +585,7 @@ const int distance = distance_between(*i,best_target->loc); const int defense = best->second.defense_modifier(map_,map_.get_terrain(*i)); const double vulnerability = power_projection(*i,enemy_srcdst,enemy_dstsrc); - + if(best_loc.valid() == false || defense < best_defense || defense == best_defense && vulnerability < best_vulnerability) { best_loc = *i; best_defense = defense; @@ -617,7 +617,7 @@ //target is dangerous, and whether we need to group some units to move in unison toward the target //if any point along the path is too dangerous for our single unit, then we hold back for(std::vector<location>::const_iterator i = best_route.steps.begin(); i != best_route.steps.end() && movement > 0; ++i) { - + const double threat = power_projection(*i,enemy_srcdst,enemy_dstsrc); if(threat >= double(best->second.hitpoints()) && threat > power_projection(*i,fullmove_srcdst,fullmove_dstsrc) || i >= best_route.steps.end()-2 && unit_at_target != units_.end() && current_team().is_enemy(unit_at_target->second.side())) { @@ -695,7 +695,7 @@ targets.push_back(target(*j,value*4.0,target::MASS)); } } - + return std::pair<location,location>(loc,best_loc); } } @@ -731,7 +731,7 @@ } LOG_AI << "Moving to " << its.first->first.x + 1 << "," << its.first->first.y + 1 << "\n"; - + return std::pair<location,location>(its.first->second,its.first->first); } else { LOG_AI << "dangerous!\n"; Index: wesnoth/src/animated.cpp diff -u wesnoth/src/animated.cpp:1.3 wesnoth/src/animated.cpp:1.4 --- wesnoth/src/animated.cpp:1.3 Sun Feb 27 18:15:20 2005 +++ wesnoth/src/animated.cpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: animated.cpp,v 1.3 2005/02/27 18:15:20 ydirson Exp $ */ +/* $Id: animated.cpp,v 1.4 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> @@ -25,7 +25,7 @@ const T animated<T,T_void_value>::void_value_ = T_void_value()(); template<typename T, typename T_void_value> -animated<T,T_void_value>::animated() : +animated<T,T_void_value>::animated() : starting_frame_time_(INT_MAX), ending_frame_time_(INT_MIN), started_(false), @@ -37,7 +37,7 @@ {} template<typename T, typename T_void_value> -animated<T,T_void_value>::animated(const std::string &cfg, const string_initializer& init): +animated<T,T_void_value>::animated(const std::string &cfg, const string_initializer& init): starting_frame_time_(INT_MAX), started_(false), no_current_frame_(true), @@ -67,7 +67,7 @@ frames_.push_back(frame(current_time, init(str))); current_time += time; } - + starting_frame_time_ = 0; ending_frame_time_ = current_time; } @@ -115,11 +115,11 @@ // std::cerr << "--- updating frame ---\n"; if(does_not_change_) return; - + frame_changed_ = false; // Always update current_time_, for the animation_time functions to work. current_time_ = SDL_GetTicks() * acceleration_; - if(!started_) + if(!started_) return; if(frames_.empty()) { Index: wesnoth/src/animated.hpp diff -u wesnoth/src/animated.hpp:1.6 wesnoth/src/animated.hpp:1.7 --- wesnoth/src/animated.hpp:1.6 Mon Feb 21 09:05:51 2005 +++ wesnoth/src/animated.hpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: animated.hpp,v 1.6 2005/02/21 09:05:51 silene Exp $ */ +/* $Id: animated.hpp,v 1.7 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -31,7 +31,7 @@ class string_initializer { public: - virtual T operator()(const std::string& s) const { return T(s); } + virtual T operator()(const std::string& s) const { return T(s); } }; animated(); @@ -67,7 +67,7 @@ int get_animation_time() const; int get_frame_time() const; const T& get_current_frame() const; - + private: struct frame { Index: wesnoth/src/array.hpp diff -u wesnoth/src/array.hpp:1.2 wesnoth/src/array.hpp:1.3 --- wesnoth/src/array.hpp:1.2 Sat Jul 10 18:45:18 2004 +++ wesnoth/src/array.hpp Sat Jun 4 19:16:05 2005 @@ -44,7 +44,7 @@ T* data() { return a; } const T* data() const { return a; } - + private: T a[N]; }; Index: wesnoth/src/astarnode.cpp diff -u wesnoth/src/astarnode.cpp:1.2 wesnoth/src/astarnode.cpp:1.3 --- wesnoth/src/astarnode.cpp:1.2 Fri Jan 21 23:17:15 2005 +++ wesnoth/src/astarnode.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: astarnode.cpp,v 1.2 2005/01/21 23:17:15 Sirp Exp $ */ +/* $Id: astarnode.cpp,v 1.3 2005/06/04 19:16:05 ott Exp $ */ /* -Copyright (C) 2003 by David White <[EMAIL PROTECTED]> -Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net +Copyright (C) 2003 by David White <[EMAIL PROTECTED]> +Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -20,7 +20,7 @@ void a_star_node::initNode(const gamemap::location& pos, const gamemap::location& dst, double cost, a_star_node* parent, const std::set<gamemap::location>* teleports) -{ +{ isInCloseList = false; loc = pos; nodeParent = parent; @@ -43,17 +43,17 @@ if(srch + dsth + 1.0 < h) { h = srch + dsth + 1.0; } - } + } } poss_a_star_node::poss_a_star_node(void) : capacity(0), curIndex(0) { - nbElemByPage = size_t((4096 - 24) / sizeof(a_star_node)); + nbElemByPage = size_t((4096 - 24) / sizeof(a_star_node)); wassert(nbElemByPage > 0); - addPage(); - SingletonPOSS_AStarNode = this; -} + addPage(); + SingletonPOSS_AStarNode = this; +} void poss_a_star_node::addPage(void) { @@ -62,7 +62,7 @@ locPageAStarNode = new a_star_node[nbElemByPage]; vectPageAStarNode.push_back(locPageAStarNode); capacity += nbElemByPage; -} +} a_star_node* poss_a_star_node::getAStarNode(void) { @@ -71,16 +71,16 @@ wassert(curIndex <= capacity); //--------------------------------------------------- a_star_node* locPageAStarNode; - + if (curIndex == capacity) addPage(); - const size_t locIndexPage = curIndex / nbElemByPage; - const size_t locIndexInsidePage = curIndex % nbElemByPage; + const size_t locIndexPage = curIndex / nbElemByPage; + const size_t locIndexInsidePage = curIndex % nbElemByPage; ++curIndex; assertParanoAstar(locIndexPage < vectPageAStarNode.size()); - locPageAStarNode = vectPageAStarNode[locIndexPage]; + locPageAStarNode = vectPageAStarNode[locIndexPage]; assertParanoAstar(locIndexInsidePage < nbElemByPage); return (&(locPageAStarNode[locIndexInsidePage])); } @@ -93,13 +93,13 @@ delete[] (*iter); vectPageAStarNode.resize(1); capacity = nbElemByPage; - } - curIndex = 0; + } + curIndex = 0; //----------------- POST_CONDITIONS ----------------- wassert(capacity == nbElemByPage); wassert(vectPageAStarNode.size() == 1); //--------------------------------------------------- -} +} void a_star_world::resize_IFN(const size_t parWidth, const size_t parHeight) { @@ -121,23 +121,23 @@ a_star_node* locNode = NULL; std::fill(_vectAStarNode.begin(), _vectAStarNode.end(), locNode); _nbNode = 0; - } + } } bool a_star_world::empty(void) -{ +{ return (_nbNode == 0); } bool a_star_world::reallyEmpty(void) -{ - for (vect_a_star_node::iterator iter = _vectAStarNode.begin(); iter != _vectAStarNode.end(); ++iter) +{ + for (vect_a_star_node::iterator iter = _vectAStarNode.begin(); iter != _vectAStarNode.end(); ++iter) { if (*iter != NULL) return (false); } return (true); -} +} void a_star_world::erase(gamemap::location const &loc) { @@ -149,7 +149,7 @@ } a_star_node* a_star_world::getNodeFromLocation(gamemap::location const &loc, bool& isCreated) -{ +{ //----------------- PRE_CONDITIONS ------------------ wassert(loc.valid()); //--------------------------------------------------- @@ -164,7 +164,7 @@ isCreated = true; wassert(SingletonPOSS_AStarNode != NULL); node = SingletonPOSS_AStarNode->getAStarNode(); - _vectAStarNode[index] = node; + _vectAStarNode[index] = node; ++_nbNode; } else Index: wesnoth/src/astarnode.hpp diff -u wesnoth/src/astarnode.hpp:1.2 wesnoth/src/astarnode.hpp:1.3 --- wesnoth/src/astarnode.hpp:1.2 Fri Jan 21 21:21:45 2005 +++ wesnoth/src/astarnode.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: astarnode.hpp,v 1.2 2005/01/21 21:21:45 silene Exp $ */ +/* $Id: astarnode.hpp,v 1.3 2005/06/04 19:16:05 ott Exp $ */ /* -Copyright (C) 2003 by David White <[EMAIL PROTECTED]> -Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net +Copyright (C) 2003 by David White <[EMAIL PROTECTED]> +Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -29,16 +29,16 @@ struct a_star_node { public: - double g, h; // g: already traveled time, h: estimated time still to travel + double g, h; // g: already traveled time, h: estimated time still to travel gamemap::location loc; a_star_node* nodeParent; bool isInCloseList; - + void initNode( const gamemap::location& pos, const gamemap::location& dst, double cost, a_star_node* parent, - const std::set<gamemap::location>* teleports); + const std::set<gamemap::location>* teleports); - inline double heuristic(const gamemap::location& src, const gamemap::location& dst) + inline double heuristic(const gamemap::location& src, const gamemap::location& dst) { return distance_between(src, dst); } @@ -58,7 +58,7 @@ poss_a_star_node(void); void addPage(void); a_star_node* getAStarNode(void); - void reduce(void); + void reduce(void); }; class a_star_world @@ -66,7 +66,7 @@ protected: typedef std::vector<a_star_node*> vect_a_star_node; - vect_a_star_node _vectAStarNode; + vect_a_star_node _vectAStarNode; size_t _width; public: @@ -75,10 +75,10 @@ void resize_IFN(const size_t parWidth, const size_t parHeight); void clear(void); void erase(gamemap::location const &loc); - a_star_node* getNodeFromLocation(gamemap::location const &loc, bool& isCreated); + a_star_node* getNodeFromLocation(gamemap::location const &loc, bool& isCreated); bool empty(void); bool reallyEmpty(void); - a_star_world(void) : _width(0), _nbNode(0) {}; + a_star_world(void) : _width(0), _nbNode(0) {}; }; /* Index: wesnoth/src/builder.cpp diff -u wesnoth/src/builder.cpp:1.51 wesnoth/src/builder.cpp:1.52 --- wesnoth/src/builder.cpp:1.51 Mon May 2 19:42:04 2005 +++ wesnoth/src/builder.cpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: builder.cpp,v 1.51 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: builder.cpp,v 1.52 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -53,19 +53,19 @@ const int terrain_builder::rule_image::TILEWIDTH = 72; const int terrain_builder::rule_image::UNITPOS = 36 + 18; -terrain_builder::rule_image::rule_image(int layer, bool global_image) : +terrain_builder::rule_image::rule_image(int layer, bool global_image) : position(HORIZONTAL), layer(layer), basex(0), basey(0), global_image(global_image) {} -terrain_builder::rule_image::rule_image(int x, int y, bool global_image) : +terrain_builder::rule_image::rule_image(int x, int y, bool global_image) : position(VERTICAL), layer(0), basex(x), basey(y), global_image(global_image) {} terrain_builder::tile::tile() : last_tod("invalid_tod") { - memset(adjacents, 0, sizeof(adjacents)); + memset(adjacents, 0, sizeof(adjacents)); } void terrain_builder::tile::add_image_to_cache(const std::string &tod, ordered_ri_list::const_iterator itor) const @@ -85,26 +85,26 @@ } } -void terrain_builder::tile::rebuild_cache(const std::string &tod) const +void terrain_builder::tile::rebuild_cache(const std::string &tod) const { images_background.clear(); images_foreground.clear(); ordered_ri_list::const_iterator itor; for(itor = horizontal_images.begin(); itor != horizontal_images.end(); ++itor) { - if (itor->first <= 0) + if (itor->first <= 0) add_image_to_cache(tod, itor); } for(itor = vertical_images.begin(); itor != vertical_images.end(); ++itor) { add_image_to_cache(tod, itor); } for(itor = horizontal_images.begin(); itor != horizontal_images.end(); ++itor) { - if (itor->first > 0) + if (itor->first > 0) add_image_to_cache(tod, itor); } } -void terrain_builder::tile::clear() +void terrain_builder::tile::clear() { flags.clear(); horizontal_images.clear(); @@ -125,21 +125,21 @@ { if(loc.x < -1 || loc.y < -1 || loc.x > x_ || loc.y > y_) return false; - + return true; } terrain_builder::tile& terrain_builder::tilemap::operator[](const gamemap::location &loc) { wassert(on_map(loc)); - + return map_[(loc.x+1) + (loc.y+1)*(x_+2)]; } const terrain_builder::tile& terrain_builder::tilemap::operator[] (const gamemap::location &loc) const { wassert(on_map(loc)); - + return map_[(loc.x+1) + (loc.y+1)*(x_+2)]; } @@ -153,7 +153,7 @@ } const terrain_builder::imagelist *terrain_builder::get_terrain_at(const gamemap::location &loc, - const std::string &tod, ADJACENT_TERRAIN_TYPE terrain_type) const + const std::string &tod, ADJACENT_TERRAIN_TYPE terrain_type) const { if(!tile_map_.on_map(loc)) return NULL; @@ -169,7 +169,7 @@ if(!tile_at.images_background.empty()) return &tile_at.images_background; } - + if(terrain_type == ADJACENT_FOREGROUND) { if(!tile_at.images_foreground.empty()) return &tile_at.images_foreground; @@ -204,7 +204,7 @@ return changed; } -// TODO: rename this function +// TODO: rename this function void terrain_builder::rebuild_terrain(const gamemap::location &loc) { if (tile_map_.on_map(loc)) { @@ -242,7 +242,7 @@ for(constraint = rule.constraints.begin(); constraint != rule.constraints.end(); ++constraint) { - for(image = constraint->second.images.begin(); + for(image = constraint->second.images.begin(); image != constraint->second.images.end(); ++image) { @@ -268,7 +268,7 @@ for(constraint = rule.constraints.begin(); constraint != rule.constraints.end(); ++constraint) { - for(image = constraint->second.images.begin(); + for(image = constraint->second.images.begin(); image != constraint->second.images.end(); ++image) { @@ -295,7 +295,7 @@ terrain_builder::terrain_constraint terrain_builder::rotate(const terrain_builder::terrain_constraint &constraint, int angle) { - static const struct { int ii; int ij; int ji; int jj; } rotations[6] = + static const struct { int ii; int ij; int ji; int jj; } rotations[6] = { { 1, 0, 0, 1 }, { 1, 1, -1, 0 }, { 0, 1, -1, -1 }, { -1, 0, 0, -1 }, { -1, -1, 1, 0 }, { 0, -1, 1, 1 } }; @@ -319,17 +319,17 @@ // // (demonstration left as an exercise for the reader) // - // So we have + // So we have // // r = [[ 1/2 -3/4 ] // [ 1 1/2 ]] // // And the following array contains I(2), r, r^2, r^3, r^4, r^5 (with // r^3 == -I(2)), which are the successive rotations. - static const struct { + static const struct { double xx; double xy; - double yx; + double yx; double yy; } xyrotations[6] = { { 1., 0., 0., 1. }, @@ -342,16 +342,16 @@ wassert(angle >= 0); - angle %= 6; + angle %= 6; terrain_constraint ret = constraint; // Vector i is going from n to s, vector j is going from ne to sw. int vi = ret.loc.y - ret.loc.x/2; int vj = ret.loc.x; - + int ri = rotations[angle].ii * vi + rotations[angle].ij * vj; int rj = rotations[angle].ji * vi + rotations[angle].jj * vj; - + ret.loc.x = rj; ret.loc.y = ri + (rj >= 0 ? rj/2 : (rj-1)/2); @@ -382,7 +382,7 @@ void terrain_builder::replace_token(std::string &s, const std::string &token, const std::string &replacement) { size_t pos; - + if(token.empty()) { ERR_NG << "empty token in replace_token\n"; return; @@ -419,10 +419,10 @@ { constraint_set::iterator cons; - for(cons = rule.constraints.begin(); cons != rule.constraints.end(); ++cons) { + for(cons = rule.constraints.begin(); cons != rule.constraints.end(); ++cons) { //Transforms attributes std::vector<std::string>::iterator flag; - + for(flag = cons->second.set_flag.begin(); flag != cons->second.set_flag.end(); flag++) { replace_token(*flag, token, replacement); } @@ -438,7 +438,7 @@ //replace_token(rule.images, token, replacement); } -terrain_builder::building_rule terrain_builder::rotate_rule(const terrain_builder::building_rule &rule, +terrain_builder::building_rule terrain_builder::rotate_rule(const terrain_builder::building_rule &rule, int angle, const std::vector<std::string>& rot) { building_rule ret; @@ -473,7 +473,7 @@ if(!(miny & 1) && (minx & 1) && (minx > 0)) miny -= 2; - for(cons2 = tmp_cons.begin(); cons2 != tmp_cons.end(); ++cons2) { + for(cons2 = tmp_cons.begin(); cons2 != tmp_cons.end(); ++cons2) { //Adjusts positions cons2->second.loc += gamemap::location(-minx, -((miny-1)/2)); ret.constraints[cons2->second.loc] = cons2->second; @@ -498,8 +498,8 @@ const std::string &name = (**img)["name"]; - if((**img)["position"].empty() || - (**img)["position"] == "horizontal") { + if((**img)["position"].empty() || + (**img)["position"] == "horizontal") { const int layer = atoi((**img)["layer"].c_str()); images.push_back(rule_image(layer, global)); @@ -514,7 +514,7 @@ basey = atoi(base[1].c_str()); } images.push_back(rule_image(basex - dx, basey - dy, global)); - + } // Adds the main (default) variant of the image, if present @@ -535,7 +535,7 @@ } void terrain_builder::add_constraints( - terrain_builder::constraint_set& constraints, + terrain_builder::constraint_set& constraints, const gamemap::location& loc, const std::string& type, const config& global_images) { @@ -545,10 +545,10 @@ } if(!type.empty()) - constraints[loc].terrain_types = type; - + constraints[loc].terrain_types = type; + int x = loc.x * rule_image::TILEWIDTH * 3 / 4; - int y = loc.y * rule_image::TILEWIDTH + (loc.x % 2) * + int y = loc.y * rule_image::TILEWIDTH + (loc.x % 2) * rule_image::TILEWIDTH / 2; add_images_from_config(constraints[loc].images, global_images, true, x, y); @@ -585,7 +585,7 @@ const std::vector<std::string> &lines = utils::split(mapstring, '\n', 0); std::vector<std::string>::const_iterator line = lines.begin(); - + //Strips trailing empty lines while (line != lines.end() && std::find_if(line->begin(), line->end(), utils::notspace) == line->end()) { line++; @@ -593,7 +593,7 @@ //Break if there only are blank lines if(line == lines.end()) return; - + //If the strings starts with a space, the first line is an odd line, //else it is an even one if((*line)[0] == ' ') @@ -613,7 +613,7 @@ while(lpos < line->size()) { std::string types = line->substr(lpos, 4); utils::strip(types); - + //If there are numbers in the types string, consider it //is an anchor if(types[0] == '.') { @@ -650,7 +650,7 @@ add_rule(rules, tpl); } else { const std::vector<std::string>& rot = utils::split(rotations, ','); - + for(size_t angle = 0; angle < rot.size(); angle++) { building_rule rule = rotate_rule(tpl, angle, rot); add_rule(rules, rule); @@ -661,7 +661,7 @@ void terrain_builder::parse_config(const config &cfg) { log_scope("terrain_builder::parse_config"); - + //Parses the list of building rules (BRs) const config::child_list& brs = cfg.get_children("terrain_graphics"); @@ -672,19 +672,19 @@ if(!((**br)["x"].empty() || (**br)["y"].empty())) pbr.location_constraints = gamemap::location(atoi((**br)["x"].c_str()), atoi((**br)["y"].c_str())); - + pbr.probability = (**br)["probability"].empty() ? -1 : atoi((**br)["probability"].c_str()); pbr.precedence = (**br)["precedence"].empty() ? 0 : atoi((**br)["precedence"].c_str()); - - //Mapping anchor indices to anchor locations. + + //Mapping anchor indices to anchor locations. anchormap anchors; - + // Parse the map= , if there is one (and fill the anchors list) parse_mapstring((**br)["map"], pbr, anchors, **br); // Parses the terrain constraints (TCs) config::child_list tcs((*br)->get_children("tile")); - + for(config::child_list::const_iterator tc = tcs.begin(); tc != tcs.end(); tc++) { //Adds the terrain constraint to the current built //terrain's list of terrain constraints, if it does not @@ -692,10 +692,10 @@ gamemap::location loc; if((**tc)["x"].size()) { loc.x = atoi((**tc)["x"].c_str()); - } + } if((**tc)["y"].size()) { loc.y = atoi((**tc)["y"].c_str()); - } + } if(!(**tc)["loc"].empty()) { std::vector<std::string> sloc = utils::split((**tc)["loc"]); if(sloc.size() == 2) { @@ -715,27 +715,27 @@ std::pair<anchormap::const_iterator, anchormap::const_iterator> range = anchors.equal_range(pos); - + for(; range.first != range.second; range.first++) { loc = range.first->second; add_constraints(pbr.constraints, loc, **tc, **br); - } + } } } const std::string global_set_flag = (**br)["set_flag"]; const std::string global_no_flag = (**br)["no_flag"]; const std::string global_has_flag = (**br)["has_flag"]; - + for(constraint_set::iterator constraint = pbr.constraints.begin(); constraint != pbr.constraints.end(); constraint++) { - + if(global_set_flag.size()) constraint->second.set_flag.push_back(global_set_flag); - + if(global_no_flag.size()) constraint->second.no_flag.push_back(global_no_flag); - + if(global_has_flag.size()) constraint->second.has_flag.push_back(global_has_flag); @@ -750,7 +750,7 @@ #if 0 std::cerr << "Built terrain rules: \n"; - + building_ruleset::const_iterator rule; for(rule = building_rules_.begin(); rule != building_rules_.end(); ++rule) { std::cerr << ">> New rule: image_background = " /* << rule->second.image_background << " , image_foreground = "<< rule->second.image_foreground */ << "\n"; @@ -761,14 +761,14 @@ << "), terrain types = " << constraint->second.terrain_types << "\n"; std::vector<std::string>::const_iterator flag; - + for(flag = constraint->second.set_flag.begin(); flag != constraint->second.set_flag.end(); ++flag) { std::cerr << ">>>>>> Set_flag: " << *flag << "\n"; } for(flag = constraint->second.no_flag.begin(); flag != constraint->second.no_flag.end(); ++flag) { std::cerr << ">>>>>> No_flag: " << *flag << "\n"; - } + } } } @@ -882,7 +882,7 @@ } // Sets flags - for(std::vector<std::string>::const_iterator itor = constraint->second.set_flag.begin(); + for(std::vector<std::string>::const_iterator itor = constraint->second.set_flag.begin(); itor != constraint->second.set_flag.end(); itor++) { btile.flags.insert(*itor); } @@ -897,12 +897,12 @@ gamemap::location adj[6]; int i; get_adjacent_tiles(loc, adj); - + for(i = 0; i < 6; ++i) { if(rule.constraints.find(adj[i]) != rule.constraints.end()) { res++; } - } + } return res; } @@ -910,7 +910,7 @@ //this constraint may possibly match. INT_MAX means "I don't know / all of them". int terrain_builder::get_constraint_size(const building_rule& rule, const terrain_constraint& constraint, bool& border) { - const std::string &types = constraint.terrain_types; + const std::string &types = constraint.terrain_types; if(types.empty()) return INT_MAX; @@ -941,7 +941,7 @@ } if(border == true) break; - } + } int constraint_size = 0; @@ -981,7 +981,7 @@ tile_map_[loc].adjacents[i+1] = map_.get_terrain(adj[i]); //determines if this tile is a border tile - if(map_.get_terrain(adj[i]) != t) + if(map_.get_terrain(adj[i]) != t) border = true; } if(border) @@ -991,7 +991,7 @@ int rule_index = 0; building_ruleset::const_iterator rule; - + for(rule = building_rules_.begin(); rule != building_rules_.end(); ++rule) { if (rule->second.location_constraints.valid()) { @@ -1010,7 +1010,7 @@ for(constraint = rule->second.constraints.begin(); constraint != rule->second.constraints.end(); ++constraint) { - + bool border; int size = get_constraint_size(rule->second, constraint->second, border); @@ -1041,7 +1041,7 @@ adjacent_types[i] = ""; } } - + } if(smallest_constraint_size != INT_MAX) { const std::string &types = smallest_constraint->second.terrain_types; @@ -1055,10 +1055,10 @@ } else { locations = &terrain_by_type_[*c]; } - + for(std::vector<gamemap::location>::const_iterator itor = locations->begin(); itor != locations->end(); ++itor) { - + if(biggest_constraint_adjacent > 0) { const gamemap::location pos = (*itor - loc) + aloc; if(!tile_map_.on_map(pos)) @@ -1066,7 +1066,7 @@ const gamemap::TERRAIN *adjacents = tile_map_[pos].adjacents; int i; - + for(i = 0; i < 7; ++i) { if(!terrain_matches(adjacents[i], adjacent_types[i])) { break; Index: wesnoth/src/builder.hpp diff -u wesnoth/src/builder.hpp:1.30 wesnoth/src/builder.hpp:1.31 --- wesnoth/src/builder.hpp:1.30 Wed Mar 23 08:52:10 2005 +++ wesnoth/src/builder.hpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: builder.hpp,v 1.30 2005/03/23 08:52:10 silene Exp $ */ +/* $Id: builder.hpp,v 1.31 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -28,7 +28,7 @@ * The class terrain_builder is constructed from a config object, and a gamemap * object. On construction, it parses the configuration and extracts the list * of [terrain_graphics] rules. Each terrain_graphics rule attachs one or more - * images to a specific terrain pattern. + * images to a specific terrain pattern. * It then applies the rules loaded from the configuration to the current map, * and calculates the list of images that must be associated to each hex of the * map. @@ -83,7 +83,7 @@ * changed, and must be redrawn. * * @param loc the location to update - * + * * @return true: this tile must be redrawn. */ bool update_animation(const gamemap::location &loc); @@ -205,9 +205,9 @@ struct terrain_constraint { terrain_constraint() : loc() {}; - + terrain_constraint(gamemap::location loc) : loc(loc) {}; - + gamemap::location loc; std::string terrain_types; std::vector<std::string> set_flag; @@ -229,7 +229,7 @@ typedef std::multimap<int, const rule_image*> ordered_ri_list; /** Contructor for the tile() structure */ - tile(); + tile(); /** Adds an image, extracted from an ordered rule_image list, * to the background or foreground image cache. @@ -252,7 +252,7 @@ /** Clears all data in this tile, and resets the cache */ void clear(); - + /** The list of flags present in this tile */ std::set<std::string> flags; @@ -277,7 +277,7 @@ */ mutable imagelist images_background; /** - * The time-of-day to which the image caches correspond. + * The time-of-day to which the image caches correspond. */ mutable std::string last_tod; @@ -286,7 +286,7 @@ * this tile. */ gamemap::TERRAIN adjacents[7]; - + }; private: @@ -327,7 +327,7 @@ */ int precedence; }; - + /** * The map of "tile" structures corresponding to the level map. */ @@ -352,7 +352,7 @@ * a const variant of operator[] */ const tile &operator[] (const gamemap::location &loc) const; - + /** * Tests if a location is on the map * @@ -361,7 +361,7 @@ * @return true if loc is on the map, false otherwise. */ bool on_map(const gamemap::location &loc) const; - + /** * Resets the whole tile map */ @@ -380,7 +380,7 @@ * of [terrain_graphics] rules. */ typedef std::multimap<int, building_rule> building_ruleset; - + /** * Tests for validity of a rule. A rule is considered valid if all its * images are present. This method is used, when building the ruleset, @@ -392,7 +392,7 @@ */ bool rule_valid(const building_rule &rule); - /** + /** * Starts the animation on a rule. * * @param rule The rule on which ot start animations @@ -427,7 +427,7 @@ * @param token The token to substitute * @param replacement The replacement string */ - void replace_token(std::string &s, const std::string &token, + void replace_token(std::string &s, const std::string &token, const std::string& replacement); /** @@ -439,7 +439,7 @@ * @param token The token to substitute * @param replacement The replacement string */ - void replace_token(rule_image_variant &variant, const std::string &token, + void replace_token(rule_image_variant &variant, const std::string &token, const std::string& replacement); /** @@ -450,10 +450,10 @@ * @param token The token to substitute * @param replacement The replacement string */ - void replace_token(rule_image &image, const std::string &token, + void replace_token(rule_image &image, const std::string &token, const std::string& replacement); - /** + /** * Replaces, in a given rule_imagelist, a token with its value. The * actual substitution is done in all rule_images contained in the * rule_imagelist. @@ -465,7 +465,7 @@ void replace_token(rule_imagelist &, const std::string &token, const std::string& replacement); - /** + /** * Replaces, in a given building_rule, a token with its value. The * actual substitution is done in the rule_imagelists contained in all * constraints of the building_rule, and in the flags (has_flag, @@ -479,7 +479,7 @@ void replace_token(building_rule &s, const std::string &token, const std::string& replacement); - /** + /** * Rotates a template rule to a given angle, and returns the rotated * rule. * @@ -488,7 +488,7 @@ * <code>@Rn</code>, n being a number from 0 to 5. * * The rule contains the rotations=r0,r1,r2,r3,r4,r5, with r0 to r5 * being strings describing the 6 different positions, typically, n, - * ne, se, s, sw, and nw (buy may be anything else.) + * ne, se, s, sw, and nw (buy may be anything else.) * * A template rule will generate 6 rules, which are similar to the * template, except that: @@ -506,7 +506,7 @@ * * * On the rule rotated 2pi/3, those will be replaced by r2, r3, r4, * r5, r0, r1 and so on. - * + * */ building_rule rotate_rule(const building_rule &rule, int angle, const std::vector<std::string>& angle_name); @@ -560,7 +560,7 @@ void add_constraints(constraint_set& constraints, const gamemap::location &loc, const config &cfg, const config& global_images); - + typedef std::multimap<int, gamemap::location> anchormap; /** @@ -634,7 +634,7 @@ * already checked, only flags and probability will be * checked. */ - bool rule_matches(const building_rule &rule, const gamemap::location &loc, + bool rule_matches(const building_rule &rule, const gamemap::location &loc, int rule_index, bool check_loc); /** @@ -682,7 +682,7 @@ * constraint may match. INT_MAX means "all of them" or "unable * to determine" */ - int get_constraint_size(const building_rule& rule, const terrain_constraint& constraint, + int get_constraint_size(const building_rule& rule, const terrain_constraint& constraint, bool& border); /** @@ -690,7 +690,7 @@ * from the gamemap and the building_rules_. */ void build_terrains(); - + /** * A reference to the gamemap class used in the current level. */ Index: wesnoth/src/campaign_server/campaign_server.cpp diff -u wesnoth/src/campaign_server/campaign_server.cpp:1.16 wesnoth/src/campaign_server/campaign_server.cpp:1.17 --- wesnoth/src/campaign_server/campaign_server.cpp:1.16 Sun May 1 08:57:54 2005 +++ wesnoth/src/campaign_server/campaign_server.cpp Sat Jun 4 19:16:06 2005 @@ -158,7 +158,7 @@ //erase the campaign write_file((*campaign)["filename"],""); - + const config::child_list& campaigns_list = campaigns().get_children("campaign"); const size_t index = std::find(campaigns_list.begin(),campaigns_list.end(),campaign) - campaigns_list.begin(); campaigns().remove_child("campaign",index); Index: wesnoth/src/cavegen.cpp diff -u wesnoth/src/cavegen.cpp:1.18 wesnoth/src/cavegen.cpp:1.19 --- wesnoth/src/cavegen.cpp:1.18 Sat Mar 26 17:10:32 2005 +++ wesnoth/src/cavegen.cpp Sat Jun 4 19:16:05 2005 @@ -131,7 +131,7 @@ if(chance != "" && (rand()%100) < atoi(chance.c_str())) { continue; } - + const std::string& xpos = (**i)["x"]; const std::string& ypos = (**i)["y"]; @@ -269,7 +269,7 @@ passage_path_calculator(const std::vector<std::vector<gamemap::TERRAIN> >& mapdata, gamemap::TERRAIN wall, double laziness, size_t windiness) : map_(mapdata), wall_(wall), laziness_(laziness), windiness_(windiness) {} - + virtual double cost(const gamemap::location& loc, const double so_far, const bool is_dest) const; private: const std::vector<std::vector<gamemap::TERRAIN> >& map_; @@ -305,15 +305,15 @@ const size_t windiness = atoi(p.cfg["windiness"].c_str()); const double laziness = maximum<double>(1.0,atof(p.cfg["laziness"].c_str())); - + passage_path_calculator calc(map_,wall_,laziness,windiness); - + const paths::route rt = a_star_search(p.src, p.dst, 10000.0, &calc, width_, height_); const size_t width = maximum<size_t>(1,atoi(p.cfg["width"].c_str())); const size_t jagged = atoi(p.cfg["jagged"].c_str()); - + for(std::vector<gamemap::location>::const_iterator i = rt.steps.begin(); i != rt.steps.end(); ++i) { std::set<gamemap::location> locs; build_chamber(*i,locs,width,jagged); Index: wesnoth/src/cavegen.hpp diff -u wesnoth/src/cavegen.hpp:1.7 wesnoth/src/cavegen.hpp:1.8 --- wesnoth/src/cavegen.hpp:1.7 Thu Mar 10 01:47:57 2005 +++ wesnoth/src/cavegen.hpp Sat Jun 4 19:16:05 2005 @@ -42,7 +42,7 @@ void place_items(const chamber& c, config::all_children_iterator i1, config::all_children_iterator i2); void place_passage(const passage& p); - + bool on_board(const gamemap::location& loc) const; void set_terrain(gamemap::location loc, gamemap::TERRAIN t); void place_castle(const std::string& side, gamemap::location loc); Index: wesnoth/src/checksum.cpp diff -u wesnoth/src/checksum.cpp:1.3 wesnoth/src/checksum.cpp:1.4 --- wesnoth/src/checksum.cpp:1.3 Tue May 10 22:15:57 2005 +++ wesnoth/src/checksum.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: checksum.cpp,v 1.3 2005/05/10 22:15:57 Sirp Exp $ */ +/* $Id: checksum.cpp,v 1.4 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/checksum.hpp diff -u wesnoth/src/checksum.hpp:1.2 wesnoth/src/checksum.hpp:1.3 --- wesnoth/src/checksum.hpp:1.2 Tue May 10 22:15:57 2005 +++ wesnoth/src/checksum.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: checksum.hpp,v 1.2 2005/05/10 22:15:57 Sirp Exp $ */ +/* $Id: checksum.hpp,v 1.3 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/clipboard.cpp diff -u wesnoth/src/clipboard.cpp:1.17 wesnoth/src/clipboard.cpp:1.18 --- wesnoth/src/clipboard.cpp:1.17 Wed Mar 23 22:10:50 2005 +++ wesnoth/src/clipboard.cpp Sat Jun 4 19:16:05 2005 @@ -7,13 +7,13 @@ #define CLIPBOARD_FUNCS_DEFINED #include <X11/Xlib.h> -#include <unistd.h> +#include <unistd.h> #include <iostream> #include "SDL_syswm.h" /** - The following are two classes which wrap the SDL's interface to X, including + The following are two classes which wrap the SDL's interface to X, including locking/unlocking, and which manage the atom internment. They exist mainly to make the actual clipboard code somewhat readable */ @@ -24,7 +24,7 @@ { acquireCount_ = 0; acquire(); - + //Intern some atoms; const char* atoms[] = { "CLIPBOARD", @@ -34,17 +34,17 @@ "WESNOTH_PASTE", "TARGETS" }; - + XInternAtoms(dpy(), (char**)atoms, 6, false, atomTable_); - + release(); } - + static XHelper* s_instance_; - + SDL_SysWMinfo wmInf_; - - Atom atomTable_[6]; + + Atom atomTable_[6]; int acquireCount_; public: static XHelper* instance() @@ -59,53 +59,53 @@ { return atomTable_[0]; } - + Atom XA_TEXT() { return atomTable_[1]; } - + Atom XA_COMPOUND_TEXT() { return atomTable_[2]; } - + Atom UTF8_STRING() { return atomTable_[3]; } - + Atom WES_PASTE() { return atomTable_[4]; } - + Atom XA_TARGETS() { return atomTable_[5]; } - + Display* dpy() { return wmInf_.info.x11.display; } - + Window window() { return wmInf_.info.x11.window; } - + void acquire(void) { ++acquireCount_; if (acquireCount_ == 1) { SDL_VERSION (&wmInf_.version); SDL_GetWMInfo(&wmInf_); - + wmInf_.info.x11.lock_func(); } } - + void release(void) { --acquireCount_; @@ -123,7 +123,7 @@ { XHelper::instance()->acquire(); } - + ~UseX() { XHelper::instance()->release(); @@ -137,23 +137,23 @@ /** Note: unfortunately, SDL does not keep track of event timestamps. - This means we are forced to use CurrentTime in many spots and are - unable to perform many safety checks. Hence, the code below is + This means we are forced to use CurrentTime in many spots and are + unable to perform many safety checks. Hence, the code below is not compliant to the ICCCM, and may ocassionally suffer from - race conditions if an X client is connected to the server over - a slow/high-latency link. This implementation is also very minimal. - The text is assumed to be reasonably small as INCR transactions are not + race conditions if an X client is connected to the server over + a slow/high-latency link. This implementation is also very minimal. + The text is assumed to be reasonably small as INCR transactions are not supported. MULTIPLE is not supported either. - - We provide UTF8_STRING, COMPOUND_TEXT, and TEXT, and + + We provide UTF8_STRING, COMPOUND_TEXT, and TEXT, and try to grab all of them, plus STRING (which is latin1). */ /** - We primarily. keep a copy of the string to response to data requests, + We primarily. keep a copy of the string to response to data requests, but it also has an another function: in case we're both the source - and destination, we just copy it accross; this is so that we + and destination, we just copy it accross; this is so that we don't have to handle SelectionRequest events while waiting for SelectionNotify. To make this work, however, this gets cleared when we loose CLIPBOARD */ @@ -165,11 +165,11 @@ XEvent& xev = event.syswm.msg->event.xevent; if (xev.type == SelectionRequest) { UseX x11; - + //Since wesnoth does not notify us of selections, //we set both selection + clipboard when copying. if ((xev.xselectionrequest.owner == x11->window()) && - ((xev.xselectionrequest.selection == XA_PRIMARY) || + ((xev.xselectionrequest.selection == XA_PRIMARY) || (xev.xselectionrequest.selection == x11->XA_CLIPBOARD()))) { XEvent responseEvent; responseEvent.xselection.type = SelectionNotify; @@ -179,48 +179,48 @@ responseEvent.xselection.target = xev.xselectionrequest.target; responseEvent.xselection.property = None; //nothing available, by default responseEvent.xselection.time = xev.xselectionrequest.time; - + //std::cout<<"Request for target:"<<XGetAtomName(x11->dpy(), xev.xselectionrequest.target)<<"\n"; - + //### presently don't handle XA_STRING as it must be latin1 - + if (xev.xselectionrequest.target == x11->XA_TARGETS()) { responseEvent.xselection.property = xev.xselectionrequest.property; - + Atom supported[] = { x11->XA_TEXT(), x11->XA_COMPOUND_TEXT(), x11->UTF8_STRING(), x11->XA_TARGETS() }; - + XChangeProperty(x11->dpy(), responseEvent.xselection.requestor, xev.xselectionrequest.property, XA_ATOM, 32, PropModeReplace, (unsigned char*)supported, 4); } - + //The encoding of XA_TEXT and XA_COMPOUND_TEXT is not specified //by the ICCCM... So we assume wesnoth native/utf-8 for simplicity. //modern apps are going to use UTF8_STRING anyway if (xev.xselectionrequest.target == x11->XA_TEXT() || - xev.xselectionrequest.target == x11->XA_COMPOUND_TEXT() || + xev.xselectionrequest.target == x11->XA_COMPOUND_TEXT() || xev.xselectionrequest.target == x11->UTF8_STRING()) { responseEvent.xselection.property = xev.xselectionrequest.property; - + XChangeProperty(x11->dpy(), responseEvent.xselection.requestor, xev.xselectionrequest.property, - xev.xselectionrequest.target, 8, PropModeReplace, + xev.xselectionrequest.target, 8, PropModeReplace, (const unsigned char*) clipboard_string.c_str(), clipboard_string.length()); } - + XSendEvent(x11->dpy(), xev.xselectionrequest.requestor, False, NoEventMask, &responseEvent); } - } - + } + if (xev.type == SelectionClear) { UseX x11; - + if (xev.xselectionclear.selection == x11->XA_CLIPBOARD()) clipboard_string = ""; //We no longer own the clipboard, don't try in-process C&P } @@ -245,7 +245,7 @@ clipboard_string = text; UseX x11; - + XSetSelectionOwner(x11->dpy(), XA_PRIMARY, x11->window(), CurrentTime); XSetSelectionOwner(x11->dpy(), x11->XA_CLIPBOARD(), x11->window(), CurrentTime); } @@ -255,17 +255,17 @@ static bool try_grab_target(Atom target, std::string& ret) { UseX x11; - + //Cleanup previous data XDeleteProperty(x11->dpy(), x11->window(), x11->WES_PASTE()); XSync (x11->dpy(), False); - + //std::cout<<"We request target:"<<XGetAtomName(x11->dpy(), target)<<"\n"; - + //Request information - XConvertSelection(x11->dpy(), x11->XA_CLIPBOARD(), target, + XConvertSelection(x11->dpy(), x11->XA_CLIPBOARD(), target, x11->WES_PASTE(), x11->window(), CurrentTime); - + //Wait (with timeout) for a response SelectionNotify for (int attempt = 0; attempt < 15; attempt++) { if (XPending(x11->dpy())) { @@ -279,20 +279,20 @@ //The size unsigned long length = 0; unsigned char* data; - + //these 3 XGetWindowProperty returns but we don't use Atom typeRet; int formatRet; unsigned long remaining; - + // std::cout<<"Grab:"<<XGetAtomName(x11->dpy(), target)<<"\n"; - + //Grab the text out of the property XGetWindowProperty(x11->dpy(), x11->window(), selectNotify.xselection.property, - 0, 65535/4, True, target, + 0, 65535/4, True, target, &typeRet, &formatRet, &length, &remaining, &data); - + if (data && length) { ret = (char*)data; XFree(data); @@ -303,10 +303,10 @@ } } } - + usleep(10000); } - + //Timed out -- return empty string return false; } @@ -316,7 +316,7 @@ if(!clipboard_string.empty()) return utils::utf8_string_to_ucs2_string(clipboard_string); utf8_string text; - + UseX x11; if(try_grab_target(x11->UTF8_STRING(), text)) return utils::utf8_string_to_ucs2_string(text); @@ -335,22 +335,22 @@ return clipboard_string; //in-wesnoth copy-paste std::string ret; - + UseX x11; - + if (try_grab_target(x11->UTF8_STRING(), ret)) return ret; - + if (try_grab_target(x11->XA_COMPOUND_TEXT(), ret)) return ret; - + if (try_grab_target(x11->XA_TEXT(), ret)) return ret; - + if (try_grab_target(XA_STRING, ret)) //acroread only provides this return ret; - + return ""; } @@ -387,7 +387,7 @@ first = ++last; } while(last != text.end()); str.push_back('\0'); - + HGLOBAL hglb = GlobalAlloc(GMEM_MOVEABLE, str.size() * sizeof(Uint16)); if(hglb == NULL) { CloseClipboard(); @@ -422,7 +422,7 @@ str.append("\r\n"); first = ++last; } while(last != text.end()); - + const HGLOBAL hglb = GlobalAlloc(GMEM_MOVEABLE, (str.size() + 1) * sizeof(TCHAR)); if(hglb == NULL) { CloseClipboard(); @@ -452,7 +452,7 @@ CloseClipboard(); return ucs2_string(); } - + //convert newlines ucs2_string str; while(*buffer != '\0') { @@ -471,7 +471,7 @@ return ""; if(!OpenClipboard(NULL)) return ""; - + HGLOBAL hglb = GetClipboardData(CF_TEXT); if(hglb == NULL) { CloseClipboard(); @@ -482,11 +482,11 @@ CloseClipboard(); return ""; } - + //convert newlines std::string str(buffer); str.erase(std::remove(str.begin(),str.end(),'\r'),str.end()); - + GlobalUnlock(hglb); CloseClipboard(); return str; Index: wesnoth/src/config.cpp diff -u wesnoth/src/config.cpp:1.138 wesnoth/src/config.cpp:1.139 --- wesnoth/src/config.cpp:1.138 Mon Apr 18 19:25:04 2005 +++ wesnoth/src/config.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: config.cpp,v 1.138 2005/04/18 19:25:04 gruikya Exp $ */ +/* $Id: config.cpp,v 1.139 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -198,7 +198,7 @@ child_list& v = children[key]; //wassert(index < v.size()); if(index >= v.size()) { - ERR_CF << "Error: attempting to delete non-existing child: " + ERR_CF << "Error: attempting to delete non-existing child: " << key << "[" << index << "]\n"; return; } @@ -400,7 +400,7 @@ //get the two child lists. 'b' has to be modified to look like 'a' const child_list& a = itor_a != children.end() ? itor_a->second : dummy; const child_list& b = itor_b != c.children.end() ? itor_b->second : dummy; - + size_t ndeletes = 0; size_t ai = 0, bi = 0; while(ai != a.size() || bi != b.size()) { @@ -423,7 +423,7 @@ ++ndeletes; ++bi; - } + } //if b has less elements than a, then we assume this element is an //element that needs inserting @@ -481,7 +481,7 @@ if(item.first->empty()) { continue; } - + const child_map::iterator itor = children.find(*item.first); if(itor == children.end() || index >= itor->second.size()) { throw error("error in diff: could not find element '" + *item.first + "'"); @@ -518,7 +518,7 @@ } for(child_map::const_iterator list = children.begin(); list != children.end(); ++list) { - for(child_list::const_iterator child = list->second.begin(); + for(child_list::const_iterator child = list->second.begin(); child != list->second.end(); ++child) { (*child)->reset_translation(); } Index: wesnoth/src/config.hpp diff -u wesnoth/src/config.hpp:1.61 wesnoth/src/config.hpp:1.62 --- wesnoth/src/config.hpp:1.61 Mon Apr 18 19:25:04 2005 +++ wesnoth/src/config.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: config.hpp,v 1.61 2005/04/18 19:25:04 gruikya Exp $ */ +/* $Id: config.hpp,v 1.62 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/cursor.cpp diff -u wesnoth/src/cursor.cpp:1.15 wesnoth/src/cursor.cpp:1.16 --- wesnoth/src/cursor.cpp:1.15 Wed Mar 9 22:21:54 2005 +++ wesnoth/src/cursor.cpp Sat Jun 4 19:16:05 2005 @@ -47,7 +47,7 @@ SDL_GetRGBA(pixels[y*nsurf->w + x],nsurf->format,&r,&g,&b,&a); const size_t index = y*cursor_width + x; - + const size_t shift = 7 - (index%8); const Uint8 trans = (a < 128 ? 0 : 1) << shift; @@ -208,7 +208,7 @@ if(use_colour_cursors() == false) { return; } - + if(cursor_buf == NULL) { return; } Index: wesnoth/src/dialogs.cpp diff -u wesnoth/src/dialogs.cpp:1.104 wesnoth/src/dialogs.cpp:1.105 --- wesnoth/src/dialogs.cpp:1.104 Tue May 17 22:19:40 2005 +++ wesnoth/src/dialogs.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: dialogs.cpp,v 1.104 2005/05/17 22:19:40 ydirson Exp $ */ +/* $Id: dialogs.cpp,v 1.105 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -111,7 +111,7 @@ bool animate_unit_advancement(const game_data& info,unit_map& units, gamemap::location loc, display& gui, size_t choice) { const command_disabler cmd_disabler; - + std::map<gamemap::location,unit>::iterator u = units.find(loc); if(u == units.end() || u->second.advances() == false) { return false; @@ -123,10 +123,10 @@ if(choice >= options.size() + mod_options.size()) { return false; } - + //when the unit advances, it fades to white, and then switches to the //new unit, then fades back to the normal colour - + if(!gui.update_locked()) { for(double intensity = 1.0; intensity >= 0.0; intensity -= 0.05) { gui.set_advancing_unit(loc,intensity); @@ -368,7 +368,7 @@ str << "\n" << _("#(Invalid)"); } else if (!campaign_type.empty()) { str << "\n"; - + if(campaign_type == "scenario") { str << _("Campaign"); } else if(campaign_type == "multiplayer") { @@ -380,7 +380,7 @@ } str << "\n"; - + if(summary["snapshot"] == "no" && summary["replay"] == "yes") { str << _("replay"); } else if (!summary["turn"].empty()) { @@ -433,7 +433,7 @@ //save is from a different year format_string = _("%b %d %y"); } - + char buf[40]; const size_t res = strftime(buf,sizeof(buf),format_string,&save_time); if(res == 0) { @@ -728,7 +728,7 @@ details << _("HP: ") << u.hitpoints() << "/" << u.max_hitpoints() << "\n"; - + if(u.can_advance() == false) { details << _("XP: ") << u.experience() << "/-"; } else { @@ -740,7 +740,7 @@ details << _("XP: ") << u.experience() << "/" << u.max_experience(); } - + if(weapons_) { details << "\n" << _("Moves: ") << u.movement_left() << "/" @@ -761,9 +761,9 @@ << (at_it->range() == attack_type::SHORT_RANGE ? _("melee") : _("ranged")); } } - + const std::string text = details.str(); - + const std::vector<std::string> lines = utils::split(text, '\n'); SDL_Rect cur_area = area; Index: wesnoth/src/dialogs.hpp diff -u wesnoth/src/dialogs.hpp:1.33 wesnoth/src/dialogs.hpp:1.34 --- wesnoth/src/dialogs.hpp:1.33 Sat Mar 19 13:02:34 2005 +++ wesnoth/src/dialogs.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: dialogs.hpp,v 1.33 2005/03/19 13:02:34 gruikya Exp $ */ +/* $Id: dialogs.hpp,v 1.34 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -40,7 +40,7 @@ // Ask user if I should really save the game and what name I should use // returns 0 iff user wants to save the game -int get_save_name(display & disp, const std::string& caption, +int get_save_name(display & disp, const std::string& caption, const std::string& message, std::string* name, gui::DIALOG_TYPE dialog_type=gui::YES_NO); Index: wesnoth/src/display.cpp diff -u wesnoth/src/display.cpp:1.321 wesnoth/src/display.cpp:1.322 --- wesnoth/src/display.cpp:1.321 Mon May 16 22:44:19 2005 +++ wesnoth/src/display.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: display.cpp,v 1.321 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: display.cpp,v 1.322 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -173,7 +173,7 @@ if(cur_ticks < wanted_ticks) { SDL_Delay(wanted_ticks - cur_ticks); } - } + } } tod_hex_mask1.assign(NULL); @@ -267,10 +267,10 @@ const int x_mod = x % tesselation_x_size; const int y_base = y / tesselation_y_size; const int y_mod = y % tesselation_y_size; - + int x_modifier = 0; int y_modifier = 0; - + if (y_mod < tesselation_y_size / 2) { if ((x_mod * 2 + y_mod) < (s / 2)) { x_modifier = -1; @@ -282,7 +282,7 @@ x_modifier = 1; y_modifier = -1; } - + } else { if ((x_mod * 2 - (y_mod - s / 2)) < 0) { x_modifier = -1; @@ -297,7 +297,7 @@ } const gamemap::location res(x_base + x_modifier, y_base + y_modifier); - + if(nearest_hex != NULL) { const int centerx = (get_location_x(res) - map_area().x + xpos_) + hex_size()/2; const int centery = (get_location_y(res) - map_area().y + ypos_) + hex_size()/2; @@ -370,10 +370,10 @@ const int tile_width = hex_width(); topleft.x = xpos_ / tile_width; - topleft.y = (ypos_ - (is_odd(topleft.x) ? zoom_/2 : 0)) / zoom_; + topleft.y = (ypos_ - (is_odd(topleft.x) ? zoom_/2 : 0)) / zoom_; bottomright.x = (xpos_ + rect.w) / tile_width; - bottomright.y = ((ypos_ + rect.h) - (is_odd(bottomright.x) ? zoom_/2 : 0)) / zoom_; + bottomright.y = ((ypos_ + rect.h) - (is_odd(bottomright.x) ? zoom_/2 : 0)) / zoom_; if(topleft.x > -1) topleft.x--; @@ -655,7 +655,7 @@ const std::string& text = label.text(); const std::string& icon = label.icon(); SDL_Rect& loc = label.location(screen_area()); - + if(icon.empty() == false) { surface surf(image::get_image(icon,image::UNSCALED)); if(!surf.null()) { @@ -680,7 +680,7 @@ } void display::draw(bool update,bool force) -{ +{ bool changed = false; //log_scope("Drawing"); invalidate_animations(); @@ -697,7 +697,7 @@ for(std::vector<theme::label>::const_iterator i = labels.begin(); i != labels.end(); ++i) { draw_label(video(),screen,*i); } - + //invalidate the reports so they are redrawn std::fill(reports_,reports_+sizeof(reports_)/sizeof(*reports_),reports::report()); invalidateGameStatus_ = true; @@ -711,7 +711,7 @@ gamemap::location bottomright; get_visible_hex_bounds(topleft, bottomright); for(int x = topleft.x; x <= bottomright.x; ++x) - for(int y = topleft.y; y <= bottomright.y; ++y) + for(int y = topleft.y; y <= bottomright.y; ++y) draw_tile(x,y); invalidateAll_ = false; @@ -809,7 +809,7 @@ if(invalidateUnit_) { //we display the unit the mouse is over if it is over a unit //otherwise we display the unit that is selected - std::map<gamemap::location,unit>::const_iterator i = + std::map<gamemap::location,unit>::const_iterator i = find_visible_unit(units_,mouseoverHex_, map_, status_.get_time_of_day().lawful_bonus, @@ -842,7 +842,7 @@ for(size_t r = reports::STATUS_REPORTS_BEGIN; r != reports::STATUS_REPORTS_END; ++r) { draw_report(reports::TYPE(r)); - } + } } void display::draw_image_for_report(surface& img, SDL_Rect& rect) @@ -1024,7 +1024,7 @@ std::string status = _("healthy"); if(map_.on_board(loc) && - u.invisible(map_.underlying_terrain(map_[loc.x][loc.y]), + u.invisible(map_.underlying_terrain(map_[loc.x][loc.y]), status_.get_time_of_day().lawful_bonus,loc, units_,teams_)) { status = font::GOOD_TEXT + _("invisible"); @@ -1061,7 +1061,7 @@ details << _("HP: ") << u.hitpoints() << "/" << u.max_hitpoints() << "\n"; - + if(u.can_advance() == false) { details << _("XP: ") << u.experience() << "/-"; } else { @@ -1073,7 +1073,7 @@ details << _("XP: ") << u.experience() << "/" << u.max_experience(); } - + details << "\n" << _("Moves: ") << u.movement_left() << "/" << u.total_movement() @@ -1094,7 +1094,7 @@ << (at_it->range() == attack_type::SHORT_RANGE ? _("melee") : _("ranged")); - + details << "\n\n"; } @@ -1146,9 +1146,9 @@ int map_w = map_.x(), map_h = map_.y(); for(unit_map::const_iterator u = units_.begin(); u != units_.end(); ++u) { - if(fogged(u->first.x,u->first.y) || + if(fogged(u->first.x,u->first.y) || (teams_[currentTeam_].is_enemy(u->second.side()) && - u->second.invisible(map_.underlying_terrain(map_[u->first.x][u->first.y]), + u->second.invisible(map_.underlying_terrain(map_[u->first.x][u->first.y]), status_.get_time_of_day().lawful_bonus,u->first, units_,teams_))) continue; @@ -1217,7 +1217,7 @@ if(it == units_.end()) { return; } - + SDL_Rect clip_rect = map_area(); if(xpos > clip_rect.x + clip_rect.w || ypos > clip_rect.y + clip_rect.h || @@ -1277,7 +1277,7 @@ if(highlight_ratio == ftofxp(1.0)) highlight_ratio = it->second.alpha(); - if(u.invisible(map_.underlying_terrain(map_[x][y]), + if(u.invisible(map_.underlying_terrain(map_[x][y]), status_.get_time_of_day().lawful_bonus,loc, units_,teams_) && highlight_ratio > ftofxp(0.5)) { @@ -1325,8 +1325,8 @@ } if(unit_image == NULL || fogged(x,y) || - (teams_[currentTeam_].is_enemy(it->second.side()) && - it->second.invisible(map_.underlying_terrain(map_[x][y]), + (teams_[currentTeam_].is_enemy(it->second.side()) && + it->second.invisible(map_.underlying_terrain(map_[x][y]), status_.get_time_of_day().lawful_bonus,loc, units_,teams_))) { return; @@ -1476,7 +1476,7 @@ return; draw_halo_on_tile(x,y); - + const gamemap::location loc(x,y); int xpos = int(get_location_x(loc)); int ypos = int(get_location_y(loc)); @@ -1541,7 +1541,7 @@ overlays.first != overlays.second; ++overlays.first) { surface overlay_surface(image::get_image(overlays.first->second.image,image_type)); - + //note that dstrect can be changed by SDL_BlitSurface and so a //new instance should be initialized to pass to each call to //SDL_BlitSurface @@ -1577,7 +1577,7 @@ SDL_BlitSurface(fog_surface,NULL,dst,&dstrect); } } - + if(!shrouded(x,y)) { draw_terrain_on_tile(x,y,image_type,ADJACENT_FOGSHROUD); } @@ -1717,7 +1717,7 @@ } const std::string& str = text.str(); - + if(str.empty() == false) { const SDL_Rect& rect = map_area(); @@ -1762,8 +1762,8 @@ std::vector<std::string> display::get_fog_shroud_graphics(const gamemap::location& loc) { std::vector<std::string> res; - - gamemap::location adjacent[6]; + + gamemap::location adjacent[6]; get_adjacent_tiles(loc,adjacent); int tiles[6]; static const int terrain_types[] = { gamemap::FOGGED, gamemap::VOID_TERRAIN, 0 }; @@ -1871,7 +1871,7 @@ res.push_back(surface); } } - } + } return res; } @@ -1994,7 +1994,7 @@ if(submerge_height != surf->h) { surf.assign(adjust_surface_alpha(surf,ftofxp(0.2))); - + srcrect.y = submerge_height; srcrect.h = surf->h-submerge_height; y += submerge_height; @@ -2077,7 +2077,7 @@ for(size_t i = 0; i < flags_.size(); ++i) { flags_[i].update_current_frame(); - if(flags_[i].frame_changed()) + if(flags_[i].frame_changed()) animate_flags = true; } @@ -2244,8 +2244,8 @@ { for(std::vector<theme::menu>::const_iterator menu = theme_.menus().begin(); menu != theme_.menus().end(); ++menu) { - - std::vector<std::string>::const_iterator hasitem = + + std::vector<std::string>::const_iterator hasitem = std::find(menu->items().begin(), menu->items().end(), item); if(hasitem != menu->items().end()) { @@ -2321,7 +2321,7 @@ if(side >= 1) { speaker_colour = team::get_side_colour(side); } - + SDL_Color message_colour = chat_message_colour; std::stringstream str; std::stringstream message_str; Index: wesnoth/src/display.hpp diff -u wesnoth/src/display.hpp:1.103 wesnoth/src/display.hpp:1.104 --- wesnoth/src/display.hpp:1.103 Sun Apr 17 20:42:10 2005 +++ wesnoth/src/display.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: display.hpp,v 1.103 2005/04/17 20:42:10 gruikya Exp $ */ +/* $Id: display.hpp,v 1.104 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -144,12 +144,12 @@ //location of the hex that this pixel corresponds to. Returns an //invalid location is the mouse isn't over any valid location. gamemap::location hex_clicked_on(int x, int y, gamemap::location::DIRECTION* nearest_hex=NULL, gamemap::location::DIRECTION* second_nearest_hex=NULL); - + //given x,y co-ordinates of a pixel on the map, will return the //location of the hex that this pixel corresponds to. Returns an //invalid location is the mouse isn't over any valid location. gamemap::location pixel_position_to_hex(int x, int y, gamemap::location::DIRECTION* nearest_hex=NULL, gamemap::location::DIRECTION* second_nearest_hex=NULL); - + //given x,y co-ordinates of the mouse, will return the location of the //hex in the minimap that the mouse is currently over, or an invalid //location if the mouse isn't over the minimap. @@ -331,7 +331,7 @@ //submerged: the amount of the unit out of 1.0 that is submerged // (presumably under water) and thus shouldn't be drawn void draw_unit(int x, int y, surface image, - bool upside_down=false,fixed_t alpha=ftofxp(1.0), + bool upside_down=false,fixed_t alpha=ftofxp(1.0), Uint32 blendto=0, double blend_ratio=0, double submerged=0.0, surface ellipse_back=surface(NULL), @@ -341,7 +341,7 @@ void rebuild_terrain(const gamemap::location &location); //rebuild all dynamic terrain. void rebuild_all(); - + //Add a location to highlight. Note that this has nothing to do with //selecting hexes, it is pure highlighting. These hexes will be //highlighted slightly darker than the currently selected hex. @@ -459,7 +459,7 @@ theme theme_; terrain_builder builder_; - + void create_buttons(); std::vector<gui::button> buttons_; Index: wesnoth/src/editor/editor.cpp diff -u wesnoth/src/editor/editor.cpp:1.104 wesnoth/src/editor/editor.cpp:1.105 --- wesnoth/src/editor/editor.cpp:1.104 Fri Apr 29 19:41:57 2005 +++ wesnoth/src/editor/editor.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -81,7 +81,7 @@ config map_editor::hotkeys_; // Do not init the l_button_func_ to DRAW, since it should be changed in // the constructor to update the report the first time. -map_editor::LEFT_BUTTON_FUNC map_editor::l_button_func_ = PASTE; +map_editor::LEFT_BUTTON_FUNC map_editor::l_button_func_ = PASTE; gamemap::TERRAIN map_editor::old_fg_terrain_; gamemap::TERRAIN map_editor::old_bg_terrain_; int map_editor::old_brush_size_; @@ -214,7 +214,7 @@ const SDL_Rect& rect = gui_.map_area(); const int centerx = (rect.x + rect.w) / 2; const int centery = (rect.y + rect.h) / 2; - + const int xdisp = mousex - centerx; const int ydisp = mousey - centery; gui_.scroll(xdisp, ydisp); @@ -224,13 +224,13 @@ if (point_in_rect(mousex, mousey, gui_.map_area())) { const int speed = preferences::scroll_speed() * (button == SDL_BUTTON_WHEELUP ? -1 : 1); - + const int centerx = gui_.mapx() / 2; const int centery = gui_.y() / 2; - + const int xdisp = abs(centerx - mousex); const int ydisp = abs(centery - mousey); - + if(xdisp > ydisp) gui_.scroll(speed,0); else @@ -297,7 +297,7 @@ } } } - + void map_editor::edit_save_as() { const std::string default_dir = @@ -335,8 +335,8 @@ _("Which player should start here?"), gui::OK_CANCEL, &players); if (res >= 0) { - res++; - if (res == num_players) res = 0; + res++; + if (res == num_players) res = 0; set_starting_position(res, selected_hex_); } } @@ -374,7 +374,7 @@ void map_editor::edit_new_map() { const std::string map = new_map_dialog(gui_, palette_.selected_bg_terrain(), changed_since_save(), game_config_); - if (map != "") { + if (map != "") { num_operations_since_save_ = 0; clear_undo_actions(); throw new_map_exception(map); @@ -988,7 +988,7 @@ // TODO evaluate if this is what is the smartest thing to do. draw_on_mouseover_hexes(palette_.selected_bg_terrain()); } - + void map_editor::middle_button_down(const int mousex, const int mousey) { const gamemap::location& minimap_loc = gui_.minimap_location_on(mousex,mousey); const gamemap::location hex = gui_.hex_clicked_on(mousex, mousey); @@ -1218,7 +1218,7 @@ const int y = menu_loc.y + menu_loc.h + 1; show_menu(m->items(), x, y, false); } - + if(key_[SDLK_UP] || mousey == 0) { gui_.scroll(0,-scroll_speed); } @@ -1231,7 +1231,7 @@ if(key_[SDLK_RIGHT] || mousex == gui_.x()-1) { gui_.scroll(scroll_speed,0); } - + if (l_button_down) { left_button_down(mousex, mousey); } Index: wesnoth/src/editor/editor.hpp diff -u wesnoth/src/editor/editor.hpp:1.42 wesnoth/src/editor/editor.hpp:1.43 --- wesnoth/src/editor/editor.hpp:1.42 Sat Mar 5 19:03:56 2005 +++ wesnoth/src/editor/editor.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -35,22 +35,22 @@ public: map_editor(display &gui, gamemap &map, config &theme, config &game_config); virtual ~map_editor(); - + /// Enter the main loop. The loop runs until set_abort() is called /// to set an abort mode which makes the loop exit. void main_loop(); - - /// Set the filename that map should be saved as. + + /// Set the filename that map should be saved as. void set_file_to_save_as(const std::string); /// How to abort the map editor. /// DONT_ABORT is set during normal operation. /// When ABORT_NORMALLY is set, the editor asks for confirmation and - /// if save is desired before it exits. + /// if save is desired before it exits. /// When ABORT_HARD is set, the editor exists without asking any /// questions or saving. enum ABORT_MODE {DONT_ABORT, ABORT_NORMALLY, ABORT_HARD}; - + /// Set the abort flag, which indicates if the editor should exit in /// some way after the current iteration of the main loop. void set_abort(const ABORT_MODE abort=ABORT_NORMALLY); @@ -69,14 +69,14 @@ /// the map. Show a message if the load failed. Throw /// load_map_exception if the file could not be loaded. std::string load_map(const std::string filename); - + virtual void handle_event(const SDL_Event &event); - + /// Handle a keyboard event. mousex and mousey is the current /// position of the mouse. void handle_keyboard_event(const SDL_KeyboardEvent &event, const int mousex, const int mousey); - + /// Handle a mouse button event. mousex and mousey is the current /// position of the mouse. void handle_mouse_button_event(const SDL_MouseButtonEvent &event, @@ -85,10 +85,10 @@ /// Return true if the map has changed since the last time it was /// saved. bool changed_since_save() const; - + /// Recalculate layout and redraw everything. void redraw_everything(); - + // Methods inherited from command_executor. Used to perform // operations on menu/hotkey commands. virtual void toggle_grid(); @@ -122,7 +122,7 @@ void perform_set_starting_pos(); virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command) const; - + /// Exception thrown when new map is to be loaded. struct new_map_exception { new_map_exception(const std::string &map, const std::string filename="") @@ -130,7 +130,7 @@ const std::string new_map; const std::string new_filename; }; - + private: /// What to perform while the left button is held down. enum LEFT_BUTTON_HELD_FUNC {DRAW_TERRAIN, ADD_SELECTION, REMOVE_SELECTION, @@ -146,42 +146,42 @@ /// Handle a left click on the location. void left_click(const gamemap::location loc); - + /// Called in every iteration when the right mouse button is held /// down. Note that this differs from a click. void right_button_down(const int mousex, const int mousey); /// Handle a right click on the location. void right_click(const gamemap::location loc); - + /// Called in every iteration when the middle mouse button is held /// down. Note that this differs from a click. void middle_button_down(const int mousex, const int mousey); - + /// Confirm that exiting is desired and ask for saving of the map. /// Return true if exit is confirmed and the save is successful or not /// wanted. Return false if exit is cancelled or the requested save /// failed. bool confirm_exit_and_save(); - + /// Set the starting position for the given player to the location /// given. void set_starting_position(const int player, const gamemap::location loc); - + /// Display a menu with given items and at the given location. void show_menu(const std::vector<std::string>& items_arg, const int xloc, const int yloc, const bool context_menu=false); - + /// Pass the command onto the hotkey handling system. Quit requests /// are intercepted because the editor does not want the default /// behavior of those. void execute_command(const hotkey::HOTKEY_COMMAND command); - + /// Draw terrain at a location. The operation is saved in the undo /// stack. Update the map to reflect the change. void draw_terrain(const gamemap::TERRAIN terrain, const gamemap::location hex); - + ///////////////////////////////////////////////////////////////////// // NOTE: after any terrain has changed, one of the invalidate // @@ -243,7 +243,7 @@ map_undo_action &undo_action); void terrain_changed(const std::set<gamemap::location> &hexes, map_undo_action &undo_action); - + /// Save an action so that it may be undone. Add an operation to the /// number done since save. void save_undo_action(const map_undo_action &action); @@ -324,7 +324,7 @@ static gamemap::TERRAIN old_fg_terrain_, old_bg_terrain_; static int old_brush_size_; bool all_hexes_selected_; - + }; } Index: wesnoth/src/editor/editor_dialogs.cpp diff -u wesnoth/src/editor/editor_dialogs.cpp:1.30 wesnoth/src/editor/editor_dialogs.cpp:1.31 --- wesnoth/src/editor/editor_dialogs.cpp:1.30 Mon Apr 25 11:33:23 2005 +++ wesnoth/src/editor/editor_dialogs.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -86,7 +86,7 @@ width_rect.x = text_right - width_rect.w; height_rect.x = text_right - height_rect.w; - + width_rect.y = ypos + title_rect.h + vertical_margin*2; height_rect.y = width_rect.y + width_rect.h + vertical_margin; @@ -98,7 +98,7 @@ new_map_button.set_location(xpos + horz_margin,height_rect.y + height_rect.h + vertical_margin); random_map_button.set_location(xpos + horz_margin,ypos + height - random_map_button.height()-14*2-vertical_margin); random_map_setting_button.set_location(random_map_button.location().x + random_map_button.width() + horz_margin, - ypos + height - random_map_setting_button.height() + ypos + height - random_map_setting_button.height() - 14*2 - vertical_margin); cancel_button.set_location(xpos + width - cancel_button.width() - horz_margin, ypos + height - cancel_button.height()-14); @@ -123,7 +123,7 @@ height_slider.set_max(map_max_height); height_slider.set_value(map_height); - static util::scoped_ptr<map_generator> random_map_generator(NULL); + static util::scoped_ptr<map_generator> random_map_generator(NULL); if (random_map_generator == NULL) { // Initialize the map generator if this is the first call, // otherwise keep the settings and such. @@ -173,7 +173,7 @@ if ((confirmation_needed && confirm_modification_disposal(disp)) || !confirmation_needed) { - + const std::string map = random_map_generator.get()->create_map(std::vector<std::string>()); if (map == "") { @@ -199,17 +199,17 @@ width_label,width_rect.x,width_rect.y); font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR, height_label,height_rect.x,height_rect.y); - + std::stringstream width_str; width_str << map_width; font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR,width_str.str(), slider_right+horz_margin,width_rect.y); - + std::stringstream height_str; height_str << map_height; font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR,height_str.str(), slider_right+horz_margin,height_rect.y); - + } new_map_button.set_dirty(); @@ -236,7 +236,7 @@ void preferences_dialog(display &disp, config &prefs) { const events::event_context dialog_events_context; const gui::dialog_manager dialog_mgr; - + const int width = 600; const int height = 200; const int xpos = disp.x()/2 - width/2; @@ -326,7 +326,7 @@ scroll_slider.set_dirty(); font::draw_text(&disp.video(),clip_rect,14,font::NORMAL_COLOUR,scroll_label, - scroll_rect.x,scroll_rect.y); + scroll_rect.x,scroll_rect.y); update_rect(screen_area()); @@ -400,7 +400,7 @@ width_rect.x = text_right - width_rect.w; height_rect.x = text_right - height_rect.w; - + width_rect.y = ypos + title_rect.h + vertical_margin*2; height_rect.y = width_rect.y + width_rect.h + vertical_margin; @@ -409,7 +409,7 @@ cancel_button.set_location(xpos + width - cancel_button.width() - horz_margin, ypos + height - cancel_button.height()-14); - + ok_button.set_location(xpos + width - cancel_button.width() - horz_margin - ok_button.width() - button_padding, ypos + height - ok_button.height()-14); @@ -452,17 +452,17 @@ width_label,width_rect.x,width_rect.y); font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR, height_label,height_rect.x,height_rect.y); - + std::stringstream width_str; width_str << map_width; font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR,width_str.str(), slider_right+horz_margin,width_rect.y); - + std::stringstream height_str; height_str << map_height; font::draw_text(&disp.video(),screen_area(),14,font::NORMAL_COLOUR,height_str.str(), slider_right+horz_margin,height_rect.y); - + } if (ok_button.pressed()) { return std::make_pair((unsigned)map_width, (unsigned)map_height); Index: wesnoth/src/editor/editor_dialogs.hpp diff -u wesnoth/src/editor/editor_dialogs.hpp:1.9 wesnoth/src/editor/editor_dialogs.hpp:1.10 --- wesnoth/src/editor/editor_dialogs.hpp:1.9 Sun May 30 14:38:30 2004 +++ wesnoth/src/editor/editor_dialogs.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/editor/editor_layout.cpp diff -u wesnoth/src/editor/editor_layout.cpp:1.4 wesnoth/src/editor/editor_layout.cpp:1.5 --- wesnoth/src/editor/editor_layout.cpp:1.4 Sun May 30 22:17:42 2004 +++ wesnoth/src/editor/editor_layout.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/editor/editor_layout.hpp diff -u wesnoth/src/editor/editor_layout.hpp:1.3 wesnoth/src/editor/editor_layout.hpp:1.4 --- wesnoth/src/editor/editor_layout.hpp:1.3 Sun May 16 21:23:50 2004 +++ wesnoth/src/editor/editor_layout.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -36,7 +36,7 @@ /// Adjust the internal size specifications to fit the display. void adjust_sizes(const display &disp, size_specs &sizes); - + } Index: wesnoth/src/editor/editor_main.cpp diff -u wesnoth/src/editor/editor_main.cpp:1.33 wesnoth/src/editor/editor_main.cpp:1.34 --- wesnoth/src/editor/editor_main.cpp:1.33 Sun Apr 17 18:53:11 2005 +++ wesnoth/src/editor/editor_main.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -51,25 +51,25 @@ continue; } - if(val == "--help" || val == "-h") { - std::cout << "usage: " << argv[0] - << " [options] [map]\n" - << " -f, --fullscreen Runs the game in full-screen\n" - << " -h, --help Prints this message and exits\n" - << " --path Prints the name of the game data directory and exits\n" - << " -w, --windowed Runs the game in windowed mode\n" - << " -v, --version Prints the game's version number and exits\n" - << " --resolution Set the resolution of the window\n" - << " --datadir Select the data directory to use\n"; - return 0; - } else if(val == "--version" || val == "-v") { - std::cout << "Battle for Wesnoth " << game_config::version - << "\n"; - return 0; - } else if(val == "--path") { - std::cout << game_config::path - << "\n"; - return 0; + if(val == "--help" || val == "-h") { + std::cout << "usage: " << argv[0] + << " [options] [map]\n" + << " -f, --fullscreen Runs the game in full-screen\n" + << " -h, --help Prints this message and exits\n" + << " --path Prints the name of the game data directory and exits\n" + << " -w, --windowed Runs the game in windowed mode\n" + << " -v, --version Prints the game's version number and exits\n" + << " --resolution Set the resolution of the window\n" + << " --datadir Select the data directory to use\n"; + return 0; + } else if(val == "--version" || val == "-v") { + std::cout << "Battle for Wesnoth " << game_config::version + << "\n"; + return 0; + } else if(val == "--path") { + std::cout << game_config::path + << "\n"; + return 0; } } @@ -156,47 +156,47 @@ image::set_wm_icon(); int video_flags = preferences::fullscreen() ? FULL_SCREEN : 0; std::pair<int,int> resolution = preferences::resolution(); - + std::cerr << "checking mode possible...\n"; const int bpp = video.modePossible(resolution.first,resolution.second,16,video_flags); - + std::cerr << bpp << "\n"; - + if(bpp == 0) { //Video mode not supported, maybe from bad prefs. std::cerr << "The video mode, " << resolution.first << "x" << resolution.second << "x16 " << "is not supported\nAttempting 1024x768x16...\n"; - + //Attempt 1024x768. resolution.first = 1024; resolution.second = 768; - + int bpp = video.modePossible(resolution.first,resolution.second,16,video_flags); - + if(bpp == 0) { //Attempt 1024x768. resolution.first = 1024; resolution.second = 768; std::cerr << "1024x768x16 is not possible.\nAttempting 800x600x16...\n"; - + resolution.first = 800; resolution.second = 600; - + bpp = video.modePossible(resolution.first,resolution.second,16,video_flags); } - + if(bpp == 0) { //couldn't do 1024x768 or 800x600 - + std::cerr << "The required video mode, " << resolution.first << "x" << resolution.second << "x16 " << "is not supported\n"; - + return 0; } } - + std::cerr << "setting mode to " << resolution.first << "x" << resolution.second << "\n"; const int res = video.setMode(resolution.first,resolution.second,bpp,video_flags); video.setBpp(bpp); @@ -244,7 +244,7 @@ mapdata += "gggggggggggggggggggg\n"; } } - + srand(time(NULL)); bool done = false; gamestatus status(cfg, 0); @@ -269,7 +269,7 @@ const config dummy_cfg; display gui(units, video, map, status, teams, *theme_cfg, cfg, dummy_cfg); - + map_editor::map_editor editor(gui, map, *theme_cfg, cfg); editor.set_file_to_save_as(filename); editor.main_loop(); Index: wesnoth/src/editor/editor_palettes.cpp diff -u wesnoth/src/editor/editor_palettes.cpp:1.27 wesnoth/src/editor/editor_palettes.cpp:1.28 --- wesnoth/src/editor/editor_palettes.cpp:1.27 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/editor/editor_palettes.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -321,11 +321,11 @@ } // void terrain_palette::bg_backup() { -// restorer_ = surface_restorer(&gui_.video(), get_rect()); +// restorer_ = surface_restorer(&gui_.video(), get_rect()); // } // void terrain_palette::bg_restore() { -// restorer_.restore(); +// restorer_.restore(); // } brush_bar::brush_bar(display &gui, const size_specs &sizes) @@ -348,7 +348,7 @@ assert(new_size > 0 && new_size <= total_brush_); selected_ = new_size - 1; } - + void brush_bar::left_mouse_click(const int mousex, const int mousey) { int index = selected_index(mousex, mousey); if(index >= 0) { @@ -418,7 +418,7 @@ dstrect.w = image->w; dstrect.h = image->h; SDL_BlitSurface(image, NULL, screen, &dstrect); - const Uint32 color = (unsigned)i == selected_brush_size() ? + const Uint32 color = (unsigned)i == selected_brush_size() ? SDL_MapRGB(screen->format,0xFF,0x00,0x00) : SDL_MapRGB(screen->format,0x00,0x00,0x00); draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, color, screen); Index: wesnoth/src/editor/editor_palettes.hpp diff -u wesnoth/src/editor/editor_palettes.hpp:1.7 wesnoth/src/editor/editor_palettes.hpp:1.8 --- wesnoth/src/editor/editor_palettes.hpp:1.7 Thu Mar 10 13:46:22 2005 +++ wesnoth/src/editor/editor_palettes.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -47,8 +47,8 @@ gamemap::TERRAIN selected_fg_terrain() const; /// Return the currently selected background terrain. gamemap::TERRAIN selected_bg_terrain() const; - - + + /// Select a foreground terrain. void select_fg_terrain(gamemap::TERRAIN); void select_bg_terrain(gamemap::TERRAIN); @@ -59,7 +59,7 @@ virtual void draw(); virtual void handle_event(const SDL_Event& event); void set_dirty(bool dirty=true); - + /// Return the number of terrains in the palette. size_t num_terrains() const; @@ -104,7 +104,7 @@ brush_bar(display &gui, const size_specs &sizes); /// Return the size of currently selected brush. - unsigned int selected_brush_size(); + unsigned int selected_brush_size(); /// Select a brush size. void select_brush_size(int new_size); @@ -123,12 +123,12 @@ /// To be called when a mouse click occurs. Check if the coordinates /// is a terrain that may be chosen, select the terrain if that is /// the case. - void left_mouse_click(const int mousex, const int mousey); + void left_mouse_click(const int mousex, const int mousey); /// Return the index of the brush that is at coordinates (x, y) in the /// panel. int selected_index(const int x, const int y) const; - + const size_specs &size_specs_; display &gui_; unsigned int selected_; Index: wesnoth/src/editor/editor_undo.cpp diff -u wesnoth/src/editor/editor_undo.cpp:1.3 wesnoth/src/editor/editor_undo.cpp:1.4 --- wesnoth/src/editor/editor_undo.cpp:1.3 Mon May 17 22:43:07 2004 +++ wesnoth/src/editor/editor_undo.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -39,7 +39,7 @@ const std::set<gamemap::location> map_undo_action::undo_selection() const { return old_selection_; } - + const std::set<gamemap::location> map_undo_action::redo_selection() const { return new_selection_; } Index: wesnoth/src/editor/editor_undo.hpp diff -u wesnoth/src/editor/editor_undo.hpp:1.3 wesnoth/src/editor/editor_undo.hpp:1.4 --- wesnoth/src/editor/editor_undo.hpp:1.3 Mon May 17 22:43:07 2004 +++ wesnoth/src/editor/editor_undo.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -28,10 +28,10 @@ class map_undo_action { public: map_undo_action(); - - const std::map<gamemap::location,gamemap::TERRAIN>& undo_terrains() const; - const std::map<gamemap::location,gamemap::TERRAIN>& redo_terrains() const; - + + const std::map<gamemap::location,gamemap::TERRAIN>& undo_terrains() const; + const std::map<gamemap::location,gamemap::TERRAIN>& redo_terrains() const; + const std::set<gamemap::location> undo_selection() const; const std::set<gamemap::location> redo_selection() const; @@ -40,7 +40,7 @@ const std::map<gamemap::location, int>& undo_starting_locations() const; const std::map<gamemap::location, int>& redo_starting_locations() const; - + void add_terrain(const gamemap::TERRAIN& old_tr, const gamemap::TERRAIN& new_tr, const gamemap::location& lc); @@ -48,7 +48,7 @@ /// Return true if a terrain change has been saved in this undo /// action. bool terrain_set() const; - + void set_selection(const std::set<gamemap::location> &old_selection, const std::set<gamemap::location> &new_selection); @@ -66,7 +66,7 @@ void add_starting_location(const int old_side, const int new_side, const gamemap::location &old_loc, const gamemap::location &new_loc); - + /// Return true if starting locations have been saved in this undo /// action. bool starting_location_set() const; @@ -85,9 +85,9 @@ std::map<gamemap::location,int> new_starting_locations_; bool starting_locations_set_; }; - + typedef std::deque<map_undo_action> map_undo_list; - + /// Add an undo action to the undo stack. Resize the stack if it gets /// larger than the maximum size. Add an operation to the number done /// since save. If keep_selection is true, it indicates that the @@ -111,7 +111,7 @@ /// Clear all stored information about performed actions. void clear_undo_actions(); - + } Index: wesnoth/src/editor/map_manip.cpp diff -u wesnoth/src/editor/map_manip.cpp:1.8 wesnoth/src/editor/map_manip.cpp:1.9 --- wesnoth/src/editor/map_manip.cpp:1.8 Sun Feb 20 21:45:22 2005 +++ wesnoth/src/editor/map_manip.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -23,7 +23,7 @@ #include <set> namespace { - + // Grow the map, represented by lines, one step. If grow_height is // true, the height is increased and every other column is shifted // one step downwards. Otherwise the map is increased in width one @@ -268,6 +268,6 @@ } return res; } - + } Index: wesnoth/src/editor/map_manip.hpp diff -u wesnoth/src/editor/map_manip.hpp:1.5 wesnoth/src/editor/map_manip.hpp:1.6 --- wesnoth/src/editor/map_manip.hpp:1.5 Fri May 28 17:07:46 2004 +++ wesnoth/src/editor/map_manip.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/events.cpp diff -u wesnoth/src/events.cpp:1.27 wesnoth/src/events.cpp:1.28 --- wesnoth/src/events.cpp:1.27 Fri Dec 31 21:01:37 2004 +++ wesnoth/src/events.cpp Sat Jun 4 19:16:05 2005 @@ -94,7 +94,7 @@ } else { focused_handler = -1; } - + return true; } @@ -191,7 +191,7 @@ } const int index = event_contexts.back().focused_handler; - + //if no-one has focus at the moment, this handler obviously wants //focus, so give it to it. if(index == -1) { @@ -244,7 +244,7 @@ break; } - + case SDL_MOUSEMOTION: { //always make sure a cursor is displayed if the //mouse moves or if the user clicks @@ -287,7 +287,7 @@ break; } - + #if defined(_X11) && !defined(__APPLE__) case SDL_SYSWMEVENT: { //clipboard support for X11 Index: wesnoth/src/filechooser.cpp diff -u wesnoth/src/filechooser.cpp:1.9 wesnoth/src/filechooser.cpp:1.10 --- wesnoth/src/filechooser.cpp:1.9 Sat Apr 16 19:43:47 2005 +++ wesnoth/src/filechooser.cpp Sat Jun 4 19:16:05 2005 @@ -47,7 +47,7 @@ fc.set_width(width - left_padding - right_padding); fc.set_height(height - top_padding - bot_padding); fc.set_dirty(true); - + events::raise_draw_event(); disp.flip(); disp.invalidate_all(); Index: wesnoth/src/filesystem.cpp diff -u wesnoth/src/filesystem.cpp:1.72 wesnoth/src/filesystem.cpp:1.73 --- wesnoth/src/filesystem.cpp:1.72 Sun May 22 23:37:43 2005 +++ wesnoth/src/filesystem.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: filesystem.cpp,v 1.72 2005/05/22 23:37:43 ott Exp $ */ +/* $Id: filesystem.cpp,v 1.73 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -96,7 +96,7 @@ } else LOG_FS << "skipping invalid entry\n"; } - + } } #endif @@ -151,7 +151,7 @@ else #endif { - + //if we have a path to find directories in, then convert relative //pathnames to be rooted on the wesnoth path if(!directory.empty() && directory[0] != '/' && !game_config::path.empty()){ @@ -738,12 +738,12 @@ } std::vector<std::string>& res = binary_paths_cache[type]; - + init_binary_paths(); for(std::set<std::string>::const_iterator i = binary_paths.begin(); i != binary_paths.end(); ++i) { res.push_back(get_user_data_dir() + "/" + *i + type + "/"); - + if(!game_config::path.empty()) { res.push_back(game_config::path + "/" + *i + type + "/"); } Index: wesnoth/src/filesystem.hpp diff -u wesnoth/src/filesystem.hpp:1.36 wesnoth/src/filesystem.hpp:1.37 --- wesnoth/src/filesystem.hpp:1.36 Sun Apr 17 20:42:10 2005 +++ wesnoth/src/filesystem.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: filesystem.hpp,v 1.36 2005/04/17 20:42:10 gruikya Exp $ */ +/* $Id: filesystem.hpp,v 1.37 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/font.cpp diff -u wesnoth/src/font.cpp:1.144 wesnoth/src/font.cpp:1.145 --- wesnoth/src/font.cpp:1.144 Fri Jun 3 19:15:28 2005 +++ wesnoth/src/font.cpp Sat Jun 4 19:16:05 2005 @@ -1,8 +1,8 @@ -/* $Id: font.cpp,v 1.144 2005/06/03 19:15:28 j_daniel Exp $ */ +/* $Id: font.cpp,v 1.145 2005/06/04 19:16:05 ott Exp $ */ /* vim:set encoding=utf-8: */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -83,10 +83,10 @@ text_chunk(subset_id subset, std::string const & text) : subset(subset), text(text) {} text_chunk(subset_id subset, ucs2_string const & ucs2_text) : subset(subset), ucs2_text(ucs2_text) {} text_chunk(subset_id subset, std::string const & text, ucs2_string const & ucs2_text) : subset(subset), text(text), ucs2_text(ucs2_text) {} - + bool operator==(text_chunk const & t) const { return subset == t.subset && ucs2_text == t.ucs2_text; } bool operator!=(text_chunk const & t) const { return !operator==(t); } - + subset_id subset; //FIXME if we don't need the utf8 here remove it std::string text; @@ -115,8 +115,8 @@ current_chunk.subset = font_map[size_t(*ch)]; } for(utils::utf8_iterator end = utils::utf8_iterator::end(utf8_text); ch != end; ++ch) { - if(size_t(*ch) < font_map.size() && - font_map[size_t(*ch)] >= 0 && + if(size_t(*ch) < font_map.size() && + font_map[size_t(*ch)] >= 0 && font_map[size_t(*ch)] != current_chunk.subset) { //null-terminate ucs2_text so we can pass it to SDL_ttf later current_chunk.ucs2_text.push_back(0); @@ -240,7 +240,7 @@ //according to the SDL_ttf documentation, combinations of //styles may cause SDL_ttf to segfault. We work around this //here by disallowing combinations of styles - + if((style&TTF_STYLE_UNDERLINE) != 0) { //style = TTF_STYLE_NORMAL; //TTF_STYLE_UNDERLINE; style = TTF_STYLE_UNDERLINE; @@ -249,7 +249,7 @@ } else if((style&TTF_STYLE_ITALIC) != 0) { //style = TTF_STYLE_NORMAL; //TTF_STYLE_ITALIC; style = TTF_STYLE_ITALIC; - } + } #endif TTF_SetFontStyle(font_, style); @@ -303,7 +303,7 @@ font_names.push_back(itor->name); std::vector<std::pair<size_t,size_t> >::const_iterator cp_range; - for(cp_range = itor->present_codepoints.begin(); + for(cp_range = itor->present_codepoints.begin(); cp_range != itor->present_codepoints.end(); ++cp_range) { size_t cp_max = maximum<size_t>(cp_range->first, cp_range->second); @@ -311,7 +311,7 @@ font_map.resize(cp_max+1, -1); } for(size_t cp = cp_range->first; cp <= cp_range->second; ++cp) { - if(font_map[cp] < 0) + if(font_map[cp] < 0) font_map[cp] = subset; } } @@ -349,7 +349,7 @@ std::vector<surface> const & get_surfaces() const; bool operator==(text_surface const &t) const { - return hash_ == t.hash_ && font_size_ == t.font_size_ + return hash_ == t.hash_ && font_size_ == t.font_size_ && color_ == t.color_ && style_ == t.style_ && str_ == t.str_; } bool operator!=(text_surface const &t) const { return !operator==(t); } @@ -399,8 +399,8 @@ { w_ = 0; h_ = 0; - - for(std::vector<text_chunk>::iterator itor = chunks_.begin(); + + for(std::vector<text_chunk>::iterator itor = chunks_.begin(); itor != chunks_.end(); ++itor) { TTF_Font* ttfont = get_font(font_id(itor->subset, font_size_)); @@ -414,7 +414,7 @@ if(itor->ucs2_text.back() != 0) { itor->ucs2_text.push_back(0); } - + TTF_SizeUNICODE(ttfont, (Uint16 const *)&(itor->ucs2_text.front()), &w, &h); w_ += w; h_ = maximum<int>(h_, h); @@ -434,7 +434,7 @@ size_t text_surface::height() const { if (h_ == -1) { - if(chunks_.empty()) + if(chunks_.empty()) chunks_ = split_text(str_); measure(); } @@ -453,13 +453,13 @@ if(width() > max_text_line_width) return surfs_; - for(std::vector<text_chunk>::const_iterator itor = chunks_.begin(); + for(std::vector<text_chunk>::const_iterator itor = chunks_.begin(); itor != chunks_.end(); ++itor) { TTF_Font* ttfont = get_font(font_id(itor->subset, font_size_)); if (ttfont == NULL) continue; font_style_setter const style_setter(ttfont, style_); - + surface s = surface(TTF_RenderUNICODE_Blended(ttfont, (Uint16 const *)&(itor->ucs2_text.front()), color_)); if(!s.null()) surfs_.push_back(s); @@ -639,7 +639,7 @@ //length restriction and small font size. SDL_Rect measure_ucs2_text_line(ucs2_string::const_iterator first, ucs2_string::const_iterator last, int font_size, int style) { wassert(last - first >= 0); - + SDL_Rect rect; rect.w = 0; rect.h = 0; @@ -654,7 +654,7 @@ if(*first < font_map.size() && font_map[*first] >= 0) { current_font = font_map[*first]; } - + for(;first != last; ++first) { if(*first < font_map.size() && font_map[*first] >= 0 && font_map[*first] != current_font) { TTF_Font* ttfont = get_font(font_id(current_font, font_size)); @@ -665,16 +665,16 @@ continue; } *(chunk_itor++) = 0; - + font_style_setter const style_setter(ttfont, style); TTF_SizeUNICODE(ttfont, (Uint16 const *)&chunk.front(), (int*)&rect.x, (int*)&rect.y); rect.w += rect.x; rect.h = maximum<Sint16>(rect.h, rect.y); - + chunk_itor = chunk.begin(); - + current_font = font_map[*first]; } *(chunk_itor++) = *first; @@ -736,7 +736,7 @@ if(line_width(text, size) > area.w) { tooltips::add_tooltip(dest,text); } - + if(dest.x + dest.w > area.x + area.w) { dest.w = area.x + area.w - dest.x; } @@ -764,13 +764,13 @@ int x, int y, bool use_tooltips, int style) { surface surface; - + if(gui == NULL) { surface = NULL; } else { surface = gui->getSurface(); } - + return draw_text_line(surface, area, size, colour, text, x, y, use_tooltips, style); } @@ -866,7 +866,7 @@ if (text.length() > 0 && text[0] == ' ') { return text.substr(1); } - + return text; } @@ -959,7 +959,7 @@ ch == 0x30e3 || ch == 0x30e5 || ch == 0x30e7 || ch == 0x30ee || ch == 0x30f5 || ch == 0x30f6 || ch == 0x30fb || ch == 0x30fc || ch == 0x30fd || ch == 0x30fe || ch == 0xff01 || ch == 0xff09 || ch == 0xff0c || ch == 0xff0e || ch == 0xff1a || - ch == 0xff1b || ch == 0xff1f || ch == 0xff3d || ch == 0xff5d; + ch == 0xff1b || ch == 0xff1f || ch == 0xff3d || ch == 0xff5d; } inline bool break_before(wchar_t ch) @@ -967,7 +967,7 @@ if(no_break_before(ch)) return false; - return ch == ' ' || + return ch == ' ' || // CKJ characters (ch >= 0x3000 && ch < 0xa000) || (ch >= 0xf900 && ch < 0xfb00) || @@ -979,7 +979,7 @@ if(no_break_after(ch)) return false; - return ch == ' ' || + return ch == ' ' || // CKJ characters (ch >= 0x3000 && ch < 0xa000) || (ch >= 0xf900 && ch < 0xfb00) || @@ -1028,7 +1028,7 @@ *ch != ' ' && *ch != '\n'; ++ch) { if(!current_word.empty() && - break_before(*ch) && + break_before(*ch) && !no_break_after(previous)) break; @@ -1097,12 +1097,12 @@ std::string make_text_ellipsis(const std::string &text, int font_size, int max_width) { static const std::string ellipsis = "..."; - + if(line_width(text, font_size) <= max_width) return text; if(line_width(ellipsis, font_size) > max_width) return ""; - + std::string current_substring; utils::utf8_iterator itor(text); @@ -1115,7 +1115,7 @@ if (line_width(tmp, font_size) > max_width) { return current_substring + ellipsis; } - + current_substring.append(itor.substr().first, itor.substr().second); } @@ -1472,12 +1472,12 @@ } namespace { - bool add_font_to_fontlist(config* fonts_config, std::vector<font::subset_descriptor>& fontlist, const std::string& name) + bool add_font_to_fontlist(config* fonts_config, std::vector<font::subset_descriptor>& fontlist, const std::string& name) { config* font = fonts_config->find_child("font", "name", name); if(font == NULL) return false; - + fontlist.push_back(font::subset_descriptor()); fontlist.back().name = name; std::vector<std::string> ranges = utils::split((*font)["codepoints"]); Index: wesnoth/src/font.hpp diff -u wesnoth/src/font.hpp:1.57 wesnoth/src/font.hpp:1.58 --- wesnoth/src/font.hpp:1.57 Tue May 17 22:19:40 2005 +++ wesnoth/src/font.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: font.hpp,v 1.57 2005/05/17 22:19:40 ydirson Exp $ */ +/* $Id: font.hpp,v 1.58 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -71,7 +71,7 @@ SIZE_PLUS = relative_size(16), SIZE_LARGE = relative_size(18), SIZE_XLARGE = relative_size(24) - ; + ; //function to draw text on the screen. The text will be clipped to area. //If the text runs outside of area horizontally, an ellipsis will be displayed //at the end of it. If use_tooltips is true, then text with an ellipsis will @@ -104,7 +104,7 @@ // Returns the maximum height of a font, in pixels int get_max_height(int size); - + bool is_format_char(char c); /// @@ -130,7 +130,7 @@ /// If the text excedes the specified max width, end it with an ellipsis (...) /// std::string make_text_ellipsis(const std::string& text, int font_size, int max_width); - + /// /// Draw text on the screen. This method makes sure that the text @@ -140,7 +140,7 @@ /// but it doesn't support special markup or tooltips. /// /// @return a bounding rectangle of the text. -/// +/// SDL_Rect draw_wrapped_text(CVideo* gui, const SDL_Rect& area, int font_size, const SDL_Color& colour, const std::string& text, int x, int y, int max_width); @@ -171,7 +171,7 @@ int add_floating_label(const std::string& text, int font_size, const SDL_Color& colour, double xpos, double ypos, double xmove, double ymove, int lifetime, const SDL_Rect& clip_rect, ALIGN alignment=CENTER_ALIGN, - const SDL_Color* bg_colour=NULL, int border_size=0, + const SDL_Color* bg_colour=NULL, int border_size=0, LABEL_SCROLL_MODE scroll_mode=ANCHOR_LABEL_SCREEN); /// moves the floating label given by 'handle' by (xmove,ymove) Index: wesnoth/src/game.cpp diff -u wesnoth/src/game.cpp:1.251 wesnoth/src/game.cpp:1.252 --- wesnoth/src/game.cpp:1.251 Sat Jun 4 04:05:42 2005 +++ wesnoth/src/game.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: game.cpp,v 1.251 2005/06/04 04:05:42 Sirp Exp $ */ +/* $Id: game.cpp,v 1.252 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -46,7 +46,7 @@ #include "show_dialog.hpp" #include "sound.hpp" #include "statistics.hpp" -#include "team.hpp" +#include "team.hpp" #include "thread.hpp" #include "titlescreen.hpp" #include "util.hpp" @@ -122,10 +122,10 @@ const int argc_; int arg_; const char* const * const argv_; - - //this should get destroyed *after* the video, since we want to clean up threads - //after the display disappears. - const threading::manager thread_manager; + + //this should get destroyed *after* the video, since we want to clean up threads + //after the display disappears. + const threading::manager thread_manager; CVideo video_; @@ -270,16 +270,16 @@ std::cerr << bpp << "\n"; if(bpp == 0) { - //Video mode not supported, maybe from bad prefs. - std::cerr << "Video mode " << resolution.first - << "x" << resolution.second << "x16 " - << "is not supported - attempting 1024x768x16...\n"; - - //Attempt 1024x768. - resolution.first = 1024; - resolution.second = 768; + //Video mode not supported, maybe from bad prefs. + std::cerr << "Video mode " << resolution.first + << "x" << resolution.second << "x16 " + << "is not supported - attempting 1024x768x16...\n"; + + //Attempt 1024x768. + resolution.first = 1024; + resolution.second = 768; - bpp = video_.modePossible(resolution.first,resolution.second,16,video_flags); + bpp = video_.modePossible(resolution.first,resolution.second,16,video_flags); if(bpp == 0) { std::cerr << "1024x768x16 not available - attempting 800x600x16...\n"; @@ -310,8 +310,8 @@ } #endif - if(bpp == 0) { - //couldn't do 1024x768 or 800x600 + if(bpp == 0) { + //couldn't do 1024x768 or 800x600 std::cerr << "The required video mode, " << resolution.first << "x" << resolution.second << "x16 " @@ -436,158 +436,158 @@ return true; } - std::string era = "era_default"; - std::string scenario = "multiplayer_test"; - std::map<int,std::string> side_types, side_controllers, side_algorithms; - std::map<int,string_map> side_parameters; - - size_t sides_counted = 0; - - for(++arg_; arg_ < argc_; ++arg_) { - const std::string val(argv_[arg_]); - if(val.empty()) { - continue; - } - - std::vector<std::string> name_value = utils::split(val, '='); - if(name_value.size() > 2) { - std::cerr << "invalid argument '" << val << "'\n"; - return false; - } else if(name_value.size() == 2) { - const std::string name = name_value.front(); - const std::string value = name_value.back(); - - const std::string name_head = name.substr(0,name.size()-1); - const char name_tail = name[name.size()-1]; - const bool last_digit = isdigit(name_tail) ? true:false; - const size_t side = name_tail - '0'; - - if(last_digit && side > sides_counted) { - std::cerr << "counted sides: " << side << "\n"; - sides_counted = side; - } - - if(name == "--scenario") { - scenario = value; - } else if(name == "--era") { - era = value; - } else if(last_digit && name_head == "--controller") { - side_controllers[side] = value; - } else if(last_digit && name_head == "--algorithm") { - side_algorithms[side] = value; - } else if(last_digit && name_head == "--side") { - side_types[side] = value; - } else if(last_digit && name_head == "--parm") { - const std::vector<std::string> name_value = utils::split(value, ':'); - if(name_value.size() != 2) { - std::cerr << "argument to '" << name << "' must be in the format name:value\n"; - return false; - } - - side_parameters[side][name_value.front()] = name_value.back(); - } else { - std::cerr << "unrecognized option: '" << name << "'\n"; - return false; - } - } - } - - const config* const lvl = game_config_.find_child("multiplayer","id",scenario); - if(lvl == NULL) { - std::cerr << "Could not find scenario '" << scenario << "'\n"; - return false; - } - - state_.campaign_type = "multiplayer"; - state_.scenario = ""; - state_.snapshot = config(); - - config level = *lvl; - std::vector<config*> story; - - const config* const era_cfg = game_config_.find_child("era","id",era); - if(era_cfg == NULL) { - std::cerr << "Could not find era '" << era << "'\n"; - return false; - } - - const config* const side = era_cfg->child("multiplayer_side"); - if(side == NULL) { - std::cerr << "Could not find multiplayer side\n"; - return false; - } - - while(level.get_children("side").size() < sides_counted) { - std::cerr << "now adding side...\n"; - level.add_child("side"); - } - - int side_num = 1; - for(config::child_itors itors = level.child_range("side"); itors.first != itors.second; ++itors.first, ++side_num) { - std::map<int,std::string>::const_iterator type = side_types.find(side_num), - controller = side_controllers.find(side_num), - algorithm = side_algorithms.find(side_num); - - const config* side = type == side_types.end() ? - era_cfg->find_child("multiplayer_side", "random_faction", "yes") : - era_cfg->find_child("multiplayer_side", "id", type->second); + std::string era = "era_default"; + std::string scenario = "multiplayer_test"; + std::map<int,std::string> side_types, side_controllers, side_algorithms; + std::map<int,string_map> side_parameters; + + size_t sides_counted = 0; + + for(++arg_; arg_ < argc_; ++arg_) { + const std::string val(argv_[arg_]); + if(val.empty()) { + continue; + } + + std::vector<std::string> name_value = utils::split(val, '='); + if(name_value.size() > 2) { + std::cerr << "invalid argument '" << val << "'\n"; + return false; + } else if(name_value.size() == 2) { + const std::string name = name_value.front(); + const std::string value = name_value.back(); + + const std::string name_head = name.substr(0,name.size()-1); + const char name_tail = name[name.size()-1]; + const bool last_digit = isdigit(name_tail) ? true:false; + const size_t side = name_tail - '0'; + + if(last_digit && side > sides_counted) { + std::cerr << "counted sides: " << side << "\n"; + sides_counted = side; + } + + if(name == "--scenario") { + scenario = value; + } else if(name == "--era") { + era = value; + } else if(last_digit && name_head == "--controller") { + side_controllers[side] = value; + } else if(last_digit && name_head == "--algorithm") { + side_algorithms[side] = value; + } else if(last_digit && name_head == "--side") { + side_types[side] = value; + } else if(last_digit && name_head == "--parm") { + const std::vector<std::string> name_value = utils::split(value, ':'); + if(name_value.size() != 2) { + std::cerr << "argument to '" << name << "' must be in the format name:value\n"; + return false; + } + + side_parameters[side][name_value.front()] = name_value.back(); + } else { + std::cerr << "unrecognized option: '" << name << "'\n"; + return false; + } + } + } + + const config* const lvl = game_config_.find_child("multiplayer","id",scenario); + if(lvl == NULL) { + std::cerr << "Could not find scenario '" << scenario << "'\n"; + return false; + } + + state_.campaign_type = "multiplayer"; + state_.scenario = ""; + state_.snapshot = config(); + + config level = *lvl; + std::vector<config*> story; + + const config* const era_cfg = game_config_.find_child("era","id",era); + if(era_cfg == NULL) { + std::cerr << "Could not find era '" << era << "'\n"; + return false; + } + + const config* const side = era_cfg->child("multiplayer_side"); + if(side == NULL) { + std::cerr << "Could not find multiplayer side\n"; + return false; + } + + while(level.get_children("side").size() < sides_counted) { + std::cerr << "now adding side...\n"; + level.add_child("side"); + } + + int side_num = 1; + for(config::child_itors itors = level.child_range("side"); itors.first != itors.second; ++itors.first, ++side_num) { + std::map<int,std::string>::const_iterator type = side_types.find(side_num), + controller = side_controllers.find(side_num), + algorithm = side_algorithms.find(side_num); + + const config* side = type == side_types.end() ? + era_cfg->find_child("multiplayer_side", "random_faction", "yes") : + era_cfg->find_child("multiplayer_side", "id", type->second); if (side == NULL) { unknown_side_id: - std::string side_name = (type == side_types.end() ? "default" : type->second); - std::cerr << "Could not find side '" << side_name << "' for side " << side_num << "\n"; - return false; - } + std::string side_name = (type == side_types.end() ? "default" : type->second); + std::cerr << "Could not find side '" << side_name << "' for side " << side_num << "\n"; + return false; + } if ((*side)["random_faction"] == "yes") { const config::child_list& eras = era_cfg->get_children("multiplayer_side"); for(int i = 0; i != 100 && (*side)["random_faction"] == "yes"; ++i) { side = eras[rand()%eras.size()]; } - if ((*side)["random_faction"] == "yes") - goto unknown_side_id; - } - - char buf[20]; - sprintf(buf,"%d",side_num); - (*itors.first)->values["side"] = buf; - - (*itors.first)->values["canrecruit"] = "1"; - - for(string_map::const_iterator i = side->values.begin(); i != side->values.end(); ++i) { - (*itors.first)->values[i->first] = i->second; - } - - if(controller != side_controllers.end()) { - (*itors.first)->values["controller"] = controller->second; - } - - if(algorithm != side_algorithms.end()) { - (*itors.first)->values["ai_algorithm"] = algorithm->second; - } - - config& ai_params = (*itors.first)->add_child("ai"); - - //now add in any arbitrary parameters given to the side - for(string_map::const_iterator j = side_parameters[side_num].begin(); j != side_parameters[side_num].end(); ++j) { - (*itors.first)->values[j->first] = j->second; - ai_params[j->first] = j->second; - } - } + if ((*side)["random_faction"] == "yes") + goto unknown_side_id; + } - try { + char buf[20]; + sprintf(buf,"%d",side_num); + (*itors.first)->values["side"] = buf; + + (*itors.first)->values["canrecruit"] = "1"; + + for(string_map::const_iterator i = side->values.begin(); i != side->values.end(); ++i) { + (*itors.first)->values[i->first] = i->second; + } + + if(controller != side_controllers.end()) { + (*itors.first)->values["controller"] = controller->second; + } + + if(algorithm != side_algorithms.end()) { + (*itors.first)->values["ai_algorithm"] = algorithm->second; + } + + config& ai_params = (*itors.first)->add_child("ai"); + + //now add in any arbitrary parameters given to the side + for(string_map::const_iterator j = side_parameters[side_num].begin(); j != side_parameters[side_num].end(); ++j) { + (*itors.first)->values[j->first] = j->second; + ai_params[j->first] = j->second; + } + } + + try { ::play_game(disp(),state_,game_config_,units_data_,video_); - //play_level(units_data_,game_config_,&level,video_,state_,story); - } catch(game::error& e) { - std::cerr << "caught error: '" << e.message << "'\n"; - } catch(game::load_game_exception& e) { - //the user's trying to load a game, so go into the normal title screen loop and load one - loaded_game_ = e.game; - loaded_game_show_replay_ = e.show_replay; + //play_level(units_data_,game_config_,&level,video_,state_,story); + } catch(game::error& e) { + std::cerr << "caught error: '" << e.message << "'\n"; + } catch(game::load_game_exception& e) { + //the user's trying to load a game, so go into the normal title screen loop and load one + loaded_game_ = e.game; + loaded_game_show_replay_ = e.show_replay; return true; - } catch(...) { - std::cerr << "caught unknown error playing level...\n"; - } + } catch(...) { + std::cerr << "caught unknown error playing level...\n"; + } return false; } @@ -620,7 +620,7 @@ std::string error_log; read_save_file(game,cfg,&error_log); if(!error_log.empty()) { - gui::show_error_message(disp(), + gui::show_error_message(disp(), _("Warning: The file you have tried to load is corrupt. Loading anyway.\n") + error_log); } @@ -640,7 +640,7 @@ refresh_game_cfg(); state_ = read_game(units_data_,&cfg); - + if(state_.version != game_config::version) { const int res = gui::show_dialog(disp(),NULL,"", _("This save is from a different version of the game. Do you want to try to load it?"), @@ -659,7 +659,7 @@ } catch(io_exception&) { gui::show_error_message(disp(), _("File I/O Error while reading the game")); return false; - } + } recorder = replay(state_.replay_data); recorder.start_replay(); recorder.set_skip(0); @@ -707,7 +707,7 @@ { state_ = game_state(); state_.campaign_type = "tutorial"; - state_.scenario = "tutorial"; + state_.scenario = "tutorial"; state_.campaign_define = "TUTORIAL"; defines_map_.clear(); defines_map_["TUTORIAL"] = preproc_define(); @@ -794,7 +794,7 @@ } state_.campaign_define = campaign["define"]; - + return true; } @@ -898,7 +898,7 @@ for(config::child_list::const_iterator i = cmps.begin(); i != cmps.end(); ++i) { const std::string& name = (**i)["name"]; campaigns.push_back(name); - + if(std::count(publish_options.begin(),publish_options.end(),name) != 0) { delete_options.push_back(name); } @@ -926,7 +926,7 @@ //add negative sizes to reverse the sort order sizes.push_back(-atoi((**i)["size"].c_str())); - + options.push_back(IMAGE_PREFIX + (**i)["icon"].str() + COLUMN_SEPARATOR + title + COLUMN_SEPARATOR + version + COLUMN_SEPARATOR + @@ -934,7 +934,7 @@ (**i)["downloads"].str() + COLUMN_SEPARATOR + format_file_size((**i)["size"])); } - + options.push_back(heading.str()); for(std::vector<std::string>::const_iterator j = publish_options.begin(); j != publish_options.end(); ++j) { @@ -1053,7 +1053,7 @@ std::cerr << "uploading campaign...\n"; network::send_data(data,sock); - + sock = network::receive_data(data,sock,5000); if(!sock) { gui::show_error_message(disp(), _("Connection timed out")); @@ -1125,18 +1125,18 @@ return false; preferences::set_login(login); - + try { defines_map_.clear(); defines_map_[state_.campaign_define] = preproc_define(); refresh_game_cfg(); - + if(res >= 2) { std::vector<std::string> chat; config game_data; - const mp::controller cntr = (res == 2 ? - mp::CNTR_NETWORK : + const mp::controller cntr = (res == 2 ? + mp::CNTR_NETWORK : (res == 3 ? mp::CNTR_LOCAL : mp::CNTR_COMPUTER )); const bool is_server = res == 2; @@ -1242,7 +1242,7 @@ const std::string fname_checksum = fname + ".checksum"; file_tree_checksum dir_checksum; - + if(use_cache) { try { if(file_exists(fname_checksum)) { @@ -1273,14 +1273,14 @@ } std::cerr << "no valid cache found. Writing cache to '" << fname << "'\n"; - + //read the file and then write to the cache scoped_istream stream = preprocess_file("data/game.cfg", &defines); std::string error_log; read(cfg, *stream, &error_log); if(!error_log.empty()) { - gui::show_error_message(disp(), + gui::show_error_message(disp(), _("Warning: Errors occurred while loading game configuration files: '") + error_log); @@ -1346,7 +1346,7 @@ if(defines_map_.count("NORMAL")) { defines_map_["MEDIUM"] = preproc_define(); } - + refresh_game_cfg(); } @@ -1382,16 +1382,16 @@ continue; } - if(val == "--help" || val == "-h") { - std::cout << "usage: " << argv[0] - << " [options] [data-directory]\n" - << " -d, --debug Shows debugging information in-game\n" - << " -f, --fullscreen Runs the game in full-screen\n" - << " -h, --help Prints this message and exits\n" - << " --path Prints the name of the game data directory and exits\n" - << " -t, --test Runs the game in a small example scenario\n" - << " -w, --windowed Runs the game in windowed mode\n" - << " -v, --version Prints the game's version number and exits\n" + if(val == "--help" || val == "-h") { + std::cout << "usage: " << argv[0] + << " [options] [data-directory]\n" + << " -d, --debug Shows debugging information in-game\n" + << " -f, --fullscreen Runs the game in full-screen\n" + << " -h, --help Prints this message and exits\n" + << " --path Prints the name of the game data directory and exits\n" + << " -t, --test Runs the game in a small example scenario\n" + << " -w, --windowed Runs the game in windowed mode\n" + << " -v, --version Prints the game's version number and exits\n" << " --log-error=\"domain1,domain2,...\", --log-warning=..., --log-info=...\n" << " Set the severity level of the debug domains\n" << " \"all\" can be used to match any debug domain\n" @@ -1402,15 +1402,15 @@ << " --decompress file1 file2 Uncompresses the binary-WML file file2 into\n" << " the text-WML file file2\n" ; - return 0; - } else if(val == "--version" || val == "-v") { - std::cout << _("Battle for Wesnoth") << " " << game_config::version - << "\n"; - return 0; - } else if(val == "--path") { - std::cout << game_config::path - << "\n"; - return 0; + return 0; + } else if(val == "--version" || val == "-v") { + std::cout << _("Battle for Wesnoth") << " " << game_config::version + << "\n"; + return 0; + } else if(val == "--path") { + std::cout << game_config::path + << "\n"; + return 0; } else if(val == "--nosound") { use_sound = false; } else if (val.substr(0, 6) == "--log-") { @@ -1613,7 +1613,7 @@ about::show_about(game.disp()); continue; } - + game.play_game(should_reload); } Index: wesnoth/src/game_config.cpp diff -u wesnoth/src/game_config.cpp:1.98 wesnoth/src/game_config.cpp:1.99 --- wesnoth/src/game_config.cpp:1.98 Mon May 16 22:44:19 2005 +++ wesnoth/src/game_config.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: game_config.cpp,v 1.98 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: game_config.cpp,v 1.99 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -56,11 +56,11 @@ std::string dot_image = "misc/dot.png"; std::string cross_image = "misc/cross.png"; - + std::vector<std::string> foot_left_nw, foot_left_n, foot_right_nw, foot_right_n; std::string observer_image; - + std::string unchecked_menu_image = "buttons/checkbox.png"; std::string checked_menu_image = "buttons/checkbox-pressed.png"; @@ -136,7 +136,7 @@ missile_ne_image = v["missile_ne_image"]; terrain_mask_image = v["terrain_mask_image"]; - + observer_image = v["observer_image"]; download_campaign_image = v["download_campaign_image"]; Index: wesnoth/src/game_config.hpp diff -u wesnoth/src/game_config.hpp:1.29 wesnoth/src/game_config.hpp:1.30 --- wesnoth/src/game_config.hpp:1.29 Mon May 16 22:44:19 2005 +++ wesnoth/src/game_config.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: game_config.hpp,v 1.29 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: game_config.hpp,v 1.30 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -40,7 +40,7 @@ extern std::string game_icon, game_title, game_logo, title_music, map_image, rightside_image, rightside_image_bot, moved_energy_image, unmoved_energy_image, partmoved_energy_image, enemy_energy_image,ally_energy_image,flag_image, - dot_image,cross_image, + dot_image,cross_image, missile_n_image,missile_ne_image,terrain_mask_image,observer_image,download_campaign_image, checked_menu_image,unchecked_menu_image; Index: wesnoth/src/game_errors.hpp diff -u wesnoth/src/game_errors.hpp:1.2 wesnoth/src/game_errors.hpp:1.3 --- wesnoth/src/game_errors.hpp:1.2 Wed Mar 23 08:52:10 2005 +++ wesnoth/src/game_errors.hpp Sat Jun 4 19:16:05 2005 @@ -1,8 +1,8 @@ -/* $Id: game_errors.hpp,v 1.2 2005/03/23 08:52:10 silene Exp $ */ +/* $Id: game_errors.hpp,v 1.3 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Yann Dirson <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/game_events.cpp diff -u wesnoth/src/game_events.cpp:1.148 wesnoth/src/game_events.cpp:1.149 --- wesnoth/src/game_events.cpp:1.148 Wed May 25 16:29:59 2005 +++ wesnoth/src/game_events.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: game_events.cpp,v 1.148 2005/05/25 16:29:59 ott Exp $ */ +/* $Id: game_events.cpp,v 1.149 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -64,7 +64,7 @@ //an 'or' statement means that if the contained statements are true, //then it automatically passes const vconfig::child_list& or_statements = cond.get_children("or"); - for(vconfig::child_list::const_iterator or_it = or_statements.begin(); + for(vconfig::child_list::const_iterator or_it = or_statements.begin(); or_it != or_statements.end(); ++or_it) { if(conditional_passed(units,*or_it)) { return true; @@ -173,7 +173,7 @@ class event_handler { public: - event_handler(const config& cfg) : + event_handler(const config& cfg) : name_(cfg["name"]), first_time_only_(cfg["first_time_only"] != "no"), disabled_(false), @@ -200,12 +200,12 @@ return cfg_.get_children("filter"); } - const vconfig::child_list second_arg_filters() + const vconfig::child_list second_arg_filters() { return cfg_.get_children("filter_second"); } - bool handle_event(const queued_event& event_info, + bool handle_event(const queued_event& event_info, const vconfig cfg = vconfig()); private: @@ -234,7 +234,7 @@ //this function handles all the different types of actions that can be triggered //by an event. -bool event_handler::handle_event_command(const queued_event& event_info, +bool event_handler::handle_event_command(const queued_event& event_info, const std::string& cmd, const vconfig cfg, bool& mutated) { log_scope2(engine, "handle_event_command"); @@ -269,19 +269,19 @@ } } } - + screen->invalidate_all(); } //teleport a unit from one location to another else if(cmd == "teleport") { - + unit_map::iterator u = units->find(event_info.loc1); //search for a valid unit filter, and if we have one, look for the matching unit const vconfig filter = cfg.child("filter"); - if(!filter.null()) { + if(!filter.null()) { for(u = units->begin(); u != units->end(); ++u){ if(game_events::unit_matches_filter(u, filter)) break; @@ -533,7 +533,7 @@ } } } - + //provide a means of specifying win/loss conditions: // [event] // name=prestart @@ -581,7 +581,7 @@ } t_string win_string = cfg["victory_string"]; - if(win_string.empty()) + if(win_string.empty()) win_string = t_string(N_("Victory:"), "wesnoth"); t_string lose_string = cfg["defeat_string"]; if(lose_string.empty()) @@ -591,7 +591,7 @@ t_string lose_objectives; const vconfig::child_list objectives = cfg.get_children("objective"); - for(vconfig::child_list::const_iterator obj_it = objectives.begin(); + for(vconfig::child_list::const_iterator obj_it = objectives.begin(); obj_it != objectives.end(); ++obj_it) { const t_string description = (*obj_it)["description"]; @@ -681,7 +681,7 @@ // random generation works as follows: // random=[comma delimited list] - // Each element in the list will be considered a separate choice, + // Each element in the list will be considered a separate choice, // unless it contains "..". In this case, it must be a numerical // range. (i.e. -1..-10, 0..100, -10..10, etc) const std::string& random = cfg["random"]; @@ -690,20 +690,20 @@ std::vector<std::string> words; std::vector<std::pair<size_t,size_t> > ranges; int num_choices = 0; - std::string::size_type pos = 0, pos2 = std::string::npos, tmp; + std::string::size_type pos = 0, pos2 = std::string::npos, tmp; std::stringstream ss(std::stringstream::in|std::stringstream::out); while (pos2 != random.length()) { pos = pos2+1; pos2 = random.find(",", pos); - if (pos2 == std::string::npos) + if (pos2 == std::string::npos) pos2 = random.length(); word = random.substr(pos, pos2-pos); words.push_back(word); tmp = word.find(".."); - - + + if (tmp == std::string::npos) { // treat this element as a string ranges.push_back(std::pair<int, int>(0,0)); @@ -732,7 +732,7 @@ } size_t choice = get_random() % num_choices; - tmp = 0; + tmp = 0; for(size_t i = 0; i < ranges.size(); i++) { tmp += (ranges[i].second - ranges[i].first) + 1; if (tmp > choice) { @@ -1102,7 +1102,7 @@ break; } } - + if(speaker == units->end() && cfg["speaker"] != "narrator") { //no matching unit found, so the dialog can't come up //continue onto the next message @@ -1161,7 +1161,7 @@ int option_chosen = -1; LOG_DP << "showing dialog...\n"; - + //if we're not replaying, or if we are replaying and there is no choice //to be made, show the dialog. if(get_replay_source().at_end() || options.empty()) { @@ -1200,7 +1200,7 @@ //implement the consequences of the choice if(options.empty() == false) { wassert(size_t(option_chosen) < menu_items.size()); - + vconfig::child_list events = option_events[option_chosen]; for(vconfig::child_list::const_iterator itor = events.begin(); itor != events.end(); ++itor) { @@ -1459,7 +1459,7 @@ const std::pair<const std::string*,const config*> item = *i; - // If the user pressed escape, we skip any message that doesn't + // If the user pressed escape, we skip any message that doesn't // require them to make a choice. if ((skip_messages) && (*item.first == "message")) { if ((item.second)->get_children("option").size() == 0) { @@ -1470,7 +1470,7 @@ if (!handle_event_command(event_info, *item.first, vconfig(item.second), mutated)) { skip_messages = true; } - else { + else { skip_messages = false; } } Index: wesnoth/src/game_events.hpp diff -u wesnoth/src/game_events.hpp:1.27 wesnoth/src/game_events.hpp:1.28 --- wesnoth/src/game_events.hpp:1.27 Sun Mar 27 23:06:16 2005 +++ wesnoth/src/game_events.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: game_events.hpp,v 1.27 2005/03/27 23:06:16 gruikya Exp $ */ +/* $Id: game_events.hpp,v 1.28 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/gamestatus.cpp diff -u wesnoth/src/gamestatus.cpp:1.72 wesnoth/src/gamestatus.cpp:1.73 --- wesnoth/src/gamestatus.cpp:1.72 Sat Jun 4 02:24:26 2005 +++ wesnoth/src/gamestatus.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: gamestatus.cpp,v 1.72 2005/06/04 02:24:26 Sirp Exp $ */ +/* $Id: gamestatus.cpp,v 1.73 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -16,7 +16,7 @@ #include "filesystem.hpp" #include "game_config.hpp" #include "game_errors.hpp" -#include "gamestatus.hpp" +#include "gamestatus.hpp" #include "gettext.hpp" #include "language.hpp" #include "log.hpp" @@ -374,7 +374,7 @@ if(game.replay_data.child("replay") == NULL) { cfg.add_child("replay",game.replay_data); } - + cfg.add_child("snapshot",game.snapshot); cfg.add_child("replay_start",game.starting_pos); cfg.add_child("statistics",statistics::write_stats()); @@ -414,7 +414,7 @@ { std::string fname = name; std::replace(fname.begin(),fname.end(),' ','_'); - + return file_exists(get_saves_dir() + "/" + fname); } @@ -452,7 +452,7 @@ config cfg; read_save_file(name,cfg,error_log); - + state = read_game(data,&cfg); } @@ -471,9 +471,9 @@ const std::string fname = get_saves_dir() + "/" + name; { scoped_ostream savefile = ostream_file(fname); - write_possibly_compressed(*savefile, cfg, preferences::compress_saves()); - if(savefile->good() == false) { - throw game::save_game_failed(_("Could not write to file")); + write_possibly_compressed(*savefile, cfg, preferences::compress_saves()); + if(savefile->good() == false) { + throw game::save_game_failed(_("Could not write to file")); } } @@ -554,7 +554,7 @@ out["replay"] = has_replay ? "yes" : "no"; out["snapshot"] = has_snapshot ? "yes" : "no"; - + out["campaign_type"] = state.campaign_type; out["scenario"] = state.scenario; out["difficulty"] = state.difficulty; @@ -632,7 +632,7 @@ t_string** varout, config** cfgout) { //we get the variable from the [variables] section of the game state. Variables may - //be in the format + //be in the format const std::string::const_iterator itor = std::find(key.begin(),key.end(),'.'); if(itor != key.end()) { std::string element(key.begin(),itor); @@ -675,7 +675,7 @@ return; } - + while(cfg.get_children(element).size() <= index) { cfg.add_child(element); } @@ -683,7 +683,7 @@ if(cfgout != NULL) { *cfgout = cfg.get_children(element)[index]; } - + get_variable_internal(sub_key,*cfg.get_children(element)[index],varout,cfgout); } else { if(varout != NULL) { @@ -699,7 +699,7 @@ if(res != NULL) { return *res; } - + static t_string empty_string; return empty_string; } Index: wesnoth/src/gamestatus.hpp diff -u wesnoth/src/gamestatus.hpp:1.45 wesnoth/src/gamestatus.hpp:1.46 --- wesnoth/src/gamestatus.hpp:1.45 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/gamestatus.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: gamestatus.hpp,v 1.45 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: gamestatus.hpp,v 1.46 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/halo.cpp diff -u wesnoth/src/halo.cpp:1.16 wesnoth/src/halo.cpp:1.17 --- wesnoth/src/halo.cpp:1.16 Thu Mar 10 20:54:56 2005 +++ wesnoth/src/halo.cpp Sat Jun 4 19:16:05 2005 @@ -40,7 +40,7 @@ std::string current_image_; bool reverse_; - + int origx_, origy_, x_, y_; double origzoom_, zoom_; surface surf_, buffer_; Index: wesnoth/src/help.cpp diff -u wesnoth/src/help.cpp:1.105 wesnoth/src/help.cpp:1.106 --- wesnoth/src/help.cpp:1.105 Sat Jun 4 01:33:10 2005 +++ wesnoth/src/help.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -58,7 +58,7 @@ typedef std::vector<section *> section_list; /// Generate a topic text on the fly. -class topic_generator +class topic_generator { unsigned count; friend class topic_text; @@ -77,7 +77,7 @@ /// The text displayed in a topic. It is generated on the fly with the information /// contained in generator_. -class topic_text +class topic_text { mutable std::vector< std::string > parsed_text_; mutable topic_generator *generator_; @@ -124,10 +124,10 @@ bool operator==(const section &) const; /// Comparison on the ID. bool operator<(const section &) const; - + /// Allocate memory for and add the section. void add_section(const section &s); - + void clear(); std::string title, id; topic_list topics; @@ -137,7 +137,7 @@ /// To be used as a function object to locate sections and topics /// with a specified ID. -class has_id +class has_id { public: has_id(const std::string &id) : id_(id) {} @@ -149,26 +149,26 @@ }; /// To be used as a function object when sorting topic lists on the title. -class title_less +class title_less { public: bool operator()(const topic &t1, const topic &t2) { return t1.title < t2.title; } }; -struct delete_section +struct delete_section { void operator()(section *s) { delete s; } }; -struct create_section +struct create_section { section *operator()(const section *s) { return new section(*s); } section *operator()(const section &s) { return new section(s); } }; - + /// The menu to the left in the help browser, where topics can be /// navigated through and chosen. -class help_menu : public gui::menu +class help_menu : public gui::menu { public: help_menu(CVideo &video, const section &toplevel, int max_height=-1); @@ -201,7 +201,7 @@ /// Regenerate what items are visible by checking what sections are /// expanded. void update_visible_items(const section &top_level, unsigned starting_level=0); - + /// Return true if the section is expanded. bool expanded(const section &sec); @@ -222,14 +222,14 @@ /// Draw the currently visible items. void display_visible_items(); - + /// Internal recursive thingie. did_expand will be true if any /// section was expanded, otherwise untouched. bool select_topic_internal(const topic &t, const section &sec); std::vector<visible_item> visible_items_; const section &toplevel_; - std::set<const section*> expanded_; + std::set<const section*> expanded_; surface_restorer restorer_; SDL_Rect rect_; topic const *chosen_topic_; @@ -237,14 +237,14 @@ }; /// Thrown when the help system fails to parse something. -struct parse_error +struct parse_error { parse_error(const std::string& msg) : message(msg) {} std::string message; }; /// The area where the content is shown in the help browser. -class help_text_area : public gui::scrollarea +class help_text_area : public gui::scrollarea { public: help_text_area(CVideo &video, const section &toplevel); @@ -283,11 +283,11 @@ surface surf; // If this item contains text, this will contain that text. - std::string text; + std::string text; // If this item contains a cross-reference, this is the id // of the referenced topic. - std::string ref_to; + std::string ref_to; // If this item is floating, that is, if things should be filled // around it. @@ -295,7 +295,7 @@ bool box; ALIGNMENT align; }; - + /// Function object to find an item at the specified coordinates. class item_at { public: @@ -344,7 +344,7 @@ /// Return the width that remain on the line the current input point is at. int get_remaining_width(); - + /// Return the least x coordinate at which something of the /// specified height can be drawn at the specified y coordinate /// without interfering with floating images. @@ -437,7 +437,7 @@ /// Parse a help config, return the top level section. Return an empty /// section if cfg is NULL. -section parse_config(const config *cfg); +section parse_config(const config *cfg); /// Recursive function used by parse_config. void parse_config_internal(const config *help_cfg, const config *section_cfg, section &sec, int level=0); @@ -498,13 +498,13 @@ const game_data *game_info = NULL; gamemap *map = NULL; // The default toplevel. - help::section toplevel; + help::section toplevel; // All sections and topics not referenced from the default toplevel. - help::section hidden_sections; + help::section hidden_sections; int last_num_encountered_units = -1; int last_num_encountered_terrains = -1; - + config dummy_cfg; std::vector<std::string> empty_string_vector; const int max_section_level = 15; @@ -518,8 +518,8 @@ const std::string closed_section_img = "help/closed_section.png"; const std::string open_section_img = "help/open_section.png"; // The topic to open by default when opening the help dialog. - const std::string default_show_topic = "introduction_topic"; - + const std::string default_show_topic = "introduction_topic"; + /// Return true if the id is valid for user defined topics and /// sections. Some IDs are special, such as toplevel and may not be /// be defined in the config. @@ -572,7 +572,7 @@ ss << "<jump>amount=" << amount << "</jump>"; return ss.str(); } - + std::string bold(const std::string &s) { std::stringstream ss; @@ -585,7 +585,7 @@ // that create a table. The table spec contains a vector with // vectors with pairs. The pairs are the markup string that should // be in a cell, and the width of that cell. - std::string generate_table(const table_spec &tab, const unsigned int spacing=font::relative_size(20)) + std::string generate_table(const table_spec &tab, const unsigned int spacing=font::relative_size(20)) { table_spec::const_iterator row_it; std::vector<std::pair<std::string, unsigned> >::const_iterator col_it; @@ -628,7 +628,7 @@ } // Return the width for the image with filename. - unsigned image_width(const std::string &filename) + unsigned image_width(const std::string &filename) { image::locator loc(filename); surface surf(image::get_image(loc, image::UNSCALED)); @@ -775,7 +775,7 @@ } return false; } - + void parse_config_internal(const config *help_cfg, const config *section_cfg, section &sec, int level) { @@ -843,9 +843,9 @@ std::copy(generated_topics.begin(), generated_topics.end(), std::back_inserter(sec.topics)); } -} +} -section parse_config(const config *cfg) +section parse_config(const config *cfg) { section sec; if (cfg != NULL) { @@ -856,7 +856,7 @@ } -std::vector<section> generate_sections(const std::string &generator) +std::vector<section> generate_sections(const std::string &generator) { std::vector<section> empty_vec; if (generator == "") { @@ -900,7 +900,7 @@ return empty_string; } -topic_text::~topic_text() +topic_text::~topic_text() { if (generator_ && --generator_->count == 0) delete generator_; @@ -920,7 +920,7 @@ return *this; } -topic_text::operator std::vector< std::string > const &() const +topic_text::operator std::vector< std::string > const &() const { if (generator_) { parsed_text_ = parse_text((*generator_)()); @@ -947,10 +947,10 @@ std::vector<attack_type> attacks = type.attacks(); for (std::vector<attack_type>::const_iterator it = attacks.begin(); it != attacks.end(); it++) { - std::string special = (*it).special(); - - //some abilities like plague can be in the form ability(argument) - //make sure we cut off the argument + std::string special = (*it).special(); + + //some abilities like plague can be in the form ability(argument) + //make sure we cut off the argument special.erase(std::find(special.begin(),special.end(),'('),special.end()); if (special != "") { if (checked_specials.find(special) == checked_specials.end()) { @@ -961,7 +961,7 @@ const size_t colon_pos = description.find(':'); if (colon_pos != std::string::npos) { // Remove the first colon and the following newline. - description.erase(0, colon_pos + 2); + description.erase(0, colon_pos + 2); } topic t(lang_special, "weaponspecial_" + special, description); topics.push_back(t); @@ -998,7 +998,7 @@ const size_t colon_pos = description.find(':'); if (colon_pos != std::string::npos) { // Remove the first colon and the following newline. - description.erase(0, colon_pos + 2); + description.erase(0, colon_pos + 2); } topic t(lang_ability, id, description); topics.push_back(t); @@ -1006,7 +1006,7 @@ } } } - + } return topics; } @@ -1059,7 +1059,7 @@ advance_it != advance_end; ++advance_it) { std::string unit_id = *advance_it; std::map<std::string,unit_type>::const_iterator new_type = game_info->unit_types.find(unit_id); - if(new_type != game_info->unit_types.end()) { + if(new_type != game_info->unit_types.end()) { std::string lang_unit = new_type->second.language_name(); std::string ref_id = std::string("unit_") + new_type->second.id(); ss << "<ref>dst='" << escape(ref_id) << "' text='" << escape(lang_unit) @@ -1212,7 +1212,7 @@ std::stringstream str; str << "<ref>text='" << escape(name) << "' dst='" << escape(std::string("terrain_") + terrain) << "'</ref>"; - row.push_back(std::make_pair(str.str(), + row.push_back(std::make_pair(str.str(), font::line_width(name, normal_font_size))); @@ -1319,7 +1319,7 @@ } }; -std::vector<topic> generate_terrains_topics() +std::vector<topic> generate_terrains_topics() { std::vector<topic> res; std::vector<gamemap::TERRAIN> show_info_about; @@ -1418,8 +1418,8 @@ std::for_each(sections.begin(), sections.end(), delete_section()); } -section::section(const section &sec) - : title(sec.title), id(sec.id), topics(sec.topics) +section::section(const section &sec) + : title(sec.title), id(sec.id), topics(sec.topics) { std::transform(sec.sections.begin(), sec.sections.end(), std::back_inserter(sections), create_section()); @@ -1434,7 +1434,7 @@ std::back_inserter(sections), create_section()); return *this; } - + bool section::operator==(const section &sec) const { @@ -1446,7 +1446,7 @@ return id < sec.id; } -void section::add_section(const section &s) +void section::add_section(const section &s) { sections.push_back(new section(s)); } @@ -1460,7 +1460,7 @@ help_menu::help_menu(CVideo &video, section const &toplevel, int max_height) : gui::menu(video, empty_string_vector, true, max_height), - toplevel_(toplevel), chosen_topic_(NULL), selected_item_(&toplevel, "") + toplevel_(toplevel), chosen_topic_(NULL), selected_item_(&toplevel, "") { update_visible_items(toplevel_); display_visible_items(); @@ -1473,19 +1473,19 @@ return expanded_.find(&sec) != expanded_.end(); } -void help_menu::expand(const section &sec) +void help_menu::expand(const section &sec) { if (sec.id != "toplevel") { expanded_.insert(&sec); } } -void help_menu::contract(const section &sec) +void help_menu::contract(const section &sec) { expanded_.erase(&sec); } -void help_menu::update_visible_items(const section &sec, unsigned level) +void help_menu::update_visible_items(const section &sec, unsigned level) { if (level == 0) { // Clear if this is the top level, otherwise append items. @@ -1507,7 +1507,7 @@ } -std::string help_menu::get_string_to_show(const section &sec, const unsigned level) +std::string help_menu::get_string_to_show(const section &sec, const unsigned level) { std::stringstream to_show; std::string pad_string; @@ -1595,7 +1595,7 @@ chosen_topic_ = NULL; return ret; } - + void help_menu::display_visible_items() { std::vector<std::string> menu_items; @@ -1620,7 +1620,7 @@ return sec != NULL && *sec == _sec; } -bool help_menu::visible_item::operator==(const topic &_t) const +bool help_menu::visible_item::operator==(const topic &_t) const { return t != NULL && *t == _t; } @@ -1646,14 +1646,14 @@ set_items(); } -void help_text_area::show_topic(const topic &t) +void help_text_area::show_topic(const topic &t) { shown_topic_ = &t; set_items(); set_dirty(true); } - + help_text_area::item::item(surface surface, int x, int y, const std::string _text, const std::string reference_to, bool _floating, bool _box, ALIGNMENT alignment) @@ -1895,7 +1895,7 @@ void help_text_area::add_text_item(const std::string text, const std::string ref_dst, int _font_size, bool bold, bool italic, - SDL_Color text_color) + SDL_Color text_color) { const int font_size = _font_size < 0 ? normal_font_size : _font_size; if (text.empty()) @@ -1951,7 +1951,7 @@ s = remove_first_space(s); } add_text_item(s, ref_dst, _font_size, bold, italic, text_color); - + } } } @@ -2066,8 +2066,8 @@ contents_height_ = maximum<int>(contents_height_, itm.rect.y + itm.rect.h); } } - - + + help_text_area::ALIGNMENT help_text_area::str_to_align(const std::string &s) { const std::string cmp_str = to_lower(s); @@ -2084,7 +2084,7 @@ msg << "Invalid alignment string: '" << s << "'"; throw parse_error(msg.str()); } - + void help_text_area::down_one_line() { adjust_last_row(); @@ -2172,7 +2172,7 @@ text_area_(disp.video(), toplevel), toplevel_(toplevel), ref_cursor_(false), back_button_(disp.video(), _("< Back"), gui::button::TYPE_PRESS), forward_button_(disp.video(), _("Forward >"), gui::button::TYPE_PRESS), - shown_topic_(NULL) + shown_topic_(NULL) { // Hide the buttons at first since we do not have any forward or // back topics at this point. They will be unhidden when history @@ -2183,7 +2183,7 @@ set_measurements(font::relative_size(400), font::relative_size(500)); } -void help_browser::adjust_layout() +void help_browser::adjust_layout() { const int menu_buttons_padding = font::relative_size(10); const int menu_y = location().y; @@ -2194,7 +2194,7 @@ const int menu_w = 250; #endif const int menu_h = height() - back_button_.height() - menu_buttons_padding; - + const int menu_text_area_padding = font::relative_size(10); const int text_area_y = location().y; const int text_area_x = menu_x + menu_w + menu_text_area_padding; @@ -2254,7 +2254,7 @@ } void help_browser::move_in_history(std::deque<const topic *> &from, - std::deque<const topic *> &to) + std::deque<const topic *> &to) { if (!from.empty()) { const topic *to_show = from.back(); @@ -2293,7 +2293,7 @@ } } } - } + } else if (event.type == SDL_MOUSEMOTION) { update_cursor(); } @@ -2332,7 +2332,7 @@ return NULL; } -const section *find_section(const section &sec, const std::string &id) +const section *find_section(const section &sec, const std::string &id) { section_list::const_iterator sit = std::find_if(sec.sections.begin(), sec.sections.end(), has_id(id)); @@ -2512,7 +2512,7 @@ return false; } -SDL_Color string_to_color(const std::string &s) +SDL_Color string_to_color(const std::string &s) { const std::string cmp_str = to_lower(s); if (cmp_str == "green") { @@ -2574,8 +2574,8 @@ } return res; } - -std::string get_first_word(const std::string &s) + +std::string get_first_word(const std::string &s) { if (s == "") { return s; @@ -2652,7 +2652,7 @@ // of the screen. if (yloc <= -1 || xloc <= -1) { xloc = scr->w / 2 - width / 2; - yloc = scr->h / 2 - height / 2; + yloc = scr->h / 2 - height / 2; } std::vector<gui::button*> buttons_ptr; gui::button close_button_(disp.video(), _("Close")); Index: wesnoth/src/help.hpp diff -u wesnoth/src/help.hpp:1.19 wesnoth/src/help.hpp:1.20 --- wesnoth/src/help.hpp:1.19 Tue May 17 22:18:30 2005 +++ wesnoth/src/help.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/hotkeys.cpp diff -u wesnoth/src/hotkeys.cpp:1.77 wesnoth/src/hotkeys.cpp:1.78 --- wesnoth/src/hotkeys.cpp:1.77 Wed May 18 14:06:29 2005 +++ wesnoth/src/hotkeys.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: hotkeys.cpp,v 1.77 2005/05/18 14:06:29 darthfool Exp $ */ +/* $Id: hotkeys.cpp,v 1.78 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -117,7 +117,7 @@ namespace hotkey { -hotkey_item::hotkey_item(HOTKEY_COMMAND id, const std::string& command, const std::string& description, bool hidden) +hotkey_item::hotkey_item(HOTKEY_COMMAND id, const std::string& command, const std::string& description, bool hidden) : id_(id), command_(command), description_(description), keycode_(0), shift_(false), ctrl_(false), alt_(false), cmd_(false), hidden_(hidden) { @@ -146,10 +146,10 @@ cmd_ = (cfg["cmd"] == "yes"); } -std::string hotkey_item::get_name() const +std::string hotkey_item::get_name() const { if (keycode_ != 0) { - std::stringstream str; + std::stringstream str; if (alt_) str << "alt+"; if (ctrl_) @@ -180,10 +180,10 @@ cmd_ = cmd; } -manager::manager() +manager::manager() { for (int i = 0; hotkey_list_[i].command; ++i) { - hotkeys_.push_back(hotkey_item(hotkey_list_[i].id, hotkey_list_[i].command, + hotkeys_.push_back(hotkey_item(hotkey_list_[i].id, hotkey_list_[i].command, "", hotkey_list_[i].hidden)); } } @@ -235,7 +235,7 @@ } } -hotkey_item& get_hotkey(HOTKEY_COMMAND id) +hotkey_item& get_hotkey(HOTKEY_COMMAND id) { std::vector<hotkey_item>::iterator itor; @@ -250,7 +250,7 @@ return *itor; } -hotkey_item& get_hotkey(const std::string& command) +hotkey_item& get_hotkey(const std::string& command) { std::vector<hotkey_item>::iterator itor; @@ -272,17 +272,17 @@ for (itor = hotkeys_.begin(); itor != hotkeys_.end(); ++itor) { if(mods) { - if(itor->get_keycode() == keycode + if(itor->get_keycode() == keycode && (shift == itor->get_shift() || shift == true) && (ctrl == itor->get_ctrl() || ctrl == true) && (alt == itor->get_alt() || alt == true) && (cmd == itor->get_cmd() || cmd == true)) break; } else { - if(itor->get_keycode() == keycode - && shift == itor->get_shift() - && ctrl == itor->get_ctrl() - && alt == itor->get_alt() + if(itor->get_keycode() == keycode + && shift == itor->get_shift() + && ctrl == itor->get_ctrl() + && alt == itor->get_alt() && cmd == itor->get_cmd()) break; } Index: wesnoth/src/hotkeys.hpp diff -u wesnoth/src/hotkeys.hpp:1.60 wesnoth/src/hotkeys.hpp:1.61 --- wesnoth/src/hotkeys.hpp:1.60 Wed May 18 14:06:29 2005 +++ wesnoth/src/hotkeys.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: hotkeys.hpp,v 1.60 2005/05/18 14:06:29 darthfool Exp $ */ +/* $Id: hotkeys.hpp,v 1.61 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -28,7 +28,7 @@ namespace hotkey { enum HOTKEY_COMMAND { - HOTKEY_CYCLE_UNITS,HOTKEY_CYCLE_BACK_UNITS, HOTKEY_UNIT_HOLD_POSITION, + HOTKEY_CYCLE_UNITS,HOTKEY_CYCLE_BACK_UNITS, HOTKEY_UNIT_HOLD_POSITION, HOTKEY_END_UNIT_TURN, HOTKEY_LEADER, HOTKEY_UNDO, HOTKEY_REDO, HOTKEY_ZOOM_IN, HOTKEY_ZOOM_OUT, HOTKEY_ZOOM_DEFAULT, @@ -45,7 +45,7 @@ //editing specific commands HOTKEY_EDIT_SET_TERRAIN, - HOTKEY_EDIT_QUIT, HOTKEY_EDIT_SAVE_MAP, + HOTKEY_EDIT_QUIT, HOTKEY_EDIT_SAVE_MAP, HOTKEY_EDIT_SAVE_AS, HOTKEY_EDIT_SET_START_POS, HOTKEY_EDIT_NEW_MAP, HOTKEY_EDIT_LOAD_MAP, HOTKEY_EDIT_FLOOD_FILL, HOTKEY_EDIT_FILL_SELECTION, HOTKEY_EDIT_CUT, HOTKEY_EDIT_COPY, @@ -53,7 +53,7 @@ HOTKEY_EDIT_FLIP, HOTKEY_EDIT_SELECT_ALL, HOTKEY_EDIT_DRAW, HOTKEY_EDIT_REFRESH, HOTKEY_USER_CMD, - HOTKEY_NULL + HOTKEY_NULL }; class hotkey_item { @@ -76,7 +76,7 @@ bool get_ctrl() const { return ctrl_; }; bool get_shift() const { return shift_; }; bool get_cmd() const { return cmd_; }; - + // Return "name" of hotkey for example :"ctrl+alt+g" std::string get_name() const; @@ -189,7 +189,7 @@ virtual ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command) const { return ACTION_STATELESS; } //Returns the appropriate menu image. Checkable items will get a checked/unchecked image. std::string get_menu_image(hotkey::HOTKEY_COMMAND command) const; - + virtual bool can_execute_command(HOTKEY_COMMAND command) const = 0; }; Index: wesnoth/src/image.cpp diff -u wesnoth/src/image.cpp:1.79 wesnoth/src/image.cpp:1.80 --- wesnoth/src/image.cpp:1.79 Sat Mar 26 17:10:32 2005 +++ wesnoth/src/image.cpp Sat Jun 4 19:16:05 2005 @@ -109,7 +109,7 @@ } } -locator::locator() : +locator::locator() : index_(-1) { } @@ -119,7 +119,7 @@ { } -locator::locator(const char *filename) : +locator::locator(const char *filename) : val_(filename) { init_index(); @@ -169,7 +169,7 @@ { } -bool locator::value::operator==(const value& a) const +bool locator::value::operator==(const value& a) const { if(a.type_ != type_) { return false; @@ -226,18 +226,18 @@ { const surface mother_surface(get_image(val_.filename_, UNSCALED, NO_ADJUST_COLOUR)); const surface mask(get_image(game_config::terrain_mask_image, UNSCALED, NO_ADJUST_COLOUR)); - + if(mother_surface == NULL) return surface(NULL); if(mask == NULL) return surface(NULL); - - SDL_Rect srcrect = { + + SDL_Rect srcrect = { ((tile_size*3) / 4) * val_.loc_.x, - tile_size * val_.loc_.y + (tile_size/2) * (val_.loc_.x % 2), - tile_size, tile_size + tile_size * val_.loc_.y + (tile_size/2) * (val_.loc_.x % 2), + tile_size, tile_size }; - + surface tmp(cut_surface(mother_surface, srcrect)); surface surf(mask_surface(tmp, mask)); @@ -435,11 +435,11 @@ surface res(get_image(i_locator, UNMASKED, adj)); // Adjusts colour if necessary. - if(adj == ADJUST_COLOUR && (red_adjust != 0 || + if(adj == ADJUST_COLOUR && (red_adjust != 0 || green_adjust != 0 || blue_adjust != 0)) { res = surface(adjust_surface_colour(res, red_adjust, green_adjust, blue_adjust)); - } + } const surface mask(get_image(image_mask,UNMASKED,NO_ADJUST_COLOUR)); if(mask != NULL) { @@ -455,7 +455,7 @@ surface get_greyed(const locator i_locator, COLOUR_ADJUSTMENT adj) { surface image(get_image(i_locator, SCALED, adj)); - + return surface(greyscale_image(image)); } @@ -501,7 +501,7 @@ default: return surface(NULL); } - + if(i_locator.in_cache(*imap)) return i_locator.locate_in_cache(*imap); @@ -605,7 +605,7 @@ default: wassert(false); } - + i_locator.add_to_cache(alternative_images_, res); return res; @@ -622,7 +622,7 @@ { typedef image::locator loc; loc::type type = i_locator.get_type(); - if (type != loc::FILE && type != loc::SUB_FILE) + if (type != loc::FILE && type != loc::SUB_FILE) return false; // the insertion will fail if there is already an element in the cache @@ -663,7 +663,7 @@ for(int x = 0; x != map.x(); ++x) { surface surf(NULL); - + const gamemap::location loc(x,y); if(map.on_board(loc)) { const bool shrouded = tm != NULL && tm->shrouded(x,y); @@ -696,7 +696,7 @@ } wassert(surf != NULL); - + SDL_Rect maprect = {x*scale*3/4,y*scale + (is_odd(x) ? scale/2 : 0),0,0}; SDL_BlitSurface(surf, NULL, minimap, &maprect); } Index: wesnoth/src/image.hpp diff -u wesnoth/src/image.hpp:1.34 wesnoth/src/image.hpp:1.35 --- wesnoth/src/image.hpp:1.34 Wed Mar 23 08:52:10 2005 +++ wesnoth/src/image.hpp Sat Jun 4 19:16:05 2005 @@ -45,7 +45,7 @@ value(const char *filename); value(const std::string& filename); value(const std::string& filename, const gamemap::location& loc); - + bool operator==(const value& a) const; bool operator<(const value& a) const; @@ -75,11 +75,11 @@ // const int get_index() const { return index_; }; // returns true if the locator does not correspond to any - // actual image + // actual image bool is_void() const { return val_.type_ == NONE; } // loads the image it is pointing to from the disk surface load_from_disk() const; - + #if 0 // returns true if the locator already was stored in the given // cache @@ -118,7 +118,7 @@ ///the image manager is responsible for setting up images, and destroying ///all images when the program exits. It should probably - ///be created once for the life of the program + ///be created once for the life of the program struct manager { manager(); Index: wesnoth/src/intro.cpp diff -u wesnoth/src/intro.cpp:1.78 wesnoth/src/intro.cpp:1.79 --- wesnoth/src/intro.cpp:1.78 Mon May 16 22:44:19 2005 +++ wesnoth/src/intro.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: intro.cpp,v 1.78 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: intro.cpp,v 1.79 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -222,11 +222,11 @@ bool skip = false, last_key = true; int xpos = textx, ypos = texty; - + //the maximum position that text can reach before wrapping const int max_xpos = next_button.location().x - 10; size_t height = 0; - + for(;;) { if(itor != utils::utf8_iterator::end(story)) { if(*itor == ' ') { @@ -269,7 +269,7 @@ if(rect.h > height) height = rect.h; - xpos += rect.w; + xpos += rect.w; update_rect(rect); ++itor; @@ -301,7 +301,7 @@ if(!skip || itor == utils::utf8_iterator::end(story)) SDL_Delay(20); } - + draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,0,0,0,1.0, video.getSurface()); @@ -319,7 +319,7 @@ const std::string text = _("The End"); const size_t font_size = font::SIZE_XLARGE; - + area = font::text_area(text,font_size); area.x = screen_area().w/2 - area.w/2; area.y = screen_area().h/2 - area.h/2; Index: wesnoth/src/intro.hpp diff -u wesnoth/src/intro.hpp:1.21 wesnoth/src/intro.hpp:1.22 --- wesnoth/src/intro.hpp:1.21 Thu Mar 24 21:35:52 2005 +++ wesnoth/src/intro.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: intro.hpp,v 1.21 2005/03/24 21:35:52 ydirson Exp $ */ +/* $Id: intro.hpp,v 1.22 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/key.cpp diff -u wesnoth/src/key.cpp:1.15 wesnoth/src/key.cpp:1.16 --- wesnoth/src/key.cpp:1.15 Wed Mar 9 17:07:43 2005 +++ wesnoth/src/key.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: key.cpp,v 1.15 2005/03/09 17:07:43 ydirson Exp $ */ +/* $Id: key.cpp,v 1.16 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/key.hpp diff -u wesnoth/src/key.hpp:1.12 wesnoth/src/key.hpp:1.13 --- wesnoth/src/key.hpp:1.12 Tue Jul 20 11:56:58 2004 +++ wesnoth/src/key.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: key.hpp,v 1.12 2004/07/20 11:56:58 gakusho Exp $ */ +/* $Id: key.hpp,v 1.13 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/language.cpp diff -u wesnoth/src/language.cpp:1.91 wesnoth/src/language.cpp:1.92 --- wesnoth/src/language.cpp:1.91 Sat Jun 4 17:08:38 2005 +++ wesnoth/src/language.cpp Sat Jun 4 19:16:05 2005 @@ -1,8 +1,8 @@ -/* $Id: language.cpp,v 1.91 2005/06/04 17:08:38 ydirson Exp $ */ +/* $Id: language.cpp,v 1.92 2005/06/04 19:16:05 ott Exp $ */ /* vim:set encoding=utf-8: */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -135,7 +135,7 @@ std::cerr << "setenv LANGUAGE failed: " << strerror(errno); if(setenv ("LC_ALL", locale, 1) == -1) std::cerr << "setenv LC_ALL failed: " << strerror(errno); -#endif +#endif #ifdef _WIN32 const std::string env = "LANG=" + slocale; @@ -194,7 +194,7 @@ config* langp = cfg.child("language"); if (langp == NULL) { - std::cerr << "No [language] block found in english.cfg\n"; + std::cerr << "No [language] block found in english.cfg\n"; return false; } @@ -216,8 +216,8 @@ if(prefs_locale.empty() == false) { wesnoth_setlocale(LC_MESSAGES, prefs_locale); for(int i = 0; known_languages[i].language[0] != '\0'; i++) { - if (prefs_locale == known_languages[i].localename) - return known_languages[i]; + if (prefs_locale == known_languages[i].localename) + return known_languages[i]; } std::cerr << "locale not found in known array; defaulting to system locale\n"; return known_languages[0]; Index: wesnoth/src/language.hpp diff -u wesnoth/src/language.hpp:1.35 wesnoth/src/language.hpp:1.36 --- wesnoth/src/language.hpp:1.35 Sun Apr 17 18:53:10 2005 +++ wesnoth/src/language.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: language.hpp,v 1.35 2005/04/17 18:53:10 gruikya Exp $ */ +/* $Id: language.hpp,v 1.36 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -29,7 +29,7 @@ language_def(const std::string& name, const std::string& lang) : localename(name), language(lang) {} std::string localename; - std::string language; + std::string language; bool operator== (const language_def&); }; extern language_def known_languages[]; Index: wesnoth/src/leader_list.cpp diff -u wesnoth/src/leader_list.cpp:1.11 wesnoth/src/leader_list.cpp:1.12 --- wesnoth/src/leader_list.cpp:1.11 Wed Mar 23 22:10:50 2005 +++ wesnoth/src/leader_list.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: leader_list.cpp,v 1.11 2005/03/23 22:10:50 ydirson Exp $ */ +/* $Id: leader_list.cpp,v 1.12 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -60,7 +60,7 @@ if(!side["leader"].empty()) { leaders_ = utils::split(side["leader"]); } - + const std::string default_leader = side["type"]; size_t default_index = 0; @@ -80,7 +80,7 @@ std::vector<std::string> leader_strings; for(itor = leaders_.begin(); itor != leaders_.end(); ++itor) { - + const game_data::unit_type_map& utypes = data_->unit_types; //const std::string name = data_->unit_types->find(*itor).language_name(); @@ -112,7 +112,7 @@ int leader_index = 0; for(std::vector<std::string>::const_iterator itor = leaders_.begin(); itor != leaders_.end(); ++itor) { - if (leader == *itor) + if (leader == *itor) combo_->set_selected(leader_index); ++leader_index; } Index: wesnoth/src/leader_list.hpp diff -u wesnoth/src/leader_list.hpp:1.3 wesnoth/src/leader_list.hpp:1.4 --- wesnoth/src/leader_list.hpp:1.3 Thu Mar 10 01:24:31 2005 +++ wesnoth/src/leader_list.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: leader_list.hpp,v 1.3 2005/03/10 01:24:31 ydirson Exp $ */ +/* $Id: leader_list.hpp,v 1.4 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify Index: wesnoth/src/map.cpp diff -u wesnoth/src/map.cpp:1.59 wesnoth/src/map.cpp:1.60 --- wesnoth/src/map.cpp:1.59 Mon May 2 19:42:04 2005 +++ wesnoth/src/map.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: map.cpp,v 1.59 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: map.cpp,v 1.60 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -148,10 +148,10 @@ return ret; } -gamemap::location& gamemap::location::operator+=(const gamemap::location &a) +gamemap::location& gamemap::location::operator+=(const gamemap::location &a) { bool parity = (x & 1) != 0; - + x += a.x; y += a.y; @@ -343,7 +343,7 @@ startingPositions_[pos - m.startingPositions_] = *pos; } } - + } int gamemap::x() const { return tiles_.size(); } @@ -366,7 +366,7 @@ //if not on the board, decide based on what surrounding terrain is TERRAIN items[6]; int nitems = 0; - + location adj[6]; get_adjacent_tiles(loc,adj); for(int n = 0; n != 6; ++n) { @@ -482,7 +482,7 @@ location adj[6]; get_adjacent_tiles(loc,adj); - for(int n = 0; n < 6; ++n) + for(int n = 0; n < 6; ++n) remove_from_border_cache(adj[n]); } Index: wesnoth/src/map.hpp diff -u wesnoth/src/map.hpp:1.38 wesnoth/src/map.hpp:1.39 --- wesnoth/src/map.hpp:1.38 Mon May 2 19:42:04 2005 +++ wesnoth/src/map.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: map.hpp,v 1.38 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: map.hpp,v 1.39 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -65,9 +65,9 @@ void write(config& cfg) const; inline bool valid() const { return x >= 0 && y >= 0; } - + inline bool valid(const int parWidth, const int parHeight) const - { + { return ((x >= 0) && (y >= 0) && (x < parWidth) && (y < parHeight)); } @@ -156,7 +156,7 @@ //shortcut to get_terrain_info(get_terrain(loc)) const terrain_type& get_terrain_info(const location &loc) const; - + //gets the list of terrains const std::vector<TERRAIN>& get_terrain_list() const; Index: wesnoth/src/mapgen.cpp diff -u wesnoth/src/mapgen.cpp:1.64 wesnoth/src/mapgen.cpp:1.65 --- wesnoth/src/mapgen.cpp:1.64 Mon Apr 25 07:25:04 2005 +++ wesnoth/src/mapgen.cpp Sat Jun 4 19:16:05 2005 @@ -214,7 +214,7 @@ if(on_map && !river.empty() && heights[x][y] > heights[river.back().x][river.back().y] + river_uphill) { return false; } - + //if we're at the end of the river if(!on_map || terrain[x][y] == 'c' || terrain[x][y] == 's') { LOG_NG << "generating river...\n"; @@ -229,7 +229,7 @@ return true; } - + location current_loc(x,y); location adj[6]; get_adjacent_tiles(current_loc,adj); @@ -440,7 +440,7 @@ } int surrounding_ranking = 0; - + for(int xpos = x-5; xpos <= x+5; ++xpos) { for(int ypos = y-5; ypos <= y+5; ++ypos) { if(valid_terrain(xpos,ypos)) { @@ -491,7 +491,7 @@ return best_loc; } -std::string generate_name(const unit_race& name_generator, const std::string& id, +std::string generate_name(const unit_race& name_generator, const std::string& id, std::string* base_name=NULL, utils::string_map* additional_symbols=NULL) { @@ -627,7 +627,7 @@ //the map, same for roads, etc etc) width *= 3; height *= 3; - + LOG_NG << "generating height map...\n"; //generate the height of everything. const height_map heights = generate_height_map(width,height,iterations,hill_size,island_size,island_off_center); @@ -687,7 +687,7 @@ const int y = rand()%height; if(heights[x][y] > atoi(cfg["min_lake_height"].c_str())) { const std::vector<location> river = generate_river(heights,terrain,x,y,atoi(cfg["river_frequency"].c_str())); - + if(river.empty() == false && labels != NULL) { std::string base_name; LOG_NG << "generating name for river...\n"; @@ -952,12 +952,12 @@ if(last == adj[0] && next == adj[3] || last == adj[3] && next == adj[0]) { direction = 0; } - + //if we are going south west-north east else if(last == adj[1] && next == adj[4] || last == adj[4] && next == adj[1]) { direction = 1; } - + //if we are going south east-north west else if(last == adj[2] && next == adj[5] || last == adj[5] && next == adj[2]) { direction = 2; @@ -1048,7 +1048,7 @@ //first we work out the size of the x and y distance between villages const size_t tiles_per_village = ((width*height)/9)/nvillages; size_t village_x = 1, village_y = 1; - + //alternate between incrementing the x and y value. When they are high enough //to equal or exceed the tiles_per_village, then we have them to the value //we want them at. @@ -1061,18 +1061,18 @@ } std::set<std::string> used_names; - + for(size_t vx = 0; vx < width; vx += village_x) { LOG_NG << "village at " << vx << "\n"; for(size_t vy = rand()%village_y; vy < height; vy += village_y) { - + const size_t add_x = rand()%3; const size_t add_y = rand()%3; const size_t x = (vx + add_x) - 1; const size_t y = (vy + add_y) - 1; - + const gamemap::location res = place_village(terrain,x,y,2,cfg); - + if(res.x >= width/3 && res.x < (width*2)/3 && res.y >= height/3 && res.y < (height*2)/3) { const std::string str(1,terrain[res.x][res.y]); const config* const child = cfg.find_child("village","terrain",str); @@ -1116,7 +1116,7 @@ name_type = "village_name_lake"; break; } - + const gamemap::TERRAIN terr = terrain[adj[n].x+width/3][adj[n].y+height/3]; if(std::count(field.begin(),field.end(),terr) > 0) { Index: wesnoth/src/mapgen_dialog.cpp diff -u wesnoth/src/mapgen_dialog.cpp:1.38 wesnoth/src/mapgen_dialog.cpp:1.39 --- wesnoth/src/mapgen_dialog.cpp:1.38 Sun Apr 24 12:05:28 2005 +++ wesnoth/src/mapgen_dialog.cpp Sat Jun 4 19:16:05 2005 @@ -111,7 +111,7 @@ hillsize_rect.x = text_right - hillsize_rect.w; villages_rect.x = text_right - villages_rect.w; landform_rect.x = text_right - landform_rect.w; - + const int vertical_margin = 20; players_rect.y = ypos + vertical_margin*2; width_rect.y = players_rect.y + players_rect.h + vertical_margin; @@ -138,7 +138,7 @@ const int max_width = 100; const int max_height = 100; const int extra_size_per_player = 2; - + slider_rect.y = width_rect.y; gui::slider width_slider(screen); width_slider.set_location(slider_rect); @@ -250,7 +250,7 @@ height_str << height_; font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,height_str.str(), slider_right+horz_margin,height_rect.y); - + std::stringstream villages_str; villages_str << nvillages_ << _("/1000 tiles"); font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,villages_str.str(), Index: wesnoth/src/mouse.cpp diff -u wesnoth/src/mouse.cpp:1.12 wesnoth/src/mouse.cpp:1.13 --- wesnoth/src/mouse.cpp:1.12 Thu Nov 18 22:00:12 2004 +++ wesnoth/src/mouse.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: mouse.cpp,v 1.12 2004/11/18 22:00:12 ydirson Exp $ */ +/* $Id: mouse.cpp,v 1.13 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -34,9 +34,9 @@ // Scrolling DOWN or RIGHT void scroll_inc() { ++scrollamount_; } - + // Reducing scroll amount -void scroll_reduce() { +void scroll_reduce() { if(scrollamount_ > 0) { --scrollamount_; } else { Index: wesnoth/src/mouse.hpp diff -u wesnoth/src/mouse.hpp:1.10 wesnoth/src/mouse.hpp:1.11 --- wesnoth/src/mouse.hpp:1.10 Tue Dec 23 22:45:30 2003 +++ wesnoth/src/mouse.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: mouse.hpp,v 1.10 2003/12/23 22:45:30 uid66289 Exp $ */ +/* $Id: mouse.hpp,v 1.11 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/multiplayer.cpp diff -u wesnoth/src/multiplayer.cpp:1.159 wesnoth/src/multiplayer.cpp:1.160 --- wesnoth/src/multiplayer.cpp:1.159 Thu Jun 2 23:10:55 2005 +++ wesnoth/src/multiplayer.cpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer.cpp,v 1.159 2005/06/02 23:10:55 Sirp Exp $ */ +/* $Id: multiplayer.cpp,v 1.160 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -103,14 +103,14 @@ const int pos = h.find_first_of(":"); std::string host; unsigned int port; - - if(pos == -1) { + + if(pos == -1) { host = h; port = 15000; - } else { + } else { host = h.substr(0, pos); port = lexical_cast_default<unsigned int>(h.substr(pos + 1), 15000); - } + } // shown_hosts is used to prevent the client being locked in a redirect // loop. @@ -142,7 +142,7 @@ const std::string errorstring = vgettext("The server requires version '$version1' while you are using version '$version2'", i18n_symbols); throw network::error(errorstring); } - + // Check for "redirect" messages if(data.child("redirect")) { config* redirect = data.child("redirect"); @@ -156,7 +156,7 @@ shown_hosts.insert(hostpair(host, port)); if(network::nconnections() > 0) - network::disconnect(); + network::disconnect(); sock = gui::network_connect_dialog(disp,_("Connecting to Server..."),host,port); continue; } @@ -181,7 +181,7 @@ std::string login = preferences::login(); - if(!first_time) { + if(!first_time) { const int res = gui::show_dialog(disp, NULL, "", _("You must log in to this server"), gui::OK_CANCEL, NULL, NULL, _("Login: "), &login); @@ -242,7 +242,7 @@ { mp::wait ui(disp, game_config, data, chat, gamelist); - + ui.join_game(observe); run_lobby_loop(disp, ui); @@ -267,14 +267,14 @@ } } -void enter_connect_mode(display& disp, const config& game_config, game_data& data, +void enter_connect_mode(display& disp, const config& game_config, game_data& data, mp::chat& chat, config& gamelist, const mp::create::parameters& params, mp::controller default_controller, bool is_server) { mp::ui::result res; game_state state; const network::manager net_manager; - const network::server_manager serv_manager(15000, is_server ? + const network::server_manager serv_manager(15000, is_server ? network::server_manager::TRY_CREATE_SERVER : network::server_manager::NO_SERVER); network_game_manager m; @@ -289,7 +289,7 @@ res = ui.get_result(); // start_game() updates the parameters to reflect game start, - // so it must be called before get_level() + // so it must be called before get_level() if (res == mp::ui::PLAY) { ui.start_game(); state = ui.get_state(); @@ -330,7 +330,7 @@ } } -void enter_lobby_mode(display& disp, const config& game_config, game_data& data, mp::chat& chat, config& gamelist) +void enter_lobby_mode(display& disp, const config& game_config, game_data& data, mp::chat& chat, config& gamelist) { mp::ui::result res; @@ -364,7 +364,7 @@ } } } - + } namespace mp { Index: wesnoth/src/multiplayer.hpp diff -u wesnoth/src/multiplayer.hpp:1.27 wesnoth/src/multiplayer.hpp:1.28 --- wesnoth/src/multiplayer.hpp:1.27 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/multiplayer.hpp Sat Jun 4 19:16:05 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer.hpp,v 1.27 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: multiplayer.hpp,v 1.28 2005/06/04 19:16:05 ott Exp $ */ /* Copyright (C) 2005 Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -27,7 +27,7 @@ /** Starts a multiplayer game in server mode, or in single-user mode. * - * @param disp The global display + * @param disp The global display * @param game_config The global, top-level WML configuration for the game * @param data The global game data (unit types, etc) * @param default_controller The default controller type @@ -38,12 +38,12 @@ /** Starts a multiplayer game in client mode. * - * @param disp The global display + * @param disp The global display * @param game_config The global, top-level WML configuration for the game * @param data The global game data (unit types, etc) * @param host The host to connect to. */ -void start_client(display& disp, const config& game_config, game_data& data, +void start_client(display& disp, const config& game_config, game_data& data, const std::string host); } Index: wesnoth/src/multiplayer_connect.cpp diff -u wesnoth/src/multiplayer_connect.cpp:1.147 wesnoth/src/multiplayer_connect.cpp:1.148 --- wesnoth/src/multiplayer_connect.cpp:1.147 Fri Jun 3 08:43:22 2005 +++ wesnoth/src/multiplayer_connect.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_connect.cpp,v 1.147 2005/06/03 08:43:22 j_daniel Exp $ */ +/* $Id: multiplayer_connect.cpp,v 1.148 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -51,7 +51,7 @@ player_number_(parent.video(), lexical_cast_default<std::string>(index+1, ""), font::SIZE_LARGE, font::LOBBY_COLOUR), combo_controller_(parent.disp(), parent.player_types_), - orig_controller_(parent.video(), cfg["description"], font::SIZE_SMALL), + orig_controller_(parent.video(), cfg["description"], font::SIZE_SMALL), combo_faction_(parent.disp(), parent.player_factions_), combo_leader_(parent.disp(), std::vector<std::string>()), combo_team_(parent.disp(), parent.player_teams_), @@ -72,7 +72,7 @@ } } } - + slider_gold_.set_min(20); slider_gold_.set_max(1000); slider_gold_.set_increment(25); @@ -121,7 +121,7 @@ if(leader_type.empty()) { leader_name_pseudolist.push_back("-"); } else { - game_data::unit_type_map::const_iterator leader_name = + game_data::unit_type_map::const_iterator leader_name = parent_->game_data_.unit_types.find(leader_type); if(leader_name == parent_->game_data_.unit_types.end()) { leader_name_pseudolist.push_back("-"); @@ -137,8 +137,8 @@ } connect::side::side(const side& a) : - parent_(a.parent_), cfg_(a.cfg_), - index_(a.index_), id_(a.id_), save_id_(a.save_id_), + parent_(a.parent_), cfg_(a.cfg_), + index_(a.index_), id_(a.id_), save_id_(a.save_id_), controller_(a.controller_), faction_(a.faction_), team_(a.team_), colour_(a.colour_), gold_(a.gold_), leader_(a.leader_), /* taken_(a.taken_), */ @@ -146,14 +146,14 @@ orig_controller_(a.orig_controller_), combo_faction_(a.combo_faction_), combo_leader_(a.combo_leader_), combo_team_(a.combo_team_), combo_colour_(a.combo_colour_), - slider_gold_(a.slider_gold_), label_gold_(a.label_gold_), + slider_gold_(a.slider_gold_), label_gold_(a.label_gold_), enabled_(a.enabled_), changed_(a.changed_), llm_(a.llm_) { llm_.set_combo(enabled_ ? &combo_leader_ : NULL); } void connect::side::add_widgets_to_scrollpane(gui::scrollpane& pane, int pos) -{ +{ pane.add_widget(&player_number_, 0, 5 + pos); pane.add_widget(&combo_controller_, 20, 5 + pos); pane.add_widget(&orig_controller_, 20 + (combo_controller_.width() - orig_controller_.width()) / 2, 35 + pos + (combo_leader_.height() - orig_controller_.height()) / 2); @@ -173,7 +173,7 @@ } else if (combo_controller_.selected() < CNTR_LAST) { // If the current side corresponds to an existing user, // we must kick it! - + if(id_ == preferences::login()) { update_controller_ui(); // Cannot kick game creator } else { @@ -208,7 +208,7 @@ } if(!enabled_) - return; + return; if (combo_faction_.changed() && combo_faction_.selected() >= 0) { faction_ = combo_faction_.selected(); @@ -383,12 +383,12 @@ update_controller_ui(); } -const std::string& connect::side::get_id() const +const std::string& connect::side::get_id() const { return id_; } -void connect::side::set_id(const std::string& id) +void connect::side::set_id(const std::string& id) { connected_user_list::iterator i = parent_->find_player(id); if (i != parent_->users_.end()) { @@ -398,7 +398,7 @@ update_ui(); } -const std::string& connect::side::get_save_id() const +const std::string& connect::side::get_save_id() const { return save_id_; } @@ -415,7 +415,7 @@ llm_.update_leader_list(faction_); llm_.set_leader(data["leader"]); } - + update_ui(); } @@ -441,7 +441,7 @@ // Builds the list of sides which aren't random std::vector<int> nonrandom_sides; - for(config::child_iterator itor = parent_->era_sides_.begin(); + for(config::child_iterator itor = parent_->era_sides_.begin(); itor != parent_->era_sides_.end(); ++itor) { if((**itor)["random_faction"] != "yes") { nonrandom_sides.push_back(itor - parent_->era_sides_.begin()); @@ -456,7 +456,7 @@ } if (llm_.get_leader() == "random") { - // Choose a random leader type. + // Choose a random leader type. const config& fact = *parent_->era_sides_[faction_]; std::vector<std::string> types = utils::split(fact["leader"]); if (!types.empty()) { @@ -471,7 +471,7 @@ } connect::connect(display& disp, const config& game_config, const game_data& data, - chat& c, config& gamelist, const create::parameters& params, + chat& c, config& gamelist, const create::parameters& params, mp::controller default_controller) : mp::ui(disp, game_config, c, gamelist), @@ -510,7 +510,7 @@ // Adds the current user as default user. users_.push_back(connected_user(preferences::login(), CNTR_LOCAL, 0)); update_user_combos(); - if(sides_.empty()) { + if(sides_.empty()) { throw config::error(_("The scenario is invalid because it has no sides.")); } @@ -583,7 +583,7 @@ void connect::start_game() { // Resolves the "random faction" and "random message" - for (side_list::iterator itor = sides_.begin(); itor != sides_.end(); + for (side_list::iterator itor = sides_.begin(); itor != sides_.end(); ++itor) { itor->resolve_random(); @@ -865,11 +865,11 @@ set_result(QUIT); return; } - + std::string error_log; ::load_game(game_data_, game, state_, &error_log); if(!error_log.empty()) { - gui::show_error_message(disp(), + gui::show_error_message(disp(), _("The file you have tried to load is corrupt: '") + error_log); set_result(QUIT); @@ -941,7 +941,7 @@ { // Import all sides into the level level_.clear_children("side"); - for(side_list::const_iterator itor = sides_.begin(); itor != sides_.end(); + for(side_list::const_iterator itor = sides_.begin(); itor != sides_.end(); ++itor) { level_.add_child("side", itor->get_config()); Index: wesnoth/src/multiplayer_connect.hpp diff -u wesnoth/src/multiplayer_connect.hpp:1.37 wesnoth/src/multiplayer_connect.hpp:1.38 --- wesnoth/src/multiplayer_connect.hpp:1.37 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/multiplayer_connect.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_connect.hpp,v 1.37 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: multiplayer_connect.hpp,v 1.38 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ // The mp::connect widget owning this mp::connect::side. Used // in the constructor, must be first. - connect* parent_; + connect* parent_; config cfg_; @@ -129,8 +129,8 @@ typedef std::vector<side> side_list; - connect(display& disp, const config& game_config, const game_data& data, - chat& c, config& gamelist, const create::parameters& params, + connect(display& disp, const config& game_config, const game_data& data, + chat& c, config& gamelist, const create::parameters& params, mp::controller default_controller); virtual void process_event(); @@ -164,13 +164,13 @@ // Updates the level_ variable to reflect the sides in the sides_ vector void update_level(); - + // Updates the level, and send a diff to the clients void update_and_send_diff(); // Returns true if there still are sides available for this game bool sides_available(); - + // Updates the state of the player list, the launch button and of the // start game label, to reflect the actual state. void update_playerlist_state(bool silent=true); @@ -209,7 +209,7 @@ // team_name list and "Team" prefix std::vector<std::string> team_names_; const std::string team_prefix_; - + side_list sides_; connected_user_list users_; Index: wesnoth/src/multiplayer_create.cpp diff -u wesnoth/src/multiplayer_create.cpp:1.25 wesnoth/src/multiplayer_create.cpp:1.26 --- wesnoth/src/multiplayer_create.cpp:1.25 Fri Jun 3 22:42:33 2005 +++ wesnoth/src/multiplayer_create.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_create.cpp,v 1.25 2005/06/03 22:42:33 Sirp Exp $ */ +/* $Id: multiplayer_create.cpp,v 1.26 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -129,7 +129,7 @@ } else { era_combo_.set_selected(0); } - + utils::string_map i18n_symbols; i18n_symbols["login"] = preferences::login(); @@ -154,7 +154,7 @@ preferences::set_turns(turns_slider_.value()); } -create::parameters& create::get_parameters() +create::parameters& create::get_parameters() { const config::child_list& era_list = game_config().get_children("era"); const int turns = turns_slider_.value() < turns_slider_.max_value() ? @@ -371,9 +371,9 @@ } } } - + void create::layout_children(const SDL_Rect& rect) -{ +{ ui::layout_children(rect); SDL_Rect ca = client_area(); @@ -401,7 +401,7 @@ minimap_rect_ = mmrect; ypos += minimap_width + border_size; - num_players_label_.set_location(xpos, ypos); + num_players_label_.set_location(xpos, ypos); ypos += num_players_label_.height() + border_size; regenerate_map_.set_location(xpos, ypos); @@ -468,7 +468,7 @@ #endif // Buttons - right_button->set_location(ca.x + ca.w - right_button->width(), + right_button->set_location(ca.x + ca.w - right_button->width(), ca.y + ca.h - right_button->height()); left_button->set_location(right_button->location().x - left_button->width() - gui::ButtonHPadding, ca.y + ca.h - left_button->height()); Index: wesnoth/src/multiplayer_create.hpp diff -u wesnoth/src/multiplayer_create.hpp:1.3 wesnoth/src/multiplayer_create.hpp:1.4 --- wesnoth/src/multiplayer_create.hpp:1.3 Sat Feb 26 19:50:00 2005 +++ wesnoth/src/multiplayer_create.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_create.hpp,v 1.3 2005/02/26 19:50:00 gruikya Exp $ */ +/* $Id: multiplayer_create.hpp,v 1.4 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify Index: wesnoth/src/multiplayer_lobby.cpp diff -u wesnoth/src/multiplayer_lobby.cpp:1.73 wesnoth/src/multiplayer_lobby.cpp:1.74 --- wesnoth/src/multiplayer_lobby.cpp:1.73 Mon May 16 22:44:19 2005 +++ wesnoth/src/multiplayer_lobby.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_lobby.cpp,v 1.73 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: multiplayer_lobby.cpp,v 1.74 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -78,7 +78,7 @@ } return mapsize1 < mapsize2; - + } else if(column == STATUS_COLUMN) { const int nslots1 = atoi(game1["slots"].c_str()); const int nslots2 = atoi(game2["slots"].c_str()); @@ -193,7 +193,7 @@ if(turn != "") { str << COLUMN_SEPARATOR << _("Turn") << " " << turn; } else if(slots != "") { - str << COLUMN_SEPARATOR << slots << " " << + str << COLUMN_SEPARATOR << slots << " " << ngettext(_("Vacant Slot"), _("Vacant Slots"), nslots); } @@ -262,7 +262,7 @@ } return; } - + if(create_game_.pressed()) { set_result(CREATE); return; Index: wesnoth/src/multiplayer_lobby.hpp diff -u wesnoth/src/multiplayer_lobby.hpp:1.12 wesnoth/src/multiplayer_lobby.hpp:1.13 --- wesnoth/src/multiplayer_lobby.hpp:1.12 Mon May 16 22:44:19 2005 +++ wesnoth/src/multiplayer_lobby.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_lobby.hpp,v 1.12 2005/05/16 22:44:19 ydirson Exp $ */ +/* $Id: multiplayer_lobby.hpp,v 1.13 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify Index: wesnoth/src/multiplayer_ui.cpp diff -u wesnoth/src/multiplayer_ui.cpp:1.26 wesnoth/src/multiplayer_ui.cpp:1.27 --- wesnoth/src/multiplayer_ui.cpp:1.26 Sat Jun 4 03:39:21 2005 +++ wesnoth/src/multiplayer_ui.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_ui.cpp,v 1.26 2005/06/04 03:39:21 Sirp Exp $ */ +/* $Id: multiplayer_ui.cpp,v 1.27 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2005 + Copyright (C) 2005 Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -104,7 +104,7 @@ void chat::add_message(const std::string& user, const std::string& message) { message_history_.push_back(msg(user, message)); - + while (message_history_.size() > 1024) { message_history_.pop_front(); @@ -117,11 +117,11 @@ { std::string s; - for(msg_hist::const_iterator itor = message_history_.begin(); + for(msg_hist::const_iterator itor = message_history_.begin(); itor != message_history_.end(); ++itor) { s.append(format_message(*itor)); } - + textbox.set_text(s); last_update_ = message_history_.size(); textbox.scroll_to_bottom(); @@ -131,7 +131,7 @@ { std::string s; - for(msg_hist::const_iterator itor = message_history_.begin() + last_update_; + for(msg_hist::const_iterator itor = message_history_.begin() + last_update_; itor != message_history_.end(); ++itor) { s.append(format_message(*itor)); } @@ -176,7 +176,7 @@ if(sock) { process_network_data(data, sock); - } + } } catch(network::error& e) { process_network_error(e); } @@ -235,7 +235,7 @@ surface background(image::get_image("misc/lobby.png",image::UNSCALED)); background = scale_surface(background, video().getx(), video().gety()); - if(background == NULL) + if(background == NULL) return; SDL_BlitSurface(background, NULL, video().getSurface(), NULL); update_whole_screen(); @@ -297,7 +297,7 @@ chat_.update_textbox(chat_textbox_); } - + network::send_data(data); entry_textbox_.clear(); } @@ -349,8 +349,8 @@ void ui::layout_children(const SDL_Rect& rect) { users_menu_.set_width(xscale(159)); - users_menu_.set_location(xscale(856), yscale(42)); - users_menu_.set_height(yscale(715)); + users_menu_.set_location(xscale(856), yscale(42)); + users_menu_.set_height(yscale(715)); users_menu_.set_max_height(yscale(715)); chat_textbox_.set_location(xscale(11) + 4, yscale(573) + 4); chat_textbox_.set_measurements(xscale(833) - 8, yscale(143) - 8); Index: wesnoth/src/multiplayer_ui.hpp diff -u wesnoth/src/multiplayer_ui.hpp:1.9 wesnoth/src/multiplayer_ui.hpp:1.10 --- wesnoth/src/multiplayer_ui.hpp:1.9 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/multiplayer_ui.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_ui.hpp,v 1.9 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: multiplayer_ui.hpp,v 1.10 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -50,7 +50,7 @@ private: struct msg { - msg(const std::string& user, const std::string& message) : + msg(const std::string& user, const std::string& message) : user(user), message(message) {}; std::string user; std::string message; Index: wesnoth/src/multiplayer_wait.cpp diff -u wesnoth/src/multiplayer_wait.cpp:1.26 wesnoth/src/multiplayer_wait.cpp:1.27 --- wesnoth/src/multiplayer_wait.cpp:1.26 Sat May 7 21:53:42 2005 +++ wesnoth/src/multiplayer_wait.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_wait.cpp,v 1.26 2005/05/07 21:53:42 ettin Exp $ */ +/* $Id: multiplayer_wait.cpp,v 1.27 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ const config::child_list& side_list) : gui::preview_pane(disp.video()), side_list_(side_list), - leader_combo_(disp, std::vector<std::string>()), + leader_combo_(disp, std::vector<std::string>()), leaders_(side_list, data, &leader_combo_), selection_(0), data_(data) { @@ -101,7 +101,7 @@ SDL_Rect image_rect = {area.x,area.y,0,0}; surface unit_image(image::get_image(image, image::UNSCALED)); - + if(!unit_image.null()) { image_rect.w = unit_image->w; image_rect.h = unit_image->h; @@ -163,12 +163,12 @@ void wait::join_game(bool observe) { for(;;) { - network::connection data_res = gui::network_data_dialog(disp(), + network::connection data_res = gui::network_data_dialog(disp(), _("Getting game data..."), level_); check_response(data_res, level_); //if we have got valid side data - if(level_.child("gamelist") == NULL) + if(level_.child("gamelist") == NULL) break; } @@ -205,7 +205,7 @@ const config* era = level_.child("era"); if(era == NULL) throw network::error(_("Era not available")); - const config::child_list& possible_sides = + const config::child_list& possible_sides = era->get_children("multiplayer_side"); if(possible_sides.empty()) { set_result(QUIT); @@ -215,13 +215,13 @@ std::vector<std::string> choices; for(config::child_list::const_iterator side = - possible_sides.begin(); side != + possible_sides.begin(); side != possible_sides.end(); ++side) { choices.push_back((**side)["name"]); } std::vector<gui::preview_pane* > preview_panes; - leader_preview_pane leader_selector(disp(), &game_data_, + leader_preview_pane leader_selector(disp(), &game_data_, possible_sides); preview_panes.push_back(&leader_selector); @@ -250,7 +250,7 @@ return state_; } -void wait::start_game() +void wait::start_game() { config const * const stats = level_.child("statistics"); if(stats != NULL) { @@ -310,7 +310,7 @@ << level_.get_children("side").size() << "," << data.get_children("side").size() << "\n"; generate_menu(); - } + } } void wait::generate_menu() @@ -358,7 +358,7 @@ // Dumps the "image" part of the faction name, if any, // to replace it by a picture of the actual leader if(side_name.str()[0] == font::IMAGE) { - std::string::size_type p = + std::string::size_type p = side_name.str().find_first_of(COLUMN_SEPARATOR); if(p != std::string::npos && p < side_name.size()) { side_name = IMAGE_PREFIX + leader_image + COLUMN_SEPARATOR + side_name.str().substr(p+1); Index: wesnoth/src/multiplayer_wait.hpp diff -u wesnoth/src/multiplayer_wait.hpp:1.5 wesnoth/src/multiplayer_wait.hpp:1.6 --- wesnoth/src/multiplayer_wait.hpp:1.5 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/multiplayer_wait.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: multiplayer_wait.hpp,v 1.5 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: multiplayer_wait.hpp,v 1.6 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) + Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ class leader_preview_pane : public gui::preview_pane { public: - leader_preview_pane(display& disp, const game_data* data, + leader_preview_pane(display& disp, const game_data* data, const config::child_list& side_list); bool show_above() const; Index: wesnoth/src/network.cpp diff -u wesnoth/src/network.cpp:1.63 wesnoth/src/network.cpp:1.64 --- wesnoth/src/network.cpp:1.63 Thu Jun 2 23:58:01 2005 +++ wesnoth/src/network.cpp Sat Jun 4 19:16:05 2005 @@ -4,7 +4,7 @@ #include "config.hpp" #include "log.hpp" #include "network.hpp" -#include "network_worker.hpp" +#include "network_worker.hpp" #include "thread.hpp" #include "util.hpp" #include "wassert.hpp" @@ -231,117 +231,117 @@ { return server_socket != 0; } - -namespace { - -class connect_operation : public threading::async_operation -{ -public: - connect_operation(const std::string& host, int port) : host_(host), port_(port), error_(NULL), connect_(0) - {} - - void check_error(); - void run(); - - network::connection result() const { return connect_; } - -private: - std::string host_; - int port_; - const char* error_; - network::connection connect_; -}; - -void connect_operation::check_error() -{ - if(error_ != NULL) { - throw error(error_); - } -} - -void connect_operation::run() -{ - char* const hostname = host_.empty() ? NULL : const_cast<char*>(host_.c_str()); - IPaddress ip; - if(SDLNet_ResolveHost(&ip,hostname,port_) == -1) { - error_ = "Could not connect to host"; - return; - } - - TCPsocket sock = SDLNet_TCP_Open(&ip); - if(!sock) { - error_ = hostname == NULL ? "Could not bind to port" : - "Could not connect to host"; - return; - } - - //if this is a server socket - if(hostname == NULL) { - const threading::lock l(get_mutex()); - connect_ = create_connection(sock,"",port_); - return; - } - - //send data telling the remote host that this is a new connection - char buf[4]; - SDLNet_Write32(0,buf); - const int nbytes = SDLNet_TCP_Send(sock,buf,4); - if(nbytes != 4) { - SDLNet_TCP_Close(sock); - - error_ = "Could not send initial handshake"; - return; - } - - //no blocking operations from here on - const threading::lock l(get_mutex()); - LOG_NW << "sent handshake...\n"; - - if(is_aborted()) { - LOG_NW << "connect operation aborted by calling thread\n"; - SDLNet_TCP_Close(sock); - return; - } - - //allocate this connection a connection handle - connect_ = create_connection(sock,host_,port_); - - const int res = SDLNet_TCP_AddSocket(socket_set,sock); - if(res == -1) { - SDLNet_TCP_Close(sock); - error_ = "Could not add socket to socket set"; - return; - } - - waiting_sockets.insert(connect_); - - sockets.push_back(connect_); - wassert(schemas.count(connect_) == 0); - schemas.insert(std::pair<network::connection,schema_pair>(connect_,schema_pair())); - - notify_finished(); -} - -} + +namespace { + +class connect_operation : public threading::async_operation +{ +public: + connect_operation(const std::string& host, int port) : host_(host), port_(port), error_(NULL), connect_(0) + {} + + void check_error(); + void run(); + + network::connection result() const { return connect_; } + +private: + std::string host_; + int port_; + const char* error_; + network::connection connect_; +}; + +void connect_operation::check_error() +{ + if(error_ != NULL) { + throw error(error_); + } +} + +void connect_operation::run() +{ + char* const hostname = host_.empty() ? NULL : const_cast<char*>(host_.c_str()); + IPaddress ip; + if(SDLNet_ResolveHost(&ip,hostname,port_) == -1) { + error_ = "Could not connect to host"; + return; + } + + TCPsocket sock = SDLNet_TCP_Open(&ip); + if(!sock) { + error_ = hostname == NULL ? "Could not bind to port" : + "Could not connect to host"; + return; + } + + //if this is a server socket + if(hostname == NULL) { + const threading::lock l(get_mutex()); + connect_ = create_connection(sock,"",port_); + return; + } + + //send data telling the remote host that this is a new connection + char buf[4]; + SDLNet_Write32(0,buf); + const int nbytes = SDLNet_TCP_Send(sock,buf,4); + if(nbytes != 4) { + SDLNet_TCP_Close(sock); + + error_ = "Could not send initial handshake"; + return; + } + + //no blocking operations from here on + const threading::lock l(get_mutex()); + LOG_NW << "sent handshake...\n"; + + if(is_aborted()) { + LOG_NW << "connect operation aborted by calling thread\n"; + SDLNet_TCP_Close(sock); + return; + } + + //allocate this connection a connection handle + connect_ = create_connection(sock,host_,port_); + + const int res = SDLNet_TCP_AddSocket(socket_set,sock); + if(res == -1) { + SDLNet_TCP_Close(sock); + error_ = "Could not add socket to socket set"; + return; + } + + waiting_sockets.insert(connect_); + + sockets.push_back(connect_); + wassert(schemas.count(connect_) == 0); + schemas.insert(std::pair<network::connection,schema_pair>(connect_,schema_pair())); + + notify_finished(); +} + +} connection connect(const std::string& host, int port) -{ - connect_operation op(host,port); - op.run(); - op.check_error(); - return op.result(); -} - -connection connect(const std::string& host, int port, threading::waiter& waiter) -{ - const threading::async_operation_holder<connect_operation> op(new connect_operation(host,port)); - const connect_operation::RESULT res = op.operation().execute(waiter); - if(res == connect_operation::ABORTED) { - return 0; - } - - op.operation().check_error(); - return op.operation().result(); +{ + connect_operation op(host,port); + op.run(); + op.check_error(); + return op.result(); +} + +connection connect(const std::string& host, int port, threading::waiter& waiter) +{ + const threading::async_operation_holder<connect_operation> op(new connect_operation(host,port)); + const connect_operation::RESULT res = op.operation().execute(waiter); + if(res == connect_operation::ABORTED) { + return 0; + } + + op.operation().check_error(); + return op.operation().result(); } connection accept_connection() Index: wesnoth/src/network.hpp diff -u wesnoth/src/network.hpp:1.25 wesnoth/src/network.hpp:1.26 --- wesnoth/src/network.hpp:1.25 Thu Jun 2 23:10:55 2005 +++ wesnoth/src/network.hpp Sat Jun 4 19:16:05 2005 @@ -5,11 +5,11 @@ #include "SDL_net.h" -#include <string> - -namespace threading -{ - class waiter; +#include <string> + +namespace threading +{ + class waiter; } //this module wraps the network interface. @@ -24,7 +24,7 @@ private: bool free_; - + manager(const manager&); void operator=(const manager&); }; @@ -34,7 +34,7 @@ struct server_manager { //parameter to pass to the constructor. - + enum CREATE_SERVER { MUST_CREATE_SERVER, //will throw exception on failure TRY_CREATE_SERVER, //will swallow failure NO_SERVER }; //won't try to create a server at all @@ -62,8 +62,8 @@ //function to attempt to connect to a remote host. Returns //the new connection on success, or 0 on failure. //throws error. -connection connect(const std::string& host, int port=15000); - +connection connect(const std::string& host, int port=15000); + connection connect(const std::string& host, int port, threading::waiter& waiter); //function to accept a connection from a remote host. If no Index: wesnoth/src/network_worker.cpp diff -u wesnoth/src/network_worker.cpp:1.28 wesnoth/src/network_worker.cpp:1.29 --- wesnoth/src/network_worker.cpp:1.28 Sun Mar 27 23:06:17 2005 +++ wesnoth/src/network_worker.cpp Sat Jun 4 19:16:05 2005 @@ -325,7 +325,7 @@ } const socket_state_map::iterator lock_it = sockets_locked.find(sock); - + if(lock_it == sockets_locked.end() || lock_it->second != SOCKET_LOCKED) { if(lock_it != sockets_locked.end()) { sockets_locked.erase(lock_it); Index: wesnoth/src/pathfind.cpp diff -u wesnoth/src/pathfind.cpp:1.66 wesnoth/src/pathfind.cpp:1.67 --- wesnoth/src/pathfind.cpp:1.66 Mon May 2 19:42:04 2005 +++ wesnoth/src/pathfind.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: pathfind.cpp,v 1.66 2005/05/02 19:42:04 silene Exp $ */ +/* $Id: pathfind.cpp,v 1.67 2005/06/04 19:16:05 ott Exp $ */ /* -Copyright (C) 2003 by David White <[EMAIL PROTECTED]> -Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net +Copyright (C) 2003 by David White <[EMAIL PROTECTED]> +Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -29,14 +29,14 @@ typedef std::vector<gamemap::location> vector_location; typedef std::vector<a_star_node*> vector_a_star_node; -typedef std::set<gamemap::location> set_location; +typedef std::set<gamemap::location> set_location; bool compare_strict_sup_a_star_node(const a_star_node* node1, const a_star_node* node2) { - return node1->g + node1->h > node2->g + node2->h; + return node1->g + node1->h > node2->g + node2->h; } bool compare_sup_equal_a_star_node(const a_star_node* node1, const a_star_node* node2) { - return node1->g + node1->h >= node2->g + node2->h; + return node1->g + node1->h >= node2->g + node2->h; } void a_star_init(gamemap::location const &src, gamemap::location const &dst, @@ -47,12 +47,12 @@ { a_star_node* locStartNode = NULL; bool locIsCreated = false; - + aStarGameWorld.resize_IFN(parWidth, parHeight); wassert(aStarGameWorld.empty()); locStartNode = aStarGameWorld.getNodeFromLocation(src, locIsCreated); wassert(locIsCreated); - locStartNode->initNode(src, dst, 0.0, NULL, teleports); + locStartNode->initNode(src, dst, 0.0, NULL, teleports); const size_t locValueH = size_t(locStartNode->h); size_t locAllocSize; @@ -62,9 +62,9 @@ else if (locValueH > 128) locAllocSize = 128; else - locAllocSize = locValueH; + locAllocSize = locValueH; openList.reserve(locAllocSize); - openList.push_back(locStartNode); + openList.push_back(locStartNode); if (locValueH < 32) locAllocSize = 32; @@ -72,16 +72,16 @@ locAllocSize = 256; else locAllocSize = locValueH; - - if (teleports != NULL) + + if (teleports != NULL) parNbTeleport = teleports->size(); else parNbTeleport = 0; vectLocation.reserve(parNbTeleport + 6); - vectLocation.resize(parNbTeleport + 6); + vectLocation.resize(parNbTeleport + 6); - if (parNbTeleport > 0) + if (parNbTeleport > 0) { gamemap::location* locLocation; @@ -90,7 +90,7 @@ locLocation->x = (*it).x; locLocation->y = (*it).y; ++locLocation; - } + } } } @@ -100,18 +100,18 @@ #ifdef _PARANO_ASTAR_ for (vector_a_star_node::iterator iter = openList.begin(); iter != openList.end(); ++iter) - wassert((*iter)->isInCloseList == false); + wassert((*iter)->isInCloseList == false); if (openList.size() > locNbAdded) { for (vector_a_star_node::iterator iter = openList.begin() + 1; iter != openList.end() - locNbAdded; ++iter) { - vector_a_star_node::iterator iterPrev = iter - 1; + vector_a_star_node::iterator iterPrev = iter - 1; wassert(compare_sup_equal_a_star_node(*iterPrev, *iter)); } } if (locNbAdded > 0) { for (vector_a_star_node::iterator iter = openList.end() - locNbAdded + 1; iter != openList.end(); ++iter) { - vector_a_star_node::iterator iterPrev = iter - 1; + vector_a_star_node::iterator iterPrev = iter - 1; wassert(compare_sup_equal_a_star_node(*iterPrev, *iter)); } } @@ -124,8 +124,8 @@ vector_a_star_node::iterator iter; for (iter = openList.begin() + 1; iter != openList.end(); ++iter) { - vector_a_star_node::iterator iterPrev = iter - 1; - wassert(compare_sup_equal_a_star_node(*iterPrev, *iter)); + vector_a_star_node::iterator iterPrev = iter - 1; + wassert(compare_sup_equal_a_star_node(*iterPrev, *iter)); } for (iter = openList.begin(); iter != openList.end(); ++iter) wassert((*iter)->isInCloseList == false); @@ -142,9 +142,9 @@ a_star_node* parCurNode, const size_t parNbTeleport) { //----------------- PRE_CONDITIONS ------------------ - wassert(parCurNode != NULL); + wassert(parCurNode != NULL); //--------------------------------------------------- - + typedef std::pair<vector_a_star_node::iterator, vector_a_star_node::iterator> pair_node_iter; a_star_node* locNextNode; @@ -154,7 +154,7 @@ bool locIsCreated = false; const double locCostFather = parCurNode->g; - get_adjacent_tiles(parCurNode->loc, &vectLocation[0]); + get_adjacent_tiles(parCurNode->loc, &vectLocation[0]); if ((parNbTeleport > 0) && (teleports->count(parCurNode->loc) > 0)) { @@ -167,7 +167,7 @@ { wassert(vectLocation.size() >= 6); locSize = 6; - } + } for (size_t i = 0; i != locSize; ++i) { @@ -180,9 +180,9 @@ if (locIsCreated) { locNextNode->initNode(locLocation, dst, locCost, parCurNode, teleports); - if (locNextNode->g + locNextNode->h < stop_at) { + if (locNextNode->g + locNextNode->h < stop_at) { openList.push_back(locNextNode); - ++locNbAdded; + ++locNbAdded; } else { @@ -194,12 +194,12 @@ { // If this path is better that the previous for this node if (locCost < locNextNode->g) - { + { if (locNextNode->isInCloseList) { locNextNode->isInCloseList = false; } else - { + { locPlace = std::equal_range(openList.begin(), openList.end() - locNbAdded, locNextNode, compare_strict_sup_a_star_node); assertParanoAstar(*(std::find(locPlace.first, locPlace.second, locNextNode)) == locNextNode); openList.erase(std::find(locPlace.first, locPlace.second, locNextNode)); @@ -207,14 +207,14 @@ openList.push_back(locNextNode); ++locNbAdded; locNextNode->g = locCost; - locNextNode->nodeParent = parCurNode; + locNextNode->nodeParent = parCurNode; } - } + } } } paths::route a_star_search( gamemap::location const &src, gamemap::location const &dst, - double stop_at, cost_calculator const *costCalculator, const size_t parWidth, + double stop_at, cost_calculator const *costCalculator, const size_t parWidth, const size_t parHeight, std::set<gamemap::location> const *teleports) { //----------------- PRE_CONDITIONS ------------------ @@ -224,22 +224,22 @@ wassert(dst.valid()); wassert(costCalculator != NULL); wassert(stop_at <= costCalculator->getNoPathValue()); - //--------------------------------------------------- - static a_star_world aStarGameWorld; + //--------------------------------------------------- + static a_star_world aStarGameWorld; static poss_a_star_node POSS_AStarNode; - - vector_a_star_node openList; + + vector_a_star_node openList; vector_location vectLocation; paths::route locRoute; - size_t locNbTeleport; - size_t locNbAdded; + size_t locNbTeleport; + size_t locNbAdded; a_star_node* locDestNode = NULL; a_star_node* locCurNode = NULL; - - wassert(openList.empty()); + + wassert(openList.empty()); wassert(aStarGameWorld.empty()); - assertParanoAstar(aStarGameWorld.reallyEmpty()); - + assertParanoAstar(aStarGameWorld.reallyEmpty()); + LOG_PF << "A* search: " << src << " -> " << dst << '\n'; if ( (src.valid(int(parWidth), int(parHeight)) == false) || @@ -249,26 +249,26 @@ LOG_PF << "aborted A* search because Start or Dest is invalid\n"; locRoute.move_left = int(costCalculator->getNoPathValue()); return (locRoute); - } + } a_star_init(src, dst, openList, aStarGameWorld, parWidth, parHeight, vectLocation, teleports, locNbTeleport); - while (!openList.empty()) + while (!openList.empty()) { locCurNode = openList.back(); - wassert(locCurNode != NULL); - + wassert(locCurNode != NULL); + //if we have found a solution if (locCurNode->loc == dst) { - locDestNode = locCurNode; - + locDestNode = locCurNode; + LOG_PF << "found solution; calculating it...\n"; while (locCurNode != NULL) { locRoute.steps.push_back(locCurNode->loc); locCurNode = locCurNode->nodeParent; - } + } std::reverse(locRoute.steps.begin(), locRoute.steps.end()); locRoute.move_left = int(locDestNode->g); @@ -282,18 +282,18 @@ openList.pop_back(); wassert(locCurNode->isInCloseList == false); - locCurNode->isInCloseList = true ; - + locCurNode->isInCloseList = true ; + locNbAdded = 0; a_star_explore_neighbours(dst, stop_at, costCalculator, parWidth, parHeight, teleports, vectLocation, openList, aStarGameWorld, locNbAdded, locCurNode, locNbTeleport); a_star_sort_and_merge(openList, locNbAdded); } - + LOG_PF << "aborted a* search\n"; locRoute.move_left = int(costCalculator->getNoPathValue()); - + label_AStarSearch_end: openList.clear(); POSS_AStarNode.reduce(); @@ -302,7 +302,7 @@ //----------------- POST_CONDITIONS ----------------- wassert(openList.empty()); wassert(aStarGameWorld.empty()); - assertParanoAstar(aStarGameWorld.reallyEmpty()); + assertParanoAstar(aStarGameWorld.reallyEmpty()); //--------------------------------------------------- return (locRoute); } @@ -417,7 +417,7 @@ } } -bool enemy_zoc(const gamemap& map, const gamestatus& status, +bool enemy_zoc(const gamemap& map, const gamestatus& status, const std::map<gamemap::location,unit>& units, const std::vector<team>& teams, const gamemap::location& loc, const team& current_team, int side) @@ -589,7 +589,7 @@ const std::vector<team>& teams, const gamemap& map, const gamestatus& status) - : unit_(u), team_(t), units_(units), teams_(teams), + : unit_(u), team_(t), units_(units), teams_(teams), map_(map), status_(status) { } @@ -606,7 +606,7 @@ if (enemy_unit != units_.end() && team_.is_enemy(enemy_unit->second.side())) return (getNoPathValue()); - if ((isDst == false) && (unit_.type().is_skirmisher() == false)) + if ((isDst == false) && (unit_.type().is_skirmisher() == false)) { gamemap::location adj[6]; get_adjacent_tiles(loc,adj); Index: wesnoth/src/pathfind.hpp diff -u wesnoth/src/pathfind.hpp:1.36 wesnoth/src/pathfind.hpp:1.37 --- wesnoth/src/pathfind.hpp:1.36 Thu Mar 10 20:17:17 2005 +++ wesnoth/src/pathfind.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: pathfind.hpp,v 1.36 2005/03/10 20:17:17 ydirson Exp $ */ +/* $Id: pathfind.hpp,v 1.37 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -51,7 +51,7 @@ VACANT_TILE_TYPE vacancy=VACANT_ANY); //function which determines if a given location is an enemy zone of control -bool enemy_zoc(const gamemap& map,const gamestatus& status, +bool enemy_zoc(const gamemap& map,const gamestatus& status, const std::map<gamemap::location,unit>& units, const std::vector<team>& teams, const gamemap::location& loc,const team& current_team,int side); @@ -66,7 +66,7 @@ //object which contains all the possible locations a unit can move to, with //associated best routes to those locations. struct paths -{ +{ paths() {} //construct a list of paths for the unit at loc. @@ -75,7 +75,7 @@ //additional_turns: if 0, paths for how far the unit can move this turn //will be calculated. If 1, paths for how far the unit can move by the //end of next turn will be calculated, and so forth. - paths(const gamemap& map, const gamestatus& status, + paths(const gamemap& map, const gamestatus& status, const game_data& gamedata, const std::map<gamemap::location,unit>& units, const gamemap::location& loc, std::vector<team>& teams, @@ -90,7 +90,7 @@ }; typedef std::map<gamemap::location,route> routes_map; - routes_map routes; + routes_map routes; }; paths::route a_star_search(gamemap::location const &src, gamemap::location const &dst, Index: wesnoth/src/pathutils.hpp diff -u wesnoth/src/pathutils.hpp:1.5 wesnoth/src/pathutils.hpp:1.6 --- wesnoth/src/pathutils.hpp:1.5 Thu Mar 10 20:17:17 2005 +++ wesnoth/src/pathutils.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: pathutils.hpp,v 1.5 2005/03/10 20:17:17 ydirson Exp $ */ +/* $Id: pathutils.hpp,v 1.6 2005/06/04 19:16:05 ott Exp $ */ /* -Copyright (C) 2003 by David White <[EMAIL PROTECTED]> -Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net +Copyright (C) 2003 by David White <[EMAIL PROTECTED]> +Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/playcampaign.cpp diff -u wesnoth/src/playcampaign.cpp:1.6 wesnoth/src/playcampaign.cpp:1.7 --- wesnoth/src/playcampaign.cpp:1.6 Thu Jun 2 20:50:26 2005 +++ wesnoth/src/playcampaign.cpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: playcampaign.cpp,v 1.6 2005/06/02 20:50:26 isaaccp Exp $ */ +/* $Id: playcampaign.cpp,v 1.7 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003-2005 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003-2005 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -32,9 +32,9 @@ namespace { -struct player_controller +struct player_controller { - player_controller() + player_controller() {} player_controller(const std::string& controller, const std::string& description) : @@ -50,7 +50,7 @@ } LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_config, - const game_data& units_data, CVideo& video, + const game_data& units_data, CVideo& video, io_type_t io_type) { std::string type = state.campaign_type; @@ -91,7 +91,7 @@ if(io_type == IO_SERVER) { const config::child_list& sides_list = scenario->get_children("side"); - for(config::child_list::const_iterator side = sides_list.begin(); + for(config::child_list::const_iterator side = sides_list.begin(); side != sides_list.end(); ++side) { std::string id = (**side)["save_id"]; if(id.empty()) @@ -110,7 +110,7 @@ } const config::child_list& sides_list = starting_pos.get_children("side"); - for(config::child_list::const_iterator side = sides_list.begin(); + for(config::child_list::const_iterator side = sides_list.begin(); side != sides_list.end(); ++side) { if((**side)["controller"] == "network" && (**side)["description"] == preferences::login()) { @@ -196,7 +196,7 @@ config cfg; do { cfg.clear(); - network::connection data_res = gui::network_data_dialog(disp, + network::connection data_res = gui::network_data_dialog(disp, _("Downloading next level..."), cfg); if(!data_res) throw network::error(_("Connection timed out")); @@ -223,14 +223,14 @@ // Tweaks sides to adapt controllers and descriptions. const config::child_list& sides_list = starting_pos.get_children("side"); - for(config::child_list::const_iterator side = sides_list.begin(); + for(config::child_list::const_iterator side = sides_list.begin(); side != sides_list.end(); ++side) { - + std::string id = (**side)["save_id"]; if(id.empty()) { continue; } - + controller_map::const_iterator ctr = controllers.find(id); if(ctr != controllers.end()) { (**side)["description"] = ctr->second.description; @@ -270,7 +270,7 @@ _("Name:"), &state.label); - + if(should_save == 0) { try { save_game(state); Index: wesnoth/src/playcampaign.hpp diff -u wesnoth/src/playcampaign.hpp:1.1 wesnoth/src/playcampaign.hpp:1.2 --- wesnoth/src/playcampaign.hpp:1.1 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/playcampaign.hpp Sat Jun 4 19:16:05 2005 @@ -1,6 +1,6 @@ -/* $Id: playcampaign.hpp,v 1.1 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: playcampaign.hpp,v 1.2 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003-2005 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003-2005 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -32,7 +32,7 @@ LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_config, const game_data& units_data, CVideo& video, io_type_t io_type=IO_NONE); - + #endif // PLAYCAMPAIGN_H_INCLUDED Index: wesnoth/src/playlevel.cpp diff -u wesnoth/src/playlevel.cpp:1.207 wesnoth/src/playlevel.cpp:1.208 --- wesnoth/src/playlevel.cpp:1.207 Tue May 31 16:39:02 2005 +++ wesnoth/src/playlevel.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: playlevel.cpp,v 1.207 2005/05/31 16:39:02 silene Exp $ */ +/* $Id: playlevel.cpp,v 1.208 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -146,14 +146,14 @@ if((*level)["scenario_generation"] != "") { LOG_NG << "randomly generating scenario...\n"; const cursor::setter cursor_setter(cursor::WAIT); - + static config scenario; scenario = random_generate_scenario((*level)["scenario_generation"],level->child("generator")); level = &scenario; state_of_game.starting_pos = scenario; } - + std::string map_data = (*level)["map_data"]; if(map_data == "" && (*level)["map"] != "") { map_data = read_map((*level)["map"]); @@ -323,11 +323,11 @@ std::copy(player->can_recruit.begin(),player->can_recruit.end(), std::inserter(teams.back().recruits(),teams.back().recruits().end())); } - + if(player != NULL) { player->can_recruit = teams.back().recruits(); } - + //if there are additional starting units on this side const config::child_list& starting_units = (*ui)->get_children("unit"); for(config::child_list::const_iterator su = starting_units.begin(); su != starting_units.end(); ++su) { @@ -364,10 +364,10 @@ LOG_NG << *it << std::endl; } LOG_NG << "Added all recruitable units\n"; - std::copy(recruitable.begin(), recruitable.end(), + std::copy(recruitable.begin(), recruitable.end(), std::inserter(enc_units, enc_units.begin())); } - + // Add all units that exist at the start to the encountered units so // that information about them are displayed to the user in the help // system. @@ -423,7 +423,7 @@ LOG_NG << "b... " << (SDL_GetTicks() - ticks) << "\n"; //this *needs* to be created before the show_intro and show_map_scene - //as that functions use the manager state_of_game + //as that functions use the manager state_of_game game_events::manager events_manager(*level,gui,map,units,teams, state_of_game,status,gameinfo); @@ -472,10 +472,10 @@ //if a team is specified whose turn it is, it means we're loading a game //instead of starting a fresh one const bool loading_game = lvl["playing_team"].empty() == false; - + gui.begin_game(); gui.adjust_colours(0,0,0); - + LOG_NG << "scrolling... " << (SDL_GetTicks() - ticks) << "\n"; if(first_human_team != -1) { LOG_NG << "b " << (SDL_GetTicks() - ticks) << "\n"; @@ -487,12 +487,12 @@ LOG_NG << "done scrolling... " << (SDL_GetTicks() - ticks) << "\n"; bool replaying = (recorder.at_end() == false); - + int first_player = atoi(lvl["playing_team"].c_str()); if(first_player < 0 || first_player >= int(teams.size())) { first_player = 0; } - + if(!loading_game) { game_events::fire("prestart"); } @@ -501,7 +501,7 @@ } std::deque<config> data_backlog; - + LOG_NG << "starting main loop\n" << (SDL_GetTicks() - ticks) << "\n"; for(bool first_time = true; true; first_time = false, first_player = 0) { if(first_time) { @@ -707,7 +707,7 @@ gui.recalculate_minimap(); gui.invalidate_all(); } - + game_events::pump(); check_victory(units,teams); @@ -715,7 +715,7 @@ //time has run out if(!status.next_turn()) { - + if(non_interactive()) { std::cout << "time over (draw)\n"; } @@ -860,7 +860,7 @@ gui::show_dialog(gui, NULL, _("Victory"), _("You have emerged victorious!"), gui::OK_ONLY); - if (state_of_game.players.size() > 0 && has_next_scenario || + if (state_of_game.players.size() > 0 && has_next_scenario || state_of_game.campaign_type == "test") gui::show_dialog(gui, NULL, _("Scenario Report"), report.str(), gui::OK_ONLY); Index: wesnoth/src/playlevel.hpp diff -u wesnoth/src/playlevel.hpp:1.23 wesnoth/src/playlevel.hpp:1.24 --- wesnoth/src/playlevel.hpp:1.23 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/playlevel.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: playlevel.hpp,v 1.23 2005/04/27 21:11:44 gruikya Exp $ */ +/* $Id: playlevel.hpp,v 1.24 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/playturn.cpp diff -u wesnoth/src/playturn.cpp:1.379 wesnoth/src/playturn.cpp:1.380 --- wesnoth/src/playturn.cpp:1.379 Sat Jun 4 03:47:08 2005 +++ wesnoth/src/playturn.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: playturn.cpp,v 1.379 2005/06/04 03:47:08 Sirp Exp $ */ +/* $Id: playturn.cpp,v 1.380 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -110,7 +110,7 @@ unit_map::const_iterator ui = units.find(*g); turn_data.move_unit_to_loc(ui,ui->second.get_goto(),false); } - + turn_data.start_interactive_turn(); while(!turn_data.turn_over()) { @@ -141,7 +141,7 @@ } turn_info::turn_info(const game_data& gameinfo, game_state& state_of_game, - const gamestatus& status, const config& terrain_config, + const gamestatus& status, const config& terrain_config, const config& level, CKey& key, display& gui, gamemap& map, std::vector<team>& teams, int team_num, unit_map& units, TURN_MODE mode, floating_textbox& textbox, @@ -188,7 +188,7 @@ const bool use_left_right = (textbox_.active() == false); if(use_left_right && key_[SDLK_LEFT] || mousex < scroll_threshold) gui_.scroll(-preferences::scroll_speed(),0); - + if(use_left_right && key_[SDLK_RIGHT] || mousex > gui_.x()-scroll_threshold) gui_.scroll(preferences::scroll_speed(),0); @@ -347,7 +347,7 @@ current_paths_ = paths(); gui_.set_paths(NULL); } - + const gamemap::location& dest = attack_from.valid() ? attack_from : new_hex; const unit_map::const_iterator dest_un = find_unit(dest); if(dest == selected_hex_ || dest_un != units_.end()) { @@ -355,9 +355,9 @@ gui_.set_route(NULL); } else if(!current_paths_.routes.empty() && map_.on_board(selected_hex_) && map_.on_board(new_hex)) { - + unit_map::const_iterator un = find_unit(selected_hex_); - + if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && !un->second.stone()) { const shortest_path_calculator calc(un->second,current_team, visible_units(),teams_,map_,status_); @@ -436,7 +436,7 @@ public: simple_attack_rating() : attacker_weapon_rating_(0), defender_weapon_rating_(0) {} - simple_attack_rating(const battle_stats& stats) : + simple_attack_rating(const battle_stats& stats) : attacker_weapon_rating_(stats.chance_to_hit_defender * stats.damage_defender_takes * stats.nattacks), defender_weapon_rating_(stats.chance_to_hit_attacker * @@ -448,7 +448,7 @@ if(attacker_weapon_rating_ < a.attacker_weapon_rating_) return true; - //if both weapons are the same but + //if both weapons are the same but //ours makes the enemy retaliate for more damage, it's worse else if(attacker_weapon_rating_ == a.attacker_weapon_rating_ && defender_weapon_rating_ > a.defender_weapon_rating_) @@ -737,7 +737,7 @@ selected_hex_ = gamemap::location(); gui_.select_hex(gamemap::location()); - + gui_.set_route(NULL); gui_.set_paths(NULL); current_paths_ = paths(); @@ -758,10 +758,10 @@ selected_hex_ = dst; gui_.select_hex(dst); } - + current_route_.steps.clear(); show_attack_options(u); - + if(current_paths_.routes.empty() == false) { current_paths_.routes[dst] = paths::route(); selected_hex_ = dst; @@ -1085,7 +1085,7 @@ if (i == units_.end()) return false; return i->second.move_interrupted(); } - + case hotkey::HOTKEY_DELAY_SHROUD: return !browse_ && (current_team().uses_fog() || current_team().uses_shroud()); case hotkey::HOTKEY_UPDATE_SHROUD: @@ -1133,7 +1133,7 @@ private: const turn_info& info_; }; - + struct not_in_context_menu { not_in_context_menu(const turn_info& info) : info_(info) {} bool operator()(const std::string& str) const { @@ -1171,7 +1171,7 @@ has_image = true; str << IMAGE_PREFIX << img << COLUMN_SEPARATOR; } - + str << hk.get_description() << COLUMN_SEPARATOR << hk.get_name(); menu.push_back(str.str()); @@ -1200,7 +1200,7 @@ } return false; - + } void turn_info::cycle_units() @@ -1312,7 +1312,7 @@ } } } - + // Ask for confirmation if units still have movement left if(preferences::yellow_confirm() && partmoved_units) { const int res = gui::show_dialog(gui_,NULL,"",_("Some units have movement left. Do you really want to end your turn?"),gui::YES_NO); @@ -1372,7 +1372,7 @@ un->second.set_user_end_turn(true); cycle_units(); } - } + } } void turn_info::end_unit_turn() @@ -1440,16 +1440,16 @@ LOG_STREAM(err, engine) << "Illegal 'undo' found. Possible abuse of [allow_undo]?\n"; return; } - + if(map_.is_village(route.front())) { get_village(route.front(),teams_,action.original_village_owner,units_); } - + action.starting_moves = u->second.movement_left(); - + unit un = u->second; un.set_goto(gamemap::location()); - + gui_.hide_unit(u->first,true); unit_display::move_unit(gui_,map_,route,un,status_.get_time_of_day(),units_,teams_); gui_.hide_unit(gamemap::location()); @@ -1527,12 +1527,12 @@ wassert(false); return; } - + action.starting_moves = u->second.movement_left(); - + unit un = u->second; un.set_goto(gamemap::location()); - + gui_.hide_unit(u->first,true); unit_display::move_unit(gui_,map_,route,un,status_.get_time_of_day(),units_,teams_); gui_.hide_unit(gamemap::location()); @@ -1540,13 +1540,13 @@ units_.erase(u); un.set_movement(starting_moves); units_.insert(std::pair<gamemap::location,unit>(route.back(),un)); - + if(map_.is_village(route.back())) { get_village(route.back(),teams_,un.side()-1,units_); } - + gui_.draw_tile(route.back().x,route.back().y); - + recorder.add_movement(route.front(),route.back()); } gui_.invalidate_unit(); @@ -1608,7 +1608,7 @@ { std::stringstream stream; - const std::string ellipsed_name = font::make_text_ellipsis(state_of_game_.label, + const std::string ellipsed_name = font::make_text_ellipsis(state_of_game_.label, font::SIZE_NORMAL, 200); stream << ellipsed_name << " " << _("Turn") << " " << status_.turn(); @@ -2104,7 +2104,7 @@ undo_stack_.push_back(undo_action(un,loc,res)); redo_stack_.clear(); - + recall_list.erase(recall_list.begin()+res); gui_.invalidate_game_status(); } @@ -2237,7 +2237,7 @@ std::vector<gamemap::location> locations_list; std::vector<unit> units_list; for(unit_map::const_iterator i = units_.begin(); i != units_.end(); ++i) { - if(i->second.side() != (gui_.viewing_team()+1)) + if(i->second.side() != (gui_.viewing_team()+1)) continue; std::stringstream row; @@ -2433,9 +2433,9 @@ { if(new_search.empty() == false && new_search != last_search_) last_search_ = new_search; - + if(last_search_.empty()) return; - + bool found = false; gamemap::location loc = last_search_hit_; //If this is a location search, just center on that location. @@ -2458,7 +2458,7 @@ loc.x = (loc.x + 1) % map_.x(); if(loc.x == 0) loc.y = (loc.y + 1) % map_.y(); - + //Search label const std::string label = gui_.labels().get_label(loc); if(label.empty() == false) { @@ -2518,7 +2518,7 @@ } } else if (teams_[index].is_ai()) { teams_[index].make_human(); - } + } } else if (cmd == "theme") { int action = 0; std::vector<std::string> options=theme::get_known_themes(); @@ -2526,7 +2526,7 @@ action = gui::show_dialog(gui_,NULL,"",current_theme,gui::OK_CANCEL,&options); if(action >-1){ preferences::set_theme(options[action]); - //it would be preferable for the new theme to take effect + //it would be preferable for the new theme to take effect //immediately, however, this will have to do for now. gui::show_dialog(gui_,NULL,"",_("New theme will take effect on next new or loaded game."),gui::MESSAGE); } @@ -2644,12 +2644,12 @@ // If we aren't using fog/shroud, this is easy :) if(current_team().uses_fog() == false && current_team().uses_shroud() == false) return true; - + //See if any enemies are visible for(unit_map::const_iterator u = units_.begin(); u != units_.end(); ++u) if(current_team().is_enemy(u->second.side()) && !gui_.fogged(u->first.x,u->first.y)) return true; - + return false; } @@ -2657,7 +2657,7 @@ void turn_info::show_enemy_moves(bool ignore_units) { all_paths_ = paths(); - + // Compute enemy movement positions for(unit_map::iterator u = units_.begin(); u != units_.end(); ++u) { if(current_team().is_enemy(u->second.side()) && !gui_.fogged(u->first.x,u->first.y) && !u->second.stone()) { @@ -2668,7 +2668,7 @@ units.insert(*u); const paths& path = paths(map_,status_,gameinfo_,ignore_units?units:units_, u->first,teams_,is_skirmisher,teleports); - + for (paths::routes_map::const_iterator route = path.routes.begin(); route != path.routes.end(); ++route) { // map<...>::operator[](const key_type& key) inserts key into // the map with a default instance of value_type @@ -2676,7 +2676,7 @@ } } } - + gui_.set_paths(&all_paths_); } @@ -2689,7 +2689,7 @@ bool turn_info::clear_shroud() { - bool cleared = current_team().auto_shroud_updates() && + bool cleared = current_team().auto_shroud_updates() && ::clear_shroud(gui_,status_,map_,gameinfo_,units_,teams_,team_num_-1); enemies_visible_ = enemies_visible(); return cleared; @@ -2959,7 +2959,7 @@ if(last_space == std::string::npos) { beginning = true; - semiword = text; + semiword = text; }else{ beginning = false; semiword.assign(text,last_space+1,text.size()); Index: wesnoth/src/playturn.hpp diff -u wesnoth/src/playturn.hpp:1.68 wesnoth/src/playturn.hpp:1.69 --- wesnoth/src/playturn.hpp:1.68 Wed May 18 14:06:30 2005 +++ wesnoth/src/playturn.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: playturn.hpp,v 1.68 2005/05/18 14:06:30 darthfool Exp $ */ +/* $Id: playturn.hpp,v 1.69 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -64,7 +64,7 @@ { util::scoped_ptr<gui::textbox> box; util::scoped_ptr<gui::button> check; - + enum MODE { TEXTBOX_NONE, TEXTBOX_SEARCH, TEXTBOX_MESSAGE, TEXTBOX_COMMAND }; MODE mode; @@ -78,7 +78,7 @@ }; enum TURN_MODE { PLAY_TURN, BROWSE_NETWORKED, BROWSE_AI }; - + turn_info(const game_data& gameinfo, game_state& state_of_game, const gamestatus& status, const config& terrain_config, const config& level, CKey& key, display& gui, gamemap& map, @@ -96,7 +96,7 @@ bool can_execute_command(hotkey::HOTKEY_COMMAND command) const; bool in_context_menu(hotkey::HOTKEY_COMMAND command) const; - + void move_unit_to_loc(const unit_map::const_iterator& ui, const gamemap::location& target, bool continue_move); void start_interactive_turn(); @@ -133,7 +133,7 @@ void write_game_snapshot(config& cfg) const; bool unit_in_cycle(unit_map::const_iterator it) const; - + //overridden from command_executor virtual void cycle_units(); virtual void cycle_back_units(); @@ -174,7 +174,7 @@ void do_command(const std::string& str); void do_speak(const std::string& str, bool allies_only); bool has_friends() const; - + void do_recruit(const std::string& name); void handle_event(const SDL_Event& event); @@ -197,9 +197,9 @@ bool clear_shroud(); void clear_undo_stack(); - + std::vector<std::string> create_unit_table(const statistics::stats::str_int_map& m); - + bool enemies_visible() const; void change_side_controller(const std::string& side, const std::string& player, bool orphan_side=false); @@ -237,12 +237,12 @@ //cached value indicating whether any enemy units are visible. //computed with enemies_visible() bool enemies_visible_; - + bool end_turn_; int start_ncmd_; std::string last_recruit_; - + std::string last_search_; gamemap::location last_search_hit_; Index: wesnoth/src/preferences.cpp diff -u wesnoth/src/preferences.cpp:1.159 wesnoth/src/preferences.cpp:1.160 --- wesnoth/src/preferences.cpp:1.159 Sun May 29 20:52:40 2005 +++ wesnoth/src/preferences.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: preferences.cpp,v 1.159 2005/05/29 20:52:40 silene Exp $ */ +/* $Id: preferences.cpp,v 1.160 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -87,7 +87,7 @@ manager::~manager() { - + std::vector<std::string> v; std::copy(encountered_units_set.begin(), encountered_units_set.end(), std::back_inserter(v)); prefs["encountered_units"] = utils::join(v); @@ -185,7 +185,7 @@ { std::pair<int,int> res = resolution; - // - Ayin: disabled the following code. Why would one want to enforce that? + // - Ayin: disabled the following code. Why would one want to enforce that? // Some 16:9, or laptop screens, may have resolutions which do not // comply to this rule (see bug 10630). I'm commenting this until it // proves absolutely necessary. @@ -480,37 +480,37 @@ } bool allow_observers() -{ +{ return prefs["allow_observers"] != "no"; } void set_allow_observers(bool value) -{ +{ prefs["allow_observers"] = value ? "yes" : "no"; } bool fog() -{ +{ return prefs["mp_fog"] == "yes"; } void set_fog(bool value) -{ +{ prefs["mp_fog"] = value ? "yes" : "no"; } bool shroud() -{ +{ return prefs["mp_shroud"] == "yes"; } void set_shroud(bool value) -{ +{ prefs["mp_shroud"] = value ? "yes" : "no"; } int turns() -{ +{ static const int default_value = 50; int value = 0; const string_map::const_iterator i = prefs.values.find("mp_turns"); @@ -526,14 +526,14 @@ } void set_turns(int value) -{ +{ std::stringstream stream; stream << value; prefs["mp_turns"] = stream.str(); } int village_gold() -{ +{ static const int default_value = 2; int value = 0; const string_map::const_iterator i = prefs.values.find("mp_village_gold"); @@ -549,14 +549,14 @@ } void set_village_gold(int value) -{ +{ std::stringstream stream; stream << value; prefs["mp_village_gold"] = stream.str(); } int xp_modifier() -{ +{ static const int default_value = 70; int value = 0; const string_map::const_iterator i = prefs.values.find("mp_xp_modifier"); @@ -572,14 +572,14 @@ } void set_xp_modifier(int value) -{ +{ std::stringstream stream; stream << value; prefs["mp_xp_modifier"] = stream.str(); } int era() -{ +{ int value = 0; const string_map::const_iterator i = prefs.values.find("mp_era"); if(i != prefs.values.end() && i->second.empty() == false) { @@ -590,14 +590,14 @@ } void set_era(int value) -{ +{ std::stringstream stream; stream << value; prefs["mp_era"] = stream.str(); } int map() -{ +{ int value = 0; const string_map::const_iterator i = prefs.values.find("mp_map"); if(i != prefs.values.end() && i->second.empty() == false) { @@ -607,14 +607,14 @@ } void set_map(int value) -{ +{ std::stringstream stream; stream << value; prefs["mp_map"] = stream.str(); } bool show_ai_moves() -{ +{ return prefs["show_ai_moves"] != "no"; } @@ -1154,7 +1154,7 @@ items.push_back(pre + "display.png" + sep + dsgettext(GETTEXT_DOMAIN,"Prefs section^Display")); items.push_back(pre + "music.png" + sep + dsgettext(GETTEXT_DOMAIN,"Prefs section^Sound")); items.push_back(pre + "advanced.png" + sep + dsgettext(GETTEXT_DOMAIN,"Advanced section^Advanced")); - + for(;;) { try { const events::event_context dialog_events_context; @@ -1270,9 +1270,9 @@ std::vector<gui::button*> buttons; buttons.push_back(&close_button); - surface_restorer restorer; + surface_restorer restorer; gui::draw_dialog(xpos,ypos,width,height,disp.video(),_("Hotkey Settings"),NULL,&buttons,&restorer); - + SDL_Rect clip_rect = { 0, 0, disp.x (), disp.y () }; SDL_Rect text_size = font::draw_text(NULL, clip_rect, font::SIZE_PLUS, font::NORMAL_COLOUR,_("Press desired HotKey"), @@ -1302,9 +1302,9 @@ gui::menu menu_(disp.video(), menu_items, false, height, -1, &sorter); menu_.sort_by(0); menu_.reset_selection(); - menu_.set_width(font::relative_size(400)); + menu_.set_width(font::relative_size(400)); menu_.set_location(xpos + font::relative_size(20), ypos); - + gui::button change_button (disp.video(), _("Change Hotkey")); change_button.set_location(xpos + width - change_button.width () - font::relative_size(30),ypos + font::relative_size(80)); @@ -1322,8 +1322,8 @@ centery-text_size.h/2 - 16, text_size.w+60, text_size.h+32}; - surface_restorer restorer(&disp.video(),dlgr); - gui::draw_dialog_frame (centerx-text_size.w/2 - 20, + surface_restorer restorer(&disp.video(),dlgr); + gui::draw_dialog_frame (centerx-text_size.w/2 - 20, centery-text_size.h/2 - 6, text_size.w+40, text_size.h+12,disp.video()); @@ -1339,9 +1339,9 @@ do { if (event.type==SDL_KEYDOWN) { - key=event.key.keysym.sym; - mod=event.key.keysym.mod; - }; + key=event.key.keysym.sym; + mod=event.key.keysym.mod; + }; SDL_PollEvent(&event); disp.flip(); SDL_Delay(10); @@ -1349,14 +1349,14 @@ restorer.restore(); disp.update_display(); - const hotkey::hotkey_item& oldhk = hotkey::get_hotkey(key, (mod & KMOD_SHIFT) != 0, + const hotkey::hotkey_item& oldhk = hotkey::get_hotkey(key, (mod & KMOD_SHIFT) != 0, (mod & KMOD_CTRL) != 0, (mod & KMOD_ALT) != 0, (mod & KMOD_LMETA) != 0); hotkey::hotkey_item& newhk = hotkey::get_visible_hotkey(menu_.selection()); if(oldhk.get_id() != newhk.get_id() && !oldhk.null()) { gui::show_dialog(disp,NULL,"",_("This HotKey is already in use."),gui::MESSAGE); } else { - newhk.set_key(key, (mod & KMOD_SHIFT) != 0, + newhk.set_key(key, (mod & KMOD_SHIFT) != 0, (mod & KMOD_CTRL) != 0, (mod & KMOD_ALT) != 0, (mod & KMOD_LMETA) != 0); menu_.change_item(menu_.selection(), 1, newhk.get_name()); @@ -1375,7 +1375,7 @@ events::pump(); events::raise_process_event(); events::raise_draw_event(); - + disp.update_display(); SDL_Delay(10); Index: wesnoth/src/preferences.hpp diff -u wesnoth/src/preferences.hpp:1.55 wesnoth/src/preferences.hpp:1.56 --- wesnoth/src/preferences.hpp:1.55 Sat May 14 20:56:21 2005 +++ wesnoth/src/preferences.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: preferences.hpp,v 1.55 2005/05/14 20:56:21 darthfool Exp $ */ +/* $Id: preferences.hpp,v 1.56 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -167,7 +167,7 @@ std::string client_type(); std::string clock_format(); - + void set_theme(const std::string& theme); const std::string& theme(); Index: wesnoth/src/race.cpp diff -u wesnoth/src/race.cpp:1.20 wesnoth/src/race.cpp:1.21 --- wesnoth/src/race.cpp:1.20 Sun Mar 27 23:06:17 2005 +++ wesnoth/src/race.cpp Sat Jun 4 19:16:05 2005 @@ -43,7 +43,7 @@ if(i == prefixes.end() || i->second.empty()) { return res; } - + const wchar_t c = i->second[get_random()%i->second.size()]; if(c == 0) { return res; @@ -78,8 +78,8 @@ return res; } if (std::find(i->second.begin(), i->second.end(), 0) - != i->second.end()) { - // This ending is valid. + != i->second.end()) { + // This ending is valid. return res; } // The current ending is invalid, remove the last character Index: wesnoth/src/random.cpp diff -u wesnoth/src/random.cpp:1.6 wesnoth/src/random.cpp:1.7 --- wesnoth/src/random.cpp:1.6 Mon May 16 22:44:20 2005 +++ wesnoth/src/random.cpp Sat Jun 4 19:16:05 2005 @@ -1,8 +1,8 @@ -/* $Id: random.cpp,v 1.6 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: random.cpp,v 1.7 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Yann Dirson <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -73,7 +73,7 @@ return res; } -const config* rng::get_random_results() +const config* rng::get_random_results() { wassert(random_ != NULL); Index: wesnoth/src/random.hpp diff -u wesnoth/src/random.hpp:1.3 wesnoth/src/random.hpp:1.4 --- wesnoth/src/random.hpp:1.3 Sat Apr 30 12:31:20 2005 +++ wesnoth/src/random.hpp Sat Jun 4 19:16:05 2005 @@ -1,8 +1,8 @@ -/* $Id: random.hpp,v 1.3 2005/04/30 12:31:20 silene Exp $ */ +/* $Id: random.hpp,v 1.4 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Yann Dirson <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/replay.cpp diff -u wesnoth/src/replay.cpp:1.112 wesnoth/src/replay.cpp:1.113 --- wesnoth/src/replay.cpp:1.112 Mon May 2 20:35:22 2005 +++ wesnoth/src/replay.cpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: replay.cpp,v 1.112 2005/05/02 20:35:22 silene Exp $ */ +/* $Id: replay.cpp,v 1.113 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -557,7 +557,7 @@ for(;;) { config* const cfg = replayer.get_next_action(); config* child; - + //do we need to recalculate shroud after this action is processed? bool fix_shroud = false; @@ -615,12 +615,12 @@ const std::string& text = (*child)["text"]; disp.labels().set_label(loc,text); - } + } else if((child = cfg->child("rename")) != NULL) { const gamemap::location loc(*child); const std::string& name = (*child)["name"]; - + std::map<gamemap::location,unit>::iterator u = units.find(loc); if(u->second.unrenamable()) { Index: wesnoth/src/replay.hpp diff -u wesnoth/src/replay.hpp:1.35 wesnoth/src/replay.hpp:1.36 --- wesnoth/src/replay.hpp:1.35 Sun Apr 17 14:35:14 2005 +++ wesnoth/src/replay.hpp Sat Jun 4 19:16:05 2005 @@ -1,7 +1,7 @@ -/* $Id: replay.hpp,v 1.35 2005/04/17 14:35:14 gruikya Exp $ */ +/* $Id: replay.hpp,v 1.36 2005/06/04 19:16:05 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -140,7 +140,7 @@ replay_undo(replay& obj) : obj_(&obj) {} ~replay_undo() { if(obj_) obj_->undo(); } void confirm_transaction() { obj_ = NULL; } - + private: replay* obj_; }; Index: wesnoth/src/reports.cpp diff -u wesnoth/src/reports.cpp:1.66 wesnoth/src/reports.cpp:1.67 --- wesnoth/src/reports.cpp:1.66 Sat May 14 20:56:21 2005 +++ wesnoth/src/reports.cpp Sat Jun 4 19:16:05 2005 @@ -65,7 +65,7 @@ const gamestatus& status, const std::set<std::string>& observers) { unit_map::const_iterator u = units.end(); - + if(int(type) >= int(UNIT_REPORTS_BEGIN) && int(type) < int(UNIT_REPORTS_END) || type == POSITION) { if(!current_team.fogged(mouseover.x,mouseover.y)) { @@ -180,7 +180,7 @@ case UNIT_WEAPONS: { report res; std::stringstream tooltip; - + const size_t team_index = u->second.side()-1; if(team_index >= teams.size()) { std::cerr << "illegal team index in reporting: " << team_index << "\n"; @@ -192,7 +192,7 @@ at_it != attacks.end(); ++at_it) { const std::string& lang_weapon = gettext(at_it->name().c_str()); const std::string& lang_type = gettext(at_it->type().c_str()); - + str << lang_weapon << " (" << lang_type << ")\n"; tooltip << lang_weapon << " (" << lang_type << ")\n"; @@ -224,20 +224,20 @@ } res.add_text(str,tooltip); - + if (!at_it->special().empty()) { str << gettext(at_it->special().c_str()) << "\n"; tooltip << string_table["weapon_special_" + at_it->special() + "_description"]; res.add_text(str,tooltip); } - + str << at_it->damage() << "-" << at_it->num_attacks() << " -- " << (at_it->range() == attack_type::SHORT_RANGE ? _("melee") : _("ranged")); tooltip << at_it->damage() << " " << _("damage") << ", " << at_it->num_attacks() << " " << _("attacks"); - + str << "\n"; res.add_text(str,tooltip); } @@ -251,14 +251,14 @@ case TIME_OF_DAY: { const time_of_day& tod = timeofday_at(status,units,mouseover); std::stringstream tooltip; - + tooltip << tod.name << "\n" << _("Lawful units: ") << (tod.lawful_bonus > 0 ? "+" : "") << tod.lawful_bonus << "%\n" << _("Neutral units: ") << "0%\n" << _("Chaotic units: ") << (tod.lawful_bonus < 0 ? "+" : "") << (tod.lawful_bonus*-1) << "%"; - + return report("",tod.image,tooltip.str()); } case TURN: @@ -324,7 +324,7 @@ if(underlying.size() != 1 || underlying[0] != terrain) { str << " ("; - + for(std::string::const_iterator i = underlying.begin(); i != underlying.end(); ++i) { str << map.get_terrain_info(*i).name(); if(i+1 != underlying.end()) { @@ -358,7 +358,7 @@ str << " (" << defense << "%," << move_cost << ")"; } - break; + break; } case SIDE_PLAYING: { @@ -420,11 +420,11 @@ } return report(str.str()); } - - + + void set_report_content(const TYPE which_report, const std::string &content) { report_contents[which_report] = content; } - + } Index: wesnoth/src/reports.hpp diff -u wesnoth/src/reports.hpp:1.13 wesnoth/src/reports.hpp:1.14 --- wesnoth/src/reports.hpp:1.13 Sat May 14 20:56:21 2005 +++ wesnoth/src/reports.hpp Sat Jun 4 19:16:06 2005 @@ -20,7 +20,7 @@ UNIT_IMAGE, UNIT_PROFILE, TIME_OF_DAY, TURN, GOLD, VILLAGES, NUM_UNITS, UPKEEP, EXPENSES, INCOME, TERRAIN, POSITION, SIDE_PLAYING, OBSERVERS, REPORT_CLOCK, - SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION, + SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION, NUM_REPORTS}; enum { UNIT_REPORTS_BEGIN=UNIT_DESCRIPTION, UNIT_REPORTS_END=UNIT_PROFILE+1 }; @@ -34,14 +34,14 @@ // invariant so I left it like the original report class. std::string image; std::string text; - + std::string tooltip; - + element() {} explicit element(const std::string& text) : text(text) {} element(const std::string& text, const std::string& image, const std::string& tooltip) : image(image), text(text), tooltip(tooltip) {} - + bool operator==(const element& o) const { return o.text == text && o.image == image && o.tooltip == tooltip; } @@ -53,7 +53,7 @@ report(const std::string& text, const std::string& image, const std::string& tooltip) { this->push_back(element(text, image, tooltip)); } - + // Convenience functions void add_text(std::stringstream& text, std::stringstream& tooltip); void add_text(const std::string& text, const std::string& tooltip); @@ -69,7 +69,7 @@ // Set what will be shown for the report with type // which_report. Note that this only works for some reports, // i.e. reports that can not be deducted from the supplied arguments - // to generate_report. + // to generate_report. // Currently: SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION void set_report_content(const TYPE which_report, const std::string &content); } Index: wesnoth/src/scoped_resource.hpp diff -u wesnoth/src/scoped_resource.hpp:1.18 wesnoth/src/scoped_resource.hpp:1.19 --- wesnoth/src/scoped_resource.hpp:1.18 Thu Feb 24 23:39:35 2005 +++ wesnoth/src/scoped_resource.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: scoped_resource.hpp,v 1.18 2005/02/24 23:39:35 gruikya Exp $ */ +/* $Id: scoped_resource.hpp,v 1.19 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/sdl_utils.cpp diff -u wesnoth/src/sdl_utils.cpp:1.78 wesnoth/src/sdl_utils.cpp:1.79 --- wesnoth/src/sdl_utils.cpp:1.78 Sat Mar 26 17:10:32 2005 +++ wesnoth/src/sdl_utils.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: sdl_utils.cpp,v 1.78 2005/03/26 17:10:32 silene Exp $ */ +/* $Id: sdl_utils.cpp,v 1.79 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -213,14 +213,14 @@ const int xsrcint = maximum<int>(0,minimum<int>(src->w-1,static_cast<int>(xsrc))); const int ysrcint = maximum<int>(0,minimum<int>(src->h-1,static_cast<int>(ysrc))); - const double ysize = minimum<double>(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc); + const double ysize = minimum<double>(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc); Uint8 r,g,b,a; SDL_GetRGBA(src_pixels[ysrcint*src->w + xsrcint],src->format,&r,&g,&b,&a); const double value = xsize*ysize*double(a)/255.0; summation += value; - + red += r*value; green += g*value; blue += b*value; @@ -304,7 +304,7 @@ //conversion. ok, this is no big deal :) //the correct formula being: //gray=0.299red+0.587green+0.114blue - const Uint8 avg = (Uint8)((77*(Uint16)red + + const Uint8 avg = (Uint8)((77*(Uint16)red + 150*(Uint16)green + 29*(Uint16)blue) / 256); @@ -430,7 +430,7 @@ surface nsurf = make_neutral_surface(surf); surface nmask(make_neutral_surface(mask)); - + if(nsurf == NULL || nmask == NULL) { std::cerr << "could not make neutral surface...\n"; return NULL; @@ -439,7 +439,7 @@ { surface_lock lock(nsurf); surface_lock mlock(nmask); - + Uint32* beg = lock.pixels(); Uint32* end = beg + nsurf->w*surf->h; Uint32* mbeg = mlock.pixels(); @@ -474,7 +474,7 @@ surface nsurf = make_neutral_surface(surf); surface res = create_compatible_surface(nsurf, surf->w, surf->h); - + if(nsurf == NULL || res == NULL) { std::cerr << "could not make neutral surface...\n"; return NULL; @@ -571,8 +571,8 @@ for(int y = 0; y < r.h && (r.y + y) < surf->h; ++y) { Uint8* line_src = src + (r.y + y) * spitch + r.x * sbpp; Uint8* line_dest = dest + y * rpitch; - size_t size = r.w + r.x <= surf->w ? r.w : surf->w - r.x; - + size_t size = r.w + r.x <= surf->w ? r.w : surf->w - r.x; + wassert(rpitch >= r.w * rbpp); memcpy(line_dest, line_src, size * rbpp); } @@ -676,7 +676,7 @@ const size_t index2 = (nsurf->h-y-1)*surf->w + x; std::swap(pixels[index1],pixels[index2]); } - } + } } return create_optimized_surface(nsurf); Index: wesnoth/src/sdl_utils.hpp diff -u wesnoth/src/sdl_utils.hpp:1.55 wesnoth/src/sdl_utils.hpp:1.56 --- wesnoth/src/sdl_utils.hpp:1.55 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/sdl_utils.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: sdl_utils.hpp,v 1.55 2005/03/23 21:30:46 ydirson Exp $ */ +/* $Id: sdl_utils.hpp,v 1.56 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -52,13 +52,13 @@ void operator()(SDL_Surface *surf) const { if (surf != NULL) - SDL_FreeSurface(surf); + SDL_FreeSurface(surf); } }; typedef util::scoped_resource<SDL_Surface*,free_sdl_surface> scoped_sdl_surface; public: - surface() : surface_(NULL) + surface() : surface_(NULL) {} surface(SDL_Surface *surf) : surface_(surf) Index: wesnoth/src/serialization/binary_wml.cpp diff -u wesnoth/src/serialization/binary_wml.cpp:1.11 wesnoth/src/serialization/binary_wml.cpp:1.12 --- wesnoth/src/serialization/binary_wml.cpp:1.11 Tue Mar 29 20:19:33 2005 +++ wesnoth/src/serialization/binary_wml.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: binary_wml.cpp,v 1.11 2005/03/29 20:19:33 gruikya Exp $ */ +/* $Id: binary_wml.cpp,v 1.12 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -156,7 +156,7 @@ { if (level >= max_recursion_levels) throw config::error("Too many recursion levels in compressed config read"); - + bool in_open_element = false; for(;;) { unsigned char const c = in.get(); Index: wesnoth/src/serialization/parser.cpp diff -u wesnoth/src/serialization/parser.cpp:1.18 wesnoth/src/serialization/parser.cpp:1.19 --- wesnoth/src/serialization/parser.cpp:1.18 Sat May 7 16:04:10 2005 +++ wesnoth/src/serialization/parser.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: parser.cpp,v 1.18 2005/05/07 16:04:10 silene Exp $ */ +/* $Id: parser.cpp,v 1.19 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -103,7 +103,7 @@ } catch(config::error& e) { if(error_log == NULL) throw; - + // On error, dump tokens to the next LF while(tok_.current_token().type != token::LF && tok_.current_token().type != token::END) { @@ -125,7 +125,7 @@ } } -void parser::parse_element() +void parser::parse_element() { tok_.next_token(); std::string elname; @@ -212,10 +212,10 @@ } tok_.next_token(); } - if(variables.back().empty()) + if(variables.back().empty()) error(_("Empty variable name")); - std::vector<std::string>::const_iterator curvar = variables.begin(); + std::vector<std::string>::const_iterator curvar = variables.begin(); bool ignore_next_newlines = false; while(1) { @@ -302,7 +302,7 @@ i18n_symbols["error"] = error_type; throw config::error( - lineno_string(i18n_symbols, tok_.get_line(), + lineno_string(i18n_symbols, tok_.get_line(), N_("$error at $pos"))); } @@ -354,30 +354,30 @@ if(w.translatable()) { if(w.textdomain() != textdomain) { - out << TextdomainPrefix - << w.textdomain() + out << TextdomainPrefix + << w.textdomain() << TextdomainPostfix; textdomain = w.textdomain(); } if(first) { - out << std::string(tab, '\t') - << i->first + out << std::string(tab, '\t') + << i->first << AttributeEquals; } - out << TranslatableAttributePrefix + out << TranslatableAttributePrefix << escaped_string(part) << AttributePostfix; } else { if(first) { - out << std::string(tab, '\t') - << i->first + out << std::string(tab, '\t') + << i->first << AttributeEquals; } - out << AttributePrefix + out << AttributePrefix << escaped_string(part) << AttributePostfix; } @@ -388,7 +388,7 @@ out << AttributeContPostfix; out << std::string(tab+1, '\t'); } - + first = false; } } Index: wesnoth/src/serialization/preprocessor.cpp diff -u wesnoth/src/serialization/preprocessor.cpp:1.19 wesnoth/src/serialization/preprocessor.cpp:1.20 --- wesnoth/src/serialization/preprocessor.cpp:1.19 Sat May 21 07:50:48 2005 +++ wesnoth/src/serialization/preprocessor.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: preprocessor.cpp,v 1.19 2005/05/21 07:50:48 silene Exp $ */ +/* $Id: preprocessor.cpp,v 1.20 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -666,7 +666,7 @@ nfname = newfilename; nfname.erase(nfname.begin(),nfname.begin()+2); nfname = directory_ + nfname; - + } else { #ifdef USE_ZIPIOS if(newfilename != "" && newfilename[0] == '@') { Index: wesnoth/src/serialization/string_utils.cpp diff -u wesnoth/src/serialization/string_utils.cpp:1.21 wesnoth/src/serialization/string_utils.cpp:1.22 --- wesnoth/src/serialization/string_utils.cpp:1.21 Sun Apr 24 12:21:19 2005 +++ wesnoth/src/serialization/string_utils.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: string_utils.cpp,v 1.21 2005/04/24 12:21:19 gruikya Exp $ */ +/* $Id: string_utils.cpp,v 1.22 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -43,22 +43,22 @@ //Going in a backwards order allows nested variable-retrieval, e.g. in arrays. //For example, "I am $creatures[$i].user_description!" const std::string::size_type var_begin_loc = res.rfind('$', rfind_dollars_sign_from); - + //If there are no '$' left then we're done. if(var_begin_loc == std::string::npos) { break; } - + //For the next iteration of the loop, search for more '$' //(not from the same place because sometimes the '$' is not replaced) rfind_dollars_sign_from = int(var_begin_loc) - 1; - - + + const std::string::iterator var_begin = res.begin() + var_begin_loc; - + //The '$' is not part of the variable name. const std::string::iterator var_name_begin = var_begin + 1; - + //Find the maximum extent of the variable name (it may be shortened later). std::string::iterator var_end = var_name_begin; for(int bracket_nesting_level = 0; var_end != res.end(); ++var_end) { @@ -75,14 +75,14 @@ break; } } - + //Two dots in a row cannot be part of a valid variable name. //That matters for random=, e.g. $x..$y var_end = std::adjacent_find(var_name_begin, var_end, two_dots); - + //If the last character is '.', then it can't be a sub-variable. //It's probably meant to be a period instead. Don't include it. - //Would need to do it repetitively if there are multiple '.'s at the end, + //Would need to do it repetitively if there are multiple '.'s at the end, //but don't actually need to do so because the previous check for adjacent '.'s would catch that. //For example, "My score is $score." or "My score is $score..." if(*(var_end-1) == '.' @@ -95,7 +95,7 @@ && *(var_end-2) != ']') { --var_end; } - + if(*var_end == '|') { //It's been used to end this variable name; now it has no more effect. //This can allow use of things like "$$composite_var_name|.x" @@ -104,16 +104,16 @@ //just put another '|' there, one matching each '$', e.g. "$$var_containing_var_name||blah" res.erase(var_end); } - + const std::string var_name(var_name_begin, var_end); - + //The variable is replaced with its value. //Replace = remove original, and then insert new value, if any. res.erase(var_begin, var_end); res.insert(var_begin_loc, set.get_variable_const(var_name)); } - + //Remove any remaining '|', which are used to separate variable names, //so that the WML writer doesn't need to worry about whether they're really necessary. //It is also occasionally useful to intentionally put them elsewhere. @@ -199,7 +199,7 @@ { public: string_map_variable_set(const string_map& map) : map_(map) {}; - + virtual const t_string& get_variable_const(const std::string& key) { static const t_string empty_string = ""; @@ -445,7 +445,7 @@ for(i = src.begin(); i != src.end(); ++i) { int count; ch = *i; - + /* Determine the bytes required */ count = 1; if(ch >= 0x80) @@ -457,7 +457,7 @@ count++; bitmask <<= 5; } - + if(count > 6) throw invalid_utf8_exception(); @@ -483,7 +483,7 @@ } } -std::string wchar_to_string(const wchar_t c) +std::string wchar_to_string(const wchar_t c) { wide_string s; s.push_back(c); @@ -493,7 +493,7 @@ wide_string string_to_wstring(const std::string &src) { wide_string res; - + try { utf8_iterator i1(src); const utf8_iterator i2(utf8_iterator::end(src)); Index: wesnoth/src/serialization/string_utils.hpp diff -u wesnoth/src/serialization/string_utils.hpp:1.13 wesnoth/src/serialization/string_utils.hpp:1.14 --- wesnoth/src/serialization/string_utils.hpp:1.13 Sun Apr 24 11:58:04 2005 +++ wesnoth/src/serialization/string_utils.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: string_utils.hpp,v 1.13 2005/04/24 11:58:04 gruikya Exp $ */ +/* $Id: string_utils.hpp,v 1.14 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -71,7 +71,7 @@ class invalid_utf8_exception : public std::exception { }; -class utf8_iterator +class utf8_iterator { public: typedef std::input_iterator_tag iterator_category; Index: wesnoth/src/serialization/tokenizer.cpp diff -u wesnoth/src/serialization/tokenizer.cpp:1.10 wesnoth/src/serialization/tokenizer.cpp:1.11 --- wesnoth/src/serialization/tokenizer.cpp:1.10 Sat May 7 15:51:13 2005 +++ wesnoth/src/serialization/tokenizer.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: tokenizer.cpp,v 1.10 2005/05/07 15:51:13 silene Exp $ */ +/* $Id: tokenizer.cpp,v 1.11 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -78,7 +78,7 @@ case EOF: token_.type = token::END; break; - case '"': + case '"': token_.type = token::QSTRING; while (1) { next_char(); @@ -98,8 +98,8 @@ token_.value += current_; }; - break; - case '[': case ']': case '/': case '\n': case '=': case ',': case '+': + break; + case '[': case ']': case '/': case '\n': case '=': case ',': case '+': token_.type = token::token_type(current_); token_.value = current_; break; Index: wesnoth/src/serialization/tokenizer.hpp diff -u wesnoth/src/serialization/tokenizer.hpp:1.4 wesnoth/src/serialization/tokenizer.hpp:1.5 --- wesnoth/src/serialization/tokenizer.hpp:1.4 Sat May 7 15:51:13 2005 +++ wesnoth/src/serialization/tokenizer.hpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: tokenizer.hpp,v 1.4 2005/05/07 15:51:13 silene Exp $ */ +/* $Id: tokenizer.hpp,v 1.5 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -19,14 +19,14 @@ class config; -struct token +struct token { enum token_type { STRING, QSTRING, UNTERMINATED_QSTRING, MISC, - + LF = '\n', EQUALS = '=', COMMA = ',', @@ -42,7 +42,7 @@ std::string value; }; -class tokenizer +class tokenizer { public: tokenizer(std::istream& in); Index: wesnoth/src/server/game.cpp diff -u wesnoth/src/server/game.cpp:1.33 wesnoth/src/server/game.cpp:1.34 --- wesnoth/src/server/game.cpp:1.33 Tue May 17 21:00:18 2005 +++ wesnoth/src/server/game.cpp Sat Jun 4 19:16:06 2005 @@ -119,7 +119,7 @@ wassert(is_member(player)); const std::string& side = cfg["side"]; - + //if the player is already on a side if(sides_.count(player)) return false; @@ -168,7 +168,7 @@ { sides_taken_.clear(); sides_.clear(); - + const config::child_itors level_sides = level_.child_range("side"); //for each player: @@ -267,7 +267,7 @@ } sides_taken_.insert(side); - + //send everyone a message saying that the observer who is taking the side has quit config observer_quit; observer_quit.add_child("observer_quit").values["name"] = player; @@ -399,7 +399,7 @@ config cfg; cfg.add_child("start_game"); network::queue_data(cfg, player); - + //send observer join of all the observers in the game to player for(std::vector<network::connection>::const_iterator pl = players_.begin()+1; pl != players_.end(); ++pl) { if(sides_.count(*pl) == 0 && *pl != player) { @@ -470,7 +470,7 @@ config cfg; cfg.add_child("gamelist"); for(std::vector<network::connection>::const_iterator p = players_.begin(); p != players_.end(); ++p) { - + const player_map::const_iterator info = player_info_->find(*p); if(info != player_info_->end()) { config& user = cfg.add_child("user"); Index: wesnoth/src/server/game.hpp diff -u wesnoth/src/server/game.hpp:1.18 wesnoth/src/server/game.hpp:1.19 --- wesnoth/src/server/game.hpp:1.18 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/server/game.hpp Sat Jun 4 19:16:06 2005 @@ -38,7 +38,7 @@ void update_side_data(); const std::string& transfer_side_control(const config& cfg); - + size_t available_slots() const; //function to set the description to the number of slots Index: wesnoth/src/server/input_stream.cpp diff -u wesnoth/src/server/input_stream.cpp:1.4 wesnoth/src/server/input_stream.cpp:1.5 --- wesnoth/src/server/input_stream.cpp:1.4 Thu Dec 2 01:59:05 2004 +++ wesnoth/src/server/input_stream.cpp Sat Jun 4 19:16:06 2005 @@ -24,7 +24,7 @@ if(res != 0) { std::cerr << "could not make fifo at '" << path << "'\n"; } - + fd_ = open(path.c_str(),O_RDONLY|O_NONBLOCK); if(fd_ == -1) { Index: wesnoth/src/server/server.cpp diff -u wesnoth/src/server/server.cpp:1.78 wesnoth/src/server/server.cpp:1.79 --- wesnoth/src/server/server.cpp:1.78 Wed Apr 27 21:11:44 2005 +++ wesnoth/src/server/server.cpp Sat Jun 4 19:16:06 2005 @@ -50,7 +50,7 @@ } else { config& msg = turn.add_child("message"); msg["sender"] = "server"; - msg["message"] = message; + msg["message"] = message; } return turn; @@ -161,7 +161,7 @@ { time_t old_stats = last_stats_; last_stats_ = time(NULL); - + std::cout << "Statistics\n" "\tnum_players = " << players_.size() << "\n" @@ -232,7 +232,7 @@ bans_.erase(itor,bans_.end()); std::cout << "ban removed on '" << mask << "'" << std::endl; } - + } else if(command == "kick") { if(i == cmd.end()) { std::cout << "you must enter a nick to kick\n"; @@ -272,7 +272,7 @@ if(input_.read_line(admin_cmd)) { process_command(admin_cmd); } - + //make sure we log stats every 5 minutes if((loop%100) == 0 && last_stats_+5*60 < time(NULL)) { dump_stats(); @@ -297,7 +297,7 @@ } metrics_.no_requests(); - + } catch(network::error& e) { if(!e.socket) { std::cerr << "fatal network error: " << e.message << "\n"; @@ -314,7 +314,7 @@ players_.erase(pl_it); } - + not_logged_in_.remove_player(e.socket); lobby_players_.remove_player(e.socket); for(std::vector<game>::iterator i = games_.begin(); i != games_.end(); ++i) { @@ -408,7 +408,7 @@ "This username is already taken"),sock); return; } - + network::send_data(join_lobby_response_, sock); config* const player_cfg = &initial_response_.add_child("user"); @@ -441,11 +441,11 @@ std::ostringstream response; if(query["type"] == "metrics") { //a query for server data from a player - response << metrics_; + response << metrics_; } else { response << "Error: unrecognized query"; } - + network::send_data(construct_server_message(response.str(),lobby_players_),sock); } @@ -585,7 +585,7 @@ name = u["username"]; ban = false; } - + player_map::iterator pl; for(pl = players_.begin(); pl != players_.end(); ++pl) { if(pl->second.name() == name) { @@ -657,7 +657,7 @@ g->level().values["map_data"] = data["map_data"]; g->level().values["map"] = data["map"]; } - + //update our config object which describes the //open games, and notifies the game of where its description //is located at @@ -877,7 +877,7 @@ const size_t index = g - vg.first; gamelist->remove_child("game",index); } - + i->disconnect(); games_.erase(i); } @@ -908,7 +908,7 @@ std::cout << "usage: " << argv[0] << " [options]\n" << " -d --daemon Runs wesnothd as a daemon\n" - << " -m, --max_packet_size n Sets the maximal packet size to n\n" + << " -m, --max_packet_size n Sets the maximal packet size to n\n" << " -p, --port Binds the server to the specified port\n" << " -v, --version Returns the server version\n"; return 0; @@ -941,7 +941,7 @@ } input_stream input(fifo_path); - + try { server(port,input).run(); } catch(network::error& e) { Index: wesnoth/src/show_dialog.cpp diff -u wesnoth/src/show_dialog.cpp:1.132 wesnoth/src/show_dialog.cpp:1.133 --- wesnoth/src/show_dialog.cpp:1.132 Fri Jun 3 05:28:48 2005 +++ wesnoth/src/show_dialog.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: show_dialog.cpp,v 1.132 2005/06/03 05:28:48 silene Exp $ */ +/* $Id: show_dialog.cpp,v 1.133 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -27,7 +27,7 @@ #include "key.hpp" #include "log.hpp" #include "playlevel.hpp" -#include "show_dialog.hpp" +#include "show_dialog.hpp" #include "thread.hpp" #include "language.hpp" #include "sdl_utils.hpp" @@ -265,7 +265,7 @@ #ifdef OK_BUTTON_ON_RIGHT std::reverse(buttons->begin(),buttons->end()); #endif - + for(std::vector<button*>::const_iterator b = buttons->begin(); b != buttons->end(); ++b) { (**b).set_location(buttons_area.x,buttons_area.y); buttons_area.x += (**b).width() + ButtonHPadding; @@ -363,7 +363,7 @@ int text_widget_width = 0; int text_widget_height = 0; if(use_textbox) { - + text_widget.set_wrap(!editable_textbox); const SDL_Rect& area = font::text_area(*text_widget_text,message_font_size); @@ -562,7 +562,7 @@ if(yloc < yframe) { yframe = yloc; } - } + } std::vector<button*> buttons_ptr; for(std::vector<button>::iterator bt = buttons.begin(); bt != buttons.end(); ++bt) { @@ -581,7 +581,7 @@ //calculate the positions of the preview panes to the sides of the dialog if(preview_panes != NULL) { - + int left_preview_pane = xframe; int right_preview_pane = xframe + total_width + left_preview_pane_width; int above_left_preview_pane = xframe + frame_width/2; @@ -751,7 +751,7 @@ const int res = menu_.process(); if(res != -1) { - return res; + return res; } } @@ -772,7 +772,7 @@ left_button = new_left_button; right_button = new_right_button; - key_down = new_key_down; + key_down = new_key_down; for(std::vector<button>::iterator button_it = buttons.begin(); button_it != buttons.end(); ++button_it) { @@ -889,54 +889,54 @@ return res; } } -} - -namespace { - -class connect_waiter : public threading::waiter -{ -public: - connect_waiter(display& disp, gui::button& button) : disp_(disp), button_(button) - {} - ACTION process(); - -private: - display& disp_; - gui::button& button_; -}; - -connect_waiter::ACTION connect_waiter::process() -{ - events::raise_draw_event(); - disp_.flip(); - events::pump(); - if(button_.pressed()) { - return ABORT; - } else { - return WAIT; - } -} - -} - -network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port) -{ - const size_t width = 250; - const size_t height = 20; - const int left = disp.x()/2 - width/2; - const int top = disp.y()/2 - height/2; - - gui::button cancel_button(disp.video(),_("Cancel")); - std::vector<gui::button*> buttons_ptr(1,&cancel_button); - - surface_restorer restorer; - gui::draw_dialog(left,top,width,height,disp.video(),msg,NULL,&buttons_ptr,&restorer); - - events::raise_draw_event(); - disp.flip(); - - connect_waiter waiter(disp,cancel_button); - return network::connect(hostname,port,waiter); +} + +namespace { + +class connect_waiter : public threading::waiter +{ +public: + connect_waiter(display& disp, gui::button& button) : disp_(disp), button_(button) + {} + ACTION process(); + +private: + display& disp_; + gui::button& button_; +}; + +connect_waiter::ACTION connect_waiter::process() +{ + events::raise_draw_event(); + disp_.flip(); + events::pump(); + if(button_.pressed()) { + return ABORT; + } else { + return WAIT; + } +} + +} + +network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port) +{ + const size_t width = 250; + const size_t height = 20; + const int left = disp.x()/2 - width/2; + const int top = disp.y()/2 - height/2; + + gui::button cancel_button(disp.video(),_("Cancel")); + std::vector<gui::button*> buttons_ptr(1,&cancel_button); + + surface_restorer restorer; + gui::draw_dialog(left,top,width,height,disp.video(),msg,NULL,&buttons_ptr,&restorer); + + events::raise_draw_event(); + disp.flip(); + + connect_waiter waiter(disp,cancel_button); + return network::connect(hostname,port,waiter); } } //end namespace gui Index: wesnoth/src/show_dialog.hpp diff -u wesnoth/src/show_dialog.hpp:1.50 wesnoth/src/show_dialog.hpp:1.51 --- wesnoth/src/show_dialog.hpp:1.50 Thu Jun 2 23:10:55 2005 +++ wesnoth/src/show_dialog.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: show_dialog.hpp,v 1.50 2005/06/02 23:10:55 Sirp Exp $ */ +/* $Id: show_dialog.hpp,v 1.51 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -141,7 +141,7 @@ void show_error_message(display &disp, std::string const &message); network::connection network_data_dialog(display& disp, const std::string& msg, config& cfg, network::connection connection_num=0); -network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port); +network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port); void check_quit(CVideo &video); Index: wesnoth/src/sound.cpp diff -u wesnoth/src/sound.cpp:1.28 wesnoth/src/sound.cpp:1.29 --- wesnoth/src/sound.cpp:1.28 Tue Feb 8 21:38:41 2005 +++ wesnoth/src/sound.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: sound.cpp,v 1.28 2005/02/08 21:38:41 silene Exp $ */ +/* $Id: sound.cpp,v 1.29 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -100,7 +100,7 @@ std::map<std::string,Mix_Music*>::const_iterator itor = music_cache.find(file); if(itor == music_cache.end()) { const std::string& filename = get_binary_file_location("music",file); - + if(filename.empty()) { return; } Index: wesnoth/src/sound.hpp diff -u wesnoth/src/sound.hpp:1.11 wesnoth/src/sound.hpp:1.12 --- wesnoth/src/sound.hpp:1.11 Mon Aug 30 01:23:16 2004 +++ wesnoth/src/sound.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: sound.hpp,v 1.11 2004/08/30 01:23:16 Sirp Exp $ */ +/* $Id: sound.hpp,v 1.12 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/statistics.hpp diff -u wesnoth/src/statistics.hpp:1.11 wesnoth/src/statistics.hpp:1.12 --- wesnoth/src/statistics.hpp:1.11 Sun Apr 17 13:49:00 2005 +++ wesnoth/src/statistics.hpp Sat Jun 4 19:16:06 2005 @@ -41,7 +41,7 @@ disabler(); ~disabler(); }; - + struct scenario_context { scenario_context(const std::string& name); Index: wesnoth/src/team.cpp diff -u wesnoth/src/team.cpp:1.89 wesnoth/src/team.cpp:1.90 --- wesnoth/src/team.cpp:1.89 Fri Jun 3 11:54:22 2005 +++ wesnoth/src/team.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: team.cpp,v 1.89 2005/06/03 11:54:22 j_daniel Exp $ */ +/* $Id: team.cpp,v 1.90 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -193,7 +193,7 @@ LOG_NG << "team_info::team_info(...): team_name: " << team_name << ", share_maps: " << share_maps << ", share_view: " << share_view << ".\n"; - + music = cfg["music"]; } @@ -282,11 +282,11 @@ { fog_.set_enabled(cfg["fog"] == "yes"); shroud_.set_enabled(cfg["shroud"] == "yes"); - shroud_.read(cfg["shroud_data"]); - + shroud_.read(cfg["shroud_data"]); + LOG_NG << "team::team(...): team_name: " << info_.team_name << ", shroud: " << uses_shroud() << ", fog: " << uses_fog() << ".\n"; - + //gold is the maximum of 'gold' and what is given in the config file if(info_.gold.empty() == false) gold_ = maximum(gold,::atoi(info_.gold.c_str())); @@ -516,7 +516,7 @@ if(teams != NULL) { for(std::vector<team>::const_iterator i = teams->begin(); i != teams->end(); ++i) { i->enemies_.clear(); - } + } } } @@ -532,7 +532,7 @@ info_.objectives_changed = true; } -void team::reset_objectives_changed() +void team::reset_objectives_changed() { info_.objectives_changed = false; } @@ -598,7 +598,7 @@ bool team::fogged(int x, int y) const { if(shrouded(x,y)) return true; - + if(!teams || !share_view()) return fog_.value(x+1,y+1); @@ -634,25 +634,25 @@ bool team::knows_about_team(size_t index) const { const team& t = (*teams)[index]; - + //We know about our own team if(this == &t) return true; - + //If we aren't using shroud or fog, then we know about everyone if(!uses_shroud() && !uses_fog()) return true; - + //We don't know about enemies if(is_enemy(index+1)) return false; - + //We know our allies in multiplayer if(network::nconnections() > 0) return true; - + //We know about allies we're sharing maps with if(share_maps() && t.uses_shroud()) return true; - + //We know about allies we're sharing view with if(share_view() && (t.uses_fog() || t.uses_shroud())) return true; - + return false; } @@ -686,7 +686,7 @@ const std::set<gamemap::location> vacant_villages(const std::set<gamemap::location>& villages, const unit_map& units) { std::set<gamemap::location> res; - + for(std::set<gamemap::location>::const_iterator i = villages.begin(); i != villages.end(); ++i) { if(units.count(*i) == 0) { res.insert(*i); @@ -779,7 +779,7 @@ { if(enabled_ == false) return false; - + for(std::vector<const shroud_map*>::const_iterator i = maps.begin(); i != maps.end(); ++i) { if((*i)->enabled_ == true && (*i)->value(x,y) == false) return false; @@ -822,7 +822,7 @@ { if(enabled_ == false) return false; - + bool cleared = false; for(std::vector<const shroud_map*>::const_iterator i = maps.begin(); i != maps.end(); ++i) { if((*i)->enabled_ == false) Index: wesnoth/src/team.hpp diff -u wesnoth/src/team.hpp:1.58 wesnoth/src/team.hpp:1.59 --- wesnoth/src/team.hpp:1.58 Sun Apr 17 15:40:34 2005 +++ wesnoth/src/team.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: team.hpp,v 1.58 2005/04/17 15:40:34 gruikya Exp $ */ +/* $Id: team.hpp,v 1.59 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -31,21 +31,21 @@ class shroud_map { public: shroud_map() : enabled_(false) {} - + void place(size_t x, size_t y); bool clear(size_t x, size_t y); void reset(); - + bool value(size_t x, size_t y) const; bool shared_value(const std::vector<const shroud_map*>& maps, size_t x, size_t y) const; - + bool copy_from(const std::vector<const shroud_map*>& maps); - + std::string write() const; void read(const std::string& shroud_data); - + bool enabled() const { return enabled_; } - void set_enabled(bool enabled) { enabled_ = enabled; } + void set_enabled(bool enabled) { enabled_ = enabled; } private: bool enabled_; std::vector<std::vector<bool> > data_; @@ -175,7 +175,7 @@ //any other ally with shared vision. bool shrouded(int x, int y) const; bool fogged(int x, int y) const; - + bool uses_shroud() const { return shroud_.enabled(); } bool uses_fog() const { return fog_.enabled(); } bool fog_or_shroud() const { return uses_shroud() || uses_fog(); } @@ -183,13 +183,13 @@ void place_shroud(int x, int y) { shroud_.place(x+1,y+1); } bool clear_fog(int x, int y) { return fog_.clear(x+1,y+1); } void refog() { fog_.reset(); } - + bool knows_about_team(size_t index) const; bool copy_ally_shroud(); - + bool auto_shroud_updates() const { return auto_shroud_updates_; } void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; } - + const std::string& music() const; int map_colour_to() const; @@ -204,10 +204,10 @@ //Make these public if you need them, but look at knows_about_team(...) first. bool share_maps() const { return info_.share_maps; } bool share_view() const { return info_.share_view; } - + const std::vector<const shroud_map*>& ally_shroud(const std::vector<team>& teams) const; const std::vector<const shroud_map*>& ally_fog(const std::vector<team>& teams) const; - + int gold_; std::set<gamemap::location> villages_; Index: wesnoth/src/terrain.cpp diff -u wesnoth/src/terrain.cpp:1.28 wesnoth/src/terrain.cpp:1.29 --- wesnoth/src/terrain.cpp:1.28 Sun Mar 27 23:06:17 2005 +++ wesnoth/src/terrain.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: terrain.cpp,v 1.28 2005/03/27 23:06:17 gruikya Exp $ */ +/* $Id: terrain.cpp,v 1.29 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -20,7 +20,7 @@ #include <iostream> terrain_type::terrain_type() : symbol_image_("void"), letter_(' '), type_(" "), - height_adjust_(0), submerge_(0.0), + height_adjust_(0), submerge_(0.0), heals_(false), village_(false), castle_(false), keep_(false) {} @@ -31,7 +31,7 @@ name_ = cfg["name"]; id_ = cfg["id"]; const std::string& letter = cfg["char"]; - + if(letter == "") { letter_ = 0; } else { Index: wesnoth/src/terrain.hpp diff -u wesnoth/src/terrain.hpp:1.23 wesnoth/src/terrain.hpp:1.24 --- wesnoth/src/terrain.hpp:1.23 Sun Mar 27 23:06:17 2005 +++ wesnoth/src/terrain.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: terrain.hpp,v 1.23 2005/03/27 23:06:17 gruikya Exp $ */ +/* $Id: terrain.hpp,v 1.24 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/theme.cpp diff -u wesnoth/src/theme.cpp:1.37 wesnoth/src/theme.cpp:1.38 --- wesnoth/src/theme.cpp:1.37 Wed Apr 13 18:47:20 2005 +++ wesnoth/src/theme.cpp Sat Jun 4 19:16:06 2005 @@ -480,7 +480,7 @@ } else { mini_map_ = object(); } - + const config* const status_cfg = cfg.child("status"); if(status_cfg != NULL) { for(config::child_map::const_iterator i = status_cfg->all_children().begin(); i != status_cfg->all_children().end(); ++i) { @@ -561,7 +561,7 @@ return; const config& v = *cfg; const config::child_list& known_themes_cfg = v.get_children("theme"); - + for(config::child_list::const_iterator thm = known_themes_cfg.begin(); thm != known_themes_cfg.end(); ++thm) { std::string thm_name=(**thm)["name"]; if(thm_name!="null" && thm_name!="editor"){ @@ -572,7 +572,7 @@ std::vector<std::string> theme::get_known_themes(){ std::vector<std::string> names; - + for(std::map<std::string, config>::iterator p_thm=known_themes.begin();p_thm!=known_themes.end();p_thm++){ names.push_back(p_thm->first); Index: wesnoth/src/theme.hpp diff -u wesnoth/src/theme.hpp:1.8 wesnoth/src/theme.hpp:1.9 --- wesnoth/src/theme.hpp:1.8 Fri Mar 25 19:34:39 2005 +++ wesnoth/src/theme.hpp Sat Jun 4 19:16:06 2005 @@ -69,7 +69,7 @@ explicit status_item(const config& cfg); using object::location; - + const std::string& prefix() const; const std::string& postfix() const; Index: wesnoth/src/thread.cpp diff -u wesnoth/src/thread.cpp:1.7 wesnoth/src/thread.cpp:1.8 --- wesnoth/src/thread.cpp:1.7 Fri Jun 3 00:44:28 2005 +++ wesnoth/src/thread.cpp Sat Jun 4 19:16:06 2005 @@ -1,47 +1,47 @@ #include "global.hpp" -#include "thread.hpp" - -#include <new> -#include <iostream> +#include "thread.hpp" + +#include <new> +#include <iostream> #include <vector> - -namespace { - -int run_async_operation(void* data) -{ - threading::async_operation* const op = reinterpret_cast<threading::async_operation*>(data); - op->run(); - - bool should_delete = false; - { - const threading::lock l(op->get_mutex()); - op->notify_finished(); //in case the operation didn't notify of finishing - if(op->is_aborted()) { - should_delete = true; - } - } - - if(should_delete) { - delete op; - } - - - return 0; -} - -std::vector<SDL_Thread*> detached_threads; - -} + +namespace { + +int run_async_operation(void* data) +{ + threading::async_operation* const op = reinterpret_cast<threading::async_operation*>(data); + op->run(); + + bool should_delete = false; + { + const threading::lock l(op->get_mutex()); + op->notify_finished(); //in case the operation didn't notify of finishing + if(op->is_aborted()) { + should_delete = true; + } + } + + if(should_delete) { + delete op; + } + + + return 0; +} + +std::vector<SDL_Thread*> detached_threads; + +} namespace threading { - -manager::~manager() -{ - for(std::vector<SDL_Thread*>::iterator i = detached_threads.begin(); i != detached_threads.end(); ++i) { - SDL_WaitThread(*i,NULL); - } -} + +manager::~manager() +{ + for(std::vector<SDL_Thread*>::iterator i = detached_threads.begin(); i != detached_threads.end(); ++i) { + SDL_WaitThread(*i,NULL); + } +} thread::thread(int (*f)(void*), void* data) : thread_(SDL_CreateThread(f,data)) {} @@ -65,12 +65,12 @@ SDL_WaitThread(thread_,NULL); thread_ = NULL; } -} - -void thread::detach() -{ - detached_threads.push_back(thread_); - thread_ = NULL; +} + +void thread::detach() +{ + detached_threads.push_back(thread_); + thread_ = NULL; } mutex::mutex() : m_(SDL_CreateMutex()) @@ -106,12 +106,12 @@ condition::WAIT_TIMEOUT_RESULT condition::wait_timeout(const mutex& m, unsigned int timeout) { - const int res = SDL_CondWaitTimeout(cond_,m.m_,timeout) == 0; - switch(res) { - //the SDL documentation appears backward on when these results are returned - case 0: return WAIT_TIMEOUT; - case SDL_MUTEX_TIMEDOUT: return WAIT_OK; - default: return WAIT_ERROR; + const int res = SDL_CondWaitTimeout(cond_,m.m_,timeout) == 0; + switch(res) { + //the SDL documentation appears backward on when these results are returned + case 0: return WAIT_TIMEOUT; + case SDL_MUTEX_TIMEDOUT: return WAIT_OK; + default: return WAIT_ERROR; } } @@ -124,46 +124,46 @@ { SDL_CondBroadcast(cond_); } - -void async_operation::notify_finished() -{ - finished_.notify_one(); -} - -async_operation::RESULT async_operation::execute(waiter& wait) -{ - //the thread must be created after the lock, and also destroyed after it. - //this is because during the thread's execution, we must always hold the mutex - //unless we are waiting on notification that the thread is finished, or we have - //already received that notification. - // - //we cannot hold the mutex while waiting for the thread to join though, because - //the thread needs access to the mutex before it terminates - std::auto_ptr<thread> t(NULL); - { - const lock l(get_mutex()); - t = std::auto_ptr<thread>(new thread(run_async_operation,this)); - - bool completed = false; - while(wait.process() == waiter::WAIT) { - const condition::WAIT_TIMEOUT_RESULT res = finished_.wait_timeout(get_mutex(),20); - if(res == condition::WAIT_OK) { - completed = true; - break; - } else if(res == condition::WAIT_ERROR) { - break; - } - } - - if(!completed) { - aborted_ = true; - t->detach(); - return ABORTED; - } - } - - return COMPLETED; -} - + +void async_operation::notify_finished() +{ + finished_.notify_one(); +} + +async_operation::RESULT async_operation::execute(waiter& wait) +{ + //the thread must be created after the lock, and also destroyed after it. + //this is because during the thread's execution, we must always hold the mutex + //unless we are waiting on notification that the thread is finished, or we have + //already received that notification. + // + //we cannot hold the mutex while waiting for the thread to join though, because + //the thread needs access to the mutex before it terminates + std::auto_ptr<thread> t(NULL); + { + const lock l(get_mutex()); + t = std::auto_ptr<thread>(new thread(run_async_operation,this)); + + bool completed = false; + while(wait.process() == waiter::WAIT) { + const condition::WAIT_TIMEOUT_RESULT res = finished_.wait_timeout(get_mutex(),20); + if(res == condition::WAIT_OK) { + completed = true; + break; + } else if(res == condition::WAIT_ERROR) { + break; + } + } + + if(!completed) { + aborted_ = true; + t->detach(); + return ABORTED; + } + } + + return COMPLETED; +} + } Index: wesnoth/src/thread.hpp diff -u wesnoth/src/thread.hpp:1.4 wesnoth/src/thread.hpp:1.5 --- wesnoth/src/thread.hpp:1.4 Thu Jun 2 23:58:01 2005 +++ wesnoth/src/thread.hpp Sat Jun 4 19:16:06 2005 @@ -9,29 +9,29 @@ // This module defines primitives for wrapping C++ around SDL's threading // interface namespace threading -{ - -struct manager -{ - ~manager(); +{ + +struct manager +{ + ~manager(); }; // Threading object. // -// This class defines threading objects. One such object represents a +// This class defines threading objects. One such object represents a // thread and admits killing and joining on threads. Intended to be // used for manipulating threads instead of poking around with SDL_Thread // calls. class thread { public: - // Construct a new thread to start executing the function - // pointed to by f. The void* data will be passed to f, to - // facilitate passing of parameters to f. + // Construct a new thread to start executing the function + // pointed to by f. The void* data will be passed to f, to + // facilitate passing of parameters to f. // // \param f the function at which the thread should start executing // \param data passed to f - // + // // \pre f != NULL explicit thread(int (*f)(void*), void* data=NULL); @@ -47,8 +47,8 @@ // Join (wait) on the thread to finish. When the thread finishes, // the function will return. calling wait() on an already killed // thread is a no-op. - void join(); - + void join(); + void detach(); private: thread(const thread&); @@ -89,9 +89,9 @@ public: // Create a lock object on the mutex given as a parameter to // the constructor. The lock will be held for the duration - // of the object existence. - // If the mutex is already locked, the constructor will - // block until the mutex lock can be acquired. + // of the object existence. + // If the mutex is already locked, the constructor will + // block until the mutex lock can be acquired. // // \param m the mutex on which we should try to lock. explicit lock(mutex& m); @@ -122,30 +122,30 @@ // section. When the condition is not met, wait blocks until // the condition is met and atomically frees up the lock on // the mutex. One will automatically regain the lock when the - // thread unblocks. + // thread unblocks. // // If wait returns false we have an error. In this case one cannot - // assume that he has a lock on the mutex anymore. - // + // assume that he has a lock on the mutex anymore. + // // \param m the mutex you wish to free the lock for // \returns true: the wait was successful, false: an error occurred // // \pre You have already aquired a lock on mutex m - // - bool wait(const mutex& m); - - enum WAIT_TIMEOUT_RESULT { WAIT_OK, WAIT_TIMEOUT, WAIT_ERROR }; + // + bool wait(const mutex& m); + + enum WAIT_TIMEOUT_RESULT { WAIT_OK, WAIT_TIMEOUT, WAIT_ERROR }; // wait on the condition with a timeout. Basically the same as the - // wait() function, but if the lock is not aquired before the + // wait() function, but if the lock is not aquired before the // timeout, the function returns with an error. // - // \param m the mutex you wish free the lock for. + // \param m the mutex you wish free the lock for. // \param timeout the allowed timeout in milliseconds (ms) - // \returns result based on whether condition was met, it timed out, + // \returns result based on whether condition was met, it timed out, // or there was an error WAIT_TIMEOUT_RESULT wait_timeout(const mutex& m, unsigned int timeout); - // signal the condition and wake up one thread waiting on the + // signal the condition and wake up one thread waiting on the // condition. If no thread is waiting, notify_one() is a no-op. // Does not unlock the mutex. // @@ -157,7 +157,7 @@ // involved and you do not know how many processes might continue. // The function should be used with care, especially if many threads are // waiting on the condition variable. - // + // // \todo SDL_CondBroadcast can return an error. This is never checked void notify_all(); @@ -166,76 +166,76 @@ void operator=(const condition&); SDL_cond* const cond_; -}; - -//class which defines an interface for waiting on an asynchronous operation -class waiter { -public: - enum ACTION { WAIT, ABORT }; - - virtual ~waiter() {} - virtual ACTION process() = 0; -}; - -//class which defines an asynchronous operation. Objects of this class are accessed from -//both the worker thread and the calling thread, and so it has 'strange' allocation semantics. -//It is allocated by the caller, and generally deleted by the caller. However, in some cases -//the asynchronous operation is aborted, and the caller abandons it. The caller cannot still -//delete the operation, since the worker thread might still access it, so in the case when the -//operation is aborted, the worker thread will delete it. -// -//The caller should hold these objects using the async_operation_holder class below, which will -//handle the delete semantics -class async_operation -{ -public: - - enum RESULT { COMPLETED, ABORTED }; - - async_operation() : aborted_(false) {} - virtual ~async_operation() {} - - RESULT execute(waiter& wait); - - mutex& get_mutex() { return mutex_; } - - virtual void run() = 0; - - //notify that the operation is finished. Can be called from within the thread - //while holding the mutex and after checking is_aborted() - //if we want to be sure that if the operation is completed, the caller is notified. - //will be called in any case after the operation returns - void notify_finished(); - - //must hold the mutex before calling this function from the worker thread - bool is_aborted() const { return aborted_; } - -private: - bool aborted_; - condition finished_; - mutex mutex_; -}; - -//T should be a type derived from async_operation -template<typename T> -class async_operation_holder -{ -public: - explicit async_operation_holder(T* op) : op_(op) - {} - - ~async_operation_holder() { - //it's okay to call is_aborted() without the mutex here, - //because we are in the calling thread, not the worker thread - if(op_->is_aborted() == false) { - delete op_; - } - } - - T& operation() const { return *op_; } - -private: - T* const op_; +}; + +//class which defines an interface for waiting on an asynchronous operation +class waiter { +public: + enum ACTION { WAIT, ABORT }; + + virtual ~waiter() {} + virtual ACTION process() = 0; +}; + +//class which defines an asynchronous operation. Objects of this class are accessed from +//both the worker thread and the calling thread, and so it has 'strange' allocation semantics. +//It is allocated by the caller, and generally deleted by the caller. However, in some cases +//the asynchronous operation is aborted, and the caller abandons it. The caller cannot still +//delete the operation, since the worker thread might still access it, so in the case when the +//operation is aborted, the worker thread will delete it. +// +//The caller should hold these objects using the async_operation_holder class below, which will +//handle the delete semantics +class async_operation +{ +public: + + enum RESULT { COMPLETED, ABORTED }; + + async_operation() : aborted_(false) {} + virtual ~async_operation() {} + + RESULT execute(waiter& wait); + + mutex& get_mutex() { return mutex_; } + + virtual void run() = 0; + + //notify that the operation is finished. Can be called from within the thread + //while holding the mutex and after checking is_aborted() + //if we want to be sure that if the operation is completed, the caller is notified. + //will be called in any case after the operation returns + void notify_finished(); + + //must hold the mutex before calling this function from the worker thread + bool is_aborted() const { return aborted_; } + +private: + bool aborted_; + condition finished_; + mutex mutex_; +}; + +//T should be a type derived from async_operation +template<typename T> +class async_operation_holder +{ +public: + explicit async_operation_holder(T* op) : op_(op) + {} + + ~async_operation_holder() { + //it's okay to call is_aborted() without the mutex here, + //because we are in the calling thread, not the worker thread + if(op_->is_aborted() == false) { + delete op_; + } + } + + T& operation() const { return *op_; } + +private: + T* const op_; }; } Index: wesnoth/src/titlescreen.cpp diff -u wesnoth/src/titlescreen.cpp:1.42 wesnoth/src/titlescreen.cpp:1.43 --- wesnoth/src/titlescreen.cpp:1.42 Fri Jun 3 20:20:53 2005 +++ wesnoth/src/titlescreen.cpp Sat Jun 4 19:16:06 2005 @@ -69,7 +69,7 @@ last_button = new_button; screen.update_display(); - + SDL_Delay(10); events::pump(); @@ -212,7 +212,7 @@ const int menu_yincr = 40; #endif const int padding = game_config::title_buttons_padding; - + std::vector<button> buttons; size_t b, max_width = 0; for(b = 0; b != nbuttons; ++b) { Index: wesnoth/src/tools/cutter.cpp diff -u wesnoth/src/tools/cutter.cpp:1.2 wesnoth/src/tools/cutter.cpp:1.3 --- wesnoth/src/tools/cutter.cpp:1.2 Mon Jul 19 18:31:32 2004 +++ wesnoth/src/tools/cutter.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: cutter.cpp,v 1.2 2004/07/19 18:31:32 gruikya Exp $ */ +/* $Id: cutter.cpp,v 1.3 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -21,7 +21,7 @@ namespace { void print_usage(std::string name) - { + { std::cerr << "usage: " << name << " [source] [dest_directory]\n"; } } @@ -40,7 +40,7 @@ continue; } - if(val == "--help" || val == "-h") { + if(val == "--help" || val == "-h") { print_usage(argv[0]); return 0; } else if(val == "--verbose" || val == "-v") { @@ -67,19 +67,19 @@ try { const config conf = cut.load_config(src); cut.load_masks(conf); - + const surface src_surface(make_neutral_surface(IMG_Load(src.c_str()))); if(src_surface == NULL) throw exploder_failure("Unable to load the source image " + src); const cutter::surface_map surfaces = cut.cut_surface(src_surface, conf); - for(cutter::surface_map::const_iterator itor = surfaces.begin(); + for(cutter::surface_map::const_iterator itor = surfaces.begin(); itor != surfaces.end(); ++itor) { const cutter::mask &mask = itor->second.mask; surface surf = surface( - create_compatible_surface(itor->second.image, + create_compatible_surface(itor->second.image, mask.cut.w, mask.cut.h)); masked_overwrite_surface(surf, itor->second.image, mask.image, Index: wesnoth/src/tools/exploder.cpp diff -u wesnoth/src/tools/exploder.cpp:1.2 wesnoth/src/tools/exploder.cpp:1.3 --- wesnoth/src/tools/exploder.cpp:1.2 Mon Jul 19 18:31:32 2004 +++ wesnoth/src/tools/exploder.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: exploder.cpp,v 1.2 2004/07/19 18:31:32 gruikya Exp $ */ +/* $Id: exploder.cpp,v 1.3 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -19,7 +19,7 @@ namespace { void print_usage(std::string name) - { + { std::cerr << "usage: " << name << " [source] [destination]\n"; } } @@ -38,7 +38,7 @@ continue; } - if(val == "--help" || val == "-h") { + if(val == "--help" || val == "-h") { print_usage(argv[0]); return 0; } else if(val == "--interactive" || val == "-i") { Index: wesnoth/src/tools/exploder_composer.cpp diff -u wesnoth/src/tools/exploder_composer.cpp:1.3 wesnoth/src/tools/exploder_composer.cpp:1.4 --- wesnoth/src/tools/exploder_composer.cpp:1.3 Mon Jul 19 18:31:32 2004 +++ wesnoth/src/tools/exploder_composer.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: exploder_composer.cpp,v 1.3 2004/07/19 18:31:32 gruikya Exp $ */ +/* $Id: exploder_composer.cpp,v 1.4 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -32,7 +32,7 @@ } cut.load_masks(src_conf); cut.load_masks(dest_conf); - + if(verbose_) { std::cerr << "Loading images...\n"; } @@ -50,14 +50,14 @@ const cutter::surface_map src_surfaces = cut.cut_surface(src_surface, src_conf); const cutter::surface_map dest_surfaces = cut.cut_surface(dest_surface, dest_conf); - for(cutter::surface_map::const_iterator itor = dest_surfaces.begin(); + for(cutter::surface_map::const_iterator itor = dest_surfaces.begin(); itor != dest_surfaces.end(); ++itor) { const std::string& name = itor->second.name; - - if(src_surfaces.find(name) == src_surfaces.end()) + + if(src_surfaces.find(name) == src_surfaces.end()) continue; - + const cutter::positioned_surface& src_ps = src_surfaces.find(name)->second; const cutter::positioned_surface& dest_ps = itor->second; @@ -75,7 +75,7 @@ } masked_overwrite_surface(dest_surface, src_ps.image, src_ps.mask.image, - dest_ps.pos.x, dest_ps.pos.y); + dest_ps.pos.x, dest_ps.pos.y); } return dest_surface; Index: wesnoth/src/tools/exploder_cutter.cpp diff -u wesnoth/src/tools/exploder_cutter.cpp:1.6 wesnoth/src/tools/exploder_cutter.cpp:1.7 --- wesnoth/src/tools/exploder_cutter.cpp:1.6 Fri Mar 25 18:19:20 2005 +++ wesnoth/src/tools/exploder_cutter.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: exploder_cutter.cpp,v 1.6 2005/03/25 18:19:20 silene Exp $ */ +/* $Id: exploder_cutter.cpp,v 1.7 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -29,7 +29,7 @@ const std::string conf_string = find_configuration(filename); config res; - + try { scoped_istream stream = preprocess_file(conf_string); read(res, *stream); @@ -62,7 +62,7 @@ const exploder_rect cut((**itor)["cut"]); if(masks_.find(name) != masks_.end() && masks_[name].filename != image) { - throw exploder_failure("Mask " + name + + throw exploder_failure("Mask " + name + " correspond to two different files: " + name + " and " + masks_.find(name)->second.filename); @@ -105,7 +105,7 @@ std::string cutter::find_configuration(const std::string &file) { - //finds the file prefix. + //finds the file prefix. const std::string fname = file_name(file); const std::string::size_type dotpos = fname.rfind('.'); @@ -120,19 +120,19 @@ } -void cutter::add_sub_image(const surface &surf, surface_map &map, const config* config) +void cutter::add_sub_image(const surface &surf, surface_map &map, const config* config) { const std::string name = (*config)["name"]; if(name.empty()) throw exploder_failure("Un-named sub-image"); - if(masks_.find(name) == masks_.end()) + if(masks_.find(name) == masks_.end()) throw exploder_failure("Unable to find mask corresponding to " + name); const cutter::mask& mask = masks_[name]; std::vector<std::string> pos = utils::split((*config)["pos"]); - if(pos.size() != 2) + if(pos.size() != 2) throw exploder_failure("Invalid position " + (*config)["pos"]); int x = atoi(pos[0].c_str()); Index: wesnoth/src/tools/exploder_utils.cpp diff -u wesnoth/src/tools/exploder_utils.cpp:1.6 wesnoth/src/tools/exploder_utils.cpp:1.7 --- wesnoth/src/tools/exploder_utils.cpp:1.6 Thu Mar 10 13:55:24 2005 +++ wesnoth/src/tools/exploder_utils.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: exploder_utils.cpp,v 1.6 2005/03/10 13:55:24 silene Exp $ */ +/* $Id: exploder_utils.cpp,v 1.7 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -134,7 +134,7 @@ //an image is considered empty if // * all its pixels have 0 alpha, OR // * all of its pixels have the same color (and the same alpha) - + surface_lock lock(surf); Uint32* beg = lock.pixels(); @@ -150,7 +150,7 @@ } return true; } - + namespace { struct rgba { @@ -169,7 +169,7 @@ //initializes PNG write structures //TODO: review whether providing NULL error handlers is something - //sensible + //sensible png_struct* png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, (png_voidp)png_voidp_NULL, png_error_ptr_NULL, png_error_ptr_NULL); @@ -198,7 +198,7 @@ //puts the actual image data in the row_pointers array png_byte **row_pointers = new png_byte *[surf->h]; surface_lock lock(surf); - + //converts the data to the RGBA format. We cannot pass SDL data //directly to the png lib, even if we know its pixel format, because of //endianness problems. Index: wesnoth/src/tools/exploder_utils.hpp diff -u wesnoth/src/tools/exploder_utils.hpp:1.3 wesnoth/src/tools/exploder_utils.hpp:1.4 --- wesnoth/src/tools/exploder_utils.hpp:1.3 Mon Jul 19 18:31:32 2004 +++ wesnoth/src/tools/exploder_utils.hpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: exploder_utils.hpp,v 1.3 2004/07/19 18:31:32 gruikya Exp $ */ +/* $Id: exploder_utils.hpp,v 1.4 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -53,5 +53,5 @@ void masked_overwrite_surface(surface dest, surface src, surface mask, int x, int y); bool image_empty(surface surf); void save_image(surface surf, const std::string &filename); - + #endif Index: wesnoth/src/tooltips.cpp diff -u wesnoth/src/tooltips.cpp:1.23 wesnoth/src/tooltips.cpp:1.24 --- wesnoth/src/tooltips.cpp:1.23 Wed Mar 23 20:46:58 2005 +++ wesnoth/src/tooltips.cpp Sat Jun 4 19:16:06 2005 @@ -16,7 +16,7 @@ const bool yoverlap = a.y >= b.y && a.y < b.y + b.h || b.y >= a.y && b.y < a.y + a.h; - + return xoverlap && yoverlap; } Index: wesnoth/src/tstring.cpp diff -u wesnoth/src/tstring.cpp:1.13 wesnoth/src/tstring.cpp:1.14 --- wesnoth/src/tstring.cpp:1.13 Mon May 16 22:44:20 2005 +++ wesnoth/src/tstring.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: tstring.cpp,v 1.13 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: tstring.cpp,v 1.14 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Copyright (C) 2005 by Guillaume Melquiond <[EMAIL PROTECTED]> @@ -105,7 +105,7 @@ switch(string_[begin_]) { case TRANSLATABLE_PART: { - std::string::size_type textdomain_end = + std::string::size_type textdomain_end = string_.find(TEXTDOMAIN_SEPARATOR, begin_ + 1); if(textdomain_end == std::string::npos || textdomain_end >= string_.size() - 1) { @@ -220,13 +220,13 @@ t_string t_string::from_serialized(const std::string& string) { t_string orig(string); - + if(!string.empty() && (string[0] == TRANSLATABLE_PART || string[0] == UNTRANSLATABLE_PART)) { orig.translatable_ = true; } else { orig.translatable_ = false; } - + t_string res; for(walker w(orig); !w.eos(); w.next()) { @@ -253,7 +253,7 @@ if(w.translatable()) { chunk.translatable_ = true; chunk.last_untranslatable_ = false; - chunk.value_ = TRANSLATABLE_PART + w.textdomain() + + chunk.value_ = TRANSLATABLE_PART + w.textdomain() + TEXTDOMAIN_SEPARATOR + substr; } else { chunk.translatable_ = false; @@ -389,7 +389,7 @@ return *this; } -t_string& t_string::operator+=(const char* string) +t_string& t_string::operator+=(const char* string) { if (string[0] == 0) return *this; @@ -416,12 +416,12 @@ bool t_string::operator!=(const std::string& string) const { return !(*this == string); } bool t_string::operator!=(const char* string) const { return !(*this == string); } -bool t_string::operator<(const t_string& string) const +bool t_string::operator<(const t_string& string) const { return value_ < string.value_; } -bool t_string::empty() const +bool t_string::empty() const { return value_.empty(); } @@ -453,7 +453,7 @@ translated_value_ += part; } } - + return translated_value_; } @@ -487,24 +487,24 @@ return stream; } -bool operator==(const std::string& a, const t_string& b) -{ - return b == a; +bool operator==(const std::string& a, const t_string& b) +{ + return b == a; } -bool operator==(const char* a, const t_string& b) -{ - return b == a; +bool operator==(const char* a, const t_string& b) +{ + return b == a; } -bool operator!=(const std::string& a, const t_string& b) -{ - return b != a; +bool operator!=(const std::string& a, const t_string& b) +{ + return b != a; } -bool operator!=(const char* a, const t_string& b) -{ - return b != a; +bool operator!=(const char* a, const t_string& b) +{ + return b != a; } t_string operator+(const std::string& a, const t_string& b) Index: wesnoth/src/tstring.hpp diff -u wesnoth/src/tstring.hpp:1.9 wesnoth/src/tstring.hpp:1.10 --- wesnoth/src/tstring.hpp:1.9 Mon May 16 22:44:20 2005 +++ wesnoth/src/tstring.hpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: tstring.hpp,v 1.9 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: tstring.hpp,v 1.10 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -64,7 +64,7 @@ t_string& operator+=(const t_string&); t_string& operator+=(const std::string&); t_string& operator+=(const char*); - + bool operator==(const t_string&) const; bool operator==(const std::string&) const; bool operator==(const char*) const; Index: wesnoth/src/unit.cpp diff -u wesnoth/src/unit.cpp:1.153 wesnoth/src/unit.cpp:1.154 --- wesnoth/src/unit.cpp:1.153 Thu May 19 17:45:49 2005 +++ wesnoth/src/unit.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: unit.cpp,v 1.153 2005/05/19 17:45:49 silene Exp $ */ +/* $Id: unit.cpp,v 1.154 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -64,7 +64,7 @@ } //constructor for reading a unit -unit::unit(const game_data& data, const config& cfg) : +unit::unit(const game_data& data, const config& cfg) : state_(STATE_NORMAL), moves_(0), user_end_turn_(false), facingLeft_(true), resting_(false), hold_position_(false), recruit_(false), @@ -163,7 +163,7 @@ traits.push_back(candidate_traits[num]); candidate_traits.erase(candidate_traits.begin()+num); } - + for(std::vector<config*>::const_iterator j = traits.begin(); j != traits.end(); ++j) { modifications_.add_child("trait",**j); } @@ -290,7 +290,7 @@ void unit::set_attacked() { - moves_ = ATTACKED; + moves_ = ATTACKED; set_hold_position(false); } @@ -368,7 +368,7 @@ void unit::set_resting(bool resting) { - resting_ = resting; + resting_ = resting; } bool unit::is_resting() const @@ -437,8 +437,8 @@ return std::count(terrain.begin(), terrain.end(), static_cast<gamemap::TERRAIN>(type)) != 0; } -bool unit::invisible(const std::string& terrain, int lawful_bonus, - const gamemap::location& loc, +bool unit::invisible(const std::string& terrain, int lawful_bonus, + const gamemap::location& loc, const unit_map& units,const std::vector<team>& teams) const { bool is_inv = false; @@ -458,7 +458,7 @@ if(is_inv){ for(unit_map::const_iterator u = units.begin(); u != units.end(); ++u) { if(teams[side_-1].is_enemy(u->second.side())) { - if(tiles_adjacent(loc,u->first)) + if(tiles_adjacent(loc,u->first)) return false; } } @@ -821,7 +821,7 @@ sprintf(buf,"%d",moves_); cfg["moves"] = buf; - cfg["resting"] = resting_ ? "yes" : "no"; + cfg["resting"] = resting_ ? "yes" : "no"; cfg["unrenamable"] = unrenamable_ ? "yes" : "no"; } @@ -915,7 +915,7 @@ { state_ = range == attack_type::LONG_RANGE ? STATE_DEFENDING_LONG : STATE_DEFENDING_SHORT; getsHit_ = hits; - + const unit_animation* const anim = get_animation(); if(anim != NULL) { anim_ = *anim; @@ -1061,7 +1061,7 @@ } else { description += t_string(N_("; "), "wesnoth"); } - + description += t_string(a->name(), "wesnoth") + " " + desc; } } @@ -1112,7 +1112,7 @@ const std::string& set_to = (**i.first)["set"]; if(increase.empty() == false) { - description += (increase[0] != '-' ? "+" : "") + increase + + description += (increase[0] != '-' ? "+" : "") + increase + " " + t_string(N_("Moves"), "wesnoth"); if(increase[increase.size()-1] == '%') { @@ -1161,7 +1161,7 @@ if(add.empty() == false) { set_flag(add); } - + if(remove.empty() == false) { remove_flag(remove); } @@ -1182,7 +1182,7 @@ if(effects_description.empty() == false) { description += t_string(N_("("), "wesnoth"); - for(std::vector<t_string>::const_iterator i = effects_description.begin(); + for(std::vector<t_string>::const_iterator i = effects_description.begin(); i != effects_description.end(); ++i) { description += *i; if(i+1 != effects_description.end()) @@ -1329,8 +1329,8 @@ } unit_map::iterator find_visible_unit(unit_map& units, - const gamemap::location loc, - const gamemap& map, int lawful_bonus, + const gamemap::location loc, + const gamemap& map, int lawful_bonus, const std::vector<team>& teams, const team& current_team) { unit_map::iterator u = units.find(loc); @@ -1348,8 +1348,8 @@ } unit_map::const_iterator find_visible_unit(const unit_map& units, - const gamemap::location loc, - const gamemap& map, int lawful_bonus, + const gamemap::location loc, + const gamemap& map, int lawful_bonus, const std::vector<team>& teams, const team& current_team) { unit_map::const_iterator u = units.find(loc); Index: wesnoth/src/unit.hpp diff -u wesnoth/src/unit.hpp:1.69 wesnoth/src/unit.hpp:1.70 --- wesnoth/src/unit.hpp:1.69 Wed May 18 14:06:30 2005 +++ wesnoth/src/unit.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: unit.hpp,v 1.69 2005/05/18 14:06:30 darthfool Exp $ */ +/* $Id: unit.hpp,v 1.70 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -83,7 +83,7 @@ void heal(int amount); void heal_all(); - bool invisible(const std::string& terrain, int lawful_bonus, + bool invisible(const std::string& terrain, int lawful_bonus, const gamemap::location& loc, const unit_map& units,const std::vector<team>& teams) const; bool poisoned() const; @@ -182,7 +182,7 @@ int side_; - //is set to the number of moves left, ATTACKED if attacked, + //is set to the number of moves left, ATTACKED if attacked, // MOVED if moved and then pressed "end turn" // NOT_MOVED if not moved and pressed "end turn" enum MOVES { ATTACKED=-1, MOVED=-2, NOT_MOVED=-3 }; @@ -267,11 +267,11 @@ std::string team_name(int side, const unit_map& units); unit_map::iterator find_visible_unit(unit_map& units, const gamemap::location loc, - const gamemap& map, int lawful_bonus, + const gamemap& map, int lawful_bonus, const std::vector<team>& teams, const team& current_team); unit_map::const_iterator find_visible_unit(const unit_map& units, const gamemap::location loc, - const gamemap& map, int lawful_bonus, + const gamemap& map, int lawful_bonus, const std::vector<team>& teams, const team& current_team); struct team_data Index: wesnoth/src/unit_display.cpp diff -u wesnoth/src/unit_display.cpp:1.59 wesnoth/src/unit_display.cpp:1.60 --- wesnoth/src/unit_display.cpp:1.59 Wed May 18 23:08:13 2005 +++ wesnoth/src/unit_display.cpp Sat Jun 4 19:16:06 2005 @@ -86,7 +86,7 @@ if(halo.empty() == false && !disp.fogged(b.x,b.y)) { halo_effect.assign(halo::add(0,0,halo)); } - + const unit_animation *teleport_animation_p = u.type().teleport_animation(); bool teleport_unit = teleport_animation_p && !tiles_adjacent(a, b); if (teleport_unit && !disp.fogged(a.x, a.y)) { // teleport @@ -291,7 +291,7 @@ while(!anim.animation_finished()) { const unit_animation::frame& frame = anim.get_current_frame(); - + const surface surf(image::get_image(frame.image)); if(surf.get() != NULL) { unit_image = surf; @@ -326,7 +326,7 @@ } namespace { - + bool unit_attack_ranged(display& disp, unit_map& units, const gamemap::location& a, const gamemap::location& b, int damage, const attack_type& attack) @@ -393,7 +393,7 @@ const std::string* missile_halo_image = NULL; const std::string* unit_halo_image = NULL; int missile_halo_x = -1, missile_halo_y = -1, unit_halo_x = -1, unit_halo_y = -1; - + attack_anim.start_animation(begin_at, unit_animation::UNIT_FRAME, acceleration); attack_anim.start_animation(begin_at + first_missile, unit_animation::MISSILE_FRAME, acceleration); @@ -431,10 +431,10 @@ new_halo_x *= -1; } - if(unit_halo_image != &unit_frame.halo || + if(unit_halo_image != &unit_frame.halo || unit_halo_x != new_halo_x || unit_halo_y != new_halo_y) { - + unit_halo_image = &unit_frame.halo; unit_halo_x = new_halo_x; unit_halo_y = new_halo_y; @@ -820,7 +820,7 @@ halo_x = new_halo_x; halo_y = new_halo_y; - if(!unit_frame.halo.empty() && + if(!unit_frame.halo.empty() && (!disp.fogged(b.x,b.y) || !disp.fogged(a.x,a.y))) { halo_effect.assign(halo::add(halo_xpos,halo_ypos,*halo_image)); } else { Index: wesnoth/src/unit_types.cpp diff -u wesnoth/src/unit_types.cpp:1.103 wesnoth/src/unit_types.cpp:1.104 --- wesnoth/src/unit_types.cpp:1.103 Fri May 27 17:24:12 2005 +++ wesnoth/src/unit_types.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: unit_types.cpp,v 1.103 2005/05/27 17:24:12 darthfool Exp $ */ +/* $Id: unit_types.cpp,v 1.104 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -27,7 +27,7 @@ unit_animation::frame::frame(const config& cfg) { - xoffset = atoi(cfg["xoffset"].c_str()); + xoffset = atoi(cfg["xoffset"].c_str()); image = cfg["image"]; image_diagonal = cfg["image_diagonal"]; halo = cfg["halo"]; @@ -38,10 +38,10 @@ unit_animation::unit_animation() {} -unit_animation::unit_animation(const config& cfg) +unit_animation::unit_animation(const config& cfg) { config::const_child_itors range = cfg.child_range("frame"); - + int last_end = INT_MIN; for(; range.first != range.second; ++range.first) { unit_frames_.add_frame(atoi((**range.first)["begin"].c_str()), frame(**range.first)); @@ -294,7 +294,7 @@ if(increase_damage.empty() == false) { int increase = 0; - + if(increase_damage[increase_damage.size()-1] == '%') { const std::string inc(increase_damage.begin(),increase_damage.end()-1); increase = div100(damage_ * atoi(inc.c_str())); @@ -314,7 +314,7 @@ if(increase_attacks.empty() == false) { int increase = 0; - + if(increase_attacks[increase_attacks.size()-1] == '%') { const std::string inc(increase_attacks.begin(),increase_attacks.end()-1); increase = div100(num_attacks_ * atoi(inc.c_str())); @@ -629,7 +629,7 @@ teleport_ = has_ability("teleport"); nightvision_ = has_ability("night vision"); steadfast_ = has_ability("steadfast"); - + const std::string& align = cfg_["alignment"]; if(align == "lawful") alignment_ = LAWFUL; @@ -706,7 +706,7 @@ } } -int unit_type::num_traits() const { +int unit_type::num_traits() const { return (cfg_["num_traits"].size() ? atoi(cfg_["num_traits"].c_str()) : race_->num_traits()); } @@ -1163,7 +1163,7 @@ if(to_unit.gender_types_[gender] == NULL) { lg::warn(lg::config) << to_id << " does not support gender " << gender << "\n"; continue; - } + } lg::info(lg::config) << "gendered advancement " << gender << ": "; gender_types_[gender]->add_advancement(*(to_unit.gender_types_[gender]),xp); } @@ -1172,7 +1172,7 @@ // since these are still a rare and special-purpose feature, // we assume that the unit designer knows what they're doing, // and don't block advancements that would remove a variation - for(variations_map::iterator v=variations_.begin(); + for(variations_map::iterator v=variations_.begin(); v!=variations_.end(); ++v) { lg::info(lg::config) << "variation advancement: "; v->second->add_advancement(to_unit,xp); @@ -1190,7 +1190,7 @@ void game_data::set_config(const config& cfg) { static const std::vector<config*> dummy_traits; - + const config::child_list& unit_traits = cfg.get_children("trait"); for(config::const_child_itors i = cfg.child_range("movetype"); @@ -1221,7 +1221,7 @@ const std::string &to = (**k.first)["id"]; const std::string &from = (**af.first)["unit"]; const int xp = lexical_cast_default<int>((**af.first)["experience"],0); - + unit_type_map::iterator from_unit = unit_types.find(from); unit_type_map::iterator to_unit = unit_types.find(to); if(from_unit==unit_types.end()) { @@ -1229,7 +1229,7 @@ continue; } wassert(to_unit!=unit_types.end()); - + from_unit->second.add_advancement(to_unit->second,xp); } Index: wesnoth/src/unit_types.hpp diff -u wesnoth/src/unit_types.hpp:1.69 wesnoth/src/unit_types.hpp:1.70 --- wesnoth/src/unit_types.hpp:1.69 Fri May 27 17:24:12 2005 +++ wesnoth/src/unit_types.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: unit_types.hpp,v 1.69 2005/05/27 17:24:12 darthfool Exp $ */ +/* $Id: unit_types.hpp,v 1.70 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/util.hpp diff -u wesnoth/src/util.hpp:1.24 wesnoth/src/util.hpp:1.25 --- wesnoth/src/util.hpp:1.24 Mon May 16 22:44:20 2005 +++ wesnoth/src/util.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: util.hpp,v 1.24 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: util.hpp,v 1.25 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -52,7 +52,7 @@ { To res; std::stringstream str; - + if(!(str << a && str >> res)) { throw bad_lexical_cast(); } else { @@ -65,7 +65,7 @@ { To res; std::stringstream str; - + if(!(str << a && str >> res)) { return def; } else { Index: wesnoth/src/variable.cpp diff -u wesnoth/src/variable.cpp:1.3 wesnoth/src/variable.cpp:1.4 --- wesnoth/src/variable.cpp:1.3 Mon May 16 22:44:20 2005 +++ wesnoth/src/variable.cpp Sat Jun 4 19:16:06 2005 @@ -1,9 +1,9 @@ -/* $Id: variable.cpp,v 1.3 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: variable.cpp,v 1.4 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> - - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -63,7 +63,7 @@ { config res; - for(string_map::const_iterator itor = cfg_->values.begin(); + for(string_map::const_iterator itor = cfg_->values.begin(); itor != cfg_->values.end(); ++itor) { res[itor->first] = expand(itor->first); @@ -113,7 +113,7 @@ namespace variable { - manager::manager(game_state* repository) + manager::manager(game_state* repository) { repos = repository; } Index: wesnoth/src/variable.hpp diff -u wesnoth/src/variable.hpp:1.5 wesnoth/src/variable.hpp:1.6 --- wesnoth/src/variable.hpp:1.5 Tue May 10 22:15:57 2005 +++ wesnoth/src/variable.hpp Sat Jun 4 19:16:06 2005 @@ -1,9 +1,9 @@ -/* $Id: variable.hpp,v 1.5 2005/05/10 22:15:57 Sirp Exp $ */ +/* $Id: variable.hpp,v 1.6 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Copyright (C) 2005 by Philippe Plantier <[EMAIL PROTECTED]> - - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -26,12 +26,12 @@ * A variable-expanding proxy for the config class. This class roughly behaves * as a constant config object, but automatically expands variables. */ -class vconfig +class vconfig { public: vconfig(); vconfig(const config* cfg); - + vconfig& operator=(const vconfig cfg); vconfig& operator=(const config* cfg); @@ -46,7 +46,7 @@ const t_string& operator[](const std::string&) const; const t_string& expand(const std::string&) const; /** < Synonym for operator[] */ const t_string& get_attribute(const std::string&) const; - + private: const config* cfg_; }; Index: wesnoth/src/video.cpp diff -u wesnoth/src/video.cpp:1.66 wesnoth/src/video.cpp:1.67 --- wesnoth/src/video.cpp:1.66 Fri Jun 3 05:28:48 2005 +++ wesnoth/src/video.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: video.cpp,v 1.66 2005/06/03 05:28:48 silene Exp $ */ +/* $Id: video.cpp,v 1.67 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -236,7 +236,7 @@ { const surface target(getSurface()); SDL_Rect dst = {x,y,0,0}; - + if(clip_rect != NULL) { const clip_rect_setter clip_setter(target,*clip_rect); SDL_BlitSurface(surf,srcrect,target,&dst); @@ -333,17 +333,17 @@ if(update_all) { ::SDL_Flip(frameBuffer); - } else if(update_rects.empty() == false) { - size_t sum = 0; - for(size_t n = 0; n != update_rects.size(); ++n) { - sum += update_rects[n].w*update_rects[n].h; - } - - const size_t redraw_whole_screen_threshold = 80; - if(sum > ((getx()*gety())*redraw_whole_screen_threshold)/100) { - ::SDL_Flip(frameBuffer); + } else if(update_rects.empty() == false) { + size_t sum = 0; + for(size_t n = 0; n != update_rects.size(); ++n) { + sum += update_rects[n].w*update_rects[n].h; + } + + const size_t redraw_whole_screen_threshold = 80; + if(sum > ((getx()*gety())*redraw_whole_screen_threshold)/100) { + ::SDL_Flip(frameBuffer); } else { - SDL_UpdateRects(frameBuffer,update_rects.size(),&update_rects[0]); + SDL_UpdateRects(frameBuffer,update_rects.size(),&update_rects[0]); } } Index: wesnoth/src/video.hpp diff -u wesnoth/src/video.hpp:1.35 wesnoth/src/video.hpp:1.36 --- wesnoth/src/video.hpp:1.35 Wed Apr 13 18:47:20 2005 +++ wesnoth/src/video.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: video.hpp,v 1.35 2005/04/13 18:47:20 gruikya Exp $ */ +/* $Id: video.hpp,v 1.36 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/wassert.cpp diff -u wesnoth/src/wassert.cpp:1.3 wesnoth/src/wassert.cpp:1.4 --- wesnoth/src/wassert.cpp:1.3 Sat Mar 26 17:10:32 2005 +++ wesnoth/src/wassert.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* Copyright (C) 2005 by Isaac Clerencia <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/wassert.hpp diff -u wesnoth/src/wassert.hpp:1.3 wesnoth/src/wassert.hpp:1.4 --- wesnoth/src/wassert.hpp:1.3 Sat Jan 8 21:06:34 2005 +++ wesnoth/src/wassert.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* Copyright (C) 2005 by Isaac Clerencia <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/button.cpp diff -u wesnoth/src/widgets/button.cpp:1.66 wesnoth/src/widgets/button.cpp:1.67 --- wesnoth/src/widgets/button.cpp:1.66 Sun May 29 20:52:40 2005 +++ wesnoth/src/widgets/button.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: button.cpp,v 1.66 2005/05/29 20:52:40 silene Exp $ */ +/* $Id: button.cpp,v 1.67 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -154,7 +154,7 @@ { surface image = image_; const int image_w = image_->w; - + int offset = 0; switch(state_) { case ACTIVE: @@ -181,7 +181,7 @@ textx = loc.x + image->w / 2 - textRect_.w / 2 + offset; else textx = loc.x + image_w + checkbox_horizontal_padding / 2; - + SDL_Color button_colour = font::BUTTON_COLOUR; if (!enabled_) { Index: wesnoth/src/widgets/button.hpp diff -u wesnoth/src/widgets/button.hpp:1.32 wesnoth/src/widgets/button.hpp:1.33 --- wesnoth/src/widgets/button.hpp:1.32 Mon May 16 22:44:20 2005 +++ wesnoth/src/widgets/button.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: button.hpp,v 1.32 2005/05/16 22:44:20 ydirson Exp $ */ +/* $Id: button.hpp,v 1.33 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/combo.cpp diff -u wesnoth/src/widgets/combo.cpp:1.29 wesnoth/src/widgets/combo.cpp:1.30 --- wesnoth/src/widgets/combo.cpp:1.29 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/combo.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: combo.cpp,v 1.29 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: combo.cpp,v 1.30 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/combo.hpp diff -u wesnoth/src/widgets/combo.hpp:1.22 wesnoth/src/widgets/combo.hpp:1.23 --- wesnoth/src/widgets/combo.hpp:1.22 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/combo.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: combo.hpp,v 1.22 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: combo.hpp,v 1.23 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/file_chooser.cpp diff -u wesnoth/src/widgets/file_chooser.cpp:1.28 wesnoth/src/widgets/file_chooser.cpp:1.29 --- wesnoth/src/widgets/file_chooser.cpp:1.28 Tue May 3 22:24:52 2005 +++ wesnoth/src/widgets/file_chooser.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -33,7 +33,7 @@ namespace gui { -file_chooser::file_chooser(display &disp, std::string start_file) +file_chooser::file_chooser(display &disp, std::string start_file) : widget(disp.video()), delete_button_(disp.video(), _("Delete File")), path_delim_('/'), current_dir_(get_path(start_file)), chosen_file_(start_file), file_list_(disp.video(), files_in_current_dir_, false), @@ -100,12 +100,12 @@ CKey key; int mousex, mousey; SDL_GetMouseState(&mousex,&mousey); - + // The menu does not implement focus functionality, so we fake // it. We give the file list focus whenever the filename textbox // does not have focus. Inflexible but easy solution. SDL_Rect const &loc = location(); - if (!(mousex > loc.x && (unsigned)mousex < loc.x + loc.w && mousey > loc.y + if (!(mousex > loc.x && (unsigned)mousex < loc.x + loc.w && mousey > loc.y && (unsigned)mousey < loc.y + loc.h - filename_textbox_.height())) { // Hmm, as I understand it this should happen automatically when // the mouse is in the textbox again. However this is not the @@ -206,7 +206,7 @@ } return chosen_file_; } - + bool file_chooser::choice_made() const { return choice_made_; Index: wesnoth/src/widgets/file_chooser.hpp diff -u wesnoth/src/widgets/file_chooser.hpp:1.12 wesnoth/src/widgets/file_chooser.hpp:1.13 --- wesnoth/src/widgets/file_chooser.hpp:1.12 Wed Mar 23 08:52:10 2005 +++ wesnoth/src/widgets/file_chooser.hpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -73,7 +73,7 @@ /// Updated the locally maintained lists of files and directories in /// the current directory. void update_file_lists(); - + /// Set the textbox to reflect the selected file. void entry_selected(const unsigned entry); Index: wesnoth/src/widgets/label.cpp diff -u wesnoth/src/widgets/label.cpp:1.9 wesnoth/src/widgets/label.cpp:1.10 --- wesnoth/src/widgets/label.cpp:1.9 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/label.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: label.cpp,v 1.9 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: label.cpp,v 1.10 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -48,7 +48,7 @@ return size_; } -int label::get_size() const +int label::get_size() const { return size_; } Index: wesnoth/src/widgets/label.hpp diff -u wesnoth/src/widgets/label.hpp:1.4 wesnoth/src/widgets/label.hpp:1.5 --- wesnoth/src/widgets/label.hpp:1.4 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/label.hpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: label.hpp,v 1.4 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: label.hpp,v 1.5 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -23,7 +23,7 @@ class label : public widget { public: - label(CVideo& video, const std::string& text, int size=font::SIZE_NORMAL, + label(CVideo& video, const std::string& text, int size=font::SIZE_NORMAL, const SDL_Color& colour=font::NORMAL_COLOUR); const std::string& set_text(const std::string& text); const std::string& get_text() const; Index: wesnoth/src/widgets/menu.cpp diff -u wesnoth/src/widgets/menu.cpp:1.94 wesnoth/src/widgets/menu.cpp:1.95 --- wesnoth/src/widgets/menu.cpp:1.94 Sat Jun 4 03:39:22 2005 +++ wesnoth/src/widgets/menu.cpp Sat Jun 4 19:16:06 2005 @@ -394,8 +394,8 @@ } void menu::set_max_height(const int new_max_height) { - max_height_ = new_max_height; - itemRects_.clear(); + max_height_ = new_max_height; + itemRects_.clear(); max_items_ = -1; } @@ -560,7 +560,7 @@ sort_by(heading); } } - } else if(event.type == SDL_MOUSEMOTION) { + } else if(event.type == SDL_MOUSEMOTION) { if(click_selects_) { const int item = hit(event.motion.x,event.motion.y); if (item != -1) @@ -752,7 +752,7 @@ xpos += img->w + 5; } } else { - const std::string to_show = max_width_ > -1 ? + const std::string to_show = max_width_ > -1 ? font::make_text_ellipsis(str, menu_font_size, loc.w - (xpos - rect.x)) : str; const SDL_Rect& text_size = font::text_area(str,menu_font_size); const size_t y = rect.y + (rect.h - text_size.h)/2; @@ -791,7 +791,7 @@ if(hidden()) { return; } - + if(!dirty()) { for(std::set<int>::const_iterator i = invalid_.begin(); i != invalid_.end(); ++i) { Index: wesnoth/src/widgets/menu.hpp diff -u wesnoth/src/widgets/menu.hpp:1.38 wesnoth/src/widgets/menu.hpp:1.39 --- wesnoth/src/widgets/menu.hpp:1.38 Mon May 16 22:44:21 2005 +++ wesnoth/src/widgets/menu.hpp Sat Jun 4 19:16:06 2005 @@ -94,7 +94,7 @@ void set_max_width(const int new_max_width); size_t nitems() const { return items_.size(); } - + int process(); bool double_clicked(); Index: wesnoth/src/widgets/scrollbar.cpp diff -u wesnoth/src/widgets/scrollbar.cpp:1.32 wesnoth/src/widgets/scrollbar.cpp:1.33 --- wesnoth/src/widgets/scrollbar.cpp:1.32 Fri Apr 22 22:47:25 2005 +++ wesnoth/src/widgets/scrollbar.cpp Sat Jun 4 19:16:06 2005 @@ -1,6 +1,6 @@ -/* $Id: scrollbar.cpp,v 1.32 2005/04/22 22:47:25 silene Exp $*/ +/* $Id: scrollbar.cpp,v 1.33 2005/06/04 19:16:06 ott Exp $*/ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> 2004 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -29,7 +29,7 @@ const std::string scrollbar_top_hl = "buttons/scrolltop-active.png"; const std::string scrollbar_bottom_hl = "buttons/scrollbottom-active.png"; const std::string scrollbar_mid_hl = "buttons/scrollmid-active.png"; - + const std::string groove_top = "buttons/scrollgroove-top.png"; const std::string groove_mid = "buttons/scrollgroove-mid.png"; const std::string groove_bottom = "buttons/scrollgroove-bottom.png"; @@ -46,7 +46,7 @@ grip_position_(0), grip_height_(0), full_height_(0), scroll_rate_(1) { static const surface img(image::get_image(scrollbar_mid, image::UNSCALED)); - + if (img != NULL) { set_width(img->w); // this is a bit rough maybe @@ -185,9 +185,9 @@ void scrollbar::draw_contents() { - const surface mid_img(image::get_image(state_ != NORMAL ? + const surface mid_img(image::get_image(state_ != NORMAL ? scrollbar_mid_hl : scrollbar_mid, image::UNSCALED)); - const surface bottom_img(image::get_image(state_ != NORMAL ? + const surface bottom_img(image::get_image(state_ != NORMAL ? scrollbar_bottom_hl : scrollbar_bottom, image::UNSCALED)); const surface top_img(image::get_image(state_ != NORMAL ? scrollbar_top_hl : scrollbar_top, image::UNSCALED)); Index: wesnoth/src/widgets/scrollpane.cpp diff -u wesnoth/src/widgets/scrollpane.cpp:1.8 wesnoth/src/widgets/scrollpane.cpp:1.9 --- wesnoth/src/widgets/scrollpane.cpp:1.8 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/scrollpane.cpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollpane.cpp,v 1.8 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: scrollpane.cpp,v 1.9 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -22,7 +22,7 @@ public: widget_finder(gui::widget* w) : w_(w) {}; - bool operator()(const std::pair<int, gui::scrollpane::scrollpane_widget>& p) + bool operator()(const std::pair<int, gui::scrollpane::scrollpane_widget>& p) { if(p.second.w == w_) return true; @@ -117,7 +117,7 @@ void scrollpane::update_widget_positions() { - widget_map::iterator itor; + widget_map::iterator itor; std::vector<bool> hidden(content_.size()); int i = 0; for(itor = content_.begin(); itor != content_.end(); ++itor) { Index: wesnoth/src/widgets/scrollpane.hpp diff -u wesnoth/src/widgets/scrollpane.hpp:1.8 wesnoth/src/widgets/scrollpane.hpp:1.9 --- wesnoth/src/widgets/scrollpane.hpp:1.8 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/scrollpane.hpp Sat Jun 4 19:16:06 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollpane.hpp,v 1.8 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: scrollpane.hpp,v 1.9 2005/06/04 19:16:06 ott Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -27,7 +27,7 @@ { public: struct scrollpane_widget { - scrollpane_widget(widget* w, int x=0, int y=0, int z_order=0) + scrollpane_widget(widget* w, int x=0, int y=0, int z_order=0) : w(w), x(x), y(y), z_order(z_order) {}; widget* w; Index: wesnoth/src/widgets/slider.cpp diff -u wesnoth/src/widgets/slider.cpp:1.40 wesnoth/src/widgets/slider.cpp:1.41 --- wesnoth/src/widgets/slider.cpp:1.40 Sat May 7 21:53:43 2005 +++ wesnoth/src/widgets/slider.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: slider.cpp,v 1.40 2005/05/07 21:53:43 ettin Exp $ */ +/* $Id: slider.cpp,v 1.41 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -30,7 +30,7 @@ slider::slider(CVideo &video) : widget(video), image_(image::get_image(slider_image, image::UNSCALED)), highlightedImage_(image::get_image(selected_image, image::UNSCALED)), - min_(-100000), max_(100000), value_(0), + min_(-100000), max_(100000), value_(0), increment_(1), state_(NORMAL) { } Index: wesnoth/src/widgets/slider.hpp diff -u wesnoth/src/widgets/slider.hpp:1.25 wesnoth/src/widgets/slider.hpp:1.26 --- wesnoth/src/widgets/slider.hpp:1.25 Mon May 16 22:44:21 2005 +++ wesnoth/src/widgets/slider.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: slider.hpp,v 1.25 2005/05/16 22:44:21 ydirson Exp $ */ +/* $Id: slider.hpp,v 1.26 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/textbox.cpp diff -u wesnoth/src/widgets/textbox.cpp:1.81 wesnoth/src/widgets/textbox.cpp:1.82 --- wesnoth/src/widgets/textbox.cpp:1.81 Thu Jun 2 20:50:26 2005 +++ wesnoth/src/widgets/textbox.cpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: textbox.cpp,v 1.81 2005/06/02 20:50:26 isaaccp Exp $ */ +/* $Id: textbox.cpp,v 1.82 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -132,7 +132,7 @@ surface surf = video().getSurface(); draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0, focus() ? alpha_focus_ : alpha_, surf); - + SDL_Rect src; if(text_image_ == NULL) { @@ -250,16 +250,16 @@ } char_x_.push_back(0); - + // Re-calculate the position of each glyph. We approximate this by asking the // width of each substring, but this is a flawed assumption which won't work with // some more complex scripts (that is, RTL languages). This part of the work should // actually be done by the font-rendering system. std::string visible_string; wide_string wrapped_text; - + wide_string::const_iterator backup_itor = text.end(); - + wide_string::const_iterator itor = text.begin(); while(itor != text.end()) { //If this is a space, save copies of the current state so we can roll back @@ -299,7 +299,7 @@ } const std::string s = utils::wstring_to_string(wrapped_text); - const surface res(font::get_rendered_text(s, font_size, font::NORMAL_COLOUR)); + const surface res(font::get_rendered_text(s, font_size, font::NORMAL_COLOUR)); return res; } @@ -329,7 +329,7 @@ } } -bool textbox::is_selection() +bool textbox::is_selection() { return (selstart_ != -1) && (selend_ != -1) && (selstart_ != selend_); } @@ -338,7 +338,7 @@ { if(!is_selection()) return; - + wide_string::iterator itor = text_.begin() + minimum(selstart_, selend_); text_.erase(itor, itor + abs(selend_ - selstart_)); cursor_ = minimum(selstart_, selend_); @@ -394,7 +394,7 @@ if(grabmouse_) selend_ = cursor_; - + update_text_cache(false); if(!grabmouse_ && mousebuttons & SDL_BUTTON(1)) { @@ -416,7 +416,7 @@ if(focus() == false) { if (event.type == SDL_MOUSEMOTION && point_in_rect(mousex, mousey, loc)) events::focus_handler(this); - + return; } @@ -427,11 +427,11 @@ const SDL_keysym& key = reinterpret_cast<const SDL_KeyboardEvent&>(event).keysym; const SDLMod modifiers = SDL_GetModState(); - + const int c = key.sym; const int old_cursor = cursor_; - - if(c == SDLK_LEFT && cursor_ > 0) + + if(c == SDLK_LEFT && cursor_ > 0) --cursor_; if(c == SDLK_RIGHT && cursor_ < text_.size()) @@ -439,16 +439,16 @@ if(c == SDLK_END || (c == SDLK_e && (modifiers & KMOD_CTRL))) cursor_ = text_.size(); - + if(c == SDLK_HOME || (c == SDLK_a && (modifiers & KMOD_CTRL))) cursor_ = 0; if((old_cursor != cursor_) && (modifiers & KMOD_SHIFT)) { - if(selstart_ == -1) + if(selstart_ == -1) selstart_ = old_cursor; selend_ = cursor_; - } - + } + if(c == SDLK_BACKSPACE) { changed = true; if(is_selection()) { @@ -487,7 +487,7 @@ c == SDLK_PAGEUP || c == SDLK_PAGEDOWN)) { if(character != 0) LOG_STREAM(info, display) << "Char: " << character << ", c = " << c << "\n"; - + if(event.key.keysym.mod & KMOD_CTRL) { switch(c) { case SDLK_v: @@ -523,18 +523,18 @@ wide_string ws = wide_string(text_.begin() + beg, text_.begin() + end); std::string s = utils::wstring_to_string(ws); copy_to_clipboard(s); - } + } break; } } else { if(character >= 32 && character != 127) { changed = true; - if(is_selection()) + if(is_selection()) erase_selection(); if(text_.size() + 1 <= max_size_) { text_.insert(text_.begin()+cursor_,character); - ++cursor_; + ++cursor_; } } } Index: wesnoth/src/widgets/textbox.hpp diff -u wesnoth/src/widgets/textbox.hpp:1.44 wesnoth/src/widgets/textbox.hpp:1.45 --- wesnoth/src/widgets/textbox.hpp:1.44 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/widgets/textbox.hpp Sat Jun 4 19:16:06 2005 @@ -1,7 +1,7 @@ -/* $Id: textbox.hpp,v 1.44 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: textbox.hpp,v 1.45 2005/06/04 19:16:06 ott Exp $ */ /* - Copyright (C) 2003 by David White <[EMAIL PROTECTED]> - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net + Copyright (C) 2003 by David White <[EMAIL PROTECTED]> + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Index: wesnoth/src/widgets/widget.hpp diff -u wesnoth/src/widgets/widget.hpp:1.28 wesnoth/src/widgets/widget.hpp:1.29 --- wesnoth/src/widgets/widget.hpp:1.28 Mon May 16 22:44:21 2005 +++ wesnoth/src/widgets/widget.hpp Sat Jun 4 19:16:06 2005 @@ -33,7 +33,7 @@ bool hidden() const; void set_clip_rect(const SDL_Rect& rect); - + //Function to set the widget to draw in 'volatile' mode. //When in 'volatile' mode, instead of using the normal //save-background-redraw-when-dirty procedure, redrawing is done Index: wesnoth/src/zipios++/xcoll.cpp diff -u wesnoth/src/zipios++/xcoll.cpp:1.2 wesnoth/src/zipios++/xcoll.cpp:1.3 --- wesnoth/src/zipios++/xcoll.cpp:1.2 Sat Jan 8 13:57:23 2005 +++ wesnoth/src/zipios++/xcoll.cpp Sat Jun 4 19:16:06 2005 @@ -19,7 +19,7 @@ return false; } -void xzipios::XCColl::childrenOf(std::string path, +void xzipios::XCColl::childrenOf(std::string path, std::vector<std::string>* files, std::vector<std::string>* dirs) const { // be sure the dirname ends with a slash Index: wesnoth/src/zipios++/xcoll.hpp diff -u wesnoth/src/zipios++/xcoll.hpp:1.2 wesnoth/src/zipios++/xcoll.hpp:1.3 --- wesnoth/src/zipios++/xcoll.hpp:1.2 Thu Mar 10 13:46:22 2005 +++ wesnoth/src/zipios++/xcoll.hpp Sat Jun 4 19:16:06 2005 @@ -10,7 +10,7 @@ public: // explicit XCColl bool hasSubdir(const std::string) const ; - void childrenOf(std::string path, + void childrenOf(std::string path, std::vector<std::string>* files, std::vector<std::string>* dirs) const; };