- bugfix (And removal) for stop command and animation stopping when upgrading
This commit is contained in:
parent
7560970590
commit
1fc330ace3
|
@ -36,8 +36,6 @@ using namespace Shared::Util;
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const int UnitPathBasic::maxBlockCount= GameConstants::updateFps / 2;
|
const int UnitPathBasic::maxBlockCount= GameConstants::updateFps / 2;
|
||||||
const int updateUnitForStopCommandFrameCount = 40;
|
|
||||||
const bool updateUnitForStopCommandFrameCountEnabled = false;
|
|
||||||
|
|
||||||
UnitPathBasic::UnitPathBasic() {
|
UnitPathBasic::UnitPathBasic() {
|
||||||
this->blockCount = 0;
|
this->blockCount = 0;
|
||||||
|
@ -205,7 +203,6 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
throw runtime_error("#2 Invalid path position = " + pos.getString());
|
throw runtime_error("#2 Invalid path position = " + pos.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->lastStopCommandCheckFrame = 0;
|
|
||||||
this->unitPath = unitpath;
|
this->unitPath = unitpath;
|
||||||
this->unitPath->setMap(map);
|
this->unitPath->setMap(map);
|
||||||
this->pos=pos;
|
this->pos=pos;
|
||||||
|
@ -1106,19 +1103,6 @@ bool Unit::needToUpdate() {
|
||||||
|
|
||||||
if(newProgress >= 1.f) {
|
if(newProgress >= 1.f) {
|
||||||
return_value = true;
|
return_value = true;
|
||||||
|
|
||||||
if(updateUnitForStopCommandFrameCountEnabled == true) {
|
|
||||||
if(currSkill->getClass() != scDie) {
|
|
||||||
if(currSkill->getClass() == scStop) {
|
|
||||||
return_value = false;
|
|
||||||
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
|
|
||||||
if(this->getLastStopCommandCheckFrame() <= 0 ||
|
|
||||||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
|
|
||||||
return_value = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return return_value;
|
return return_value;
|
||||||
|
@ -1212,17 +1196,6 @@ bool Unit::update() {
|
||||||
if(currSkill->getClass() != scDie) {
|
if(currSkill->getClass() != scDie) {
|
||||||
progress = 0.f;
|
progress = 0.f;
|
||||||
return_value = true;
|
return_value = true;
|
||||||
if(updateUnitForStopCommandFrameCountEnabled == true) {
|
|
||||||
if(currSkill->getClass() == scStop && this->anyCommand() == false) {
|
|
||||||
return_value = false;
|
|
||||||
uint32 framesSinceLastCheck = (game->getWorld()->getFrameCount() - this->getLastStopCommandCheckFrame());
|
|
||||||
if(this->getLastStopCommandCheckFrame() <= 0 ||
|
|
||||||
framesSinceLastCheck >= updateUnitForStopCommandFrameCount) {
|
|
||||||
this->setLastStopCommandCheckFrame(game->getWorld()->getFrameCount());
|
|
||||||
return_value = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
progress= 1.f;
|
progress= 1.f;
|
||||||
|
|
|
@ -331,7 +331,6 @@ private:
|
||||||
static Game *game;
|
static Game *game;
|
||||||
|
|
||||||
bool ignoreCheckCommand;
|
bool ignoreCheckCommand;
|
||||||
uint32 lastStopCommandCheckFrame;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);
|
Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);
|
||||||
|
@ -497,9 +496,6 @@ public:
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
bool needToUpdate();
|
bool needToUpdate();
|
||||||
|
|
||||||
uint32 getLastStopCommandCheckFrame() const {return lastStopCommandCheckFrame; }
|
|
||||||
void setLastStopCommandCheckFrame(uint32 value) { lastStopCommandCheckFrame = value; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float computeHeight(const Vec2i &pos) const;
|
float computeHeight(const Vec2i &pos) const;
|
||||||
void updateTarget();
|
void updateTarget();
|
||||||
|
|
|
@ -269,16 +269,12 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
|
||||||
if(unit->anyCommand() == false && unit->isOperative()) {
|
if(unit->anyCommand() == false && unit->isOperative()) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(unit->getType()->hasSkillClass(scAttack) || unit->getType()->hasCommandClass(ccMove)) {
|
if(unit->getType()->hasSkillClass(scStop)) {
|
||||||
//printf("\n\n\n$$$$$$$$$ Unit [%s - %d] unitFrame [%d] WorldFrame [%d]\n",unit->getFullName().c_str(),unit->getId(),unit->getLastStopCommandCheckFrame(),world->getFrameCount());
|
unit->setCurrSkill(scStop);
|
||||||
if(unit->getType()->hasSkillClass(scStop)) {
|
}
|
||||||
unit->setCurrSkill(scStop);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(unit->getType()->hasCommandClass(ccStop)) {
|
if(unit->getType()->hasCommandClass(ccStop)) {
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
unit->giveCommand(new Command(unit->getType()->getFirstCtOfClass(ccStop)));
|
||||||
unit->giveCommand(new Command(unit->getType()->getFirstCtOfClass(ccStop)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -346,9 +342,6 @@ void UnitUpdater::updateStop(Unit *unit, int frameIndex) {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// printf("\n\n\n################ Unit [%s - %d] unitFrame [%d] WorldFrame [%d]\n",unit->getFullName().c_str(),unit->getId(),unit->getLastStopCommandCheckFrame(),world->getFrameCount());
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue