[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src Makefile.am config.cpp config.hpp f...
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src Makefile.am config.cpp config.hpp f... |
Date: |
Sat, 05 Mar 2005 05:54:26 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/03/05 10:54:25
Modified files:
src : Makefile.am config.cpp config.hpp font.cpp
game.cpp gamestatus.cpp help.cpp language.cpp
mapgen.cpp multiplayer.cpp multiplayer_wait.cpp
network.cpp playturn.cpp preferences.cpp
publish_campaign.cpp replay.cpp team.cpp
titlescreen.cpp
src/campaign_server: campaign_server.cpp
src/editor : editor.cpp editor_dialogs.cpp editor_main.cpp
src/serialization: preprocessor.cpp preprocessor.hpp
src/server : game.cpp server.cpp
src/tools : exploder_cutter.cpp
Added files:
src/serialization: binary_or_text.cpp binary_wml.cpp
binary_wml.hpp parser.cpp parser.hpp
Log message:
Split text and binary parsers from config.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/Makefile.am.diff?tr1=1.76&tr2=1.77&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.129&tr2=1.130&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.115&tr2=1.116&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.202&tr2=1.203&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gamestatus.cpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.70&tr2=1.71&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/language.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.144&tr2=1.145&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.cpp.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.336&tr2=1.337&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.136&tr2=1.137&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/publish_campaign.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.cpp.diff?tr1=1.80&tr2=1.81&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/campaign_server/campaign_server.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.94&tr2=1.95&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_main.cpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_or_text.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_wml.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/binary_wml.hpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/parser.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/parser.hpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/preprocessor.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/game.cpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/server.cpp.diff?tr1=1.70&tr2=1.71&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_cutter.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: wesnoth/src/Makefile.am
diff -u wesnoth/src/Makefile.am:1.76 wesnoth/src/Makefile.am:1.77
--- wesnoth/src/Makefile.am:1.76 Fri Mar 4 19:39:59 2005
+++ wesnoth/src/Makefile.am Sat Mar 5 10:54:25 2005
@@ -32,336 +32,348 @@
# Wesnoth #
#############################################################################
-wesnoth_SOURCES = about.cpp \
- actions.cpp \
- ai.cpp \
- ai_attack.cpp \
- ai_move.cpp \
- animated.cpp \
- astarnode.cpp \
- builder.cpp \
- cavegen.cpp \
- clipboard.cpp \
- config.cpp \
- cursor.cpp \
- dialogs.cpp \
- display.cpp \
- events.cpp \
- filesystem.cpp \
- font.cpp \
- game.cpp \
- game_config.cpp \
- game_events.cpp \
- gamestatus.cpp \
- gettext.cpp \
- halo.cpp \
- help.cpp \
- hotkeys.cpp \
- image.cpp \
- intro.cpp \
- key.cpp \
- language.cpp \
- leader_list.cpp \
- log.cpp \
- map.cpp \
- map_label.cpp \
- mapgen.cpp \
- mapgen_dialog.cpp \
- mouse.cpp \
- multiplayer.cpp \
- multiplayer_ui.cpp \
- multiplayer_wait.cpp \
- multiplayer_connect.cpp \
- multiplayer_create.cpp \
- multiplayer_lobby.cpp \
- network.cpp \
- network_worker.cpp \
- pathfind.cpp \
- pathutils.cpp \
- playlevel.cpp \
- playturn.cpp \
- preferences.cpp \
- publish_campaign.cpp \
- race.cpp \
- replay.cpp \
- reports.cpp \
- sdl_utils.cpp \
- show_dialog.cpp \
- sound.cpp \
- statistics.cpp \
- team.cpp \
- terrain.cpp \
- theme.cpp \
- thread.cpp \
- titlescreen.cpp \
- tooltips.cpp \
- unit.cpp \
- unit_display.cpp \
- unit_types.cpp \
- video.cpp \
- wassert.cpp \
- serialization/preprocessor.cpp \
- serialization/string_utils.cpp \
- widgets/button.cpp \
- widgets/combo.cpp \
- widgets/label.cpp \
- widgets/menu.cpp \
- widgets/progressbar.cpp \
- widgets/scrollarea.cpp \
- widgets/scrollbar.cpp \
- widgets/scrollpane.cpp \
- widgets/slider.cpp \
- widgets/textbox.cpp \
- widgets/widget.cpp \
- zipios++/xcoll.cpp \
- sdl_ttf/SDL_ttf.c \
- about.hpp \
- actions.hpp \
- ai.hpp \
- ai2.hpp \
- ai_attack.hpp \
- ai_interface.hpp \
- ai_move.hpp \
- animated.hpp \
- array.hpp \
- astarnode.hpp \
- builder.hpp \
- cavegen.hpp \
- clipboard.hpp \
- cursor.hpp \
- config.hpp \
- dialogs.hpp \
- display.hpp \
- events.hpp \
- filesystem.hpp \
- font.hpp \
- game_config.hpp \
- game_events.hpp \
- gamestatus.hpp \
- gettext.hpp \
- global.hpp \
- halo.hpp \
- help.hpp \
- hotkeys.hpp \
- image.hpp \
- intro.hpp \
- key.hpp \
- language.hpp \
- leader_list.hpp \
- log.hpp \
- map.hpp \
- map_label.hpp \
- mapgen.hpp \
- mapgen_dialog.hpp \
- mouse.hpp \
- multiplayer.hpp \
- multiplayer_ui.hpp \
- multiplayer_wait.hpp \
- multiplayer_connect.hpp \
- multiplayer_create.hpp \
- multiplayer_lobby.hpp \
- network.hpp \
- network_worker.hpp \
- pathfind.hpp \
- pathutils.hpp \
- playlevel.hpp \
- playturn.hpp \
- preferences.hpp \
- publish_campaign.hpp \
- race.hpp \
- replay.hpp \
- reports.hpp \
- scoped_resource.hpp \
- sdl_utils.hpp \
- show_dialog.hpp \
- sound.hpp \
- statistics.hpp \
- team.hpp \
- terrain.hpp \
- theme.hpp \
- thread.hpp \
- titlescreen.hpp \
- tooltips.hpp \
- unit.hpp \
- unit_display.hpp \
- unit_types.hpp \
- util.hpp \
- video.hpp \
- wassert.hpp \
- serialization/preprocessor.hpp \
- serialization/string_utils.hpp \
- widgets/button.hpp \
- widgets/combo.hpp \
- widgets/label.hpp \
- widgets/menu.hpp \
- widgets/progressbar.hpp \
- widgets/scrollarea.hpp \
- widgets/scrollbar.hpp \
- widgets/scrollpane.hpp \
- widgets/slider.hpp \
- widgets/textbox.hpp \
- widgets/widget.hpp \
- zipios++/xcoll.hpp \
- sdl_ttf/SDL_ttf.h \
- wesconfig.h
+wesnoth_SOURCES = \
+ about.cpp \
+ actions.cpp \
+ ai.cpp \
+ ai_attack.cpp \
+ ai_move.cpp \
+ animated.cpp \
+ astarnode.cpp \
+ builder.cpp \
+ cavegen.cpp \
+ clipboard.cpp \
+ config.cpp \
+ cursor.cpp \
+ dialogs.cpp \
+ display.cpp \
+ events.cpp \
+ filesystem.cpp \
+ font.cpp \
+ game.cpp \
+ game_config.cpp \
+ game_events.cpp \
+ gamestatus.cpp \
+ gettext.cpp \
+ halo.cpp \
+ help.cpp \
+ hotkeys.cpp \
+ image.cpp \
+ intro.cpp \
+ key.cpp \
+ language.cpp \
+ leader_list.cpp \
+ log.cpp \
+ map.cpp \
+ map_label.cpp \
+ mapgen.cpp \
+ mapgen_dialog.cpp \
+ mouse.cpp \
+ multiplayer.cpp \
+ multiplayer_ui.cpp \
+ multiplayer_wait.cpp \
+ multiplayer_connect.cpp \
+ multiplayer_create.cpp \
+ multiplayer_lobby.cpp \
+ network.cpp \
+ network_worker.cpp \
+ pathfind.cpp \
+ pathutils.cpp \
+ playlevel.cpp \
+ playturn.cpp \
+ preferences.cpp \
+ publish_campaign.cpp \
+ race.cpp \
+ replay.cpp \
+ reports.cpp \
+ sdl_utils.cpp \
+ show_dialog.cpp \
+ sound.cpp \
+ statistics.cpp \
+ team.cpp \
+ terrain.cpp \
+ theme.cpp \
+ thread.cpp \
+ titlescreen.cpp \
+ tooltips.cpp \
+ unit.cpp \
+ unit_display.cpp \
+ unit_types.cpp \
+ video.cpp \
+ wassert.cpp \
+ serialization/binary_or_text.cpp \
+ serialization/binary_wml.cpp \
+ serialization/parser.cpp \
+ serialization/preprocessor.cpp \
+ serialization/string_utils.cpp \
+ widgets/button.cpp \
+ widgets/combo.cpp \
+ widgets/label.cpp \
+ widgets/menu.cpp \
+ widgets/progressbar.cpp \
+ widgets/scrollarea.cpp \
+ widgets/scrollbar.cpp \
+ widgets/scrollpane.cpp \
+ widgets/slider.cpp \
+ widgets/textbox.cpp \
+ widgets/widget.cpp \
+ zipios++/xcoll.cpp \
+ sdl_ttf/SDL_ttf.c \
+ about.hpp \
+ actions.hpp \
+ ai.hpp \
+ ai2.hpp \
+ ai_attack.hpp \
+ ai_interface.hpp \
+ ai_move.hpp \
+ animated.hpp \
+ array.hpp \
+ astarnode.hpp \
+ builder.hpp \
+ cavegen.hpp \
+ clipboard.hpp \
+ cursor.hpp \
+ config.hpp \
+ dialogs.hpp \
+ display.hpp \
+ events.hpp \
+ filesystem.hpp \
+ font.hpp \
+ game_config.hpp \
+ game_events.hpp \
+ gamestatus.hpp \
+ gettext.hpp \
+ global.hpp \
+ halo.hpp \
+ help.hpp \
+ hotkeys.hpp \
+ image.hpp \
+ intro.hpp \
+ key.hpp \
+ language.hpp \
+ leader_list.hpp \
+ log.hpp \
+ map.hpp \
+ map_label.hpp \
+ mapgen.hpp \
+ mapgen_dialog.hpp \
+ mouse.hpp \
+ multiplayer.hpp \
+ multiplayer_ui.hpp \
+ multiplayer_wait.hpp \
+ multiplayer_connect.hpp \
+ multiplayer_create.hpp \
+ multiplayer_lobby.hpp \
+ network.hpp \
+ network_worker.hpp \
+ pathfind.hpp \
+ pathutils.hpp \
+ playlevel.hpp \
+ playturn.hpp \
+ preferences.hpp \
+ publish_campaign.hpp \
+ race.hpp \
+ replay.hpp \
+ reports.hpp \
+ scoped_resource.hpp \
+ sdl_utils.hpp \
+ show_dialog.hpp \
+ sound.hpp \
+ statistics.hpp \
+ team.hpp \
+ terrain.hpp \
+ theme.hpp \
+ thread.hpp \
+ titlescreen.hpp \
+ tooltips.hpp \
+ unit.hpp \
+ unit_display.hpp \
+ unit_types.hpp \
+ util.hpp \
+ video.hpp \
+ wassert.hpp \
+ serialization/binary_wml.hp \
+ serialization/parser.hp \
+ serialization/preprocessor.hpp \
+ serialization/string_utils.hpp \
+ widgets/button.hpp \
+ widgets/combo.hpp \
+ widgets/label.hpp \
+ widgets/menu.hpp \
+ widgets/progressbar.hpp \
+ widgets/scrollarea.hpp \
+ widgets/scrollbar.hpp \
+ widgets/scrollpane.hpp \
+ widgets/slider.hpp \
+ widgets/textbox.hpp \
+ widgets/widget.hpp \
+ zipios++/xcoll.hpp \
+ sdl_ttf/SDL_ttf.h \
+ wesconfig.h
#############################################################################
# Editor #
#############################################################################
-wesnoth_editor_SOURCES = editor/editor.cpp \
- editor/editor_layout.cpp \
- editor/map_manip.cpp \
- editor/editor_palettes.cpp \
- editor/editor_main.cpp \
- editor/editor_dialogs.cpp \
- editor/editor_undo.cpp \
- about.cpp \
- actions.cpp \
- animated.cpp \
- astarnode.cpp \
- builder.cpp \
- cavegen.cpp \
- clipboard.cpp \
- config.cpp \
- cursor.cpp \
- dialogs.cpp \
- display.cpp \
- events.cpp \
- filechooser.cpp \
- filesystem.cpp \
- font.cpp \
- game_config.cpp \
- game_events.cpp \
- gamestatus.cpp \
- gettext.cpp \
- halo.cpp \
- help.cpp \
- hotkeys.cpp \
- image.cpp \
- key.cpp \
- language.cpp \
- log.cpp \
- map_label.cpp \
- map.cpp \
- mapgen.cpp \
- mapgen_dialog.cpp \
- mouse.cpp \
- network.cpp \
- network_worker.cpp \
- pathutils.cpp \
- pathfind.cpp \
- playturn.cpp \
- preferences.cpp \
- race.cpp \
- replay.cpp \
- reports.cpp \
- sdl_utils.cpp \
- show_dialog.cpp \
- sound.cpp \
- statistics.cpp \
- team.cpp \
- terrain.cpp \
- thread.cpp \
- theme.cpp \
- tooltips.cpp \
- unit.cpp \
- unit_display.cpp \
- unit_types.cpp \
- video.cpp \
- serialization/preprocessor.cpp \
- serialization/string_utils.cpp \
- widgets/button.cpp \
- widgets/file_chooser.cpp \
- widgets/label.cpp \
- widgets/menu.cpp \
- widgets/progressbar.cpp \
- widgets/textbox.cpp \
- widgets/scrollarea.cpp \
- widgets/scrollbar.cpp \
- widgets/slider.cpp \
- widgets/widget.cpp \
- zipios++/xcoll.cpp \
- sdl_ttf/SDL_ttf.c \
- editor/editor.hpp \
- editor/editor_layout.hpp \
- editor/map_manip.hpp \
- editor/editor_palettes.hpp \
- editor/editor_dialogs.hpp \
- editor/editor_undo.hpp \
- about.hpp \
- actions.hpp \
- ai.hpp \
- ai_attack.hpp \
- ai_move.hpp \
- animated.hpp \
- array.hpp \
- astarnode.hpp \
- builder.hpp \
- cavegen.hpp \
- clipboard.hpp \
- config.hpp \
- cursor.hpp \
- dialogs.hpp \
- display.hpp \
- events.hpp \
- filesystem.hpp \
- font.hpp \
- game_config.hpp \
- game_events.hpp \
- gamestatus.hpp \
- gettext.hpp \
- halo.hpp \
- help.hpp \
- hotkeys.hpp \
- image.hpp \
- intro.hpp \
- key.hpp \
- language.hpp \
- log.hpp \
- map_label.hpp \
- map.hpp \
- mapgen.hpp \
- mapgen_dialog.hpp \
- mouse.hpp \
- network.hpp \
- network_worker.hpp \
- pathfind.hpp \
- pathutils.hpp \
- playlevel.hpp \
- playturn.hpp \
- preferences.hpp \
- race.hpp \
- replay.hpp \
- reports.hpp \
- sdl_utils.hpp \
- show_dialog.hpp \
- sound.hpp \
- statistics.hpp \
- team.hpp \
- terrain.hpp \
- theme.hpp \
- thread.hpp \
- tooltips.hpp \
- unit.hpp \
- unit_display.hpp \
- unit_types.hpp \
- video.hpp \
- serialization/preprocessor.hpp \
- serialization/string_utils.hpp \
- widgets/button.hpp \
- widgets/file_chooser.hpp \
- widgets/label.hpp \
- widgets/menu.hpp \
- widgets/progressbar.hpp \
- widgets/textbox.hpp \
- widgets/scrollarea.hpp \
- widgets/scrollbar.hpp \
- widgets/slider.hpp \
- widgets/widget.hpp \
- zipios++/xcoll.hpp \
- sdl_ttf/SDL_ttf.h \
- wesconfig.h
+wesnoth_editor_SOURCES = \
+ editor/editor.cpp \
+ editor/editor_layout.cpp \
+ editor/map_manip.cpp \
+ editor/editor_palettes.cpp \
+ editor/editor_main.cpp \
+ editor/editor_dialogs.cpp \
+ editor/editor_undo.cpp \
+ about.cpp \
+ actions.cpp \
+ animated.cpp \
+ astarnode.cpp \
+ builder.cpp \
+ cavegen.cpp \
+ clipboard.cpp \
+ config.cpp \
+ cursor.cpp \
+ dialogs.cpp \
+ display.cpp \
+ events.cpp \
+ filechooser.cpp \
+ filesystem.cpp \
+ font.cpp \
+ game_config.cpp \
+ game_events.cpp \
+ gamestatus.cpp \
+ gettext.cpp \
+ halo.cpp \
+ help.cpp \
+ hotkeys.cpp \
+ image.cpp \
+ key.cpp \
+ language.cpp \
+ log.cpp \
+ map_label.cpp \
+ map.cpp \
+ mapgen.cpp \
+ mapgen_dialog.cpp \
+ mouse.cpp \
+ network.cpp \
+ network_worker.cpp \
+ pathutils.cpp \
+ pathfind.cpp \
+ playturn.cpp \
+ preferences.cpp \
+ race.cpp \
+ replay.cpp \
+ reports.cpp \
+ sdl_utils.cpp \
+ show_dialog.cpp \
+ sound.cpp \
+ statistics.cpp \
+ team.cpp \
+ terrain.cpp \
+ thread.cpp \
+ theme.cpp \
+ tooltips.cpp \
+ unit.cpp \
+ unit_display.cpp \
+ unit_types.cpp \
+ video.cpp \
+ serialization/binary_or_text.cpp \
+ serialization/binary_wml.cpp \
+ serialization/parser.cpp \
+ serialization/preprocessor.cpp \
+ serialization/string_utils.cpp \
+ widgets/button.cpp \
+ widgets/file_chooser.cpp \
+ widgets/label.cpp \
+ widgets/menu.cpp \
+ widgets/progressbar.cpp \
+ widgets/textbox.cpp \
+ widgets/scrollarea.cpp \
+ widgets/scrollbar.cpp \
+ widgets/slider.cpp \
+ widgets/widget.cpp \
+ zipios++/xcoll.cpp \
+ sdl_ttf/SDL_ttf.c \
+ editor/editor.hpp \
+ editor/editor_layout.hpp \
+ editor/map_manip.hpp \
+ editor/editor_palettes.hpp \
+ editor/editor_dialogs.hpp \
+ editor/editor_undo.hpp \
+ about.hpp \
+ actions.hpp \
+ ai.hpp \
+ ai_attack.hpp \
+ ai_move.hpp \
+ animated.hpp \
+ array.hpp \
+ astarnode.hpp \
+ builder.hpp \
+ cavegen.hpp \
+ clipboard.hpp \
+ config.hpp \
+ cursor.hpp \
+ dialogs.hpp \
+ display.hpp \
+ events.hpp \
+ filesystem.hpp \
+ font.hpp \
+ game_config.hpp \
+ game_events.hpp \
+ gamestatus.hpp \
+ gettext.hpp \
+ halo.hpp \
+ help.hpp \
+ hotkeys.hpp \
+ image.hpp \
+ intro.hpp \
+ key.hpp \
+ language.hpp \
+ log.hpp \
+ map_label.hpp \
+ map.hpp \
+ mapgen.hpp \
+ mapgen_dialog.hpp \
+ mouse.hpp \
+ network.hpp \
+ network_worker.hpp \
+ pathfind.hpp \
+ pathutils.hpp \
+ playlevel.hpp \
+ playturn.hpp \
+ preferences.hpp \
+ race.hpp \
+ replay.hpp \
+ reports.hpp \
+ sdl_utils.hpp \
+ show_dialog.hpp \
+ sound.hpp \
+ statistics.hpp \
+ team.hpp \
+ terrain.hpp \
+ theme.hpp \
+ thread.hpp \
+ tooltips.hpp \
+ unit.hpp \
+ unit_display.hpp \
+ unit_types.hpp \
+ video.hpp \
+ serialization/binary_wml.hpp \
+ serialization/parser.hpp \
+ serialization/preprocessor.hpp \
+ serialization/string_utils.hpp \
+ widgets/button.hpp \
+ widgets/file_chooser.hpp \
+ widgets/label.hpp \
+ widgets/menu.hpp \
+ widgets/progressbar.hpp \
+ widgets/textbox.hpp \
+ widgets/scrollarea.hpp \
+ widgets/scrollbar.hpp \
+ widgets/slider.hpp \
+ widgets/widget.hpp \
+ zipios++/xcoll.hpp \
+ sdl_ttf/SDL_ttf.h \
+ wesconfig.h
#############################################################################
# Wesnothd Server #
@@ -382,7 +394,7 @@
network.cpp \
network_worker.cpp \
thread.cpp \
- serialization/preprocessor.cpp \
+ serialization/binary_wml.cpp \
serialization/string_utils.cpp \
zipios++/xcoll.cpp \
server/game.hpp \
@@ -398,7 +410,7 @@
network.hpp \
network_worker.hpp \
thread.hpp \
- serialization/preprocessor.hpp \
+ serialization/binary_wml.hpp \
serialization/string_utils.hpp \
zipios++/xcoll.hpp
@@ -420,7 +432,8 @@
network_worker.cpp \
publish_campaign.cpp \
thread.cpp \
- serialization/preprocessor.cpp \
+ serialization/binary_wml.cpp \
+ serialization/parser.cpp \
serialization/string_utils.cpp \
zipios++/xcoll.cpp \
game_events.hpp \
@@ -432,6 +445,8 @@
network.hpp \
network_worker.hpp \
publish_campaign.hpp \
+ serialization/binary_wml.hpp \
+ serialization/parser.hpp \
serialization/preprocessor.hpp \
serialization/string_utils.hpp \
thread.hpp \
@@ -455,12 +470,14 @@
game_config.cpp \
sdl_utils.cpp \
log.cpp \
+ serialization/parser.cpp \
serialization/preprocessor.cpp \
serialization/string_utils.cpp \
zipios++/xcoll.cpp \
tools/exploder_composer.hpp \
tools/exploder_cutter.hpp \
tools/exploder_utils.hpp \
+ serialization/parser.hpp \
serialization/preprocessor.hpp \
serialization/string_utils.hpp \
zipios++/xcoll.hpp \
@@ -477,12 +494,14 @@
game_config.cpp \
sdl_utils.cpp \
log.cpp \
+ serialization/parser.cpp \
serialization/preprocessor.cpp \
serialization/string_utils.cpp \
zipios++/xcoll.cpp \
tools/exploder_composer.hpp \
tools/exploder_cutter.hpp \
tools/exploder_utils.hpp \
+ serialization/parser.hpp \
serialization/preprocessor.hpp \
serialization/string_utils.hpp \
zipios++/xcoll.hpp \
Index: wesnoth/src/campaign_server/campaign_server.cpp
diff -u wesnoth/src/campaign_server/campaign_server.cpp:1.9
wesnoth/src/campaign_server/campaign_server.cpp:1.10
--- wesnoth/src/campaign_server/campaign_server.cpp:1.9 Sat Feb 5 04:00:27 2005
+++ wesnoth/src/campaign_server/campaign_server.cpp Sat Mar 5 10:54:25 2005
@@ -1,8 +1,10 @@
-#include "../config.hpp"
-#include "../filesystem.hpp"
-#include "../network.hpp"
-#include "../publish_campaign.hpp"
-#include "../util.hpp"
+#include "config.hpp"
+#include "filesystem.hpp"
+#include "network.hpp"
+#include "publish_campaign.hpp"
+#include "util.hpp"
+#include "serialization/binary_wml.hpp"
+#include "serialization/parser.hpp"
#include "SDL.h"
@@ -30,7 +32,7 @@
explicit campaign_server(const std::string& cfgfile);
void run();
private:
-
+ int load_config(); // return the server port
const config& campaigns() const { return *cfg_.child("campaigns"); }
config& campaigns() { return *cfg_.child("campaigns"); }
config cfg_;
@@ -40,9 +42,14 @@
};
+int campaign_server::load_config()
+{
+ read(cfg_, read_file(file_));
+ return lexical_cast_default<int>(cfg_["port"], 15002);
+}
+
campaign_server::campaign_server(const std::string& cfgfile)
- : cfg_(read_file(cfgfile)), file_(cfgfile),
- server_manager_(lexical_cast_default<int>(cfg_["port"],15002))
+ : file_(cfgfile), server_manager_(load_config())
{
if(cfg_.child("campaigns") == NULL) {
cfg_.add_child("campaigns");
@@ -55,7 +62,7 @@
try {
//write config to disk every ten minutes
if((increment%(60*10*2)) == 0) {
- write_file(file_,cfg_.write());
+ write_file(file_, write(cfg_));
}
network::process_send_queue();
@@ -84,7 +91,7 @@
} else {
config cfg;
compression_schema schema;
-
cfg.read_compressed(read_file((*campaign)["filename"]),schema);
+ read_compressed(cfg,
read_file((*campaign)["filename"]),schema);
network::queue_data(cfg,sock);
const int downloads =
lexical_cast_default<int>((*campaign)["downloads"],0)+1;
@@ -120,12 +127,12 @@
const config* const data =
upload->child("data");
if(data != NULL) {
compression_schema
schema;
- const std::string&
filedata = data->write_compressed(schema);
+ const std::string&
filedata = write_compressed(*data, schema);
write_file((*campaign)["filename"],filedata);
(*campaign)["size"] =
lexical_cast<std::string>(filedata.size());
}
- write_file(file_,cfg_.write());
+ write_file(file_, write(cfg_));
network::send_data(construct_message("Campaign accepted."),sock);
}
} else if(const config* erase =
data.child("delete")) {
@@ -146,7 +153,7 @@
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);
- write_file(file_,cfg_.write());
+ write_file(file_, write(cfg_));
network::send_data(construct_message("Campaign erased."),sock);
}
}
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.129 wesnoth/src/config.cpp:1.130
--- wesnoth/src/config.cpp:1.129 Sun Feb 27 18:15:20 2005
+++ wesnoth/src/config.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.129 2005/02/27 18:15:20 ydirson Exp $ */
+/* $Id: config.cpp,v 1.130 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,61 +14,11 @@
#include "global.hpp"
#include <algorithm>
-#include <cctype>
-#include <fstream>
-#include <iostream>
-#include <stack>
#include <sstream>
-#include <vector>
#include "config.hpp"
-#include "filesystem.hpp"
-#include "game_config.hpp"
#include "game_events.hpp"
-#include "gettext.hpp"
-#include "log.hpp"
-#include "util.hpp"
#include "wassert.hpp"
-#include "wesconfig.h"
-#include "serialization/preprocessor.hpp"
-#include "serialization/string_utils.hpp"
-
-#define ERR_CF lg::err(lg::config)
-#define WRN_CF lg::warn(lg::config)
-#define LOG_CF lg::info(lg::config)
-
-bool operator<(const line_source& a, const line_source& b)
-{
- return a.linenum < b.linenum;
-}
-
-namespace {
-
-const int max_recursion_levels = 100;
-
-bool isnewline(char c)
-{
- return c == '\r' || c == '\n';
-}
-
-//make sure that we can use Mac, DOS, or Unix style text files on any system
-//and they will work, by making sure the definition of whitespace is consistent
-bool portable_isspace(char c)
-{
- // returns true only on ASCII spaces
- if((unsigned char)c >= 128)
- return false;
- return isnewline(c) || isspace(c);
-}
-
-} //end anonymous namespace
-
-config::config(const std::string& data,
- const std::vector<line_source>* line_sources)
-{
- log_scope("parsing config...");
- read(data,line_sources);
-}
config::config(const config& cfg)
{
@@ -105,614 +55,6 @@
}
}
-void config::read(const std::string& data,
- const std::vector<line_source>* line_sources)
-{
- clear();
-
- std::stack<std::string> element_names;
- std::stack<int> element_locs;
- std::stack<config*> elements;
- std::stack<std::map<std::string,config*> > last_element; //allows
[+element] syntax
- std::stack<std::string> textdomains;
- std::string current_textdomain = PACKAGE;
- std::string current_textdomain_location = "";
- elements.push(this);
- element_names.push("");
- element_locs.push(0);
- last_element.push(std::map<std::string,config*>());
-
- enum { ELEMENT_NAME, IN_ELEMENT, VARIABLE_NAME, VALUE }
- state = IN_ELEMENT;
- std::string var;
-
- std::vector<std::pair<std::string,bool> > stored_values;
- std::string value;
-
- bool in_quotes = false, has_quotes = false, in_comment = false,
escape_next = false, translatable = false, expecting_value = false;
-
- int line = 0;
-
- for(std::string::const_iterator i = data.begin(); i != data.end(); ++i)
{
- const char c = *i;
- if(c == '\r') //ignore any DOS-style newlines
- continue;
-
- if(c == '\n') {
- in_comment = false;
- ++line;
- }
-
- if(*i == '#' && !in_quotes) {
- in_comment = true;
- }
-
- if(in_comment) {
- continue;
- }
-
- switch(state) {
- case ELEMENT_NAME:
- if(c == ']') {
- if(value == "end" || value.empty() ==
false && value[0] == '/') {
- wassert(!elements.empty());
-
- if(value[0] == '/' &&
- std::string("/" +
element_names.top()) != value) {
- std::stringstream err;
-
- if(line_sources !=
NULL) {
- const
line_source src = get_line_source(*line_sources,line);
-
- err << src.file
<< " " << src.fileline << ": ";
- } else {
- err << "line "
<< line << ": ";
- }
-
- err << "Found illegal
end tag: '" << value
- << "', at end of '"
- <<
element_names.top() << "'";
-
- throw error(err.str());
- }
-
- const std::string name =
element_names.top();
- config* const element =
elements.top();
-
- elements.pop();
- element_names.pop();
- element_locs.pop();
- last_element.pop();
-
- if(elements.empty()) {
- std::stringstream err;
-
- if(line_sources !=
NULL) {
- const
line_source src =
-
get_line_source(*line_sources,line);
-
- err << src.file
<< " " << src.fileline << ": ";
- }
-
- err << "Unexpected
terminating tag\n";
- throw error(err.str());
- return;
- }
-
- last_element.top()[name] =
element;
-
-
if(element->values.count("textdomain") != 0){
- current_textdomain =
textdomains.top();
- textdomains.pop();
- }
- current_textdomain_location =
"";
-
- state = IN_ELEMENT;
-
- break;
- }
-
- //any elements with a + sign prefix,
like [+element] mean
- //that they are appending to the
previous element with the same
- //name, if there is one
- if(value.empty() == false && value[0]
== '+') {
-
value.erase(value.begin(),value.begin()+1);
- const
std::map<std::string,config*>::iterator itor = last_element.top().find(value);
- if(itor !=
last_element.top().end()) {
-
elements.push(itor->second);
-
element_names.push(value);
- element_locs.push(line);
-
last_element.push(std::map<std::string,config*>());
- state = IN_ELEMENT;
- value = "";
- break;
- }
- }
-
-
elements.push(&elements.top()->add_child(value));
- element_names.push(value);
- element_locs.push(line);
-
last_element.push(std::map<std::string,config*>());
-
- state = IN_ELEMENT;
- value = "";
- } else {
- value.resize(value.size()+1);
- value[value.size()-1] = c;
- }
-
- break;
-
- case IN_ELEMENT:
- if(c == '[') {
- state = ELEMENT_NAME;
- value = "";
- } else if(!portable_isspace(c)) {
- value.resize(1);
- value[0] = c;
- state = VARIABLE_NAME;
- }
-
- break;
-
- case VARIABLE_NAME:
- if(c == '=') {
- state = VALUE;
- var = value;
- value = "";
- } else {
- value.resize(value.size()+1);
- value[value.size()-1] = c;
- }
-
- break;
-
- case VALUE:
- if(c == '[' && in_quotes) {
- if(line_sources != NULL) {
- const line_source src =
get_line_source(*line_sources,line);
- LOG_CF << src.file << " " <<
src.fileline << ": ";
- } else {
- LOG_CF << "line " << line << ":
";
- }
-
- WRN_CF << "square bracket found in
string. Is this a run-away string?\n";
- }
-
- if(in_quotes && c == '"' && (i+1) != data.end()
&& *(i+1) == '"') {
- push_back(value, c);
- ++i; // skip the next double-quote
- } else if(c == '"') {
- expecting_value = false;
- in_quotes = !in_quotes;
- has_quotes = true;
-
- //if we have an underscore outside of
quotes in front, then
- //we strip it away, since it simply
indicates that this value is translatable.
- if(value.empty() == false &&
std::count(value.begin(),value.end(),'_') == 1) {
- std::string val = value;
- if (utils::strip(val) == "_") {
- value = "";
- translatable = true;
- }
- }
- } else if(c == '+' && has_quotes && !in_quotes)
{
-
stored_values.push_back(std::make_pair(value,translatable));
- value = "";
- translatable = false;
- expecting_value = true;
- } else if(c == '\n' && !in_quotes &&
expecting_value) {
- //do nothing...just ignore
- } else if(c == '\n' && !in_quotes) {
-
-
stored_values.push_back(std::make_pair(value,translatable));
- value = "";
-
for(std::vector<std::pair<std::string,bool> >::const_iterator i =
stored_values.begin(); i != stored_values.end(); ++i) {
- if(i->second) {
- value +=
dsgettext(current_textdomain.c_str(),i->first.c_str());
- } else {
- value += i->first;
- }
- }
-
- stored_values.clear();
-
- //see if this is a CSV list=CSV list
style assignment (e.g. x,y=5,8)
- std::vector<std::string> vars, values;
-
if(std::count(var.begin(),var.end(),',') > 0) {
- vars = utils::split(var);
- values = utils::split(value);
- } else {
- vars.push_back(var);
- values.push_back(value);
- if (var == "textdomain") {
-
textdomains.push(current_textdomain);
- current_textdomain =
value;
-
bindtextdomain(current_textdomain.c_str(),
-
current_textdomain_location.empty() ?
-
get_intl_dir().c_str() :
-
current_textdomain_location.c_str());
- bind_textdomain_codeset
(current_textdomain.c_str(), "UTF-8");
- } else if (var ==
"translations") {
- const std::string&
location = get_binary_file_location(value, ".");
-
current_textdomain_location = location;
- }
- }
-
- //iterate over the names and values,
assigning each to its corresponding
- //element. If there are more names than
values, than remaining names get
- //assigned to the last value. If there
are more values than names, then
- //all the last values get concatenated
onto the last name
- if(vars.empty() == false) {
- for(size_t n = 0; n !=
maximum<size_t>(vars.size(),values.size()); ++n) {
- std::string value;
- if(n < values.size()) {
- value =
values[n];
- } else
if(values.empty() == false) {
- value =
values.back();
- }
-
- if(has_quotes == false)
{
-
utils::strip(value);
- }
-
- if(n < vars.size()) {
-
elements.top()->values[vars[n]] = value;
- } else {
-
elements.top()->values[vars.back()] += "," + value;
- }
- }
- }
-
- state = IN_ELEMENT;
- var = "";
- value = "";
- has_quotes = false;
- escape_next = false;
- translatable = false;
- } else if(in_quotes || !has_quotes) {
- expecting_value = false;
- push_back(value, c);
- } else if(expecting_value) {
- // after a +, emulate !has_quotes so we
can see any _ when we encounter a " later
- push_back(value, c);
- }
-
- break;
- }
- }
-
- const std::string top = element_names.top();
- element_names.pop();
- if(!element_names.empty()) {
- throw error("Configuration not terminated: no closing tag to '"
+ top + "' (line " + str_cast(element_locs.top()) + ")");
- }
-}
-
-namespace {
- const std::string AttributeEquals = "=\"";
- const std::string AttributePostfix = "\"\n";
- const std::string ElementPrefix = "[";
- const std::string ElementPostfix = "]\n";
- const std::string EndElementPrefix = "[/";
- const std::string EndElementPostfix = "]\n";
- const std::string ConfigPostfix = "\n";
-
-std::string escaped_string(const std::string& value) {
- std::vector<char> res;
- for(std::string::const_iterator i = value.begin(); i != value.end();
++i) {
- //double interior quotes
- if(*i == '\"') res.push_back(*i);
- res.push_back(*i);
- }
- return std::string(res.begin(), res.end());
-}
-
-}
-
-size_t config::write_size(size_t tab) const
-{
- size_t res = 0;
- for(string_map::const_iterator i = values.begin(); i != values.end();
++i) {
- if(i->second.empty() == false) {
- res += i->first.size() + AttributeEquals.size() +
- escaped_string(i->second).size() +
AttributePostfix.size() + tab;
- }
- }
-
- for(all_children_iterator j = ordered_begin(); j != ordered_end(); ++j)
{
- const std::pair<const std::string*,const config*>& item = *j;
- const std::string& name = *item.first;
- const config& cfg = *item.second;
- res += ElementPrefix.size() + name.size() +
ElementPostfix.size() +
- cfg.write_size(tab+1) + EndElementPrefix.size() +
name.size() + EndElementPostfix.size() + tab*2;
-
- }
-
- res += ConfigPostfix.size();
-
- return res;
-}
-
-std::string::iterator config::write_internal(std::string::iterator out, size_t
tab) const
-{
- if(tab > max_recursion_levels)
- return out;
-
- for(std::map<std::string,std::string>::const_iterator i =
values.begin();
- i != values.end(); ++i) {
- if(i->second.empty() == false) {
- std::fill(out,out+tab,'\t');
- out += tab;
-
- out = std::copy(i->first.begin(),i->first.end(),out);
- out =
std::copy(AttributeEquals.begin(),AttributeEquals.end(),out);
- std::string value = escaped_string(i->second);
- out = std::copy(value.begin(),value.end(),out);
- out =
std::copy(AttributePostfix.begin(),AttributePostfix.end(),out);
- }
- }
-
- for(all_children_iterator j = ordered_begin(); j != ordered_end(); ++j)
{
- const std::pair<const std::string*,const config*>& item = *j;
- const std::string& name = *item.first;
- const config& cfg = *item.second;
-
- std::fill(out,out+tab,'\t');
- out += tab;
-
- out = std::copy(ElementPrefix.begin(),ElementPrefix.end(),out);
- out = std::copy(name.begin(),name.end(),out);
- out =
std::copy(ElementPostfix.begin(),ElementPostfix.end(),out);
- out = cfg.write_internal(out,tab+1);
-
- std::fill(out,out+tab,'\t');
- out += tab;
-
- out =
std::copy(EndElementPrefix.begin(),EndElementPrefix.end(),out);
- out = std::copy(name.begin(),name.end(),out);
- out =
std::copy(EndElementPostfix.begin(),EndElementPostfix.end(),out);
- }
-
- out = std::copy(ConfigPostfix.begin(),ConfigPostfix.end(),out);
- return out;
-}
-
-std::string config::write() const
-{
- log_scope("config::write");
-
- std::string res;
-
- res.resize(write_size());
-
- const std::string::iterator i = write_internal(res.begin());
- wassert(i == res.end());
- if(i != res.end()) {
- ERR_CF << "size of config buffer: " << (i - res.begin()) << "/"
<< res.size() << "\n";
- }
-
- return res;
-}
-
-//data compression. Compression is designed for network traffic.
-//assumptions compression is based on:
-// - most space is taken up by element names and attribute names
-// - there are relatively few element names and attribute names that are
repeated many times
-//
-//how it works: there are some control characters:
-// 'compress_open_element': signals that the next word found is an element.
-// any words found that are not after this are assumed to be attributes
-// 'compress_close_element': signals to close the current element
-// 'compress_schema_item': signals that following is a nul-delimited string,
which should
-// be added as a word in the schema
-// 'compress_literal_word': signals that following is a word stored as a
nul-delimited string
-// (an attribute name, unless it was preceeded by 'compress_open_element')
-//
-// all other characters are mapped to words. When an item is inserted into the
schema,
-// it is mapped to the first available character. Any attribute found is
always followed
-// by a nul-delimited string which is the value for the attribute.
-//
-// the schema objects are designed to be persisted. That is, in a network
game, both peers
-// can store their schema objects, and so rather than sending schema data each
time, the peers
-// use and build their schemas as the game progresses, adding a new word to
the schema anytime
-// it is required.
-namespace {
- const unsigned int compress_open_element = 0, compress_close_element =
1,
- compress_schema_item = 2, compress_literal_word = 3,
- compress_first_word = 4, compress_end_words = 256;
- const size_t compress_max_words = compress_end_words -
compress_first_word;
- const size_t max_schema_item_length = 20;
-
- void compress_output_literal_word(const std::string& word,
std::vector<char>& output)
- {
- output.resize(output.size() + word.size());
- std::copy(word.begin(),word.end(),output.end()-word.size());
- output.push_back(char(0));
- }
-
- compression_schema::word_char_map::const_iterator
add_word_to_schema(const std::string& word, compression_schema& schema)
- {
- if(word.size() > max_schema_item_length) {
- throw config::error("Schema item is too long");
- }
-
- unsigned int c = compress_first_word +
schema.word_to_char.size();
-
- schema.char_to_word.insert(std::pair<unsigned
int,std::string>(c,word));
- return
schema.word_to_char.insert(std::pair<std::string,unsigned int>(word,c)).first;
- }
-
- compression_schema::word_char_map::const_iterator
get_word_in_schema(const std::string& word, compression_schema& schema,
std::vector<char>& output)
- {
- if(word.size() > max_schema_item_length) {
- return schema.word_to_char.end();
- }
-
- //see if this word is already in the schema
- const compression_schema::word_char_map::const_iterator w =
schema.word_to_char.find(word);
- if(w != schema.word_to_char.end()) {
- //in the schema. Return it
- return w;
- } else if(schema.word_to_char.size() < compress_max_words) {
- //we can add the word to the schema
-
- //we insert the code to add a schema item, followed by
the zero-delimited word
- output.push_back(char(compress_schema_item));
- compress_output_literal_word(word,output);
-
- return add_word_to_schema(word,schema);
- } else {
- //it's not there, and there's no room to add it
- return schema.word_to_char.end();
- }
- }
-
- void compress_emit_word(const std::string& word, compression_schema&
schema, std::vector<char>& res)
- {
- //get the word in the schema
- const compression_schema::word_char_map::const_iterator w =
get_word_in_schema(word,schema,res);
- if(w != schema.word_to_char.end()) {
- //the word is in the schema, all we have to do is
output the compression code for it.
- res.push_back(w->second);
- } else {
- //the word is not in the schema. Output it as a literal
word
- res.push_back(char(compress_literal_word));
- compress_output_literal_word(word,res);
- }
- }
-
- std::string::const_iterator
compress_read_literal_word(std::string::const_iterator i1,
std::string::const_iterator i2, std::string& res)
- {
- const std::string::const_iterator end_word = std::find(i1,i2,0);
- if(end_word == i2) {
- throw config::error("Unexpected end of data in
compressed config read\n");
- }
-
- res = std::string(i1,end_word);
- return end_word;
- }
-}
-
-void config::write_compressed_internal(compression_schema& schema,
std::vector<char>& res, int level) const
-{
- if(level > max_recursion_levels)
- throw config::error("Too many recursion levels in compressed
config write\n");
-
- for(std::map<std::string,std::string>::const_iterator i =
values.begin();
- i != values.end(); ++i) {
- if(i->second.empty() == false) {
-
- //output the name, using compression
- compress_emit_word(i->first,schema,res);
-
- //output the value, with no compression
- compress_output_literal_word(i->second,res);
- }
- }
-
- for(all_children_iterator j = ordered_begin(); j != ordered_end(); ++j)
{
- const std::pair<const std::string*,const config*>& item = *j;
- const std::string& name = *item.first;
- const config& cfg = *item.second;
-
- res.push_back(compress_open_element);
- compress_emit_word(name,schema,res);
- cfg.write_compressed_internal(schema,res, level+1);
- res.push_back(compress_close_element);
- }
-}
-
-std::string config::write_compressed(compression_schema& schema) const
-{
- std::vector<char> res;
- write_compressed_internal(schema,res,0);
- std::string s;
- s.resize(res.size());
- std::copy(res.begin(),res.end(),s.begin());
- return s;
-}
-
-std::string::const_iterator
config::read_compressed_internal(std::string::const_iterator i1,
std::string::const_iterator i2, compression_schema& schema, int level)
-{
- if(level >= max_recursion_levels)
- throw config::error("Too many recursion levels in compressed
config read\n");
-
- bool in_open_element = false;
- while(i1 != i2) {
- switch(*i1) {
- case compress_open_element:
- in_open_element = true;
- break;
- case compress_close_element:
- return i1;
- case compress_schema_item: {
- std::string word;
- i1 = compress_read_literal_word(i1+1,i2,word);
-
- add_word_to_schema(word,schema);
-
- break;
- }
-
- default: {
- std::string word;
- if(*i1 == compress_literal_word) {
- i1 = compress_read_literal_word(i1+1,i2,word);
- } else {
- const unsigned char c = *i1;
- unsigned int code = c;
-
- const
compression_schema::char_word_map::const_iterator itor =
schema.char_to_word.find(code);
- if(itor == schema.char_to_word.end()) {
- ERR_CF << "illegal word code: " << code
<< "\n";
- throw error("Illegal character in
compression input\n");
- }
-
- word = itor->second;
- }
-
- if(in_open_element) {
- in_open_element = false;
- config& cfg = add_child(word);
- i1 =
cfg.read_compressed_internal(i1+1,i2,schema,level+1);
- } else {
- //we have a name/value pair, the value is
always a literal string
- std::string value;
- i1 = compress_read_literal_word(i1+1,i2,value);
-
values.insert(std::pair<std::string,std::string>(word,value));
- }
- }
-
- } //end switch
-
- if(i1 == i2)
- return i2;
- ++i1;
- }
-
- return i1;
-}
-
-void config::read_compressed(const std::string& data, compression_schema&
schema)
-{
- clear();
- read_compressed_internal(data.begin(),data.end(),schema,0);
-}
-
-bool config::detect_format_and_read(const std::string& data)
-{
- try {
- compression_schema schema;
- read_compressed(data,schema);
- return true;
- } catch(config::error&) {
- }
-
- read(data);
- return false;
-}
-
config::child_itors config::child_range(const std::string& key)
{
child_map::iterator i = children.find(key);
@@ -859,8 +201,8 @@
{
const std::string& str = get_attribute(key);
//see if the value is a variable
- if(str != "" && str[0] == '$') {
- return
game_events::get_variable_const(std::string(str.begin()+1,str.end()));
+ if (!str.empty() && str[0] == '$') {
+ return game_events::get_variable_const(std::string(str.begin()
+ 1, str.end()));
} else {
return str;
}
Index: wesnoth/src/config.hpp
diff -u wesnoth/src/config.hpp:1.57 wesnoth/src/config.hpp:1.58
--- wesnoth/src/config.hpp:1.57 Sun Feb 27 18:15:20 2005
+++ wesnoth/src/config.hpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: config.hpp,v 1.57 2005/02/27 18:15:20 ydirson Exp $ */
+/* $Id: config.hpp,v 1.58 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,12 +14,9 @@
#define CONFIG_HPP_INCLUDED
#include <map>
-#include <sstream>
#include <string>
#include <vector>
-#include "serialization/preprocessor.hpp"
-
//This module defines the interface to Wesnoth Markup Language (WML).
//WML is a simple hierarchical text-based file format. The format
//is defined in Wiki, under BuildingScenariosWML
@@ -30,16 +27,6 @@
typedef std::map<std::string,std::string> string_map;
-//this object holds the schema by which config objects can be compressed and
decompressed.
-struct compression_schema
-{
- typedef std::map<unsigned int,std::string> char_word_map;
- char_word_map char_to_word;
-
- typedef std::map<std::string,unsigned int> word_char_map;
- word_char_map word_to_char;
-};
-
//a config object defines a single node in a WML file, with access to
//child nodes.
class config
@@ -48,41 +35,11 @@
//create an empty node.
config() {}
- //create a node from data
- explicit config(const std::string& data,
- const std::vector<line_source>* lines=0); //throws config::error
config(const config& cfg);
~config();
config& operator=(const config& cfg);
- //read data in, clobbering existing data.
- void read(const std::string& data,
- const std::vector<line_source>* lines=0); //throws
config::error
- std::string write() const;
-
- //functions to read and write compressed data. The schema will be
created and written
- //with the data. However if you are making successive writes (e.g. a
network connection)
- //you can re-use the same schema on the sending end, and the receiver
can store the schema,
- //meaning that the entire schema won't have to be transmitted each time.
- std::string write_compressed(compression_schema& schema) const;
- void read_compressed(const std::string& data, compression_schema&
schema); //throws config::error
-
- std::string write_compressed() const {
- compression_schema schema;
- return write_compressed(schema);
- }
-
- void read_compressed(const std::string& data) {
- compression_schema schema;
- read_compressed(data,schema);
- }
-
- //function which reads a file, and automatically detects whether it's
compressed or not before
- //reading it. If it's not a valid file at all, it will throw an error
as if it was trying to
- //read it as text WML. Returns true iff the format is compressed
- bool detect_format_and_read(const std::string& data); //throws
config::error
-
typedef std::vector<config*> child_list;
typedef std::map<std::string,child_list> child_map;
@@ -168,11 +125,6 @@
string_map values;
private:
- size_t write_size(size_t tab=0) const;
- std::string::iterator write_internal(std::string::iterator out, size_t
tab=0) const;
- std::string::const_iterator
read_compressed_internal(std::string::const_iterator i1,
std::string::const_iterator i2, compression_schema& schema, int level);
- void write_compressed_internal(compression_schema& schema,
std::vector<char>& res, int level) const;
-
//a list of all children of this node.
child_map children;
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.94 wesnoth/src/editor/editor.cpp:1.95
--- wesnoth/src/editor/editor.cpp:1.94 Sun Feb 27 18:15:21 2005
+++ wesnoth/src/editor/editor.cpp Sat Mar 5 10:54:25 2005
@@ -32,6 +32,7 @@
#include "../util.hpp"
#include "../video.hpp"
#include "../wml_separators.hpp"
+#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "editor.hpp"
@@ -99,7 +100,7 @@
// Perform some initializations that should only be performed
// the first time the editor object is created.
try {
- prefs_.read(read_file(prefs_filename));
+ read(prefs_, read_file(prefs_filename));
}
catch (config::error e) {
std::cerr << "Error when reading " << prefs_filename <<
": "
@@ -135,7 +136,7 @@
old_bg_terrain_ = palette_.selected_bg_terrain();
old_brush_size_ = brush_.selected_brush_size();
try {
- write_file(prefs_filename, prefs_.write());
+ write_file(prefs_filename, write(prefs_));
}
catch (io_exception& e) {
std::cerr << "Error when writing to " << prefs_filename << ": "
Index: wesnoth/src/editor/editor_dialogs.cpp
diff -u wesnoth/src/editor/editor_dialogs.cpp:1.20
wesnoth/src/editor/editor_dialogs.cpp:1.21
--- wesnoth/src/editor/editor_dialogs.cpp:1.20 Sun Oct 31 20:50:13 2004
+++ wesnoth/src/editor/editor_dialogs.cpp Sat Mar 5 10:54:25 2005
@@ -128,7 +128,7 @@
const config* const toplevel_cfg =
game_config.find_child("multiplayer","id","ranmap");
const config* const cfg = toplevel_cfg == NULL ? NULL :
toplevel_cfg->child("generator");
if (cfg == NULL) {
- config dummy_cfg("");
+ config dummy_cfg;
random_map_generator.assign(create_map_generator("",
&dummy_cfg));
}
else {
Index: wesnoth/src/editor/editor_main.cpp
diff -u wesnoth/src/editor/editor_main.cpp:1.27
wesnoth/src/editor/editor_main.cpp:1.28
--- wesnoth/src/editor/editor_main.cpp:1.27 Sat Feb 26 18:52:24 2005
+++ wesnoth/src/editor/editor_main.cpp Sat Mar 5 10:54:25 2005
@@ -25,6 +25,8 @@
#include "../team.hpp"
#include "../util.hpp"
#include "../wesconfig.h"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include <cctype>
@@ -223,7 +225,7 @@
//Read the configuration af
config cfg;
try {
- cfg.read(preprocess_file("data/game.cfg", &defines_map));
+ read(cfg, preprocess_file("data/game.cfg", &defines_map));
}
catch (config::error e) {
std::cerr << "Error when reading game config: '" << e.message
<< "'" << std::endl;
@@ -243,7 +245,7 @@
// Add a dummy team so the reports will be handled properly.
teams.push_back(team(cfg));
config* theme_cfg = cfg.find_child("theme", "name", "editor");
- config dummy_theme("");
+ config dummy_theme;
if (!theme_cfg) {
std::cerr << "Editor theme could not be loaded." << std::endl;
theme_cfg = &dummy_theme;
@@ -257,7 +259,7 @@
std::cerr << "creating map...\n";
gamemap map(cfg, mapdata);
- const config dummy_cfg("");
+ const config dummy_cfg;
display gui(units, video, map, status, teams,
*theme_cfg, cfg, dummy_cfg);
Index: wesnoth/src/font.cpp
diff -u wesnoth/src/font.cpp:1.115 wesnoth/src/font.cpp:1.116
--- wesnoth/src/font.cpp:1.115 Fri Mar 4 20:23:40 2005
+++ wesnoth/src/font.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: font.cpp,v 1.115 2005/03/04 20:23:40 j_daniel Exp $ */
+/* $Id: font.cpp,v 1.116 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -23,8 +23,10 @@
#include "team.hpp"
#include "tooltips.hpp"
#include "util.hpp"
-#include "serialization/string_utils.hpp"
#include "wassert.hpp"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
+#include "serialization/string_utils.hpp"
#include <algorithm>
#include <cstdio>
@@ -331,8 +333,8 @@
SDL_Color color_;
int style_;
mutable int w_, h_;
- mutable bool initialized_;
std::string str_;
+ mutable bool initialized_;
mutable std::vector<text_chunk> chunks_;
mutable std::vector<surface> surfs_;
void hash();
@@ -1309,7 +1311,7 @@
//config when changing languages
config cfg;
try {
- cfg.read(preprocess_file("data/fonts.cfg"));
+ read(cfg, preprocess_file("data/fonts.cfg"));
} catch(config::error&) {
std::cerr << "Could not read fonts.cfg\n";
return false;
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.202 wesnoth/src/game.cpp:1.203
--- wesnoth/src/game.cpp:1.202 Sun Feb 27 18:15:20 2005
+++ wesnoth/src/game.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.202 2005/02/27 18:15:20 ydirson Exp $ */
+/* $Id: game.cpp,v 1.203 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -52,6 +52,9 @@
#include "video.hpp"
#include "wassert.hpp"
#include "wml_separators.hpp"
+#include "serialization/binary_wml.hpp"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
@@ -87,7 +90,7 @@
//if the starting state is specified, then use that,
//otherwise get the scenario data and start from there.
if(state.starting_pos.empty() == false) {
- std::cerr << "loading starting position: '" <<
state.starting_pos.write() << "'\n";
+ std::cerr << "loading starting position: '" <<
write(state.starting_pos) << "'\n";
starting_pos = state.starting_pos;
scenario = &starting_pos;
} else {
@@ -253,7 +256,8 @@
if(use_cache) {
try {
if(file_exists(fname_checksum))
{
- const config
checksum_cfg(read_file(fname_checksum));
+ config const
checksum_cfg;
+ read(cfg,
read_file(fname_checksum));
dir_checksum =
file_tree_checksum(checksum_cfg);
}
} catch(config::error&) {
@@ -269,7 +273,7 @@
compression_schema schema;
try {
-
cfg.read_compressed(read_file(fname),schema);
+ read_compressed(cfg,
read_file(fname), schema);
return;
} catch(config::error&) {
std::cerr << "cache is corrupt.
Loading from files\n";
@@ -281,15 +285,15 @@
std::cerr << "no valid cache found. Writing
cache to '" << fname << "'\n";
//read the file and then write to the cache
-
cfg.read(preprocess_file("data/game.cfg",&defines,&line_src),&line_src);
+ read(cfg, preprocess_file("data/game.cfg",
&defines, &line_src), &line_src);
try {
compression_schema schema;
-
write_file(fname,cfg.write_compressed(schema));
+ write_file(fname, write_compressed(cfg,
schema));
config checksum_cfg;
data_tree_checksum().write(checksum_cfg);
- std::cerr << "wrote checksum: '" <<
checksum_cfg.write() << "'\n";
-
write_file(fname_checksum,checksum_cfg.write());
+ std::cerr << "wrote checksum: '" <<
write(checksum_cfg) << "'\n";
+ write_file(fname_checksum,
write(checksum_cfg));
} catch(io_exception&) {
std::cerr << "could not write to cache
'" << fname << "'\n";
}
@@ -300,7 +304,7 @@
}
std::cerr << "caching cannot be done. Reading file\n";
- cfg.read(preprocess_file("data/game.cfg",&defines,&line_src),&line_src);
+ read(cfg, preprocess_file("data/game.cfg", &defines, &line_src),
&line_src);
}
bool less_campaigns_rank(const config* a, const config* b) {
@@ -454,7 +458,7 @@
}
static display::unit_map dummy_umap;
- static config dummy_cfg("");
+ static config dummy_cfg;
static gamemap dummy_map(dummy_cfg, "1");
static gamestatus dummy_status(dummy_cfg, 0);
static std::vector<team> dummy_teams;
@@ -1519,7 +1523,7 @@
const bool compress = val == "--compress";
try {
- const bool is_compressed =
cfg.detect_format_and_read(in);
+ const bool is_compressed =
detect_format_and_read(cfg, in);
if(is_compressed && compress) {
std::cerr << input << " is already
compressed\n";
return 0;
@@ -1528,7 +1532,7 @@
return 0;
}
- const std::string res(compress ?
cfg.write_compressed() : cfg.write());
+ const std::string res(compress ?
write_compressed(cfg) : write(cfg));
write_file(output,res);
} catch(config::error& e) {
Index: wesnoth/src/gamestatus.cpp
diff -u wesnoth/src/gamestatus.cpp:1.57 wesnoth/src/gamestatus.cpp:1.58
--- wesnoth/src/gamestatus.cpp:1.57 Sun Feb 27 18:15:21 2005
+++ wesnoth/src/gamestatus.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: gamestatus.cpp,v 1.57 2005/02/27 18:15:21 ydirson Exp $ */
+/* $Id: gamestatus.cpp,v 1.58 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -21,6 +21,8 @@
#include "preferences.hpp"
#include "statistics.hpp"
#include "util.hpp"
+#include "serialization/binary_wml.hpp"
+#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include <algorithm>
@@ -420,7 +422,7 @@
}
cfg.clear();
- cfg.detect_format_and_read(file_data);
+ detect_format_and_read(cfg, file_data);
if(cfg.empty()) {
std::cerr << "Could not parse file data into config\n";
@@ -452,7 +454,7 @@
const std::string fname = get_saves_dir() + "/" + name;
- write_file(fname,preferences::compress_saves() ?
cfg.write_compressed() : cfg.write());
+ write_file(fname, preferences::compress_saves() ?
write_compressed(cfg) : write(cfg));
config& summary = save_summary(state.label);
extract_summary_data_from_save(state,summary);
@@ -475,7 +477,7 @@
{
if(save_index_loaded == false) {
try {
-
save_index_cfg.detect_format_and_read(read_file(get_save_index_file()));
+ detect_format_and_read(save_index_cfg,
read_file(get_save_index_file()));
} catch(io_exception& e) {
std::cerr << "error reading save index: '" << e.what()
<< "'\n";
} catch(config::error&) {
@@ -516,7 +518,7 @@
{
log_scope("write_save_index()");
try {
-
write_file(get_save_index_file(),save_index().write_compressed());
+ write_file(get_save_index_file(),
write_compressed(save_index()));
} catch(io_exception& e) {
std::cerr << "error writing to save index file: '" << e.what()
<< "'\n";
}
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.70 wesnoth/src/help.cpp:1.71
--- wesnoth/src/help.cpp:1.70 Sun Feb 27 15:43:31 2005
+++ wesnoth/src/help.cpp Sat Mar 5 10:54:25 2005
@@ -26,6 +26,7 @@
#include "util.hpp"
#include "wassert.hpp"
#include "wml_separators.hpp"
+#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
@@ -1671,7 +1672,8 @@
if (*it != "" && (*it)[0] == '[') {
// Should be parsed as WML.
try {
- config cfg(*it);
+ config cfg;
+ read(cfg, *it);
config *child = cfg.child("ref");
if (child != NULL) {
handle_ref_cfg(*child);
@@ -1729,7 +1731,7 @@
if (dst == "") {
std::string msg =
"Ref markup must have dst attribute. Please submit a
bug report if you have not modified the game files yourself. Errornous config:
";
- msg += cfg.write();
+ msg += write(cfg);
throw parse_error(msg);
}
if (show_ref) {
Index: wesnoth/src/language.cpp
diff -u wesnoth/src/language.cpp:1.73 wesnoth/src/language.cpp:1.74
--- wesnoth/src/language.cpp:1.73 Thu Mar 3 21:52:39 2005
+++ wesnoth/src/language.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: language.cpp,v 1.73 2005/03/03 21:52:39 gruikya Exp $ */
+/* $Id: language.cpp,v 1.74 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,6 +17,8 @@
#include "language.hpp"
#include "preferences.hpp"
#include "util.hpp"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
#include <cctype>
#include <cerrno>
@@ -152,7 +154,7 @@
// fill string_table (should be moved somwhere else some day)
try {
- cfg.read(preprocess_file("data/translations/english.cfg"));
+ read(cfg, preprocess_file("data/translations/english.cfg"));
} catch(config::error& e) {
std::cerr << "Could not read english.cfg\n";
throw e;
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.57 wesnoth/src/mapgen.cpp:1.58
--- wesnoth/src/mapgen.cpp:1.57 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/mapgen.cpp Sat Mar 5 10:54:25 2005
@@ -674,8 +674,6 @@
naming = *names_info;
}
- LOG_NG << "random map config: '" << cfg.write() << "'\n";
- LOG_NG << "making dummy race for naming: '" << naming.write() << "'\n";
//make a dummy race for generating names
unit_race name_generator(naming);
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.144 wesnoth/src/multiplayer.cpp:1.145
--- wesnoth/src/multiplayer.cpp:1.144 Thu Mar 3 21:52:39 2005
+++ wesnoth/src/multiplayer.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.144 2005/03/03 21:52:39 gruikya Exp $ */
+/* $Id: multiplayer.cpp,v 1.145 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -12,18 +12,19 @@
*/
#include "global.hpp"
+
+#include "game_config.hpp"
+#include "gettext.hpp"
+#include "log.hpp"
#include "multiplayer.hpp"
#include "multiplayer_ui.hpp"
#include "multiplayer_connect.hpp"
#include "multiplayer_wait.hpp"
#include "multiplayer_lobby.hpp"
#include "multiplayer_create.hpp"
-#include "preferences.hpp"
-#include "game_config.hpp"
-#include "log.hpp"
-#include "playlevel.hpp"
#include "network.hpp"
-#include "gettext.hpp"
+#include "playlevel.hpp"
+#include "preferences.hpp"
#define LOG_NW lg::info(lg::network)
@@ -154,8 +155,6 @@
throw network::error(_("Connection timed out"));
}
- LOG_NW << "login response: '" << data.write() << "'\n";
-
error = data.child("error");
} while(error != NULL);
}
Index: wesnoth/src/multiplayer_wait.cpp
diff -u wesnoth/src/multiplayer_wait.cpp:1.8
wesnoth/src/multiplayer_wait.cpp:1.9
--- wesnoth/src/multiplayer_wait.cpp:1.8 Thu Mar 3 21:52:39 2005
+++ wesnoth/src/multiplayer_wait.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.cpp,v 1.8 2005/03/03 21:52:39 gruikya Exp $ */
+/* $Id: multiplayer_wait.cpp,v 1.9 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -13,6 +13,7 @@
#include "global.hpp"
+#include "gettext.hpp"
#include "log.hpp"
#include "multiplayer_wait.hpp"
#include "preferences.hpp"
@@ -20,7 +21,6 @@
#include "util.hpp"
#include "wassert.hpp"
#include "wml_separators.hpp"
-#include "gettext.hpp"
#include "serialization/string_utils.hpp"
#define LOG_NW lg::info(lg::network)
@@ -267,8 +267,6 @@
}
}
- std::cerr << level_.write() << "\n";
-
// FIXME: To be reviewed
//any replay data is only temporary and should be removed from
Index: wesnoth/src/network.cpp
diff -u wesnoth/src/network.cpp:1.52 wesnoth/src/network.cpp:1.53
--- wesnoth/src/network.cpp:1.52 Wed Mar 2 01:18:57 2005
+++ wesnoth/src/network.cpp Sat Mar 5 10:54:25 2005
@@ -5,6 +5,7 @@
#include "network_worker.hpp"
#include "util.hpp"
#include "wassert.hpp"
+#include "serialization/binary_wml.hpp"
#include "SDL_net.h"
@@ -506,7 +507,7 @@
const schema_map::iterator schema = schemas.find(result);
wassert(schema != schemas.end());
-
cfg.read_compressed(std::string(buf.begin(),buf.end()),schema->second.incoming);
+ read_compressed(cfg, std::string(buf.begin(), buf.end()),
schema->second.incoming);
return result;
}
@@ -554,7 +555,7 @@
const schema_map::iterator schema = schemas.find(connection_num);
wassert(schema != schemas.end());
- const std::string& value =
cfg.write_compressed(schema->second.outgoing);
+ const std::string& value = write_compressed(cfg,
schema->second.outgoing);
// std::cerr << "--- SEND DATA to " << ((int)connection_num) << ": '"
// << cfg.write() << "'\n--- END SEND DATA\n";
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.336 wesnoth/src/playturn.cpp:1.337
--- wesnoth/src/playturn.cpp:1.336 Tue Mar 1 01:31:15 2005
+++ wesnoth/src/playturn.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.336 2005/03/01 01:31:15 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.337 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2032,7 +2032,6 @@
cfg["team_name"] = teams_[gui_.viewing_team()].team_name();
}
- lg::info(lg::config) << "logging speech: '" << cfg.write() << "'\n";
recorder.speak(cfg);
gui_.add_chat_message(cfg["description"],side,message,
private_message ? display::MESSAGE_PRIVATE :
display::MESSAGE_PUBLIC);
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.136 wesnoth/src/preferences.cpp:1.137
--- wesnoth/src/preferences.cpp:1.136 Sun Feb 27 18:15:21 2005
+++ wesnoth/src/preferences.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.136 2005/02/27 18:15:21 ydirson Exp $ */
+/* $Id: preferences.cpp,v 1.137 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -28,6 +28,7 @@
#include "util.hpp"
#include "wesconfig.h"
#include "wml_separators.hpp"
+#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "widgets/button.hpp"
#include "widgets/label.hpp"
@@ -65,7 +66,7 @@
manager::manager()
{
- prefs.read(read_file(get_prefs_file()));
+ read(prefs, read_file(get_prefs_file()));
set_music_volume(music_volume());
set_sound_volume(sound_volume());
@@ -94,7 +95,7 @@
encountered_units_set.clear();
encountered_terrains_set.clear();
try {
- write_file(get_prefs_file(),prefs.write());
+ write_file(get_prefs_file(), write(prefs));
} catch(io_exception&) {
std::cerr << "error writing to preferences file '" <<
get_prefs_file() << "'\n";
}
Index: wesnoth/src/publish_campaign.cpp
diff -u wesnoth/src/publish_campaign.cpp:1.5
wesnoth/src/publish_campaign.cpp:1.6
--- wesnoth/src/publish_campaign.cpp:1.5 Thu Nov 18 04:08:32 2004
+++ wesnoth/src/publish_campaign.cpp Sat Mar 5 10:54:25 2005
@@ -3,6 +3,7 @@
#include "config.hpp"
#include "filesystem.hpp"
#include "publish_campaign.hpp"
+#include "serialization/parser.hpp"
#include <algorithm>
#include <cstring>
@@ -25,12 +26,12 @@
void get_campaign_info(const std::string& campaign_name, config& cfg)
{
- cfg.read(read_file(campaign_dir() + "/" + campaign_name + ".pbl"));
+ read(cfg, read_file(campaign_dir() + "/" + campaign_name + ".pbl"));
}
void set_campaign_info(const std::string& campaign_name, const config& cfg)
{
- write_file(campaign_dir() + "/" + campaign_name + ".pbl", cfg.write());
+ write_file(campaign_dir() + "/" + campaign_name + ".pbl", write(cfg));
}
std::vector<std::string> available_campaigns()
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.92 wesnoth/src/replay.cpp:1.93
--- wesnoth/src/replay.cpp:1.92 Sun Feb 20 11:12:29 2005
+++ wesnoth/src/replay.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.92 2005/02/20 11:12:29 silene Exp $ */
+/* $Id: replay.cpp,v 1.93 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -933,7 +933,7 @@
}
fix_shroud = true;
} else {
- ERR_NW << "unrecognized action: '" << cfg->write() <<
"'\n";
+ ERR_NW << "unrecognized action\n";
throw replay::error();
}
Index: wesnoth/src/serialization/preprocessor.cpp
diff -u wesnoth/src/serialization/preprocessor.cpp:1.1
wesnoth/src/serialization/preprocessor.cpp:1.2
--- wesnoth/src/serialization/preprocessor.cpp:1.1 Sun Feb 20 19:22:31 2005
+++ wesnoth/src/serialization/preprocessor.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.cpp,v 1.1 2005/02/20 19:22:31 silene Exp $ */
+/* $Id: preprocessor.cpp,v 1.2 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -21,13 +21,6 @@
#include <sstream>
#include <vector>
-#if 0
-#include "config.hpp"
-#include "game_config.hpp"
-#include "game_events.hpp"
-#include "gettext.hpp"
-#include "util.hpp"
-#endif
#include "filesystem.hpp"
#include "log.hpp"
#include "wesconfig.h"
@@ -37,28 +30,10 @@
#define ERR_CF lg::err(lg::config)
#define LOG_CF lg::info(lg::config)
-bool line_source::operator<(line_source const &v) const {
- return linenum < v.linenum;
-}
-
bool preproc_define::operator==(preproc_define const &v) const {
return value == v.value && arguments == v.arguments;
}
-line_source get_line_source(std::vector< line_source > const &line_src, int
line)
-{
- line_source res(line, "", 0);
- std::vector< line_source >::const_iterator it =
- std::upper_bound(line_src.begin(), line_src.end(), res);
- if (it != line_src.begin()) {
- --it;
- res.file = it->file;
- res.fileline = it->fileline + (line - it->linenum);
- }
-
- return res;
-}
-
// FIXME
struct config {
struct error {
Index: wesnoth/src/serialization/preprocessor.hpp
diff -u wesnoth/src/serialization/preprocessor.hpp:1.1
wesnoth/src/serialization/preprocessor.hpp:1.2
--- wesnoth/src/serialization/preprocessor.hpp:1.1 Sun Feb 20 19:22:31 2005
+++ wesnoth/src/serialization/preprocessor.hpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: preprocessor.hpp,v 1.1 2005/02/20 19:22:31 silene Exp $ */
+/* $Id: preprocessor.hpp,v 1.2 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -28,11 +28,9 @@
int linenum;
std::string file;
int fileline;
- bool operator<(line_source const &) const;
+ bool operator<(line_source const &v) const { return linenum <
v.linenum; }
};
-line_source get_line_source(std::vector< line_source > const &line_src, int
line);
-
struct preproc_define
{
preproc_define() {}
Index: wesnoth/src/server/game.cpp
diff -u wesnoth/src/server/game.cpp:1.30 wesnoth/src/server/game.cpp:1.31
--- wesnoth/src/server/game.cpp:1.30 Tue Feb 22 23:07:20 2005
+++ wesnoth/src/server/game.cpp Sat Mar 5 10:54:25 2005
@@ -61,7 +61,7 @@
} else if(observers_can_chat() && (*i)->child("speak")
!= NULL && (*i)->all_children().size() == 1) {
;
} else {
- std::cerr << "removing observer's illegal
command: '" << (*i)->write() << "'\n";
+ std::cerr << "removing observer's illegal
command\n";
marked.push_back(index - marked.size());
}
Index: wesnoth/src/server/server.cpp
diff -u wesnoth/src/server/server.cpp:1.70 wesnoth/src/server/server.cpp:1.71
--- wesnoth/src/server/server.cpp:1.70 Thu Mar 3 04:27:11 2005
+++ wesnoth/src/server/server.cpp Sat Mar 5 10:54:25 2005
@@ -157,18 +157,15 @@
void server::dump_stats()
{
- config parent;
- config& stats = parent.add_child("statistics");
-
- stats["num_players"] = str_cast(players_.size());
- stats["lobby_players"] = str_cast(lobby_players_.nplayers());
- stats["num_games"] = str_cast(games_.size());
- stats["start_interval"] = str_cast(last_stats_);
+ time_t old_stats = last_stats_;
last_stats_ = time(NULL);
- stats["end_interval"] = str_cast(last_stats_);
-
- //write and flush the output stream
- std::cout << parent.write() << std::endl;
+
+ std::cout <<
+ "Statistics\n"
+ "\tnum_players = " << players_.size() << "\n"
+ "\tlobby_players = " << lobby_players_.nplayers() << "\n"
+ "\tstart_interval = " << old_stats << "\n"
+ "\tend_interval = " << last_stats_ << std::endl;
}
void server::process_command(const std::string& cmd)
Index: wesnoth/src/team.cpp
diff -u wesnoth/src/team.cpp:1.80 wesnoth/src/team.cpp:1.81
--- wesnoth/src/team.cpp:1.80 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/team.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: team.cpp,v 1.80 2005/02/21 09:05:51 silene Exp $ */
+/* $Id: team.cpp,v 1.81 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -391,9 +391,6 @@
aggression_ = lexical_cast_default<double>(aiparams_["aggression"],0.5);
caution_ = lexical_cast_default<double>(aiparams_["caution"],0.25);
-
- LOG_NG << "for turn " << turn << ", time of day '" << tod.id << "' set
ai_params to: ---\n"
- << aiparams_.write() << "\n---\n";
}
void team::spend_gold(int amount)
Index: wesnoth/src/titlescreen.cpp
diff -u wesnoth/src/titlescreen.cpp:1.32 wesnoth/src/titlescreen.cpp:1.33
--- wesnoth/src/titlescreen.cpp:1.32 Thu Jan 20 23:03:25 2005
+++ wesnoth/src/titlescreen.cpp Sat Mar 5 10:54:25 2005
@@ -16,6 +16,8 @@
#include "titlescreen.hpp"
#include "util.hpp"
#include "video.hpp"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
#include "SDL_ttf.h"
@@ -124,7 +126,7 @@
std::cerr << "Loading tips of day\n";
try {
- cfg.read(preprocess_file("data/tips.cfg"));
+ read(cfg, preprocess_file("data/tips.cfg"));
} catch(config::error&) {
std::cerr << "Could not read tips.cfg\n";
}
Index: wesnoth/src/tools/exploder_cutter.cpp
diff -u wesnoth/src/tools/exploder_cutter.cpp:1.4
wesnoth/src/tools/exploder_cutter.cpp:1.5
--- wesnoth/src/tools/exploder_cutter.cpp:1.4 Sun Feb 20 21:45:22 2005
+++ wesnoth/src/tools/exploder_cutter.cpp Sat Mar 5 10:54:25 2005
@@ -1,4 +1,4 @@
-/* $Id: exploder_cutter.cpp,v 1.4 2005/02/20 21:45:22 silene Exp $ */
+/* $Id: exploder_cutter.cpp,v 1.5 2005/03/05 10:54:25 silene Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -14,6 +14,8 @@
#include "exploder_cutter.hpp"
#include "filesystem.hpp"
#include "sdl_utils.hpp"
+#include "serialization/parser.hpp"
+#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "SDL_image.h"
@@ -30,7 +32,7 @@
config res;
try {
- res.read(pre_conf_string);
+ read(res, pre_conf_string);
} catch(config::error err) {
throw exploder_failure("Unable to load the configuration for
the file " + filename + ": "+ err.message);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src Makefile.am config.cpp config.hpp f...,
Guillaume Melquiond <=