unit_display.hpp

Go to the documentation of this file.
00001 /* $Id: unit_display.hpp 26777 2008-05-22 17:40:20Z mordante $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 /**
00016  *  @file unit_display.hpp
00017  *  Display units performing various actions: moving, attacking, and dying.
00018  */
00019 
00020 #ifndef UNIT_DISPLAY_HPP_INCLUDED
00021 #define UNIT_DISPLAY_HPP_INCLUDED
00022 
00023 #include "map.hpp"
00024 
00025 class attack_type;
00026 class team;
00027 class unit;
00028 class unit_map;
00029 
00030 /**
00031  *  Contains a number of free functions which display units
00032  *
00033  *  performing various on-screen actions - moving, attacking, and dying.
00034  */
00035 namespace unit_display
00036 {
00037 bool unit_visible_on_path( const std::vector<gamemap::location>& path, const unit& u, const unit_map& units, const std::vector<team>& teams);
00038 
00039 /** Display a unit moving along a given path. */
00040 void move_unit(const std::vector<gamemap::location>& path, unit& u, const std::vector<team>& teams);
00041 
00042 /**
00043  * Show a unit fading out.
00044  *
00045  * Note: this only shows the effect, it doesn't actually kill the unit.
00046  */
00047 void unit_die( const gamemap::location& loc, unit& u, const attack_type* attack=NULL, const attack_type*secondary_attack=NULL, unit * winner=NULL);
00048 
00049 /**
00050  *  Make the unit on tile 'a' attack the unit on tile 'b'.
00051  *
00052  *  The 'damage' will be subtracted from the unit's hitpoints,
00053  *  and a die effect will be displayed if the unit dies.
00054  *
00055  *  @retval true                  if the defending unit is dead, should be 
00056  *                                removed from the playing field.
00057  */
00058 void unit_attack(
00059                  const gamemap::location& a, const gamemap::location& b, int damage,
00060                  const attack_type& attack, const attack_type* secondary_attack,
00061          int swing,std::string hit_text,bool drain,std::string att_text);
00062 void unit_recruited(gamemap::location& loc);
00063 
00064 /**
00065  *  Set healer_loc to an invalid location if there are no healers.
00066  *
00067  *  This will use a poisoning anim if healing<0.
00068  */
00069 void unit_healing(unit& healed,gamemap::location& healed_loc, std::vector<unit_map::iterator> healers, int healing);
00070 }
00071 
00072 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs