Fix out-by-one error on [label] when set in events,
...fix up tutorial which was compensating. Fix South Guard label which was malformed and never appeared anyway.
This commit is contained in:
parent
044167b4c4
commit
ee65456b27
6 changed files with 93 additions and 81 deletions
|
@ -24,6 +24,11 @@
|
|||
{@campaigns/The_South_Guard/utils/sg_deaths.cfg}
|
||||
{@campaigns/The_South_Guard/utils/sg_help.cfg}
|
||||
|
||||
[label]
|
||||
x,y=22,16
|
||||
text=_"Westin"
|
||||
[/label]
|
||||
|
||||
{SECOND_WATCH}
|
||||
{DAWN}
|
||||
{MORNING}
|
||||
|
@ -125,11 +130,6 @@
|
|||
[event]
|
||||
name=prestart
|
||||
|
||||
[label]
|
||||
x,y=20,16
|
||||
label= _ "Westin"
|
||||
[/label]
|
||||
|
||||
# The Bandit Armies control almost all of the villages.
|
||||
|
||||
{STARTING_VILLAGES 2 30}
|
||||
|
|
|
@ -14,24 +14,23 @@
|
|||
{VARIABLE dest unset}
|
||||
#enddef
|
||||
|
||||
# FIXME: For some reason, label locations need to be offset??
|
||||
#define STUDENT_START_LOC
|
||||
8,5
|
||||
9,6
|
||||
#enddef
|
||||
#define MARKER_LOC
|
||||
11,4
|
||||
#enddef
|
||||
#define DELFADOR_LOC
|
||||
12,5
|
||||
#enddef
|
||||
#define DELFADOR_LOC
|
||||
13,6
|
||||
#enddef
|
||||
#define QUINTAIN_LOC
|
||||
12,4
|
||||
13,5
|
||||
#enddef
|
||||
#define VILLAGE_LOC
|
||||
10,6
|
||||
11,7
|
||||
#enddef
|
||||
#define KEEP_LOC
|
||||
8,5
|
||||
9,6
|
||||
#enddef
|
||||
|
||||
[tutorial]
|
||||
|
@ -110,7 +109,7 @@ ffffgggggggggcgggfff
|
|||
[unit]
|
||||
description=Delfador
|
||||
type=Elder Mage
|
||||
x,y=13,6
|
||||
x,y={DELFADOR_LOC}
|
||||
side=3
|
||||
[/unit]
|
||||
{LABEL Delfador {DELFADOR_LOC}}
|
||||
|
@ -133,7 +132,7 @@ ffffgggggggggcgggfff
|
|||
[/objectives]
|
||||
|
||||
[hide_unit]
|
||||
x,y=9,6
|
||||
x,y={STUDENT_START_LOC}
|
||||
[/hide_unit]
|
||||
{VARIABLE student_hp 32}
|
||||
|
||||
|
@ -265,7 +264,7 @@ You moved to the wrong place! After this message, you can press 'u' to Undo, th
|
|||
name=moveto
|
||||
[filter]
|
||||
side=1
|
||||
x,y=12,5
|
||||
x,y={MARKER_LOC}
|
||||
[/filter]
|
||||
|
||||
{CLEAR_PRINT}
|
||||
|
@ -322,7 +321,7 @@ You moved to the wrong place! After this message, you can press 'u' to Undo, th
|
|||
description=Quintain
|
||||
type=Quintain
|
||||
ai_special="guardian"
|
||||
x,y=13,5
|
||||
x,y={QUINTAIN_LOC}
|
||||
side=2
|
||||
[/unit]
|
||||
|
||||
|
@ -527,7 +526,7 @@ Now, this quintain gets five chances to hit you, and if it hits every time, you'
|
|||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
x,y=9,6
|
||||
x,y={KEEP_LOC}
|
||||
[/filter]
|
||||
|
||||
{CLEAR_PRINT}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
{NUMEQ dumbo_dead 1}
|
||||
[then]
|
||||
{VARIABLE island_defended 1}
|
||||
{LABEL (_"Patch of forest") 9,13}
|
||||
{LABEL (_"Patch of forest") 10,14}
|
||||
{TALK_ABOUT_LOC 10,14 (_"Now put an unwounded unit, preferably a fighter, in that patch of forest on the south-east of the island: a nice, defensible spot.")}
|
||||
{STUDENT (_"Can one unit survive against all those enemies?")}
|
||||
{TEACHER (_"With a little help, yes. If your move your Shaman next to the defending unit, it will heal it by 4 hitpoints per turn. Just be careful not to expose the Shaman to attack: is fairly weak itself.")}
|
||||
|
@ -32,7 +32,7 @@
|
|||
[filter]
|
||||
x,y=10,14
|
||||
[/filter]
|
||||
{UNLABEL 9,13}
|
||||
{UNLABEL 10,14}
|
||||
{PRINT (_"Advance other units onto the island or to capture villages, then End Turn")}
|
||||
[allow_undo][/allow_undo]
|
||||
[/event]
|
||||
|
@ -379,29 +379,29 @@
|
|||
|
||||
{TALK_ABOUT Dumbo (_"First, we will have to deal with the Orcish Grunt stationed in the middle of the river. He should be little trouble.")}
|
||||
{TALK_ABOUT Thrag (_"By then, their leader will have recruited units to send against us, and the real fight will begin.")}
|
||||
{LABEL (_"SHALLOW") 18,15}
|
||||
{LABEL (_"SHALLOW") 17,15}
|
||||
{LABEL (_"SHALLOW") 17,13}
|
||||
{LABEL (_"SHALLOW") 19,16}
|
||||
{LABEL (_"SHALLOW") 18,16}
|
||||
{LABEL (_"SHALLOW") 18,14}
|
||||
{LABEL (_"SHALLOW") 19,13}
|
||||
{LABEL (_"DEEP") 16,15}
|
||||
{LABEL (_"DEEP") 17,14}
|
||||
{LABEL (_"DEEP") 19,14}
|
||||
{LABEL (_"DEEP") 18,16}
|
||||
{LABEL (_"SHALLOW") 19,15}
|
||||
{LABEL (_"SHALLOW") 20,14}
|
||||
{LABEL (_"DEEP") 17,16}
|
||||
{LABEL (_"DEEP") 18,15}
|
||||
{LABEL (_"DEEP") 20,15}
|
||||
{LABEL (_"DEEP") 19,17}
|
||||
|
||||
{TALK_ABOUT_LOC 19,14 (_"See this dark blue water: it is too deep for either side to cross. They could slowly wade through that narrow band of shallow lighter-blue water in the east, but we would stand on the shore and force them to fight us from the water, where they are exposed and we are protected by the forest.")}
|
||||
{UNLABEL 18,15}
|
||||
{UNLABEL 17,15}
|
||||
{UNLABEL 17,13}
|
||||
{UNLABEL 18,14}
|
||||
{UNLABEL 19,13}
|
||||
{UNLABEL 16,15}
|
||||
{UNLABEL 17,14}
|
||||
{UNLABEL 19,14}
|
||||
{UNLABEL 19,16}
|
||||
{UNLABEL 18,16}
|
||||
{LABEL (_"Village") 10,13}
|
||||
{UNLABEL 18,14}
|
||||
{UNLABEL 19,15}
|
||||
{UNLABEL 20,14}
|
||||
{UNLABEL 17,16}
|
||||
{UNLABEL 18,15}
|
||||
{UNLABEL 20,15}
|
||||
{UNLABEL 19,17}
|
||||
{LABEL (_"Village") 11,14}
|
||||
{TALK_ABOUT_LOC 9,14 (_"The more likely attack, then, is across the bridge. That middle island is the key: it has a village, for healing injured units, and forest in which we fight so well.")}
|
||||
{UNLABEL 10,13}
|
||||
{UNLABEL 11,14}
|
||||
{TEACHER (_"To start, we will need some units:
|
||||
Two Elvish Fighters
|
||||
Two Elvish Archers
|
||||
|
@ -479,7 +479,7 @@ One Elvish Shaman")}
|
|||
{TEACHER (_ "During your tutorial, $recall_name1 gained $recall_xp1 experience points. You should recall that unit now, and recruit a second one (which is cheaper than recalling, anyway).")}
|
||||
[/else]
|
||||
[/if]
|
||||
{LABEL (_"RECALL $recall_name1") 9,3}
|
||||
{LABEL (_"RECALL $recall_name1") 10,4}
|
||||
{PRINT (_"Right click on the tile south of you and recall $recall_name1")}
|
||||
[/then]
|
||||
[else]
|
||||
|
@ -495,7 +495,7 @@ One Elvish Shaman")}
|
|||
{TEACHER (_"If you had any experienced units alive from your last battle we would recall them, instead we must recruit a new Elvish Fighter.")}
|
||||
[/else]
|
||||
[/if]
|
||||
{LABEL (_"Elvish Fighter") 9,3}
|
||||
{LABEL (_"Elvish Fighter") 10,4}
|
||||
{PRINT (_"Right click on the tile south of you and recruit an Elvish Fighter")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -534,7 +534,7 @@ One Elvish Shaman")}
|
|||
[/then]
|
||||
[else]
|
||||
{VARIABLE_OP recruit_num add 1}
|
||||
{UNLABEL 9,1}
|
||||
{UNLABEL 10,2}
|
||||
{CLEAR_PRINT}
|
||||
{TEACHER (_"The Shaman is a fairly weak unit, but has the ability to heal units around it. It also has a special attack which slows enemies, halving the damage they do!")}
|
||||
{STUDENT (_"So, should I end my turn now?")}
|
||||
|
@ -582,9 +582,9 @@ One Elvish Shaman")}
|
|||
[/unit]
|
||||
{EXPLAIN_QUICK_RESILIENT (_"Eowynial")}
|
||||
|
||||
{UNLABEL 8,3}
|
||||
{UNLABEL 8,2}
|
||||
{LABEL (_"Shaman") 9,1}
|
||||
{UNLABEL 9,4}
|
||||
{UNLABEL 9,3}
|
||||
{LABEL (_"Shaman") 10,2}
|
||||
{PRINT (_"Recruit an Elvish Shaman to your north")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -655,9 +655,9 @@ One Elvish Shaman")}
|
|||
[/then]
|
||||
[else]
|
||||
{VARIABLE_OP recruit_num add 1}
|
||||
{UNLABEL 10,3}
|
||||
{LABEL (_"Archer #1") 8,3}
|
||||
{LABEL (_"Archer #2") 8,2}
|
||||
{UNLABEL 11,4}
|
||||
{LABEL (_"Archer #1") 9,4}
|
||||
{LABEL (_"Archer #2") 9,3}
|
||||
{PRINT (_"Recruit two Elvish Archers in tiles to your west")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -697,9 +697,9 @@ One Elvish Shaman")}
|
|||
[/unit]
|
||||
{EXPLAIN_QUICK_RESILIENT (_"Golir")}
|
||||
|
||||
{UNLABEL 10,3}
|
||||
{LABEL (_"Archer #1") 8,3}
|
||||
{LABEL (_"Archer #2") 8,2}
|
||||
{UNLABEL 11,4}
|
||||
{LABEL (_"Archer #1") 9,4}
|
||||
{LABEL (_"Archer #2") 9,3}
|
||||
{PRINT (_"Recruit two Elvish Archers in tiles to your west")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -759,7 +759,7 @@ One Elvish Shaman")}
|
|||
[/then]
|
||||
[else]
|
||||
{VARIABLE_OP recruit_num add 1}
|
||||
{UNLABEL 9,3}
|
||||
{UNLABEL 10,4}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
|
@ -768,10 +768,10 @@ One Elvish Shaman")}
|
|||
[/variable]
|
||||
[then]
|
||||
{PRINT (_"Right click on the tile south-east of you and recall $recall_name2")}
|
||||
{LABEL (_"RECALL $recall_name2") 10,3}
|
||||
{LABEL (_"RECALL $recall_name2") 11,4}
|
||||
[/then]
|
||||
[else]
|
||||
{LABEL (_"Elvish Fighter") 10,3}
|
||||
{LABEL (_"Elvish Fighter") 11,4}
|
||||
{PRINT (_"Right click on the tile south-east of you and recruit an Elvish Fighter")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -794,7 +794,7 @@ One Elvish Shaman")}
|
|||
[/kill]
|
||||
[/then]
|
||||
[else]
|
||||
{UNLABEL 9,3}
|
||||
{UNLABEL 10,4}
|
||||
{VARIABLE_OP recruit_num add 1}
|
||||
|
||||
[kill]
|
||||
|
@ -814,7 +814,7 @@ One Elvish Shaman")}
|
|||
[/modifications]
|
||||
[/unit]
|
||||
{EXPLAIN_STRONG_INTELLIGENT (_"Elindel")}
|
||||
{LABEL (_"Elvish Fighter") 10,3}
|
||||
{LABEL (_"Elvish Fighter") 11,4}
|
||||
{PRINT (_"Right click on the tile south-east of you and recruit an Elvish Fighter")}
|
||||
[/else]
|
||||
[/if]
|
||||
|
@ -905,8 +905,8 @@ One Elvish Shaman")}
|
|||
name=attack_end
|
||||
|
||||
{CLEAR_PRINT}
|
||||
{UNLABEL 13,2}
|
||||
{LABEL (_"Fighter to Here") 18,4}
|
||||
{UNLABEL 14,3}
|
||||
{LABEL (_"Fighter to Here") 19,5}
|
||||
{TALK_ABOUT_LOC 19,5 (_"Your other units cannot reach that Orc this turn. Send a Fighter to that village to the far east: that will take two turns.")}
|
||||
{NARRATOR (_"You can make a unit keep moving for multiple turns: select the unit, then click on the target. You will see (2) if it will take two turns to reach it.")}
|
||||
{PRINT (_"Tell a Fighter to move to the far east village")}
|
||||
|
@ -918,8 +918,8 @@ One Elvish Shaman")}
|
|||
y=1-6
|
||||
[/filter]
|
||||
|
||||
{UNLABEL 18,4}
|
||||
{LABEL (_"Keep") 9,2}
|
||||
{UNLABEL 19,5}
|
||||
{LABEL (_"Keep") 10,3}
|
||||
{TEACHER (_"Send the other Fighter and the Shaman south so they can attack next turn, then return to the keep to recruit more units!")}
|
||||
{PRINT (_"Move Fighter and Shaman south, then return $student to the Keep")}
|
||||
[/event]
|
||||
|
@ -930,7 +930,7 @@ One Elvish Shaman")}
|
|||
side=1
|
||||
x,y=10,3
|
||||
[/filter]
|
||||
{UNLABEL 9,2}
|
||||
{UNLABEL 10,3}
|
||||
{PRINT (_"Recruit another Archer and a Fighter")}
|
||||
{VARIABLE num_recruited 0}
|
||||
[/event]
|
||||
|
@ -941,7 +941,7 @@ One Elvish Shaman")}
|
|||
[filter]
|
||||
side=1
|
||||
[/filter]
|
||||
{UNLABEL 9,3}
|
||||
{UNLABEL 10,4}
|
||||
{VARIABLE_OP num_recruited add 1}
|
||||
[if]
|
||||
{NUMEQ num_recruited 2}
|
||||
|
@ -969,30 +969,30 @@ One Elvish Shaman")}
|
|||
[event]
|
||||
name=turn 3
|
||||
|
||||
{UNLABEL 9,3}
|
||||
{UNLABEL 10,3}
|
||||
{UNLABEL 10,4}
|
||||
{UNLABEL 11,4}
|
||||
|
||||
# Explain: Zone of Control
|
||||
{TALK_ABOUT Dumbo (_"The Orc is blocking the bridge! We must occupy that island before the wolf riders reach it.")}
|
||||
{STUDENT (_"Can't our units just move around him?")}
|
||||
|
||||
# All around Dumbo (label 8,13)
|
||||
{LABEL (_"ZoC") 9,13}
|
||||
{LABEL (_"ZoC") 7,13}
|
||||
{LABEL (_"ZoC") 8,12}
|
||||
# All around Dumbo (9,14)
|
||||
{LABEL (_"ZoC") 10,14}
|
||||
{LABEL (_"ZoC") 8,14}
|
||||
{LABEL (_"ZoC") 9,12}
|
||||
{LABEL (_"ZoC") 7,12}
|
||||
{LABEL (_"ZoC") 9,13}
|
||||
{LABEL (_"ZoC") 9,15}
|
||||
{LABEL (_"ZoC") 10,13}
|
||||
{LABEL (_"ZoC") 8,13}
|
||||
# FIXME: Figure out best unit choice.
|
||||
{TALK_ABOUT Dumbo (_"No: once you move close to an enemy unit, you are in it's 'Zone of Control', and cannot move further that turn.
|
||||
To move your troops onto that island without wading slowly through the water, you'll have to kill him.")}
|
||||
{PRINT (_"Attack the Orc with an Archer")}
|
||||
{UNLABEL 9,13}
|
||||
{UNLABEL 7,13}
|
||||
{UNLABEL 8,12}
|
||||
{UNLABEL 10,14}
|
||||
{UNLABEL 8,14}
|
||||
{UNLABEL 9,12}
|
||||
{UNLABEL 7,12}
|
||||
{UNLABEL 9,15}
|
||||
{UNLABEL 9,13}
|
||||
{UNLABEL 10,13}
|
||||
{UNLABEL 8,13}
|
||||
|
||||
[event]
|
||||
name=attack_end
|
||||
|
@ -1118,12 +1118,13 @@ To move your troops onto that island without wading slowly through the water, yo
|
|||
name=turn 7
|
||||
|
||||
{CHECK_INCOME}
|
||||
{LABEL (_"Defend here") 18,13}
|
||||
{LABEL (_"Defend here") 19,14}
|
||||
{TALK_ABOUT_LOC 19,16 (_"Beware those Orcs crossing the river! If they get into the forest they'll be hard to dislodge!")}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=turn 9
|
||||
{UNLABEL 19,14}
|
||||
{NARRATOR (_"You can make sure you've used all your units for this turn: press 'n' for the next unit, SPACE to indicate it's finished.
|
||||
When 'n' no longer selects a new unit, you can end your turn.")}
|
||||
[/event]
|
||||
|
|
|
@ -1739,7 +1739,7 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
|||
events::pump();
|
||||
}
|
||||
} else if(cmd == "label") {
|
||||
const gamemap::location loc(lexical_cast_default<int>(cfg["x"],-1),lexical_cast_default<int>(cfg["y"],-1));
|
||||
const gamemap::location loc(cfg);
|
||||
const std::string& text = cfg["text"];
|
||||
screen->labels().set_label(loc,text);
|
||||
}
|
||||
|
|
18
src/map.cpp
18
src/map.cpp
|
@ -13,15 +13,16 @@
|
|||
|
||||
#include "global.hpp"
|
||||
|
||||
#include "actions.hpp"
|
||||
#include "config.hpp"
|
||||
#include "gamestatus.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map.hpp"
|
||||
#include "pathutils.hpp"
|
||||
#include "util.hpp"
|
||||
#include "variable.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "actions.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
@ -177,11 +178,8 @@ std::string gamemap::location::write_direction(gamemap::location::DIRECTION dir)
|
|||
}
|
||||
}
|
||||
|
||||
gamemap::location::location(const config& cfg) : x(-1), y(-1)
|
||||
void gamemap::location::init(const std::string &xstr, const std::string &ystr)
|
||||
{
|
||||
const std::string& xstr = cfg["x"];
|
||||
const std::string& ystr = cfg["y"];
|
||||
|
||||
//the co-ordinates in config files will be 1-based, while we
|
||||
//want them as 0-based
|
||||
if(xstr.empty() == false)
|
||||
|
@ -191,6 +189,16 @@ gamemap::location::location(const config& cfg) : x(-1), y(-1)
|
|||
y = atoi(ystr.c_str()) - 1;
|
||||
}
|
||||
|
||||
gamemap::location::location(const config& cfg) : x(-1), y(-1)
|
||||
{
|
||||
init(cfg["x"], cfg["y"]);
|
||||
}
|
||||
|
||||
gamemap::location::location(const vconfig& cfg) : x(-1), y(-1)
|
||||
{
|
||||
init(cfg["x"], cfg["y"]);
|
||||
}
|
||||
|
||||
void gamemap::location::write(config& cfg) const
|
||||
{
|
||||
char buf[50];
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
class config;
|
||||
class gamestatus;
|
||||
class unit;
|
||||
class vconfig;
|
||||
|
||||
#include "terrain.hpp"
|
||||
|
||||
|
@ -71,6 +72,7 @@ public:
|
|||
location() : x(-1), y(-1) {}
|
||||
location(int x, int y) : x(x), y(y) {}
|
||||
explicit location(const config& cfg);
|
||||
explicit location(const vconfig& cfg);
|
||||
|
||||
void write(config& cfg) const;
|
||||
|
||||
|
@ -99,6 +101,8 @@ public:
|
|||
DIRECTION get_relative_dir(location loc) const;
|
||||
|
||||
static location null_location;
|
||||
private:
|
||||
void init(const std::string &x, const std::string &y);
|
||||
};
|
||||
typedef std::map<location,unit> unit_map;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue