← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~gunchleoc/widelands/bug-1454371 into lp:widelands

 

I have added a comment on the line where we need to add the mines restriction back in. Could you please take care of it for me, because I'm away from my developer machine?

Diff comments:

> === modified file 'src/chat/chat.h'
> --- src/chat/chat.h	2014-09-20 09:37:47 +0000
> +++ src/chat/chat.h	2015-06-10 07:32:02 +0000
> @@ -29,7 +29,7 @@
>  
>  // A chat message as received in game.
>  struct ChatMessage {
> -	CAN_BE_SEND_AS_NOTE(NoteId::ChatMessage)
> +	CAN_BE_SENT_AS_NOTE(NoteId::ChatMessage)
>  
>  	// The (real-)time at which the message was received.
>  	time_t time;
> 
> === modified file 'src/graphic/graphic.h'
> --- src/graphic/graphic.h	2014-12-08 05:22:52 +0000
> +++ src/graphic/graphic.h	2015-06-10 07:32:02 +0000
> @@ -35,7 +35,7 @@
>  
>  // Will be send whenever the resolution changes.
>  struct GraphicResolutionChanged {
> -	CAN_BE_SEND_AS_NOTE(NoteId::GraphicResolutionChanged)
> +	CAN_BE_SENT_AS_NOTE(NoteId::GraphicResolutionChanged)
>  
>  	// New width and height in pixels.
>  	int width;
> 
> === modified file 'src/logic/editor_game_base.h'
> --- src/logic/editor_game_base.h	2015-02-09 05:57:08 +0000
> +++ src/logic/editor_game_base.h	2015-06-10 07:32:02 +0000
> @@ -55,7 +55,7 @@
>  struct AttackController;
>  
>  struct NoteFieldPossession {
> -	CAN_BE_SEND_AS_NOTE(NoteId::FieldPossession)
> +	CAN_BE_SENT_AS_NOTE(NoteId::FieldPossession)
>  
>  	// Has this been lost or gained?
>  	enum class Ownership {LOST, GAINED};
> 
> === modified file 'src/logic/immovable.h'
> --- src/logic/immovable.h	2015-02-24 20:55:09 +0000
> +++ src/logic/immovable.h	2015-06-10 07:32:02 +0000
> @@ -47,7 +47,7 @@
>  class TribeDescr;
>  
>  struct NoteImmovable {
> -	CAN_BE_SEND_AS_NOTE(NoteId::Immovable)
> +	CAN_BE_SENT_AS_NOTE(NoteId::Immovable)
>  
>  	PlayerImmovable* pi;
>  
> 
> === modified file 'src/logic/map.h'
> --- src/logic/map.h	2014-10-29 06:00:52 +0000
> +++ src/logic/map.h	2015-06-10 07:32:02 +0000
> @@ -70,7 +70,7 @@
>  class Immovable;
>  
>  struct NoteFieldTransformed {
> -	CAN_BE_SEND_AS_NOTE(NoteId::FieldTransformed)
> +	CAN_BE_SENT_AS_NOTE(NoteId::FieldTransformed)
>  
>  	FCoords fc;
>  	MapIndex map_index;
> 
> === modified file 'src/logic/productionsite.cc'
> --- src/logic/productionsite.cc	2015-05-30 12:19:57 +0000
> +++ src/logic/productionsite.cc	2015-06-10 07:32:02 +0000
> @@ -65,13 +65,13 @@
>  	{
>  		m_out_of_resource_title = section->get_string("title", "");
>  		m_out_of_resource_message = section->get_string("message", "");
> -		m_out_of_resource_delay_attempts = section->get_natural("delay_attempts", 0);
> +		out_of_resource_productivity_threshold_ = section->get_natural("productivity_threshold", 100);
>  	}
>  	else
>  	{
>  		m_out_of_resource_title = "";
>  		m_out_of_resource_message = "";
> -		m_out_of_resource_delay_attempts = 0;
> +		out_of_resource_productivity_threshold_ = 100;
>  	}
>  	while
>  		(Section::Value const * const op = global_s.get_next_val("output"))
> @@ -202,8 +202,7 @@
>  	m_crude_percent     (0),
>  	m_is_stopped        (false),
>  	m_default_anim      ("idle"),
> -	m_production_result (""),
> -	m_out_of_resource_delay_counter(0)
> +	m_production_result ("")
>  {
>  	calc_statistics();
>  }
> @@ -322,13 +321,28 @@
>  
>  	std::string trend;
>  	if (lastPercOk > percOk) {
> +<<<<<<< TREE
>  		color = UI_FONT_CLR_GOOD.hex_value();
> +=======
> +		trend_ = Trend::kRising;
> +		color = UI_FONT_CLR_GOOD_HEX;
> +>>>>>>> MERGE-SOURCE
>  		trend = "+";
>  	} else if (lastPercOk < percOk) {
> +<<<<<<< TREE
>  		color = UI_FONT_CLR_BAD.hex_value();
> +=======
> +		trend_ = Trend::kFalling;
> +		color = UI_FONT_CLR_BAD_HEX;
> +>>>>>>> MERGE-SOURCE
>  		trend = "-";
>  	} else {
> +<<<<<<< TREE
>  		color = UI_FONT_CLR_BRIGHT.hex_value();
> +=======
> +		trend_ = Trend::kUnchanged;
> +		color = UI_FONT_CLR_BRIGHT_HEX;
> +>>>>>>> MERGE-SOURCE
>  		trend = "=";
>  	}
>  	const std::string trend_str =
> @@ -918,9 +932,9 @@
>  
>  void ProductionSite::notify_player(Game & game, uint8_t minutes)
>  {
> -
> -	if (m_out_of_resource_delay_counter >=
> -		 descr().out_of_resource_delay_attempts()) {
> +	if (m_last_stat_percent == 0 ||
> +		 (m_last_stat_percent <= descr().out_of_resource_productivity_threshold()
> +		  && trend_ == Trend::kFalling)) {
>  		if (descr().out_of_resource_title().empty())
>  		{
>  			set_production_result(_("Can’t find any more resources!"));
> @@ -937,14 +951,9 @@
>  				 true,
>  				 minutes * 60000, 0);
>  		}
> -		// following sends "out of resources" messages to be picked up by AI
> -		// used as a information for dismantling and upgrading mines
> -		if (descr().get_ismine())
> -			Notifications::publish(NoteProductionSiteOutOfResources(this, get_owner()));
> -	}
> -	if (m_out_of_resource_delay_counter++ >=
> -		 descr().out_of_resource_delay_attempts()) {
> -		m_out_of_resource_delay_counter = 0;
> +		// The following sends "out of resources" messages to be picked up by AI
> +		// used as information for dismantling and upgrading buildings
> +		Notifications::publish(NoteProductionSiteOutOfResources(this, get_owner()));

Add if (descr().get_ismine()) back in above this line

>  	}
>  }
>  
> 
> === modified file 'src/logic/productionsite.h'
> --- src/logic/productionsite.h	2015-01-28 07:35:51 +0000
> +++ src/logic/productionsite.h	2015-06-10 07:32:02 +0000
> @@ -94,8 +94,8 @@
>  	const std::string& out_of_resource_message() const {
>  		return m_out_of_resource_message;
>  	}
> -	uint32_t out_of_resource_delay_attempts() const {
> -		return m_out_of_resource_delay_attempts;
> +	uint32_t out_of_resource_productivity_threshold() const {
> +		return out_of_resource_productivity_threshold_;
>  	}
>  
>  private:
> @@ -106,7 +106,7 @@
>  	Programs m_programs;
>  	std::string m_out_of_resource_title;
>  	std::string m_out_of_resource_message;
> -	uint32_t    m_out_of_resource_delay_attempts;
> +	int         out_of_resource_productivity_threshold_;
>  
>  	DISALLOW_COPY_AND_ASSIGN(ProductionSiteDescr);
>  };
> @@ -281,9 +281,10 @@
>  	std::string              m_default_anim; // normally "idle", "empty", if empty mine.
>  
>  private:
> +	enum class Trend {kUnchanged, kRising, kFalling};
> +	Trend                    trend_;
>  	std::string              m_statistics_string_on_changed_statistics;
>  	std::string              m_production_result; // hover tooltip text
> -	uint32_t                 m_out_of_resource_delay_counter;
>  
>  	DISALLOW_COPY_AND_ASSIGN(ProductionSite);
>  };
> @@ -312,7 +313,7 @@
>   */
>  // A note we're using to notify the AI
>  struct NoteProductionSiteOutOfResources {
> -	CAN_BE_SEND_AS_NOTE(NoteId::ProductionSiteOutOfResources)
> +	CAN_BE_SENT_AS_NOTE(NoteId::ProductionSiteOutOfResources)
>  
>  	// The production site that is out of resources.
>  	ProductionSite* ps;
> 
> === modified file 'src/logic/ship.h'
> --- src/logic/ship.h	2015-04-18 11:20:53 +0000
> +++ src/logic/ship.h	2015-06-10 07:32:02 +0000
> @@ -45,7 +45,7 @@
>  };
>  
>  struct NoteShipMessage {
> -	CAN_BE_SEND_AS_NOTE(NoteId::ShipMessage)
> +	CAN_BE_SENT_AS_NOTE(NoteId::ShipMessage)
>  
>  	Ship* ship;
>  
> 
> === modified file 'src/notifications/notifications.h'
> --- src/notifications/notifications.h	2015-03-01 09:21:20 +0000
> +++ src/notifications/notifications.h	2015-06-10 07:32:02 +0000
> @@ -30,11 +30,11 @@
>  // The Notification framework is build around a singleton that dispatches
>  // 'Note'. A Note is any class that has a uint32_t note_id() member that must
>  // return something unique throughout the whole system. Use the macro
> -// CAN_BE_SEND_AS_NOTE to define that method easily.
> +// CAN_BE_SENT_AS_NOTE to define that method easily.
>  //
>  // The only public interface for the framework are the two functions below.
>  
> -#define CAN_BE_SEND_AS_NOTE(id)                                                                    \
> +#define CAN_BE_SENT_AS_NOTE(id)                                                                    \
>  	static uint32_t note_id() {                                                                     \
>  		return static_cast<uint32_t>(id);                                                            \
>  	}
> 
> === modified file 'src/notifications/test/notifications_test.cc'
> --- src/notifications/test/notifications_test.cc	2015-03-01 09:21:20 +0000
> +++ src/notifications/test/notifications_test.cc	2015-06-10 07:32:02 +0000
> @@ -26,7 +26,7 @@
>  #include "notifications/notifications.h"
>  
>  struct SimpleNote {
> -	CAN_BE_SEND_AS_NOTE(100)
> +	CAN_BE_SENT_AS_NOTE(100)
>  
>  	SimpleNote(const std::string& init_text) : text(init_text) {}
>  
> 
> === modified file 'src/wui/logmessage.h'
> --- src/wui/logmessage.h	2014-07-16 07:44:33 +0000
> +++ src/wui/logmessage.h	2015-06-10 07:32:02 +0000
> @@ -29,7 +29,7 @@
>   * Represents one log message.
>   */
>  struct LogMessage {
> -	CAN_BE_SEND_AS_NOTE(NoteId::LogMessage)
> +	CAN_BE_SENT_AS_NOTE(NoteId::LogMessage)
>  
>  	/**
>  	 * The (real-)time at which the message was received.
> 
> === modified file 'tribes/atlanteans/blackroot_farm/conf'
> --- tribes/atlanteans/blackroot_farm/conf	2014-08-02 19:55:23 +0000
> +++ tribes/atlanteans/blackroot_farm/conf	2015-06-10 07:32:02 +0000
> @@ -42,7 +42,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The farmer working at this blackroot farm has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=30
>  
>  [idle]
>  pics=blackroot_farm_i_??.png  # ???
> 
> === modified file 'tribes/atlanteans/farm/conf'
> --- tribes/atlanteans/farm/conf	2014-08-02 19:55:23 +0000
> +++ tribes/atlanteans/farm/conf	2015-06-10 07:32:02 +0000
> @@ -46,7 +46,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The farmer working at this farm has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=30
>  
>  [idle]
>  pics=farm_i_??.png  # ???
> 
> === modified file 'tribes/atlanteans/hunters_house/conf'
> --- tribes/atlanteans/hunters_house/conf	2014-08-02 19:55:23 +0000
> +++ tribes/atlanteans/hunters_house/conf	2015-06-10 07:32:02 +0000
> @@ -27,7 +27,7 @@
>  # TRANSLATORS: "Game" means animals that you can hunt
>  title=_Out of Game
>  message=_The hunter working out of this hunter’s house can’t find any game in his working radius.
> -delay_attempts=10
> +productivity_threshold=0
>  
>  [idle]
>  pics=hunters_house_i_??.png
> 
> === modified file 'tribes/atlanteans/well/conf'
> --- tribes/atlanteans/well/conf	2014-08-02 19:55:23 +0000
> +++ tribes/atlanteans/well/conf	2015-06-10 07:32:02 +0000
> @@ -31,7 +31,7 @@
>  [out_of_resource_notification]
>  title=_Out of Water
>  message=_The carrier working at this well can’t find any water in his working radius.
> -delay_attempts=50
> +productivity_threshold=33
>  
>  [idle]
>  pics=well_i_??.png  # ???
> 
> === modified file 'tribes/atlanteans/woodcutters_house/conf'
> --- tribes/atlanteans/woodcutters_house/conf	2014-08-02 19:55:23 +0000
> +++ tribes/atlanteans/woodcutters_house/conf	2015-06-10 07:32:02 +0000
> @@ -27,7 +27,7 @@
>  [out_of_resource_notification]
>  title=_Out of Trees
>  message=_The woodcutter working at this woodcutter’s house can’t find any trees in his working radius. You should consider dismantling or destroying the building or building a forester’s house.
> -delay_attempts=60
> +productivity_threshold=66
>  
>  [idle]
>  pics=woodcutters_house_i_??.png
> 
> === modified file 'tribes/barbarians/farm/conf'
> --- tribes/barbarians/farm/conf	2015-02-07 01:51:19 +0000
> +++ tribes/barbarians/farm/conf	2015-06-10 07:32:02 +0000
> @@ -28,7 +28,7 @@
>  [plant_wheat]
>  sleep=14000  #orig 20000
>  worker=plant
> -# animate=working  10000 
> +# animate=working  10000
>  
>  [harvest_wheat]
>  sleep=4000  #orig 5000
> @@ -44,7 +44,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The farmer working at this farm has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=30
>  
>  [build]
>  pics=build_??.png  # ???
> @@ -60,4 +60,4 @@
>  
>  [working]
>  pics=working_??.png  # ???
> -hotspot=69 76
> \ No newline at end of file
> +hotspot=69 76
> 
> === modified file 'tribes/barbarians/hunters_hut/conf'
> --- tribes/barbarians/hunters_hut/conf	2015-02-11 18:12:14 +0000
> +++ tribes/barbarians/hunters_hut/conf	2015-06-10 07:32:02 +0000
> @@ -27,7 +27,7 @@
>  # TRANSLATORS: "Game" means animals that you can hunt
>  title=_Out of Game
>  message=_The hunter working out of this hunter’s hut can’t find any game in his working radius. Remember that you can build a gamekeeper’s hut to release more game into the wild.
> -delay_attempts=10
> +productivity_threshold=33
>  
>  [build]
>  pics=build_??.png
> 
> === modified file 'tribes/barbarians/lumberjacks_hut/conf'
> --- tribes/barbarians/lumberjacks_hut/conf	2015-02-12 03:27:56 +0000
> +++ tribes/barbarians/lumberjacks_hut/conf	2015-06-10 07:32:02 +0000
> @@ -25,7 +25,7 @@
>  [out_of_resource_notification]
>  title=_Out of Trees
>  message=_The lumberjack working at this lumberjack’s hut can’t find any trees in his working radius. You should consider dismantling or destroying the building or building a rangers’s hut.
> -delay_attempts=60
> +productivity_threshold=66
>  
>  [idle]
>  pics=idle_??.png
> 
> === modified file 'tribes/barbarians/reed_yard/conf'
> --- tribes/barbarians/reed_yard/conf	2014-08-02 19:55:23 +0000
> +++ tribes/barbarians/reed_yard/conf	2015-06-10 07:32:02 +0000
> @@ -40,7 +40,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The gardener working at this reed yard has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=20
>  
>  [idle]
>  pics=reed_yard_i_??.png  # ???
> 
> === modified file 'tribes/barbarians/well/conf'
> --- tribes/barbarians/well/conf	2014-08-02 19:55:23 +0000
> +++ tribes/barbarians/well/conf	2015-06-10 07:32:02 +0000
> @@ -27,7 +27,7 @@
>  [out_of_resource_notification]
>  title=_Out of Water
>  message=_The carrier working at this well can’t find any water in his working radius.
> -delay_attempts=50
> +productivity_threshold=33
>  
>  [idle]
>  pics=well_i_??.png
> 
> === modified file 'tribes/empire/farm/conf'
> --- tribes/empire/farm/conf	2014-08-02 19:55:23 +0000
> +++ tribes/empire/farm/conf	2015-06-10 07:32:02 +0000
> @@ -45,7 +45,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The farmer working at this farm has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=30
>  
>  [idle]
>  pics=farm_i_??.png  # ???
> 
> === modified file 'tribes/empire/hunters_house/conf'
> --- tribes/empire/hunters_house/conf	2014-08-02 19:55:23 +0000
> +++ tribes/empire/hunters_house/conf	2015-06-10 07:32:02 +0000
> @@ -26,7 +26,7 @@
>  # TRANSLATORS: "Game" means animals that you can hunt
>  title=_Out of Game
>  message=_The hunter working out of this hunter’s house can’t find any game in his working radius.
> -delay_attempts=10
> +productivity_threshold=0
>  
>  [idle]
>  pics=hunters_house_i_??.png
> 
> === modified file 'tribes/empire/lumberjacks_house/conf'
> --- tribes/empire/lumberjacks_house/conf	2014-08-02 19:55:23 +0000
> +++ tribes/empire/lumberjacks_house/conf	2015-06-10 07:32:02 +0000
> @@ -27,7 +27,7 @@
>  [out_of_resource_notification]
>  title=_Out of Trees
>  message=_The lumberjack working at this lumberjack’s house can’t find any trees in his working radius. You should consider dismantling or destroying the building or building a forester’s house.
> -delay_attempts=60
> +productivity_threshold=66
>  
>  [idle]
>  pics=lumberjacks_house_i_??.png
> 
> === modified file 'tribes/empire/vineyard/conf'
> --- tribes/empire/vineyard/conf	2014-08-02 19:55:23 +0000
> +++ tribes/empire/vineyard/conf	2015-06-10 07:32:02 +0000
> @@ -42,7 +42,7 @@
>  [out_of_resource_notification]
>  title=_Out of Fields
>  message=_The farmer working at this vineyard has no cleared soil to plant his seeds.
> -delay_attempts=10
> +productivity_threshold=30
>  
>  [idle]
>  pics=vineyard_i_??.png  # ???
> 
> === modified file 'tribes/empire/well/conf'
> --- tribes/empire/well/conf	2014-08-02 19:55:23 +0000
> +++ tribes/empire/well/conf	2015-06-10 07:32:02 +0000
> @@ -30,7 +30,7 @@
>  [out_of_resource_notification]
>  title=_Out of Water
>  message=_The carrier working at this well can’t find any water in his working radius.
> -delay_attempts=50
> +productivity_threshold=33
>  
>  [idle]
>  pics=well_i_??.png  # ???
> 


-- 
https://code.launchpad.net/~gunchleoc/widelands/bug-1454371/+merge/261375
Your team Widelands Developers is requested to review the proposed merge of lp:~gunchleoc/widelands/bug-1454371 into lp:widelands.


References