1 /***************************************************************************
2  *   Copyright (C) 2009 by Andrey Afletdinov <fheroes2@gmail.com>          *
3  *                                                                         *
4  *   Part of the Free Heroes2 Engine:                                      *
5  *   http://sourceforge.net/projects/fheroes2                              *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21  ***************************************************************************/
22 
23 #include "morale.h"
24 #include "tools.h"
25 #include "translations.h"
26 
String(int morale)27 std::string Morale::String( int morale )
28 {
29     switch ( morale ) {
30     case Morale::TREASON:
31         return _( "morale|Treason" );
32     case Morale::AWFUL:
33         return _( "morale|Awful" );
34     case Morale::POOR:
35         return _( "morale|Poor" );
36     case Morale::NORMAL:
37         return _( "morale|Normal" );
38     case Morale::GOOD:
39         return _( "morale|Good" );
40     case Morale::GREAT:
41         return _( "morale|Great" );
42     case Morale::BLOOD:
43         return _( "morale|Blood!" );
44     default:
45         break;
46     }
47 
48     return "Unknown";
49 }
50 
Description(int morale)51 std::string Morale::Description( int morale )
52 {
53     switch ( morale ) {
54     case Morale::TREASON:
55     case Morale::AWFUL:
56     case Morale::POOR:
57         return _( "Bad morale may cause your armies to freeze in combat." );
58     case Morale::NORMAL:
59         return _( "Neutral morale means your armies will never be blessed with extra attacks or freeze in combat." );
60     case Morale::GOOD:
61     case Morale::GREAT:
62     case Morale::BLOOD:
63         return _( "Good morale may give your armies extra attacks in combat." );
64     default:
65         break;
66     }
67 
68     return "Unknown";
69 }
70 
Normalize(const int morale)71 int Morale::Normalize( const int morale )
72 {
73     return clamp( morale, static_cast<int>( Morale::TREASON ), static_cast<int>( Morale::BLOOD ) );
74 }
75