dansk language; fix for fog of war off; command queuing works a bit better ( especially when attacking );
This commit is contained in:
parent
8b0b6300ed
commit
cfba817280
|
@ -950,7 +950,9 @@ void MenuStateConnectedGame::update() {
|
||||||
listBoxFogOfWar.setSelectedItemIndex(2);
|
listBoxFogOfWar.setSelectedItemIndex(2);
|
||||||
}
|
}
|
||||||
if((gameSettings->getFlagTypes1() & ft1_show_map_resources) == ft1_show_map_resources){
|
if((gameSettings->getFlagTypes1() & ft1_show_map_resources) == ft1_show_map_resources){
|
||||||
listBoxFogOfWar.setSelectedItemIndex(1);
|
if(gameSettings->getFogOfWar() == true){
|
||||||
|
listBoxFogOfWar.setSelectedItemIndex(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow Observers
|
// Allow Observers
|
||||||
|
|
|
@ -1984,7 +1984,8 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings) {
|
||||||
gameSettings->setAllowObservers(listBoxAllowObservers.getSelectedItemIndex() == 1);
|
gameSettings->setAllowObservers(listBoxAllowObservers.getSelectedItemIndex() == 1);
|
||||||
|
|
||||||
uint32 valueFlags1 = gameSettings->getFlagTypes1();
|
uint32 valueFlags1 = gameSettings->getFlagTypes1();
|
||||||
if(listBoxFogOfWar.getSelectedItemIndex() == 1) {
|
if(listBoxFogOfWar.getSelectedItemIndex() == 1 ||
|
||||||
|
listBoxFogOfWar.getSelectedItemIndex() == 2 ) {
|
||||||
valueFlags1 |= ft1_show_map_resources;
|
valueFlags1 |= ft1_show_map_resources;
|
||||||
gameSettings->setFlagTypes1(valueFlags1);
|
gameSettings->setFlagTypes1(valueFlags1);
|
||||||
}
|
}
|
||||||
|
@ -2265,7 +2266,9 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
|
||||||
listBoxFogOfWar.setSelectedItemIndex(2);
|
listBoxFogOfWar.setSelectedItemIndex(2);
|
||||||
}
|
}
|
||||||
if((gameSettings.getFlagTypes1() & ft1_show_map_resources) == ft1_show_map_resources){
|
if((gameSettings.getFlagTypes1() & ft1_show_map_resources) == ft1_show_map_resources){
|
||||||
listBoxFogOfWar.setSelectedItemIndex(1);
|
if(gameSettings.getFogOfWar() == true){
|
||||||
|
listBoxFogOfWar.setSelectedItemIndex(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listBoxAllowObservers.setSelectedItem(gameSettings.getAllowObservers() == true ? lang.get("Yes") : lang.get("No"));
|
listBoxAllowObservers.setSelectedItem(gameSettings.getAllowObservers() == true ? lang.get("Yes") : lang.get("No"));
|
||||||
|
|
|
@ -30,6 +30,7 @@ Command::Command(const CommandType *ct, const Vec2i &pos){
|
||||||
|
|
||||||
this->commandType= ct;
|
this->commandType= ct;
|
||||||
this->pos= pos;
|
this->pos= pos;
|
||||||
|
this->unitRef= NULL;
|
||||||
unitType= NULL;
|
unitType= NULL;
|
||||||
stateType = cst_None;
|
stateType = cst_None;
|
||||||
stateValue = -1;
|
stateValue = -1;
|
||||||
|
@ -51,6 +52,7 @@ Command::Command(const CommandType *ct, Unit* unit){
|
||||||
Command::Command(const CommandType *ct, const Vec2i &pos, const UnitType *unitType, CardinalDir facing){
|
Command::Command(const CommandType *ct, const Vec2i &pos, const UnitType *unitType, CardinalDir facing){
|
||||||
this->commandType= ct;
|
this->commandType= ct;
|
||||||
this->pos= pos;
|
this->pos= pos;
|
||||||
|
this->unitRef= NULL;
|
||||||
this->unitType= unitType;
|
this->unitType= unitType;
|
||||||
this->facing = facing;
|
this->facing = facing;
|
||||||
stateType = cst_None;
|
stateType = cst_None;
|
||||||
|
@ -61,6 +63,12 @@ Command::Command(const CommandType *ct, const Vec2i &pos, const UnitType *unitTy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Command::getPriority(){
|
||||||
|
if(this->commandType->commandTypeClass==ccAttack && getUnit()==NULL){
|
||||||
|
return 5; // attacks to the ground have low priority
|
||||||
|
}
|
||||||
|
return this->commandType->getTypePriority();
|
||||||
|
}
|
||||||
// =============== set ===============
|
// =============== set ===============
|
||||||
|
|
||||||
void Command::setCommandType(const CommandType *commandType){
|
void Command::setCommandType(const CommandType *commandType){
|
||||||
|
|
|
@ -59,7 +59,10 @@ public:
|
||||||
Unit* getUnit() const {return unitRef.getUnit();}
|
Unit* getUnit() const {return unitRef.getUnit();}
|
||||||
const UnitType* getUnitType() const {return unitType;}
|
const UnitType* getUnitType() const {return unitType;}
|
||||||
CardinalDir getFacing() const {return facing;}
|
CardinalDir getFacing() const {return facing;}
|
||||||
|
|
||||||
|
//Priority: commands of higher priority will cancel commands of lower priority
|
||||||
|
virtual int getPriority();
|
||||||
|
|
||||||
//set
|
//set
|
||||||
void setCommandType(const CommandType *commandType);
|
void setCommandType(const CommandType *commandType);
|
||||||
void setPos(const Vec2i &pos);
|
void setPos(const Vec2i &pos);
|
||||||
|
|
|
@ -738,11 +738,6 @@ int Unit::getCountOfProducedUnits(const UnitType *ut) const{
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define deleteSingleCommand(command) {\
|
|
||||||
undoCommand(command);\
|
|
||||||
delete command;\
|
|
||||||
}
|
|
||||||
|
|
||||||
//give one command (clear, and push back)
|
//give one command (clear, and push back)
|
||||||
CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__);
|
||||||
|
@ -761,18 +756,18 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
const int command_priority = command->getCommandType()->getPriority();
|
const int command_priority = command->getPriority();
|
||||||
|
|
||||||
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->getCommandType()->isQueuable(tryQueue) && (commands.empty() || (command_priority >= commands.back()->getCommandType()->getPriority()))){
|
if(command->getCommandType()->isQueuable(tryQueue)){
|
||||||
|
|
||||||
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());
|
||||||
|
|
||||||
//Delete all lower-prioirty commands
|
//Delete all lower-prioirty commands
|
||||||
for (list<Command*>::iterator i = commands.begin(); i != commands.end();) {
|
for (list<Command*>::iterator i = commands.begin(); i != commands.end();) {
|
||||||
if ((*i)->getCommandType()->getPriority() < command_priority) {
|
if ((*i)->getPriority() < command_priority) {
|
||||||
deleteSingleCommand(*i);
|
deleteQueuedCommand(*i);
|
||||||
i = commands.erase(i);
|
i = commands.erase(i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -797,7 +792,6 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
||||||
//empty command queue
|
//empty command queue
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
clearCommands();
|
clearCommands();
|
||||||
this->unitPath->clear();
|
|
||||||
|
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
@ -1424,6 +1418,7 @@ void Unit::updateTarget(){
|
||||||
|
|
||||||
void Unit::clearCommands() {
|
void Unit::clearCommands() {
|
||||||
this->setCurrentUnitTitle("");
|
this->setCurrentUnitTitle("");
|
||||||
|
this->unitPath->clear();
|
||||||
while(!commands.empty()){
|
while(!commands.empty()){
|
||||||
undoCommand(commands.back());
|
undoCommand(commands.back());
|
||||||
delete commands.back();
|
delete commands.back();
|
||||||
|
@ -1431,6 +1426,17 @@ void Unit::clearCommands() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::deleteQueuedCommand(Command *command) {
|
||||||
|
if(getCurrCommand()==command)
|
||||||
|
{
|
||||||
|
this->setCurrentUnitTitle("");
|
||||||
|
this->unitPath->clear();
|
||||||
|
}
|
||||||
|
undoCommand(command);
|
||||||
|
delete command;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CommandResult Unit::checkCommand(Command *command) const {
|
CommandResult Unit::checkCommand(Command *command) const {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ private:
|
||||||
float computeHeight(const Vec2i &pos) const;
|
float computeHeight(const Vec2i &pos) const;
|
||||||
void updateTarget();
|
void updateTarget();
|
||||||
void clearCommands();
|
void clearCommands();
|
||||||
|
void deleteQueuedCommand(Command *command);
|
||||||
CommandResult undoCommand(Command *command);
|
CommandResult undoCommand(Command *command);
|
||||||
void stopDamageParticles();
|
void stopDamageParticles();
|
||||||
void startDamageParticles();
|
void startDamageParticles();
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
return (q != qNever) && (q != qOnlyLast);
|
return (q != qNever) && (q != qOnlyLast);
|
||||||
}
|
}
|
||||||
//Priority: commands of higher priority will cancel commands of lower priority
|
//Priority: commands of higher priority will cancel commands of lower priority
|
||||||
virtual int getPriority() const {return 0;}
|
virtual int getTypePriority() const {return 10;}
|
||||||
|
|
||||||
//get
|
//get
|
||||||
CommandClass getClass() const;
|
CommandClass getClass() const;
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
|
virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
virtual Queueability isQueuable() const {return qNever;}
|
virtual Queueability isQueuable() const {return qNever;}
|
||||||
virtual int getPriority() const {return 100000;}
|
virtual int getTypePriority() const {return 100000;}
|
||||||
//get
|
//get
|
||||||
const StopSkillType *getStopSkillType() const {return stopSkillType;};
|
const StopSkillType *getStopSkillType() const {return stopSkillType;};
|
||||||
};
|
};
|
||||||
|
@ -300,7 +300,6 @@ public:
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
virtual const ProducibleType *getProduced() const;
|
virtual const ProducibleType *getProduced() const;
|
||||||
virtual Queueability isQueuable() const {return qAlways;}
|
virtual Queueability isQueuable() const {return qAlways;}
|
||||||
virtual int getPriority() const {return 5;} //higher priority to cancel attack
|
|
||||||
|
|
||||||
//get
|
//get
|
||||||
const ProduceSkillType *getProduceSkillType() const {return produceSkillType;}
|
const ProduceSkillType *getProduceSkillType() const {return produceSkillType;}
|
||||||
|
@ -326,7 +325,6 @@ public:
|
||||||
virtual string getReqDesc() const;
|
virtual string getReqDesc() const;
|
||||||
virtual const ProducibleType *getProduced() const;
|
virtual const ProducibleType *getProduced() const;
|
||||||
virtual Queueability isQueuable() const {return qAlways;}
|
virtual Queueability isQueuable() const {return qAlways;}
|
||||||
virtual int getPriority() const {return 5;} //higher priority to cancel attack (and same as Build)
|
|
||||||
|
|
||||||
//get
|
//get
|
||||||
const UpgradeSkillType *getUpgradeSkillType() const {return upgradeSkillType;}
|
const UpgradeSkillType *getUpgradeSkillType() const {return upgradeSkillType;}
|
||||||
|
|
|
@ -346,6 +346,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)
|
||||||
|
{
|
||||||
|
unit->finishCommand(); // all queued "ground attacks" are skipped if somthing else is queued after them.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//if found
|
//if found
|
||||||
if(attackableOnRange(unit, &target, act->getAttackSkillType())) {
|
if(attackableOnRange(unit, &target, act->getAttackSkillType())) {
|
||||||
if(unit->getEp()>=act->getAttackSkillType()->getEpCost()) {
|
if(unit->getEp()>=act->getAttackSkillType()->getEpCost()) {
|
||||||
|
@ -361,6 +367,7 @@ void UnitUpdater::updateAttack(Unit *unit) {
|
||||||
else {
|
else {
|
||||||
//compute target pos
|
//compute target pos
|
||||||
Vec2i pos;
|
Vec2i pos;
|
||||||
|
Command *nextCommand;
|
||||||
if(command->getUnit()!=NULL) {
|
if(command->getUnit()!=NULL) {
|
||||||
pos= command->getUnit()->getCenteredPos();
|
pos= command->getUnit()->getCenteredPos();
|
||||||
}
|
}
|
||||||
|
@ -400,22 +407,21 @@ void UnitUpdater::updateAttack(Unit *unit) {
|
||||||
unit->finishCommand();
|
unit->finishCommand();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//if unit arrives destPos order has ended
|
//if unit arrives destPos order has ended
|
||||||
switch (tsValue){
|
switch (tsValue){
|
||||||
case tsMoving:
|
case tsMoving:
|
||||||
unit->setCurrSkill(act->getMoveSkillType());
|
unit->setCurrSkill(act->getMoveSkillType());
|
||||||
break;
|
break;
|
||||||
case tsBlocked:
|
case tsBlocked:
|
||||||
if(unit->getPath()->isBlocked()){
|
if(unit->getPath()->isBlocked()){
|
||||||
|
unit->finishCommand();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
unit->finishCommand();
|
unit->finishCommand();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(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(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
@ -1795,7 +1801,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
float currentDistance;
|
float currentDistance;
|
||||||
float nearestDistance;
|
float nearestDistance;
|
||||||
for(int i = attackWarnings.size()-1; i>-1; --i) {
|
for(int i = attackWarnings.size()-1; i>-1; --i) {
|
||||||
if(world->getFrameCount()-attackWarnings[i]->lastFrameCount>100) { //after 100 frames attack break we warn again
|
if(world->getFrameCount()-attackWarnings[i]->lastFrameCount>200) { //after 200 frames attack break we warn again
|
||||||
AttackWarningData *toDelete=attackWarnings[i];
|
AttackWarningData *toDelete=attackWarnings[i];
|
||||||
attackWarnings.erase(attackWarnings.begin()+i);
|
attackWarnings.erase(attackWarnings.begin()+i);
|
||||||
delete toDelete; // old one
|
delete toDelete; // old one
|
||||||
|
|
|
@ -64,7 +64,6 @@ void WaterEffects::addWaterSplash(const Vec2f &pos, int size){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
waterSplashes.push_back(WaterSplash(pos,size));
|
waterSplashes.push_back(WaterSplash(pos,size));
|
||||||
printf("count of watereffects=%d\n",getWaterSplashCount());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
Loading…
Reference in New Issue