Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1810062-territorial-calculations into lp:widelands

2019-02-26 Thread hessenfarmer
Thanks again for the great work everybody. However travis si complaining about 
a missing newline in autogenerated rst files.

It might be the case we need to insert an empty line at this line
https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/scripting/lua_map.cc#L6612
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1810062-territorial-calculations/+merge/361366
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1810062-territorial-calculations.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1810062-territorial-calculations into lp:widelands

2019-02-26 Thread GunChleoc
Thanks, should be fixed ow.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1810062-territorial-calculations/+merge/361366
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1810062-territorial-calculations.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1796364-blinking-buildings into lp:widelands

2019-02-26 Thread hessenfarmer
I will test a windows debug build tonight.

@ Klaus could you test this another time as well?
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1796364-blinking-buildings/+merge/359348
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1796364-blinking-buildings.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands

2019-02-26 Thread Benedikt Straub
Benedikt Straub has proposed merging 
lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands.

Commit message:
Shorten a soldier's last evade_failure animation if the soldier is about to die 
to prevent overlooping. The health bar falls gradually during an attack instead 
of one-shot.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1817664 in widelands: "Bug in fight"
  https://bugs.launchpad.net/widelands/+bug/1817664

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1817664-overlooping-eva_fail/+merge/363679

During battles, the evade_failure animation may overloop. If the soldier dies 
immediately afterwards, this can look like he is attacking while he dies 
(especially noticeable with ATL vs FRI). Shorten the last eva_fail anim if the 
soldier is going to die.

Debugging this, I also implemented that the soldierĀ“s health bar falls 
gradually while he is being attacked, instead of one-shot half a second after 
the attack is visually over.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/battle.cc'
--- src/logic/map_objects/tribes/battle.cc	2019-02-23 11:00:49 +
+++ src/logic/map_objects/tribes/battle.cc	2019-02-26 18:55:11 +
@@ -137,6 +137,13 @@
 	return other_soldier;
 }
 
+uint32_t Battle::get_pending_damage(const Soldier* for_whom) const {
+	if (for_whom == (first_strikes_ ? first_ : second_)) {
+		return damage_;
+	}
+	return 0;
+}
+
 //  TODO(unknown): Couldn't this code be simplified tremendously by doing all scheduling
 //  for one soldier and letting the other sleep until the battle is over?
 //  Could be, but we need to be able change the animations of the soldiers
@@ -167,10 +174,11 @@
 	// Apply pending damage
 	if (damage_ && oneReadyToFight) {
 		// Current attacker is last defender, so damage goes to current attacker
-		if (first_strikes_)
+		if (first_strikes_) {
 			first_->damage(damage_);
-		else
+		} else {
 			second_->damage(damage_);
+		}
 		damage_ = 0;
 	}
 
@@ -184,8 +192,9 @@
 		return schedule_destroy(game);
 	}
 
-	if (!first_ || !second_)
+	if (!first_ || !second_) {
 		return soldier.skip_act();
+	}
 
 	// Here is a timeout to prevent battle freezes
 	if (waitingForOpponent && (game.get_gametime() - creationtime_) > 90 * 1000) {
@@ -248,10 +257,12 @@
 	molog("[battle] (%u) vs (%u) is %d, first strikes %d, last hit %d\n", soldier.serial(),
 	  opponent(soldier)->serial(), this_soldier_is, first_strikes_, last_attack_hits_);
 
+	bool shorten = false;
 	if (this_soldier_is == 1) {
 		if (first_strikes_) {
 			if (last_attack_hits_) {
 what_anim = "evade_failure_e";
+shorten = true;
 			} else {
 what_anim = "evade_success_e";
 			}
@@ -272,13 +283,17 @@
 		} else {
 			if (last_attack_hits_) {
 what_anim = "evade_failure_w";
+shorten = true;
 			} else {
 what_anim = "evade_success_w";
 			}
 		}
 	}
+	// If the soldier will die as soon as the animation is complete, don't
+	// show it for the full length to prevent overlooping (bug 1817664)
+	shorten &= damage_ >= soldier.get_current_health();
 	molog("[battle] Starting animation %s for soldier %d\n", what_anim.c_str(), soldier.serial());
-	soldier.start_task_idle(game, soldier.descr().get_rand_anim(game, what_anim.c_str()), 1000);
+	soldier.start_task_idle(game, soldier.descr().get_rand_anim(game, what_anim.c_str()), shorten ? 850 : 1000);
 }
 
 void Battle::calculate_round(Game& game) {

=== modified file 'src/logic/map_objects/tribes/battle.h'
--- src/logic/map_objects/tribes/battle.h	2019-02-23 11:00:49 +
+++ src/logic/map_objects/tribes/battle.h	2019-02-26 18:55:11 +
@@ -74,6 +74,8 @@
 		return second_;
 	}
 
+	uint32_t get_pending_damage(const Soldier* for_whom) const;
+
 	// Returns the other soldier involved in this battle. CHECKs that the given
 	// soldier is participating in this battle. Can return nullptr, probably when the
 	// opponent has died.

=== modified file 'src/logic/map_objects/tribes/soldier.cc'
--- src/logic/map_objects/tribes/soldier.cc	2019-02-23 11:00:49 +
+++ src/logic/map_objects/tribes/soldier.cc	2019-02-26 18:55:11 +
@@ -505,7 +505,26 @@
 	 kSoldierHealthBarWidth * 2 * scale, 5 * scale);
 	dst->fill_rect(energy_outer, RGBColor(255, 255, 255));
 
-	int health_width = 2 * (kSoldierHealthBarWidth - 1) * current_health_ / get_max_health();
+	uint32_t health_to_show = current_health_;
+	if (battle_) {
+		uint32_t pending_damage = battle_->get_pending_damage(this);
+		if (pending_damage) {
+			int32_t timeshift = owner().egbase().get_gametime() - get_animstart();
+			if (timeshift < 0) {
+timeshift = 0;
+			} else if (timeshift > 1000) {
+timeshift = 1000;
+			}
+			pending_damage *= timeshift;
+			pending_damage /= 1000;
+			if (pending_damage > health_to_show) {
+health_t

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/territorial_unify_notifications into lp:widelands

2019-02-26 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4529. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/498743350.
Appveyor build 4316. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_territorial_unify_notifications-4316.
-- 
https://code.launchpad.net/~widelands-dev/widelands/territorial_unify_notifications/+merge/362502
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/territorial_unify_notifications into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1796364-blinking-buildings into lp:widelands

2019-02-26 Thread hessenfarmer
Review: Approve playtest

Tested with the latest win debug build from appveyor.

no crashes and I couldn't see any blinking buildings or similar.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1796364-blinking-buildings/+merge/359348
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1796364-blinking-buildings.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands

2019-02-26 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4530. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/498892692.
Appveyor build 4317. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1817664_overlooping_eva_fail-4317.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1817664-overlooping-eva_fail/+merge/363679
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail into lp:widelands

2019-02-26 Thread GunChleoc
Review: Approve

LGTM - thanks for the fix :)

I have pushed some small code style tweaks - have a look at them if you want.

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1817664-overlooping-eva_fail/+merge/363679
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1817664-overlooping-eva_fail.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp