1 /* 2 * Copyright (C) 2011-2016 OpenDungeons Team 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 3 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, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #include "creatureaction/CreatureAction.h" 19 20 #include "entities/Creature.h" 21 #include "utils/Helper.h" 22 #include "utils/LogManager.h" 23 24 #include <istream> 25 toString(CreatureActionType actionType)26std::string CreatureAction::toString(CreatureActionType actionType) 27 { 28 switch (actionType) 29 { 30 case CreatureActionType::walkToTile: 31 return "walkToTile"; 32 33 case CreatureActionType::fight: 34 return "fight"; 35 36 case CreatureActionType::fightFriendly: 37 return "fightFriendly"; 38 39 case CreatureActionType::searchTileToDig: 40 return "searchTileToDig"; 41 42 case CreatureActionType::digTile: 43 return "digTile"; 44 45 case CreatureActionType::searchWallTileToClaim: 46 return "searchWallTileToClaim"; 47 48 case CreatureActionType::claimWallTile: 49 return "claimWallTile"; 50 51 case CreatureActionType::searchGroundTileToClaim: 52 return "searchGroundTileToClaim"; 53 54 case CreatureActionType::claimGroundTile: 55 return "claimGroundTile"; 56 57 case CreatureActionType::findHome: 58 return "findHome"; 59 60 case CreatureActionType::sleep: 61 return "sleep"; 62 63 case CreatureActionType::searchJob: 64 return "searchJob"; 65 66 case CreatureActionType::useRoom: 67 return "useRoom"; 68 69 case CreatureActionType::searchFood: 70 return "searchFood"; 71 72 case CreatureActionType::eatChicken: 73 return "eatChicken"; 74 75 case CreatureActionType::flee: 76 return "flee"; 77 78 case CreatureActionType::searchEntityToCarry: 79 return "searchEntityToCarry"; 80 81 case CreatureActionType::grabEntity: 82 return "grabEntity"; 83 84 case CreatureActionType::carryEntity: 85 return "carryEntity"; 86 87 case CreatureActionType::getFee: 88 return "getFee"; 89 90 case CreatureActionType::leaveDungeon: 91 return "leaveDungeon"; 92 93 case CreatureActionType::stealFreeGold: 94 return "stealFreeGold"; 95 96 default: 97 assert(false); 98 break; 99 } 100 101 return "unhandledAct=" + Helper::toString(static_cast<uint32_t>(actionType)); 102 } 103