| 1245 | } |
| 1246 | |
| 1247 | static std::string getVerb(df::unit* unit, const std::string &reportStr) { |
| 1248 | std::string result(reportStr); |
| 1249 | std::string name = unit->name.first_name + " "; |
| 1250 | bool match = strncmp(result.c_str(), name.c_str(), name.length()) == 0; |
| 1251 | if ( match ) { |
| 1252 | result = result.substr(name.length()); |
| 1253 | result = result.substr(0,result.length()-1); |
| 1254 | return result; |
| 1255 | } |
| 1256 | //use profession name |
| 1257 | name = "The " + Units::getProfessionName(unit) + " "; |
| 1258 | match = strncmp(result.c_str(), name.c_str(), name.length()) == 0; |
| 1259 | if ( match ) { |
| 1260 | result = result.substr(name.length()); |
| 1261 | result = result.substr(0,result.length()-1); |
| 1262 | return result; |
| 1263 | } |
| 1264 | |
| 1265 | if ( unit->id != 0 ) { |
| 1266 | return ""; |
| 1267 | } |
| 1268 | |
| 1269 | std::string you = "You "; |
| 1270 | match = strncmp(result.c_str(), name.c_str(), name.length()) == 0; |
| 1271 | if ( match ) { |
| 1272 | result = result.substr(name.length()); |
| 1273 | result = result.substr(0,result.length()-1); |
| 1274 | return result; |
| 1275 | } |
| 1276 | return ""; |
| 1277 | } |
| 1278 | |
| 1279 | static InteractionData getAttacker(color_ostream& out, df::report* attackEvent, df::unit* lastAttacker, df::report* defendEvent, vector<df::unit*>& relevantUnits) { |
| 1280 | vector<df::unit*> attackers = relevantUnits; |
no test coverage detected