fix for updateAttackStopped and command queuing;

switching tilesets react with delay like switching maps; 
new/updated maps; 
reverted egypt mining slave model;
many loading screens for scenarios
This commit is contained in:
Titus Tscharntke 2011-01-30 23:01:55 +00:00
parent 7397ff0368
commit d7a65ed18e
4 changed files with 17 additions and 9 deletions

View File

@ -27,7 +27,7 @@ using namespace Shared::Platform;
namespace Glest { namespace Game { namespace Glest { namespace Game {
const string mailString = "contact@megaglest.org"; const string mailString = "contact@megaglest.org";
const string glestVersionString = "v3.4.0-beta3"; const string glestVersionString = "v3.4.0-dev";
#if defined(SVNVERSION) #if defined(SVNVERSION)
const string SVN_Rev = string("Rev: ") + string(SVNVERSION); const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
#elif defined(SVNVERSIONHEADER) #elif defined(SVNVERSIONHEADER)

View File

@ -61,7 +61,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
currentFactionName_factionPreview=""; currentFactionName_factionPreview="";
mapPreviewTexture=NULL; mapPreviewTexture=NULL;
hasCheckedForUPNP = false; hasCheckedForUPNP = false;
needToPublishMap=false; needToPublishDelayed=false;
mapPublishingDelayTimer=time(NULL); mapPublishingDelayTimer=time(NULL);
publishToMasterserverThread = NULL; publishToMasterserverThread = NULL;
@ -666,7 +666,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
if(hasNetworkGameSettings() == true) if(hasNetworkGameSettings() == true)
{ {
//delay publishing for 5 seconds //delay publishing for 5 seconds
needToPublishMap=true; needToPublishDelayed=true;
mapPublishingDelayTimer=time(NULL); mapPublishingDelayTimer=time(NULL);
} }
} }
@ -734,8 +734,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
} }
if(hasNetworkGameSettings() == true) if(hasNetworkGameSettings() == true)
{ {
needToSetChangedGameSettings = true;
lastSetChangedGameSettings = time(NULL); //delay publishing for 5 seconds
needToPublishDelayed=true;
mapPublishingDelayTimer=time(NULL);
} }
} }
else if(listBoxMapFilter.mouseClick(x, y)){ else if(listBoxMapFilter.mouseClick(x, y)){
@ -1707,17 +1709,17 @@ void MenuStateCustomGame::update() {
// give it to me baby, aha aha ... // give it to me baby, aha aha ...
publishToMasterserver(); publishToMasterserver();
} }
if(needToPublishMap){ if(needToPublishDelayed){
// this delay is done to make it possible to switch over maps which are not meant to be distributed // this delay is done to make it possible to switch over maps which are not meant to be distributed
if(difftime(time(NULL), mapPublishingDelayTimer) >= 5){ if(difftime(time(NULL), mapPublishingDelayTimer) >= 5){
// after 5 seconds we are allowed to publish again! // after 5 seconds we are allowed to publish again!
needToSetChangedGameSettings = true; needToSetChangedGameSettings = true;
lastSetChangedGameSettings = time(NULL); lastSetChangedGameSettings = time(NULL);
// set to normal.... // set to normal....
needToPublishMap=false; needToPublishDelayed=false;
} }
} }
if(!needToPublishMap){ if(!needToPublishDelayed){
bool broadCastSettings = (difftime(time(NULL),lastSetChangedGameSettings) >= 2); bool broadCastSettings = (difftime(time(NULL),lastSetChangedGameSettings) >= 2);
if(broadCastSettings == true) { if(broadCastSettings == true) {

View File

@ -98,7 +98,7 @@ private:
time_t lastMasterserverPublishing; time_t lastMasterserverPublishing;
time_t lastNetworkPing; time_t lastNetworkPing;
time_t mapPublishingDelayTimer; time_t mapPublishingDelayTimer;
bool needToPublishMap; bool needToPublishDelayed;
bool needToRepublishToMasterserver; bool needToRepublishToMasterserver;
bool needToBroadcastServerSettings; bool needToBroadcastServerSettings;

View File

@ -428,6 +428,12 @@ void UnitUpdater::updateAttackStopped(Unit *unit) {
const AttackStoppedCommandType *asct= static_cast<const AttackStoppedCommandType*>(command->getCommandType()); const AttackStoppedCommandType *asct= static_cast<const AttackStoppedCommandType*>(command->getCommandType());
Unit *enemy; Unit *enemy;
if(unit->getCommandSize()>1)
{
unit->finishCommand(); // attackStopped is skipped if somthing else is queued after this.
return;
}
if(attackableOnRange(unit, &enemy, asct->getAttackSkillType())){ if(attackableOnRange(unit, &enemy, asct->getAttackSkillType())){
unit->setCurrSkill(asct->getAttackSkillType()); unit->setCurrSkill(asct->getAttackSkillType());
unit->setTarget(enemy); unit->setTarget(enemy);