Author: crab
Date: Mon Apr  6 16:44:19 2009
New Revision: 34585

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34585&view=rev
Log:
Added ability to change the share_view side attribute using [modify_side] tag. 
Be sure to use fog=yes for that side and have it as an ally  (bug #13320)

Modified:
    trunk/changelog
    trunk/src/game_events.cpp
    trunk/src/team.cpp
    trunk/src/team.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=34585&r1=34584&r2=34585&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Mon Apr  6 16:44:19 2009
@@ -70,6 +70,8 @@
    * [switch] and [case]/[else] can be used to wrap story [part]s in [story]
      now (bug #13170)
    * Added a "preload" WML event type.
+   * Added ability to change the share_view team attribute using [modify_side] 
tag. 
+     Be sure to use fog=yes for that side  (bug #13320)
    * Added support for Lua scripts in WML event actions ([lua] tag)
  * Miscellaneous and bugfixes:
    * Fixed compilation with -D_GLIBCXX_PARALLEL

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=34585&r1=34584&r2=34585&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Mon Apr  6 16:44:19 2009
@@ -816,6 +816,7 @@
                 * to change it on the fly without causing visual glitches
                 */
                std::string switch_ai = cfg["switch_ai"];
+               std::string share_view = cfg["share_view"];
 
                assert(state_of_game != NULL);
                const int side_num = lexical_cast_default<int>(side,1);
@@ -879,6 +880,14 @@
                        if (!switch_ai.empty()) {
                                
ai_manager::add_ai_for_team_from_file(side_num,switch_ai);
                        }
+                       // Add shared view to current team
+                       if (!share_view.empty()){
+                               (*teams)[team_index].set_share_view( 
utils::string_bool(share_view, true) );
+                               team::clear_caches();
+                               screen->recalculate_minimap();
+                               screen->invalidate_all();
+                       }
+
                }
        }
 

Modified: trunk/src/team.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.cpp?rev=34585&r1=34584&r2=34585&view=diff
==============================================================================
--- trunk/src/team.cpp (original)
+++ trunk/src/team.cpp Mon Apr  6 16:44:19 2009
@@ -574,6 +574,10 @@
        return 
std::find(info_.enemies.begin(),info_.enemies.end(),int(index+1)) != 
info_.enemies.end();
 }
 
+void team::set_share_view( bool share_view ){
+       info_.share_view = share_view;
+}
+
 void team::change_controller(const std::string& controller)
 {
        team::team_info::CONTROLLER cid;
@@ -605,6 +609,10 @@
                info_.user_team_name = name;
        }
 
+       clear_caches(); 
+}
+
+void team::clear_caches(){
        // Reset the cache of allies for all teams
        if(teams != NULL) {
                for(std::vector<team>::const_iterator i = teams->begin(); i != 
teams->end(); ++i) {

Modified: trunk/src/team.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.hpp?rev=34585&r1=34584&r2=34585&view=diff
==============================================================================
--- trunk/src/team.hpp (original)
+++ trunk/src/team.hpp Mon Apr  6 16:44:19 2009
@@ -306,6 +306,12 @@
 
        void log_recruitable();
 
+       /**set the share view attribute */
+       void set_share_view( bool share_view );
+
+       /** clear the shroud, fog, and enemies cache for all teams*/
+       static void clear_caches();
+
 private:
        //Make these public if you need them, but look at knows_about_team(...) 
first.
        bool share_maps() const { return info_.share_maps; }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to