rendered paste body#include "monster2.hpp"
int Combatant::getDirection(void)
{
return direction;
}
AnimationSet *Combatant::getAnimationSet(void)
{
return animSet;
}
CombatLocation Combatant::getLocation(void)
{
return location;
}
CombatLoyalty Combatant::getLoyalty(void)
{
return loyalty;
}
std::string Combatant::getName(void)
{
return name;
}
std::string Combatant::getPrintableName(void)
{
return printableName;
}
void Combatant::setDirection(Direction dir)
{
direction = dir;
}
void Combatant::setInfo(CombatantInfo &newinfo)
{
memcpy(&info, &newinfo, sizeof(CombatantInfo));
}
void Combatant::setLocation(CombatLocation l)
{
location = l;
}
void Combatant::setLoyalty(CombatLoyalty l)
{
loyalty = l;
}
Combatant::Combatant(const std::string &name) :
name(name)
{
printf("Combatant::Combatant\n");
/* Chop of everything from '_' to the end of the string
* so we can share animations between "different"
* enemies. Keep the original in tact.
*/
std::string s = name;
std::string::size_type loc = s.find("_", 0);
s = s.substr(0, loc);
printableName = s;
s = getResource("combat_media/") + s + ".png";
animSet = new AnimationSet(s);
animSet->setSubAnimation("stand");
status.type = COMBAT_WAITING;
}
Combatant::~Combatant(void)
{
printf("~Combatant\n");
delete animSet;
}