[Widelands-cvs] SF.net SVN: widelands:[3275] trunk
Status: Beta
Brought to you by:
sirver
From: <nas...@us...> - 2008-08-25 20:14:07
|
Revision: 3275 http://widelands.svn.sourceforge.net/widelands/?rev=3275&view=rev Author: nasenbaer_peter Date: 2008-08-25 20:13:55 +0000 (Mon, 25 Aug 2008) Log Message: ----------- * Make game_tips constructor more dynamic and use it for the editor. * Another small fix for better s2map loading for the editor to allow loading of maps even if no starting positions are set. * Add comment about wexception to player.cc * Update one entry in txts/gametips and add txts/editortips (would be nice if someone with better English knowledge would take a look in it ;-) ) Modified Paths: -------------- trunk/src/editor/editorinteractive.cc trunk/src/game_tips.cc trunk/src/game_tips.h trunk/src/player.cc trunk/src/s2map.cc trunk/txts/gametips Added Paths: ----------- trunk/txts/editortips Modified: trunk/src/editor/editorinteractive.cc =================================================================== --- trunk/src/editor/editorinteractive.cc 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/src/editor/editorinteractive.cc 2008-08-25 20:13:55 UTC (rev 3275) @@ -28,6 +28,7 @@ #include "editor_player_menu.h" #include "editor_tool_menu.h" #include "editor_toolsize_menu.h" +#include "game_tips.h" #include "graphic.h" #include "i18n.h" #include "interactive_base.h" @@ -122,6 +123,7 @@ Widelands::Map_Loader * const ml = map.get_correct_loader(filename.c_str()); UI::ProgressWindow loader_ui("pics/editor.jpg"); + GameTips editortips (loader_ui, "txts/editortips"); { std::string const old_world_name = map.get_world_name(); ml->preload_map(true); @@ -526,6 +528,7 @@ editor.set_iabase(&eia); //TODO: get rid of this { UI::ProgressWindow loader_ui("pics/editor.jpg"); + GameTips editortips (loader_ui, "txts/editortips"); g_gr->flush(PicMod_Menu); { Modified: trunk/src/game_tips.cc =================================================================== --- trunk/src/game_tips.cc 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/src/game_tips.cc 2008-08-25 20:13:55 UTC (rev 3275) @@ -32,7 +32,7 @@ #define GAMETIPS_TEXTAREA_BORDER 2 #define GAMETIPS_DEFAULT_PADDING 15 -GameTips::GameTips(UI::ProgressWindow & progressWindow) +GameTips::GameTips(UI::ProgressWindow & progressWindow, std::string filename) : m_lastUpdated (0), m_updateAfter (0), @@ -45,8 +45,6 @@ // Skip, if no triggers saved // Load the TrueType Font - std::string filename = "txts/gametips"; - try { Profile prof(filename.c_str()); if (Section * const s = prof.get_section("global")) { Modified: trunk/src/game_tips.h =================================================================== --- trunk/src/game_tips.h 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/src/game_tips.h 2008-08-25 20:13:55 UTC (rev 3275) @@ -28,7 +28,8 @@ /// Displays game tips in progress window struct GameTips : public UI::IProgressVisualization { - GameTips(UI::ProgressWindow & progressWindow); + GameTips(UI::ProgressWindow & progressWindow, + std::string filename = "txts/gametips"); virtual ~GameTips(); virtual void update(bool repaint); Modified: trunk/src/player.cc =================================================================== --- trunk/src/player.cc 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/src/player.cc 2008-08-25 20:13:55 UTC (rev 3275) @@ -90,11 +90,13 @@ Coords starting_pos = map.get_starting_pos(m_plnum); if (!starting_pos) + // TODO don't use wexception as this is not a "bug" in this case throw wexception("Player %u has no starting point", m_plnum); FCoords fpos = map.get_fcoords(starting_pos); if ((fpos.field->get_caps() & BUILDCAPS_SIZEMASK) < BUILDCAPS_BIG) + // TODO don't use wexception as this is not a "bug" in this case throw wexception("Starting point of player %u is too small", m_plnum); Player_Area<Area<FCoords> > starting_area Modified: trunk/src/s2map.cc =================================================================== --- trunk/src/s2map.cc 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/src/s2map.cc 2008-08-25 20:13:55 UTC (rev 3275) @@ -744,10 +744,12 @@ log(msg); Widelands::Coords starting_pos = m_map.get_starting_pos(p); - if (!starting_pos) - // TODO don't use wexception as this is not a "bug" in this case - throw wexception("Player %u has no starting point. Please try " - "to fix this in the widelands editor", p); + if (!starting_pos) { + // Do not throw exception, else map won't be loadable in editor + // Player initialisation will keep track about missing starting pos. + log("Has no starting position.\n"); + continue; + } Widelands::FCoords fpos = m_map.get_fcoords(starting_pos); // WTF? can anyone tell me why get_caps() returns 39 for @@ -755,10 +757,7 @@ // Below is a hack to make it work - but I didn't found the reason yet. int32_t BIG = 39; if (fpos.field->get_caps() != BIG) { //Widelands::BUILDCAPS_BIG) { - - snprintf(msg, sizeof(msg), - "wrong size - trying to fix it:\n"); - log(msg); + log("wrong size - trying to fix it:\n"); // Try to find a BUILDCAPS_BIG place near original start point Widelands::FCoords tl = m_map.tl_n(fpos); Widelands::FCoords l = m_map .l_n(fpos); @@ -856,10 +855,10 @@ log(" Starting position was successfully fixed " "during 2nd try!\n"); } else { - // TODO don't use wexception as this is not a "bug" in this case - throw wexception("Player %u has invalid starting point, " - "that couldn't be fixed. Please try to fix it " - "manually in the editor.", p); + // Do not throw exception, else map won't be loadable in editor + // Player initialisation will keep track about wrong starting pos. + log("invalid starting point, that couldn't be fixed.\n"); + log(" Please try to fix it manually in the editor.\n"); } } } else Added: trunk/txts/editortips =================================================================== --- trunk/txts/editortips (rev 0) +++ trunk/txts/editortips 2008-08-25 20:13:55 UTC (rev 3275) @@ -0,0 +1,46 @@ +[global] +background=pics/tips_bg.png +width=400 +height=160 +padding-left=48 +padding-top=28 +padding-right=48 +padding-bottom=28 +background-color=dfd1ad +text-color=21211b + +[Tip 1] +text=_"You can find general help for the editor as well as a short tutorial in our wiki at www.widelands.org" +sec=6 + +[Tip 2] +text=_"You can select multiple nature objects (bobs) if you hold down CTRL during selection. If you than click on the map, one of the selected objects will be randomly placed." +sec=7 + +[Tip 3] +text=_"Like with natural objects (bobs), you can also select multiple animals or groundtextures with CTRL + Mouseclick." +sec=6 + +[Tip 4] +text=_"Holding down SHIFT switches first alternative tool on. This tool is in most cases the complete difference of the normal tool (for example deletion of an object instead of placing one)." +sec=7 + +[Tip 5] +text=_"Holding down ALT switches second alternative tool on (if it exists)." +sec=6 + +[Tip 6] +text=_"The number keys (1 - 0) allow you to directly set the size of the selected area around your mouse." +sec=6 + +[Tip 7] +text=_"SPACE key behaves like in normal game. It switches buildhelp on or off." +sec=6 + +[Tip 8] +text=_"The tools for events, triggers, event chains and objectives are still under heavy development. If you've got a question or found a problem, meet us in the editor forums at www.widelands.org" +sec=7 + +[Tip 9] +text=_"You can find a reference for all triggers and events in our wiki at widelands.org." +sec=6 Property changes on: trunk/txts/editortips ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/txts/gametips =================================================================== --- trunk/txts/gametips 2008-08-24 13:37:07 UTC (rev 3274) +++ trunk/txts/gametips 2008-08-25 20:13:55 UTC (rev 3275) @@ -42,7 +42,7 @@ sec=5 [Tip 9] -text=_Any further questions? Meet us at www.widelands.org. There are our FAQs, the Wiki and of course our Community Forums. +text=_Any further questions? Our FAQs, the wiki and of course our community forums can be found at www.widelands.org. sec=6 [Tip 10] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |