1 /***************************************************************************
2  *      Mechanized Assault and Exploration Reloaded Projectfile            *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18  ***************************************************************************/
19 
20 #include "game/data/report/savedreportsimple.h"
21 
22 #include "netmessage.h"
23 #include "main.h" //lngPack
24 
25 //------------------------------------------------------------------------------
cSavedReportSimple(eSavedReportType type_)26 cSavedReportSimple::cSavedReportSimple (eSavedReportType type_) :
27 	type (type_)
28 {
29 	// TODO: check valid type?!
30 }
31 
32 //------------------------------------------------------------------------------
getType() const33 eSavedReportType cSavedReportSimple::getType() const
34 {
35 	return type;
36 }
37 
38 //------------------------------------------------------------------------------
getMessage() const39 std::string cSavedReportSimple::getMessage() const
40 {
41 	switch (type)
42 	{
43 		case eSavedReportType::MetalInsufficient:
44 			return lngPack.i18n ("Text~Comp~Metal_Insufficient");
45 		case eSavedReportType::FuelInsufficient:
46 			return lngPack.i18n ("Text~Comp~Fuel_Insufficient");
47 		case eSavedReportType::GoldInsufficient:
48 			return lngPack.i18n ("Text~Comp~Gold_Insufficient");
49 		case eSavedReportType::EnergyInsufficient:
50 			return lngPack.i18n ("Text~Comp~Energy_Insufficient");
51 		case eSavedReportType::TeamInsufficient:
52 			return lngPack.i18n ("Text~Comp~Team_Insufficient");
53 
54 		case eSavedReportType::MetalLow:
55 			return lngPack.i18n ("Text~Comp~Metal_Low");
56 		case eSavedReportType::FuelLow:
57 			return lngPack.i18n ("Text~Comp~Fuel_Low");
58 		case eSavedReportType::GoldLow:
59 			return lngPack.i18n ("Text~Comp~Gold_Low");
60 		case eSavedReportType::EnergyLow:
61 			return lngPack.i18n ("Text~Comp~Energy_ToLow");
62 		case eSavedReportType::TeamLow:
63 			return lngPack.i18n ("Text~Comp~Team_Low");
64 
65 		case eSavedReportType::EnergyToLow:
66 			return lngPack.i18n ("Text~Comp~Energy_ToLow");
67 		case eSavedReportType::EnergyIsNeeded:
68 			return lngPack.i18n ("Text~Comp~Energy_IsNeeded");
69 
70 		case eSavedReportType::BuildingDisabled:
71 			return lngPack.i18n ("Text~Comp~Building_Disabled");
72 
73 		case eSavedReportType::ProducingError:
74 			return lngPack.i18n ("Text~Comp~Producing_Err");
75 
76 		case eSavedReportType::TurnWait:
77 			return lngPack.i18n ("Text~Comp~Turn_Wait");
78 		case eSavedReportType::TurnAutoMove:
79 			return lngPack.i18n ("Text~Comp~Turn_Automove");
80 		default: break;
81 	}
82 	return "";
83 }
84 
85 //------------------------------------------------------------------------------
isAlert() const86 bool cSavedReportSimple::isAlert() const
87 {
88 	switch (type)
89 	{
90 		case eSavedReportType::MetalInsufficient:
91 		case eSavedReportType::FuelInsufficient:
92 		case eSavedReportType::GoldInsufficient:
93 		case eSavedReportType::EnergyInsufficient:
94 		case eSavedReportType::TeamInsufficient:
95 		case eSavedReportType::EnergyIsNeeded:
96 		case eSavedReportType::BuildingDisabled:
97 			return true;
98 		default:
99 			return false;
100 	}
101 	return false;
102 }
103