add [replace_map] functionality.
Allows completely changing the map in a scenario, including loading a map with a different size.
This commit is contained in:
parent
91acb9022e
commit
3708b6b8c9
3 changed files with 57 additions and 0 deletions
|
@ -47,6 +47,8 @@ Version 1.5.7+svn:
|
|||
* the animate_unit action can now animate multiple units
|
||||
* the animate_unit action can now change the direction the unit is facing
|
||||
with a SLF
|
||||
* add a [replace_map] map="file" event that can load a map of a different
|
||||
size in a scenario
|
||||
* Miscellaneous and bug fixes:
|
||||
* Added the sunset feature to the new dialogs.
|
||||
* Fix the calculate feature in the test scenario.
|
||||
|
|
|
@ -1135,6 +1135,44 @@ Result:
|
|||
[/end_turn]
|
||||
[/event]
|
||||
|
||||
[label]
|
||||
x,y=10,2
|
||||
text="map change"
|
||||
[/label]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
x,y=10,2
|
||||
[/filter]
|
||||
[message]
|
||||
side=2
|
||||
message="Suddenly, Elves Besieged!"
|
||||
[/message]
|
||||
[replace_map]
|
||||
map="{campaigns/Heir_To_The_Throne/maps/01_The_Elves_Besieged.map}"
|
||||
[/replace_map]
|
||||
[/event]
|
||||
|
||||
[label]
|
||||
x,y=10,3
|
||||
text="map change2"
|
||||
[/label]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
x,y=10,3
|
||||
[/filter]
|
||||
[message]
|
||||
side=2
|
||||
message="Suddenly, Blackwater Port!"
|
||||
[/message]
|
||||
[replace_map]
|
||||
map="{campaigns/Heir_To_The_Throne/maps/02_Blackwater_Port.map}"
|
||||
[/replace_map]
|
||||
[/event]
|
||||
|
||||
# Capture connected villages near 13,2 for team 2
|
||||
[event]
|
||||
name=prestart
|
||||
|
|
|
@ -3105,6 +3105,23 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
// Experimental map replace
|
||||
WML_HANDLER_FUNCTION(replace_map,handler,/*event_info*/,cfg)
|
||||
{
|
||||
gamemap map(*game_map);
|
||||
try {
|
||||
map.read(cfg["map"]);
|
||||
} catch(incorrect_map_format_exception&) {
|
||||
ERR_NG << "terrain mask is in the incorrect format, and couldn't be applied\n";
|
||||
return;
|
||||
} catch(twml_exception& e) {
|
||||
e.show(*screen);
|
||||
return;
|
||||
}
|
||||
*game_map = map;
|
||||
screen->reload_map();
|
||||
handler.rebuild_screen() = true;
|
||||
}
|
||||
|
||||
/** Handles all the different types of actions that can be triggered by an event. */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue