Merge branch 'master' into travis

This commit is contained in:
Alexander van Gessel 2013-05-21 20:39:35 +02:00
commit d6208c3e69
32 changed files with 191 additions and 157 deletions

View file

@ -21,6 +21,7 @@ You'll need to have these libraries and their development headers to build Wesno
libsdl >= 1.2.7
libsdl-image >= 1.2 (with png support)
libsdl-mixer >= 1.2 (with Vorbis support)
vorbisfile
libsdl-net
libsdl-ttf >= 2.0.8
libz

View file

@ -14,19 +14,21 @@ The release team should empty this file after each release.
CHANGES
=======
[section="New Micro AI functionality and [micro_ai] tag"]
18 new specialized and configurable AIs, so-called Micro AIs, are now available together with 14 test scenarios. Mirco AIs allow Wesnoth campaign and scenario authors to add new AI functionality without the need for any AI programming. A Micro AI is activated and configured (or deleted) simply via the [micro_ai] tag, requiring only a few lines of WML code.
[section="New dependency on vorbisfile"]
The library "vorbisfile" is a new dependency to build Wesnoth.
It is used to display track titles in the editor's playlist manager.
[/section]
This includes AIs for 7 different animal behaviors, bottleneck defense, 2 different guardians and a coward, healer support, lurkers, messenger escort, patrol, protect and move a unit, and 2 alternative recruiting strategies.
Full documentation is available [wiki=Micro_AIs]on the Wesnoth wiki[/wiki], which explains what the different Micro AIs do, how to set them up and configure them, and how to start the test scenarios.
[section="A Change"]
Text
[/section]
[section="Another Change"]
Increased the pango cairo dependency to version 1.24.4.
Text
[/section]
[section="Yet another Change"]
Text
[/section]
==========

View file

@ -335,6 +335,7 @@ if env["prereqs"]:
conf.CheckBoost("regex", require_version = "1.35.0") and \
conf.CheckSDL("SDL_ttf", require_version = "2.0.8") and \
conf.CheckSDL("SDL_mixer", require_version = '1.2.0') and \
conf.CheckLib("vorbisfile") and \
conf.CheckSDL("SDL_image", require_version = '1.2.0') and \
conf.CheckOgg() or Warning("Client prerequisites are not met. wesnoth, cutter and exploder cannot be built.")

View file

@ -217,9 +217,9 @@
message= _ "There are too many to fight, far too many. We must escape!"
[/message]
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" "" _"This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The goal is to move Konrad to the signpost in the northwest, while keeping both Konrad and Delfador alive. The same AI as in scenario ""Protect Unit"" is used.
{MESSAGE narrator "wesnoth-icon.png" "" _"This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The goal is to move Konrad to the signpost in the northwest, while keeping both Konrad and Delfador alive. The same AI as in scenario ""Protect Unit"" is used.
Note: The Protect Unit AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Note: The Protect Unit AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
{PLACE_IMAGE "scenery/signpost.png" 1 1}

View file

@ -1,25 +1,25 @@
#textdomain wesnoth
#define ANIMAL_AI_DESCRIPTIONS1
_"<u>General</u>: These AI's are set up to simulate (to some extent) how these animals behave in real life. This includes that they are animals, meaning that they are not super smart. As an example, the wolves generally hunt in a pack, but are easily distracted by prey coming into range. They are also decent, but not great at cornering deer. For the most part, this is intentional.
_"<u>General</u>: These AI's are set up to simulate (to some extent) how these animals behave in real life. This includes that they are animals, meaning that they are not super smart. As an example, the wolves generally hunt in a pack, but are easily distracted by prey coming into range. They are also decent, but not great at cornering deer. For the most part, this is intentional.
<u>Bears (replaced by Ghasts), Spiders and Yetis</u> mostly just wander in their respective parts of the map. They stay out of each other's way (and out of the way of the dogs), but do attack each other if cornered. They attack the other, weaker animals (deer etc.) if those are within range.
<u>Bears (replaced by Ghasts), Spiders and Yetis</u> mostly just wander in their respective parts of the map. They stay out of each other's way (and out of the way of the dogs), but do attack each other if cornered. They attack the other, weaker animals (deer etc.) if those are within range.
<u>Wolves</u> hunt in a pack. They actively go after the closest deer (as long as it stays in the forest) and try to corner it (not always super successfully), but are easily distracted by other prey coming into range. The wolves try to avoid getting into the range of bears, spiders, dogs and the yeti, except when they are going in for an attack. If you let them move for long enough, they will also learn that it is not healthy to attack the tusklets. When no deer is left, they wander randomly. Note that, unlike the Wolves Multipack AI (used in a different scenario), this Wolves AI combines all wolves of the side in the same pack."
<u>Wolves</u> hunt in a pack. They actively go after the closest deer (as long as it stays in the forest) and try to corner it (not always super successfully), but are easily distracted by other prey coming into range. The wolves try to avoid getting into the range of bears, spiders, dogs and the yeti, except when they are going in for an attack. If you let them move for long enough, they will also learn that it is not healthy to attack the tusklets. When no deer is left, they wander randomly. Note that, unlike the Wolves Multipack AI (used in a different scenario), this Wolves AI combines all wolves of the side in the same pack."
#enddef
#define ANIMAL_AI_DESCRIPTIONS2
_"Each <u>Deer (replaced by Vampire Bats)</u> wanders randomly on forest tiles, except when enemies get in its (the deer's) range, in which case it flees to the farthest point it can reach.
<u>Tuskers (replaced by Ogres)</u> exhibit the same behavior as deer, except when an enemy is next to one of the tusklets. This enemy will then experience the full wrath of an irate boar.
<u>Tuskers (replaced by Ogres)</u> exhibit the same behavior as deer, except when an enemy is next to one of the tusklets. This enemy will then experience the full wrath of an irate boar.
<u>Tusklets (replaced by Young Ogres)</u> blindly follow the closest adult tusker, except when there is no tusker left, in which case they behave the same as deer.
<u>Rabbits (replaced by Rats)</u> also wander randomly, but in addition disappear into their holes (replaced by straw bales; if any are within reach) when enemies are close. They reappear out of their holes at the beginning of the turn, if it is safe.
<u>Rabbits (replaced by Rats)</u> also wander randomly, but in addition disappear into their holes (replaced by straw bales; if any are within reach) when enemies are close. They reappear out of their holes at the beginning of the turn, if it is safe.
<u>Sheep dogs (replaced by Footpads)</u> try to keep their sheep safe. This involves keeping them inside the area outlined by the path the dogs have worn into the meadow, positioning themselves in between the sheep and approaching enemies, and attacking the enemies if those get too close. You might have to let the scenario play for quite some time before you get to see an interesting dog/wolf interaction. If no active herding or protecting move is needed, the dogs go to a random location on the path.
<u>Sheep dogs (replaced by Footpads)</u> try to keep their sheep safe. This involves keeping them inside the area outlined by the path the dogs have worn into the meadow, positioning themselves in between the sheep and approaching enemies, and attacking the enemies if those get too close. You might have to let the scenario play for quite some time before you get to see an interesting dog/wolf interaction. If no active herding or protecting move is needed, the dogs go to a random location on the path.
<u>Sheep (replaced by Troll Whelps)</u> wander aimlessly except when a sheep dog is next to them, in which case they run away from the dog. The dogs exploit this by positioning themselves on the outside of the sheep, if possible. Sheep also run away from approaching enemies. The sheep, dogs and forest creatures (deer, tuskers, rabbits) have learned that they are no threat to each other and leave each other alone, demonstrating the enormous self control of a well trained sheep dog."
<u>Sheep (replaced by Troll Whelps)</u> wander aimlessly except when a sheep dog is next to them, in which case they run away from the dog. The dogs exploit this by positioning themselves on the outside of the sheep, if possible. Sheep also run away from approaching enemies. The sheep, dogs and forest creatures (deer, tuskers, rabbits) have learned that they are no threat to each other and leave each other alone, demonstrating the enormous self control of a well trained sheep dog."
#enddef
[test]
@ -346,9 +346,9 @@
[event]
name=start
{MESSAGE narrator "wesnoth-icon.png" "Important Note" _"<span color='#A00000'>Important:</span> The animal Micro AIs in this scenario are written for a number of animal unit types that do not exist in Wesnoth mainline, such as bears, sheep and sheep dogs, or deer. In this test scenario, theses units have been replaced by mainline units. If you want to get the ""full experience"" with the original animal unit types, check out the 'Animals' scenario in the 'AI Modification Demos' add-on."}
{MESSAGE narrator "wesnoth-icon.png" "Important Note" _"<span color='#A00000'>Important:</span> The animal Micro AIs in this scenario are written for a number of animal unit types that do not exist in Wesnoth mainline, such as bears, sheep and sheep dogs, or deer. In this test scenario, theses units have been replaced by mainline units. If you want to get the ""full experience"" with the original animal unit types, check out the 'Animals' scenario in the 'AI Modification Demos' add-on."}
{MESSAGE narrator "wesnoth-icon.png" "" _"This is a fun little scenario with a bunch of different animal AIs, mostly for watching only. The animal AIs behave as follows:
{MESSAGE narrator "wesnoth-icon.png" "" _"This is a fun little scenario with a bunch of different animal AIs, mostly for watching only. The animal AIs behave as follows:
"+{ANIMAL_AI_DESCRIPTIONS1}}
{MESSAGE narrator "wesnoth-icon.png" "" {ANIMAL_AI_DESCRIPTIONS2}}
@ -360,9 +360,9 @@
# wmllint: unbalanced-on
message=_"It is possible to include a human-controlled Side 1, so that the action stops once every turn for looking around (or to mess with things in debug mode).
Note that there is no end to this scenario. For demonstration purposes, any unit that is killed is replaced by another unit of the same type at the beginning of the next turn. In order to end the scenario, there's a right-click option - but that only works in human-controlled mode. In AI-only mode, you have to press 'Esc' or reload a previous savefile.
Note that there is no end to this scenario. For demonstration purposes, any unit that is killed is replaced by another unit of the same type at the beginning of the next turn. In order to end the scenario, there's a right-click option - but that only works in human-controlled mode. In AI-only mode, you have to press 'Esc' or reload a previous savefile.
Also note: The Animal AIs are coded as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."
Also note: The Animal AIs are coded as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."
# wmllint: unbalanced-off
[option]
message=_"<span font='16'>I'll just watch the animals.</span>"

View file

@ -82,14 +82,14 @@
[event]
name=start
{MESSAGE LuaAI "" "" _"All right, chaps. Those orcs need to be stopped."}
{MESSAGE LuaAI "" "" _"All right, chaps. Those orcs need to be stopped."}
{STORE_UNIT_VAR (id=Big Bad Orc) profile profile}
{MESSAGE (Big Bad Orc) "$profile~FL()~RIGHT()" "" _"They there! We them get!"}
{CLEAR_VARIABLE profile}
# wmllint: unbalanced-on
{MESSAGE LuaAI "" "" _"We need to hold that pass for as long as we can. Let's put our strongest fighters on the front line and bring injured units to the back for healing. If we're careful enough, we might even win this battle. I'll join you as soon as I'm done recruiting and do my share of the fighting.
{MESSAGE LuaAI "" "" _"We need to hold that pass for as long as we can. Let's put our strongest fighters on the front line and bring injured units to the back for healing. If we're careful enough, we might even win this battle. I'll join you as soon as I'm done recruiting and do my share of the fighting.
Note: The Bottleneck Defense AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Note: The Bottleneck Defense AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[message]

View file

@ -81,18 +81,18 @@
name=start
{STORE_UNIT_VAR (id=Dreadful Bat) profile profile}
{MESSAGE (Dreadful Bat) "" "" _"Be careful to stay out of the way of that dragon. He's a mean one."}
{MESSAGE (Dreadful Bat) "" "" _"Be careful to stay out of the way of that dragon. He's a mean one."}
{CLEAR_VARIABLE profile}
# wmllint: unbalanced-on
{MESSAGE Rowck "" "" _"Hi there. I am Rowck and here is what I do:
When hungry, I move around part of the map in a random wander until I get into range of an enemy. If enemies are within range, I attack and devour the weakest of them. After that, I retreat to my rest location, where I stay for a certain number of turns or until fully healed.
{MESSAGE Rowck "" "" _"Hi there. I am Rowck and here is what I do:
When hungry, I move around part of the map in a random wander until I get into range of an enemy. If enemies are within range, I attack and devour the weakest of them. After that, I retreat to my rest location, where I stay for a certain number of turns or until fully healed.
A few details (features, not bugs, but can be changed if desired):
- If my way home is blocked on the return, the normal RCA AI takes over my behavior.
- I will, however, attack any enemy occupying my rest hex, if I can get there.
- A kill only makes me go home when I am the attacker, not as defender.
- Occasionally I will not move at all while wandering (a dragon has to rest sometimes!)
Note: The Hunter AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Note: The Hunter AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]

View file

@ -434,7 +434,7 @@ separate attack Zone"
{VARIABLE_CONDITIONAL scenario_name equals guardians}
[/show_if]
[command]
{MESSAGE narrator "portraits/dwarves/transparent/guard.png" _"Standard WML Guardian" _"This is the built-in WML guardian coded using 'ai_special=guardian'. These guardians attack if there is an enemy within their movement range, otherwise they do nothing (except maybe retreating to a village for healing)."}
{MESSAGE narrator "portraits/dwarves/transparent/guard.png" _"Standard WML Guardian" _"This is the built-in WML guardian coded using 'ai_special=guardian'. These guardians attack if there is an enemy within their movement range, otherwise they do nothing (except maybe retreating to a village for healing)."}
[/command]
[/set_menu_item]
[set_menu_item]
@ -461,8 +461,8 @@ separate attack Zone"
{VARIABLE_CONDITIONAL scenario_name equals guardians}
[/show_if]
[command]
{MESSAGE narrator "portraits/trolls/transparent/troll.png" _"Home Guard" _"A 'home guard' is a variant on the 'guardian' AI special. With this variant, the unit has an assigned 'home' location, and will return there if not involved in combat and if not going to a village, whether for healing or to capture it this turn. (By contrast, the standard guardian AI will cause the unit to stay where it last attacked.) This differs from 'return guardian' in that a home guard will press the attack, possibly getting drawn quite far from 'home', rather than returning after each attack. (It can also be lured away by a string of closely-placed villages, but that is something a map builder can control.)
This also demonstrates how to combine candidate actions from Formula AI and Lua AI in one side. The home guard is written in Formula AI, while the return and stationed guardians and the cowards are written in Lua AI. In addition the non-guardian units of the side follow the default AI behavior."}
{MESSAGE narrator "portraits/trolls/transparent/troll.png" _"Home Guard" _"A 'home guard' is a variant on the 'guardian' AI special. With this variant, the unit has an assigned 'home' location, and will return there if not involved in combat and if not going to a village, whether for healing or to capture it this turn. (By contrast, the standard guardian AI will cause the unit to stay where it last attacked.) This differs from 'return guardian' in that a home guard will press the attack, possibly getting drawn quite far from 'home', rather than returning after each attack. (It can also be lured away by a string of closely-placed villages, but that is something a map builder can control.)
This also demonstrates how to combine candidate actions from Formula AI and Lua AI in one side. The home guard is written in Formula AI, while the return and stationed guardians and the cowards are written in Lua AI. In addition the non-guardian units of the side follow the default AI behavior."}
[/command]
[/set_menu_item]
[set_menu_item]
@ -490,7 +490,7 @@ This also demonstrates how to combine candidate actions from Formula AI and Lua
{VARIABLE_CONDITIONAL scenario_name equals guardians}
[/show_if]
[command]
{MESSAGE narrator "units/monsters/giant-rat.png" _"Coward" _"Cowards are units that, like guardians, sit around doing nothing until an enemy comes into range. Unlike guardians, however, they run away once enemies approach. Applications might be wild animals, unarmed civilians getting in the way of a battle, etc. The coward macro can be called with two optional locations, 'seek' and 'avoid':
{MESSAGE narrator "units/monsters/giant-rat.png" _"Coward" _"Cowards are units that, like guardians, sit around doing nothing until an enemy comes into range. Unlike guardians, however, they run away once enemies approach. Applications might be wild animals, unarmed civilians getting in the way of a battle, etc. The coward macro can be called with two optional locations, 'seek' and 'avoid':
- If neither is given, the coward retreats to the position farthest away from the approaching enemies.
- If 'seek' is given, it preferentially goes toward that location (but getting away from enemies takes priority).
- If 'avoid' is given, it in addition tries to avoid that location (with both maximizing distance from enemies and going toward 'seek' taking priority).
@ -519,11 +519,11 @@ This also demonstrates how to combine candidate actions from Formula AI and Lua
{MESSAGE Kraa "$profile~FL()~RIGHT()" "" _"Kraahhh!!!!"}
{MESSAGE (Another Bad Orc) "" "" _"They there! We them get!"}
# wmllint: unbalanced-on
{MESSAGE Kraa "$profile~FL()~RIGHT()" "" _"Gryphons of the High Plains, look at all these enemies. They don't behave normally. Most of them don't move at all unless we get close. Let's check out how they react to us.
{MESSAGE Kraa "$profile~FL()~RIGHT()" "" _"Gryphons of the High Plains, look at all these enemies. They don't behave normally. Most of them don't move at all unless we get close. Let's check out how they react to us.
Note to the player: the right-click context menu provides information about each of the units' behavior.
Another note: Most of the Guardian AIs are coded as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Another note: Most of the Guardian AIs are coded as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
{CLEAR_VARIABLE profile}
@ -597,7 +597,7 @@ Another note: Most of the Guardian AIs are coded as Micro AIs. A Micro AI can b
[event]
name=end_scenario
{MESSAGE Kraa "" "" _"Gryphons of the High Plains, it is time to return to said plains. Follow me."}
{MESSAGE Kraa "" "" _"Gryphons of the High Plains, it is time to return to said plains. Follow me."}
[endlevel]
result=victory

View file

@ -433,16 +433,16 @@
[event]
name=start
{MESSAGE Pekzs "" "" _"In this scenario we demonstrate the Lurker Micro AI. A lurker is a unit that is capable of moving across most terrains, but that only stops on and attacks from specific terrain. It might also have the ability to hide on this terrain (which is the reason why this is called the Lurker AI).
{MESSAGE Pekzs "" "" _"In this scenario we demonstrate the Lurker Micro AI. A lurker is a unit that is capable of moving across most terrains, but that only stops on and attacks from specific terrain. It might also have the ability to hide on this terrain (which is the reason why this is called the Lurker AI).
Lurkers move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead - or it just sits and waits (lurks)."}
Lurkers move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead - or it just sits and waits (lurks)."}
# wmllint: unbalanced-on
{MESSAGE Pekzs "" "" _"Three different lurker behaviors are set up here using the [micro_ai] tag with different parameters:
Side 2 (blue): saurians attacking only from swamp. If no enemy is in range, they do not move.
Side 2 (blue): saurians attacking only from swamp. If no enemy is in range, they do not move.
Side 3 (green): saurians attacking only from swamp. If no enemy is in range, they wander randomly (on swamp only).
Side 3 (green): saurians attacking only from swamp. If no enemy is in range, they wander randomly (on swamp only).
Side 4 (purple): nagas wandering only on water terrain, but attacking from both water and swamp.
@ -452,7 +452,7 @@ We also added two other sides, which demonstrate lurker behavior coded in WML (S
Any unit not adjacent to swamp (and water, for the nagas) is safe from the lurkers, thus it is easy to keep Pekzs from being attacked.
The Lua Lurker AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
The Lua Lurker AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]
@ -516,7 +516,7 @@ The Lua Lurker AI is coded as a Micro AI. A Micro AI can be added and adapted t
[event]
name=end_scenario
{MESSAGE Pekzs "" "" _"Zzanksss for helping me wizz zzossse lurkerss. Hope to sssee you again ssometime."}
{MESSAGE Pekzs "" "" _"Zzanksss for helping me wizz zzossse lurkerss. Hope to sssee you again ssometime."}
[endlevel]
result=victory

View file

@ -135,15 +135,15 @@
{STORE_UNIT_VAR id=Vanak profile profile}
{MESSAGE Vanak "$profile~FL()~RIGHT()" "" _"They there! We them get!"}
{CLEAR_VARIABLE profile}
{MESSAGE messenger "" "" _"Men, I need to get to that signpost in the north, to get the message to our leader. Let's head up there as quickly as we can."}
{MESSAGE messenger "" "" _"Men, I need to get to that signpost in the north, to get the message to our leader. Let's head up there as quickly as we can."}
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" _"Notes" _"The Messenger Escort AI will try to move the dragoon messenger to the signpost in the north, while protecting him as well as possible with the other units. Vanak's orcs need to stop him.
{MESSAGE narrator "wesnoth-icon.png" _"Notes" _"The Messenger Escort AI will try to move the dragoon messenger to the signpost in the north, while protecting him as well as possible with the other units. Vanak's orcs need to stop him.
Note that the messenger route is set up through a series of waypoints here simply to demonstrate how to use waypoints. On this map, using only a single waypoint at the end of the route would work just as well (or probably even better).
Note that the messenger route is set up through a series of waypoints here simply to demonstrate how to use waypoints. On this map, using only a single waypoint at the end of the route would work just as well (or probably even better).
Also note that the messenger does not have to get exactly to each signpost (except for the last one), getting close is good enough.
The Messenger Escort AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
The Messenger Escort AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]
@ -183,7 +183,7 @@ The Messenger Escort AI is coded as a Micro AI. A Micro AI can be added and ada
[filter]
id=messenger
[/filter]
{MESSAGE messenger "" "" _"Nooo! All is lost. We will never stop the orcs now!"}
{MESSAGE messenger "" "" _"Nooo! All is lost. We will never stop the orcs now!"}
# So that game goes on to next scenario
[modify_side]

View file

@ -180,19 +180,19 @@
{STORE_UNIT_VAR id=Konrad profile profile}
# wmllint: unbalanced-on
{MESSAGE Konrad "$profile~FL()~RIGHT()" "" _"Hello! I'm a Konrad impostor. We are going to demonstrate the Patrol AI to you in this scenario.
{MESSAGE Konrad "$profile~FL()~RIGHT()" "" _"Hello! I'm a Konrad impostor. We are going to demonstrate the Patrol AI to you in this scenario.
I am heading for the keep east of the central mountain via a couple waypoints in the south. I will stay there once I get there. By contrast, those two fellas in the center are perpetually circling the mountain, one of them always in the same direction, the other changing directions after every lap.
I am heading for the keep east of the central mountain via a couple waypoints in the south. I will stay there once I get there. By contrast, those two fellas in the center are perpetually circling the mountain, one of them always in the same direction, the other changing directions after every lap.
All of this is implemented by use of the same [micro_ai] tag."}
# wmllint: unbalanced-off
{CLEAR_VARIABLE profile}
{MESSAGE Urudin "" "" _"And I am Urudin. I will attack my enemies for a few turns, but will retreat toward the right edge of the map if my hitpoints are below half of maximum or by Turn 5, whatever happens first.
{MESSAGE Urudin "" "" _"And I am Urudin. I will attack my enemies for a few turns, but will retreat toward the right edge of the map if my hitpoints are below half of maximum or by Turn 5, whatever happens first.
This is an AI separate from the Patrols of Side 2."}
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" _"Notes" _"You, as the player, are in charge of Gertburt's bandits in this scenario. You can either simply watch the patrols move around, or you can move units into their way. The three patrol units are all instructed to behave differently when facing enemy units:
{MESSAGE narrator "wesnoth-icon.png" _"Notes" _"You, as the player, are in charge of Gertburt's bandits in this scenario. You can either simply watch the patrols move around, or you can move units into their way. The three patrol units are all instructed to behave differently when facing enemy units:
Konrad only attacks Gertburt, or any enemy unit that blocks his final waypoint.
@ -200,9 +200,9 @@ The Swordsman never attacks at all.
The Longbowman attacks any enemy unit he ends up next to at the end of his move.
They all have in common, however, that getting to their next waypoint takes priority over attacking. They will thus prefer to move around enemies rather than straight for them. Also, if a waypoint is occupied by a unit they are not instructed to attack, they will (eventually) abandon that waypoint once they get close enough and move on to the next one.
They all have in common, however, that getting to their next waypoint takes priority over attacking. They will thus prefer to move around enemies rather than straight for them. Also, if a waypoint is occupied by a unit they are not instructed to attack, they will (eventually) abandon that waypoint once they get close enough and move on to the next one.
The Patrol AI controlling all Side 2 units is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
The Patrol AI controlling all Side 2 units is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]

View file

@ -125,9 +125,9 @@
name=start
{STORE_UNIT_VAR id=Koorzhar profile profile}
{MESSAGE Koorzhar "$profile~FL()~RIGHT()" "" _"There's that traitor wizard. Let's get him."}
{MESSAGE Koorzhar "$profile~FL()~RIGHT()" "" _"There's that traitor wizard. Let's get him."}
{CLEAR_VARIABLE profile}
{MESSAGE Langzhar "" "" _"Men, you know the deal. We must protect Rossauba under all circumstances. Even my survival is not as important."}
{MESSAGE Langzhar "" "" _"Men, you know the deal. We must protect Rossauba under all circumstances. Even my survival is not as important."}
{MESSAGE Rossauba "" "" _"That's very kind of you, but ..."}
{MESSAGE Langzhar "" "" _"No buts! You stay behind the lines and do not engage in battle unless there is no risk to your life, is that understood? And get to that signpost in the northwest if it is safe."}

View file

@ -79,13 +79,13 @@
{MESSAGE Koorzhar "$profile~FL()~RIGHT()" "" _"This is a very simple scenario that can be used to test out different recruiting patterns."}
{CLEAR_VARIABLE profile}
{MESSAGE Langzhar "" "" _"Just watch the recruiting of both sides and see if it is what you would expect. The recruitment lists cover level 0 to level 2 units, in order to make differences more obvious."}
{MESSAGE Langzhar "" "" _"Just watch the recruiting of both sides and see if it is what you would expect. The recruitment lists cover level 0 to level 2 units, in order to make differences more obvious."}
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" "Notes" _"If you have not changed anything, Side 1 uses the Random Recruiting AI, with swordsmen and peasants having been given higher probability than the other units. This is not meant as a good recruitment pattern, it simply serves as a demonstration how to use the AI.
{MESSAGE narrator "wesnoth-icon.png" "Notes" _"If you have not changed anything, Side 1 uses the Random Recruiting AI, with swordsmen and peasants having been given higher probability than the other units. This is not meant as a good recruitment pattern, it simply serves as a demonstration how to use the AI.
Side 2 uses Wesnoth' default recruiting.
Also note that several Recruiting AIs are available as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Also note that several Recruiting AIs are available as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[/event]

View file

@ -96,7 +96,7 @@
{VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
[/show_if]
[command]
{MESSAGE Grnk "" _"Bottleneck Defense Micro AI Demo" _"In the Bottleneck Defense Micro AI scenario, a small group of human soldiers is instructed to hold a pass against a large horde of orcs. You can either watch them fight it out against the standard RCA AI or take over the orc side."}
{MESSAGE Grnk "" _"Bottleneck Defense Micro AI Demo" _"In the Bottleneck Defense Micro AI scenario, a small group of human soldiers is instructed to hold a pass against a large horde of orcs. You can either watch them fight it out against the standard RCA AI or take over the orc side."}
[/command]
[/set_menu_item]
@ -111,7 +111,7 @@
{VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
[/show_if]
[command]
{MESSAGE Grnk "" _"Swamp Lurker Micro AI demo" _"Swamp lurkers are dumb, impulse-driven creatures which can move across most terrain, but only stop on swamp. They move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead."}
{MESSAGE Grnk "" _"Swamp Lurker Micro AI demo" _"Swamp lurkers are dumb, impulse-driven creatures which can move across most terrain, but only stop on swamp. They move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead."}
[/command]
[/set_menu_item]
@ -171,7 +171,7 @@
{VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
[/show_if]
[command]
{MESSAGE Grnk "" _"Protect Unit Micro AI Demo" _"This scenario demonstrates one side protecting a wizard while moving him to a goal location. At the same time, the other side is modified to do priority attacks on the wizard, even if a better target (by the default AI criteria) is available. You can watch the two AIs fight it out, or take control of either side to explore how the opposing AI behaves."}
{MESSAGE Grnk "" _"Protect Unit Micro AI Demo" _"This scenario demonstrates one side protecting a wizard while moving him to a goal location. At the same time, the other side is modified to do priority attacks on the wizard, even if a better target (by the default AI criteria) is available. You can watch the two AIs fight it out, or take control of either side to explore how the opposing AI behaves."}
[/command]
[/set_menu_item]
@ -186,7 +186,7 @@
{VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
[/show_if]
[command]
{MESSAGE Grnk "" _"HttT: The Elves Besieged Micro AI demo" _"This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The same algorithm as for scenario ""Protect Unit"" is used."}
{MESSAGE Grnk "" _"HttT: The Elves Besieged Micro AI demo" _"This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The same algorithm as for scenario ""Protect Unit"" is used."}
[/command]
[/set_menu_item]
@ -201,7 +201,7 @@
{VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
[/show_if]
[command]
{MESSAGE Grnk "" _"Messenger Escort Micro AI demo" _"'Messenger Escort' has the AI actively protect a messenger while he makes his way to the edge of the map. The escort will also try to open the path for the messenger if there are enemies in the way."}
{MESSAGE Grnk "" _"Messenger Escort Micro AI demo" _"'Messenger Escort' has the AI actively protect a messenger while he makes his way to the edge of the map. The escort will also try to open the path for the messenger if there are enemies in the way."}
[/command]
[/set_menu_item]

View file

@ -136,11 +136,11 @@
name=start
# wmllint: unbalanced-on
{MESSAGE narrator "wesnoth-icon.png" "" _"This scenario features bats moving around in a swarm. Without adjacent enemies, they simply try to stay together and at a certain distance from enemies. However, if an enemy unit is close to any bat, the swarm scatters. This is particular fun to watch when one places an enemy unit in the middle of the swarm. After being scattered, the swarm members slowly rejoin, but not in a very organized way. Sub-swarms or individual bats might roam around for quite some time before they find their way back. It is also possible that individual bats (or small groups) split off from the larger swarm at times.
{MESSAGE narrator "wesnoth-icon.png" "" _"This scenario features bats moving around in a swarm. Without adjacent enemies, they simply try to stay together and at a certain distance from enemies. However, if an enemy unit is close to any bat, the swarm scatters. This is particular fun to watch when one places an enemy unit in the middle of the swarm. After being scattered, the swarm members slowly rejoin, but not in a very organized way. Sub-swarms or individual bats might roam around for quite some time before they find their way back. It is also possible that individual bats (or small groups) split off from the larger swarm at times.
The player controls a side of gryphons, each of which is given 99 moves so that the reaction of the swarm to enemies can be tested easily. There are also several right-click options, for example for adding bats or gryphons or for taking units off the map.
The player controls a side of gryphons, each of which is given 99 moves so that the reaction of the swarm to enemies can be tested easily. There are also several right-click options, for example for adding bats or gryphons or for taking units off the map.
Note: The Swarm AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
Note: The Swarm AI is coded as a Micro AI. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information."}
# wmllint: unbalanced-off
[objectives]

View file

@ -188,9 +188,9 @@
[event]
name=start
{MESSAGE narrator "wesnoth-icon.png" "" _"This scenario features a different kind of wolf behavior from 'Animals'. First, there can be an arbitrary number of wolf packs and the pack size on each side is a free parameter (set to 3 for Side 2 and 4 for Side 3 in this scenario). At the beginning of the scenario, close wolves are grouped into packs in a semi-methodical way. Wolves of the same pack begin by joining each other on the map. After that, they stay together until only one wolf is left, which then tries to join up with an incomplete pack or with other single wolves. Individual wolves entering the map during the scenario behave in that way as well.
{MESSAGE narrator "wesnoth-icon.png" "" _"This scenario features a different kind of wolf behavior from 'Animals'. First, there can be an arbitrary number of wolf packs and the pack size on each side is a free parameter (set to 3 for Side 2 and 4 for Side 3 in this scenario). At the beginning of the scenario, close wolves are grouped into packs in a semi-methodical way. Wolves of the same pack begin by joining each other on the map. After that, they stay together until only one wolf is left, which then tries to join up with an incomplete pack or with other single wolves. Individual wolves entering the map during the scenario behave in that way as well.
Second, wolves do not actively hunt here. For the most part they just wander (often long distance). However, the pack ferociously (and without regard for its own health) attacks any enemy units that come into range, as long as that does not mean separating the pack by more than a few hexes. Staying together, or joining with a new wolf assigned to the pack, is the only thing that takes priority over satisfying the wolves' thirst for blood.
Second, wolves do not actively hunt here. For the most part they just wander (often long distance). However, the pack ferociously (and without regard for its own health) attacks any enemy units that come into range, as long as that does not mean separating the pack by more than a few hexes. Staying together, or joining with a new wolf assigned to the pack, is the only thing that takes priority over satisfying the wolves' thirst for blood.
To emphasize which wolf belongs to which pack, the pack number will be displayed below each wolf in this scenario once the AI takes control of a side the first time."}

View file

@ -214,27 +214,6 @@
[/label]
[/column]
[/row]
[row]
grow_factor = 0
[column]
horizontal_alignment = "left"
[grid]
[row]
grow_factor = 0
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[toggle_button]
id = "use_mdi"
definition = "default"
label = _ "Allow multiple maps to be open simultaneously"
[/toggle_button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]

View file

@ -65,7 +65,7 @@
#image=lite_small
#image=lite
font_size=9
items=statustable,unitlist,editor-map-new,editor-map-load,editor-map-revert,editor-map-save,editor-map-save-as,preferences,editor-settings,help,editor-close-map,quit-editor,editor-quit-to-desktop
items=statustable,unitlist,editor-map-new,editor-map-load,editor-map-revert,editor-map-save,editor-map-save-as,editor-map-save-all,preferences,editor-settings,help,editor-close-map,quit-editor,editor-quit-to-desktop
ref=top-panel
rect="=+1,=+1,+100,+20"
#rect="=+3,=+1,+55,=-4"
@ -196,7 +196,6 @@
items=editor-map-load
#type=
image=button_square/button_square_30
#tooltip= _ ""
auto_tooltip=yes
tooltip_name_prepend=yes
ref=replay-panel
@ -207,7 +206,6 @@
[action]
id=top_button_file2
items=editor-map-save
#type=
image=button_square/button_square_30
#tooltip= _ ""
auto_tooltip=yes
@ -227,9 +225,7 @@
[action]
id=top_button_undo1
items=editor-partial-undo
#type=
image=button_square/button_square_30
#tooltip= _ ""
auto_tooltip=yes
tooltip_name_prepend=yes
rect="+1,=,+30,+30"
@ -239,9 +235,7 @@
[action]
id=top_button_undo2
items=undo
#type=
image=button_square/button_square_30
#tooltip= _ ""
auto_tooltip=yes
tooltip_name_prepend=yes
tooltip_name_prepend=yes
@ -252,9 +246,7 @@
[action]
id=top_button_undo3
items=redo
#type=
image=button_square/button_square_30
#tooltip= _ ""
auto_tooltip=yes
tooltip_name_prepend=yes
rect="+1,=,+30,+30"
@ -481,6 +473,14 @@
xanchor=right
yanchor=fixed
[/action]
[panel]
id=top_separator4
# image=themes/editor/classic/menubar_rightside.png
# ref=replay-panel
rect="=-11,=,+10,+27"
xanchor=fixed
yanchor=fixed
[/panel]
[menu]
id=switch_time
items=editor-switch-time, menu-editor-schedule

View file

@ -339,6 +339,10 @@ bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
case HOTKEY_EDITOR_MAP_SAVE:
return context_manager_->get_map_context().modified();
case HOTKEY_EDITOR_MAP_SAVE_ALL:
{
std::string dummy;
return context_manager_->modified_maps(dummy) > 1;
}
case HOTKEY_EDITOR_SWITCH_MAP:
case HOTKEY_EDITOR_SWITCH_AREA:
case HOTKEY_EDITOR_CLOSE_MAP:
@ -499,9 +503,7 @@ hotkey::ACTION_STATE editor_controller::get_action_state(hotkey::HOTKEY_COMMAND
std::advance(it, index);
const std::vector<time_of_day>& times1 = it->second.second;
const std::vector<time_of_day>& times2 = context_manager_->get_map_context().get_time_manager()->times();
return (times1 == times2) ? ACTION_SELECTED : ACTION_DESELECTED;
//TODO
//return ACTION_STATELESS;
return (times1 == times2) ? ACTION_SELECTED : ACTION_DESELECTED;
}
}
return ACTION_ON;
@ -549,6 +551,7 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
}
case TIME:
{
//TODO mark the map as changed
tod_manager* tod = context_manager_->get_map_context().get_time_manager();
tod->set_turn(index +1, true);
tod_color col = tod->times()[index].color;
@ -557,12 +560,18 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
}
case MUSIC:
{
//TODO mark the map as changed
sound::play_music_once(music_tracks_[index].id());
context_manager_->get_map_context().add_to_playlist(music_tracks_[index]);
std::vector<std::string> items;
items.push_back("editor-playlist");
gui::button* b = gui_->find_menu_button("menu-playlist");
show_menu(items, b->location().x +1, b->location().y + b->height() +1, false, *gui_);
return true;
}
case SCHEDULE:
{
//TODO mark the map as changed
tod_manager* tod = context_manager_->get_map_context().get_time_manager();
tods_map::iterator iter = tods_.begin();
std::advance(iter, index);
@ -879,7 +888,7 @@ void editor_controller::show_menu(const std::vector<std::string>& items_arg, int
active_menu_ = editor::MUSIC;
items.erase(items.begin());
BOOST_FOREACH(const sound::music_track& track, music_tracks_) {
items.push_back(track.id());
items.push_back(track.title().empty() ? track.id() : track.title());
}
}
if (!items.empty() && items.front() == "editor-assign-schedule") {

View file

@ -29,14 +29,6 @@ namespace editor {
preferences::set("editor_auto_update_transitions", lexical_cast<std::string>(value));
}
bool use_mdi() {
return preferences::get("editor_use_mdi", true);
}
void set_use_mdi(bool value) {
preferences::set("editor_use_mdi", value);
}
std::string default_dir() {
return preferences::get("editor_default_dir");
}

View file

@ -31,9 +31,6 @@ namespace editor {
int auto_update_transitions();
void set_auto_update_transitions(int value);
bool use_mdi();
void set_use_mdi(bool value);
std::string default_dir();
bool draw_terrain_codes();

View file

@ -169,33 +169,23 @@ void context_manager::set_default_dir(const std::string& str)
void context_manager::load_map_dialog(bool force_same_context /* = false */)
{
if (!preferences::editor::use_mdi() && !confirm_discard()) {
return;
}
std::string fn = directory_name(get_map_context().get_filename());
if (fn.empty()) {
fn = default_dir_;
}
int res = dialogs::show_file_chooser_dialog(gui_, fn, _("Choose a Map to Open"));
if (res == 0) {
load_map(fn, force_same_context
? false
: preferences::editor::use_mdi());
load_map(fn, !force_same_context);
}
}
void context_manager::new_map_dialog()
{
if (!preferences::editor::use_mdi() && !confirm_discard()) {
return;
}
int w = get_map().w();
int h = get_map().h();
if(gui2::teditor_new_map::execute(w, h, gui_.video())) {
const t_translation::t_terrain fill = get_selected_bg_terrain();
new_map(w, h, fill, preferences::editor::use_mdi());
new_map(w, h, fill, true);
}
}
@ -207,11 +197,12 @@ void context_manager::expand_open_maps_menu(std::vector<std::string>& items)
std::vector<std::string> contexts;
for (size_t mci = 0; mci < map_contexts_.size(); ++mci) {
std::string filename = map_contexts_[mci]->get_filename();
bool changed = map_contexts_[mci]->modified();
if (filename.empty()) {
filename = _("(New Map)");
}
std::string label = "[" + lexical_cast<std::string>(mci) + "] "
+ filename;
+ filename + (changed ? " [*]" : "");
if (map_contexts_[mci]->is_embedded()) {
label += " (E)";
}
@ -253,24 +244,24 @@ void context_manager::expand_areas_menu(std::vector<std::string>& items)
void context_manager::expand_sides_menu(std::vector<std::string>& items)
{
for (unsigned int i = 0; i < items.size(); ++i) {
if (items[i] == "editor-switch-side") {
items.erase(items.begin() + i);
std::vector<std::string> contexts;
for (unsigned int i = 0; i < items.size(); ++i) {
if (items[i] == "editor-switch-side") {
items.erase(items.begin() + i);
std::vector<std::string> contexts;
for (size_t mci = 0; mci < get_map_context().get_teams().size(); ++mci) {
for (size_t mci = 0; mci < get_map_context().get_teams().size(); ++mci) {
const team& t = get_map_context().get_teams()[mci];
std::stringstream label;
label << "[" << mci+1 << "] ";
label << (t.name().empty() ? _("(New Side)") : t.name());
contexts.push_back(label.str());
}
const team& t = get_map_context().get_teams()[mci];
std::stringstream label;
label << "[" << mci+1 << "] ";
label << (t.name().empty() ? _("(New Side)") : t.name());
contexts.push_back(label.str());
}
items.insert(items.begin() + i, contexts.begin(), contexts.end());
break;
}
}
items.insert(items.begin() + i, contexts.begin(), contexts.end());
break;
}
}
}
void context_manager::expand_time_menu(std::vector<std::string>& items)
@ -465,7 +456,8 @@ void context_manager::save_map_as_dialog()
res = dialogs::show_file_chooser_dialog_save(gui_, input_name, _("Save the Map As"));
if (res == 0) {
if (file_exists(input_name)) {
const int res = gui2::show_message(gui_.video(), "", _("The file already exists. Do you want to overwrite it?"), gui2::tmessage::yes_no_buttons);
const int res = gui2::show_message(gui_.video(), "",
_("The file already exists. Do you want to overwrite it?"), gui2::tmessage::yes_no_buttons);
overwrite_res = gui2::twindow::CANCEL == res ? 1 : 0;
} else {
overwrite_res = 0;

View file

@ -66,12 +66,12 @@ public:
bool select_area(int index);
/**
* Map accesor
* Map accessor
*/
editor_map& get_map() { return map_; };
/**
* Map accesor - const version
* Map accessor - const version
*/
const editor_map& get_map() const { return map_; }
@ -165,7 +165,7 @@ public:
void set_needs_terrain_rebuild(bool value=true) { needs_terrain_rebuild_ = value; }
/**
* Getter fo the labels reset flag. Set when the labels need to be refreshed.
* Getter for the labels reset flag. Set when the labels need to be refreshed.
*/
bool needs_labels_reset() const { return needs_labels_reset_; }
@ -208,9 +208,9 @@ public:
void set_map(const editor_map& map);
/**
* Performs an action (thus modyfying the map). An appropriate undo action is added to
* Performs an action (thus modifying the map). An appropriate undo action is added to
* the undo stack. The redo stack is cleared. Note that this may throw, use caution
* when calling this with a dereferennced pointer that you own (i.e. use a smart pointer).
* when calling this with a dereferenced pointer that you own (i.e. use a smart pointer).
*/
void perform_action(const editor_action& action);
@ -248,14 +248,14 @@ public:
/** Un-does the last action, and puts it in the redo stack for a possible redo */
void undo();
/** Re-does a previousle undid action, and puts it back in the undo stack. */
/** Re-does a previously undid action, and puts it back in the undo stack. */
void redo();
/**
* Un-does a single step from a undo action chain. The action is separated
* from the chain and it's undo (the redo) is added as a standalone action
* from the chain and it's undo (the redo) is added as a stand-alone action
* to the redo stack.
* Precodnition: the last undo action has to actually be an action chain.
* Precondition: the last undo action has to actually be an action chain.
*/
void partial_undo();

View file

@ -86,8 +86,8 @@ void terrain_palette::setup(const config& cfg)
cfg["id"] = g["id"];
cfg["name"] = g["name"];
cfg["icon"] = "icons/terrain/terrain_" + g["icon"].t_str();
cfg["core"] = "yes";
cfg["icon"] = "icons/terrain/terrain_" + g["icon"].str();
cfg["core"] = g["core"];
groups_.push_back(item_group(cfg));
group_names.insert(groups_.back().id);

View file

@ -99,10 +99,6 @@ teditor_settings::teditor_settings(editor::editor_display* display
, display_(display)
, can_update_display_(false)
{
register_bool("use_mdi"
, true
, &preferences::editor::use_mdi
, &preferences::editor::set_use_mdi);
}
void teditor_settings::do_next_tod(twindow& window)

View file

@ -1208,7 +1208,7 @@ void play_controller::expand_wml_commands(std::vector<std::string>& items)
}
}
void play_controller::show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu)
void play_controller::show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& disp)
{
std::vector<std::string> items = items_arg;
hotkey::HOTKEY_COMMAND command;
@ -1244,7 +1244,7 @@ void play_controller::show_menu(const std::vector<std::string>& items_arg, int x
if(items.empty())
return;
command_executor::show_menu(items, xloc, yloc, context_menu, *gui_);
command_executor::show_menu(items, xloc, yloc, context_menu, disp);
}
bool play_controller::in_context_menu(hotkey::HOTKEY_COMMAND command) const

View file

@ -168,7 +168,7 @@ protected:
/** Check if a command can be executed. */
virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command, int index=-1) const;
virtual bool execute_command(hotkey::HOTKEY_COMMAND command, int index=-1);
void show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu);
void show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& disp);
/**
* Determines whether the command should be in the context menu or not.

View file

@ -1075,7 +1075,7 @@ static config time_of_day_at(const map_location& mouseover_hex)
liminal_color = "red";
}
tooltip << tod.name << '\n'
<< _("Lawful units: ") << "<span foreground=\"" << lawful_color << "\">"
<< _("Lawful units: ") << "<span foreground=\"" << lawful_color << "\">"
<< utils::signed_percent(b) << "</span>\n"
<< _("Neutral units: ") << utils::signed_percent(0) << '\n'
<< _("Chaotic units: ") << "<span foreground=\"" << chaotic_color << "\">"

View file

@ -20,6 +20,7 @@
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include "vorbis/vorbisfile.h"
static lg::log_domain log_audio("audio");
#define ERR_AUDIO LOG_STREAM(err, log_audio)
@ -41,6 +42,7 @@ music_track::music_track() :
music_track::music_track(const config& node) :
id_(node["name"]),
file_path_(),
title_(),
ms_before_(node["ms_before"]),
ms_after_(node["ms_after"]),
once_(node["play_once"].to_bool()),
@ -53,6 +55,7 @@ music_track::music_track(const config& node) :
music_track::music_track(const std::string& v_name) :
id_(v_name),
file_path_(),
title_(),
ms_before_(0),
ms_after_(0),
once_(false),
@ -76,6 +79,38 @@ void music_track::resolve()
return;
}
FILE* f;
f = fopen(file_path_.c_str(), "r");
if (f == NULL) {
ERR_AUDIO << "Error opening file '" << file_path_ << "'\n";
return;
}
OggVorbis_File vf;
if(ov_open(f, &vf, NULL, 0) < 0) {
ERR_AUDIO << "track does not appear to be an Ogg file '" << id_ << "'\n";
ov_clear(&vf);
return;
}
vorbis_comment* comments = ov_comment(&vf, -1);
char** user_comments = comments->user_comments;
bool found = false;
for (int i=0; i< comments->comments; i++) {
const std::string comment_string(user_comments[i]);
const std::vector<std::string> sowas = utils::split(comment_string, '=');
if (sowas[0] == "TITLE" || sowas[0] == "title") {
title_ = sowas[1];
found = true;
}
}
if (!found) {
ERR_AUDIO << "No title for music track '" << id_ << "'\n";
}
ov_clear(&vf);
LOG_AUDIO << "resolved music track '" << id_ << "' into '" << file_path_ << "'\n";
}

View file

@ -43,6 +43,7 @@ public:
const std::string& file_path() const { return file_path_; }
const std::string& id() const { return id_; }
const std::string& title() const { return title_; }
void set_play_once(bool v) { once_ = v; }
@ -51,6 +52,7 @@ private:
std::string id_;
std::string file_path_;
std::string title_;
int ms_before_, ms_after_;

View file

@ -1,3 +1,17 @@
/*
Copyright (C) 2013 by Maxim Biro <nurupo.contributions@gmail.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#include "windows_tray_notification.hpp"
#include <SDL_syswm.h>

View file

@ -1,3 +1,17 @@
/*
Copyright (C) 2013 by Maxim Biro <nurupo.contributions@gmail.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef WINDOWS_TRAY_NOTIFICATION_HPP_INCLUDED
#define WINDOWS_TRAY_NOTIFICATION_HPP_INCLUDED