you can attack teammates again; fix for attack queuing, units don't walk to dead bodies if next attack command is in queue ;
This commit is contained in:
parent
54f739c15d
commit
45a3601286
|
@ -58,6 +58,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
|
||||||
lastRenderLog2d = 0;
|
lastRenderLog2d = 0;
|
||||||
totalRenderFps = 0;
|
totalRenderFps = 0;
|
||||||
|
|
||||||
|
mouseMoved= false;
|
||||||
quitTriggeredIndicator = false;
|
quitTriggeredIndicator = false;
|
||||||
originalDisplayMsgCallback = NULL;
|
originalDisplayMsgCallback = NULL;
|
||||||
thisGamePtr = this;
|
thisGamePtr = this;
|
||||||
|
@ -1029,6 +1030,11 @@ void Game::mouseDownRight(int x, int y){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::mouseUpCenter(int x, int y){
|
||||||
|
if (!mouseMoved) gameCamera.resetPosition();
|
||||||
|
else mouseMoved = false;
|
||||||
|
}
|
||||||
|
|
||||||
void Game::mouseUpLeft(int x, int y){
|
void Game::mouseUpLeft(int x, int y){
|
||||||
try {
|
try {
|
||||||
gui.mouseUpLeftGraphics(x, y);
|
gui.mouseUpLeftGraphics(x, y);
|
||||||
|
@ -1085,6 +1091,7 @@ void Game::mouseMove(int x, int y, const MouseState *ms){
|
||||||
// gameCamera.moveForwardH((y - lastMousePos.y) * speed, response);
|
// gameCamera.moveForwardH((y - lastMousePos.y) * speed, response);
|
||||||
// gameCamera.moveSideH((x - lastMousePos.x) * speed, response);
|
// gameCamera.moveSideH((x - lastMousePos.x) * speed, response);
|
||||||
//} else
|
//} else
|
||||||
|
mouseMoved = true;
|
||||||
{
|
{
|
||||||
//float ymult = Config::getInstance().getCameraInvertYAxis() ? -0.2f : 0.2f;
|
//float ymult = Config::getInstance().getCameraInvertYAxis() ? -0.2f : 0.2f;
|
||||||
//float xmult = Config::getInstance().getCameraInvertXAxis() ? -0.2f : 0.2f;
|
//float xmult = Config::getInstance().getCameraInvertXAxis() ? -0.2f : 0.2f;
|
||||||
|
|
|
@ -86,6 +86,7 @@ private:
|
||||||
bool gameOver;
|
bool gameOver;
|
||||||
bool renderNetworkStatus;
|
bool renderNetworkStatus;
|
||||||
bool showFullConsole;
|
bool showFullConsole;
|
||||||
|
bool mouseMoved;
|
||||||
float scrollSpeed;
|
float scrollSpeed;
|
||||||
Speed speed;
|
Speed speed;
|
||||||
GraphicMessageBox mainMessageBox;
|
GraphicMessageBox mainMessageBox;
|
||||||
|
@ -147,6 +148,7 @@ public:
|
||||||
virtual void keyPress(char c);
|
virtual void keyPress(char c);
|
||||||
virtual void mouseDownLeft(int x, int y);
|
virtual void mouseDownLeft(int x, int y);
|
||||||
virtual void mouseDownRight(int x, int y);
|
virtual void mouseDownRight(int x, int y);
|
||||||
|
virtual void mouseUpCenter(int x, int y);
|
||||||
virtual void mouseUpLeft(int x, int y);
|
virtual void mouseUpLeft(int x, int y);
|
||||||
virtual void mouseDoubleClickLeft(int x, int y);
|
virtual void mouseDoubleClickLeft(int x, int y);
|
||||||
virtual void eventMouseWheel(int x, int y, int zDelta);
|
virtual void eventMouseWheel(int x, int y, int zDelta);
|
||||||
|
|
|
@ -389,6 +389,12 @@ void UnitUpdater::updateAttack(Unit *unit) {
|
||||||
|
|
||||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
|
|
||||||
|
if(command->getUnit()!=NULL && !command->getUnit()->isAlive() && unit->getCommandSize()>1)
|
||||||
|
{// don't run over to dead body if there is still something to do in the queue
|
||||||
|
unit->finishCommand();
|
||||||
|
}
|
||||||
|
else {
|
||||||
//if unit arrives destPos order has ended
|
//if unit arrives destPos order has ended
|
||||||
switch (tsValue){
|
switch (tsValue){
|
||||||
case tsMoving:
|
case tsMoving:
|
||||||
|
@ -402,7 +408,8 @@ void UnitUpdater::updateAttack(Unit *unit) {
|
||||||
default:
|
default:
|
||||||
unit->finishCommand();
|
unit->finishCommand();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1755,7 +1762,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
|
|
||||||
//attack enemies that can attack first
|
//attack enemies that can attack first
|
||||||
for(int i = 0; i< enemies.size(); ++i) {
|
for(int i = 0; i< enemies.size(); ++i) {
|
||||||
if(enemies[i]->getType()->hasSkillClass(scAttack) && enemies[i]->isAlive() == true && !(unit->isAlly(enemies[i]))) {
|
if(enemies[i]->getType()->hasSkillClass(scAttack) && enemies[i]->isAlive() == true ) {
|
||||||
*rangedPtr= enemies[i];
|
*rangedPtr= enemies[i];
|
||||||
enemySeen=enemies[i];
|
enemySeen=enemies[i];
|
||||||
result=true;
|
result=true;
|
||||||
|
@ -1765,7 +1772,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
|
|
||||||
//any enemy
|
//any enemy
|
||||||
for(int i = 0; i< enemies.size(); ++i) {
|
for(int i = 0; i< enemies.size(); ++i) {
|
||||||
if(enemies[i]->isAlive() == true && !(unit->isAlly(enemies[i]))) {
|
if(enemies[i]->isAlive() == true ) {
|
||||||
*rangedPtr= enemies[i];
|
*rangedPtr= enemies[i];
|
||||||
enemySeen=enemies[i];
|
enemySeen=enemies[i];
|
||||||
result=true;
|
result=true;
|
||||||
|
@ -1773,9 +1780,8 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result)
|
if(result && !(unit->isAlly(enemySeen)))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(world->getFrameCount()-lastWarnFrameCount>100) //after 100 frames attack break we warn again
|
if(world->getFrameCount()-lastWarnFrameCount>100) //after 100 frames attack break we warn again
|
||||||
{
|
{
|
||||||
world->addAttackEffects(enemySeen);
|
world->addAttackEffects(enemySeen);
|
||||||
|
|
Loading…
Reference in New Issue