terrain stored in [store_locations] WML
This commit is contained in:
parent
a44d632afe
commit
d4486ed8d3
5 changed files with 24 additions and 3 deletions
|
@ -40,6 +40,7 @@ SVN trunk (1.1.2+svn):
|
|||
greatsword, orcish sword, pincers, plaguestaff, string, thorns, torch,
|
||||
touch, wail, zombie touch
|
||||
* hitpoint distribution graphs under Damage Calculations
|
||||
* stylistic improvements to loadscreen progressbar
|
||||
* multiplayer maps:
|
||||
* added multiplayer maps: 8p Morituri
|
||||
* revised multiplayer maps: Blitz, Charge, Cynsaun Battlefield, Den of Onis,
|
||||
|
@ -69,6 +70,7 @@ SVN trunk (1.1.2+svn):
|
|||
* interpret the variables/arrays in a few more tags
|
||||
* floating damage/heal or status can be printed over a modified unit using
|
||||
the 'text', 'red', 'blue', and 'green' keys in [unstore_unit]
|
||||
* store_locations now stores terrain as well as x,y
|
||||
* multiplayer settings:
|
||||
* two additional MP timer settings, time reservoir limit and action bonus:
|
||||
* Reservoir prevents the turn timer from exceeding an upper limit.
|
||||
|
|
|
@ -1559,7 +1559,9 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
|||
static const t_string default_store = "location";
|
||||
const t_string& store = cfg["variable"].empty() ? default_store : cfg["variable"];
|
||||
wassert(state_of_game != NULL);
|
||||
loc.write(state_of_game->get_variable_cfg(store));
|
||||
config &loc_store = state_of_game->get_variable_cfg(store);
|
||||
loc.write(loc_store);
|
||||
game_map->write_terrain(loc, loc_store);
|
||||
}
|
||||
|
||||
else if(cmd == "store_locations") {
|
||||
|
@ -1591,7 +1593,9 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
|||
if (u == units->end() || !game_events::unit_matches_filter(u, unit_filter))
|
||||
continue;
|
||||
}
|
||||
j->write(state_of_game->variables.add_child(variable));
|
||||
config &loc_store = state_of_game->variables.add_child(variable);
|
||||
j->write(loc_store);
|
||||
game_map->write_terrain(*j, loc_store);
|
||||
++added;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,14 @@ bool gamemap::filter_location(const gamemap::location &loc,const config & /*con*
|
|||
return on_board(loc);
|
||||
}
|
||||
|
||||
void gamemap::write_terrain(const gamemap::location &loc, config& cfg) const
|
||||
{
|
||||
//will need to be updated for multi-letter terrain --Sapient
|
||||
char *loc_terrain = " ";
|
||||
*loc_terrain = get_terrain(loc);
|
||||
cfg["terrain"] = loc_terrain;
|
||||
}
|
||||
|
||||
gamemap::location::DIRECTION gamemap::location::parse_direction(const std::string& str)
|
||||
{
|
||||
if(str == "n") {
|
||||
|
|
|
@ -146,6 +146,10 @@ public:
|
|||
//this allows proper drawing of the edges of the map
|
||||
TERRAIN get_terrain(const location& loc) const;
|
||||
|
||||
//writes the terrain at loc to cfg
|
||||
void gamemap::write_terrain(const gamemap::location &loc, config& cfg) const;
|
||||
|
||||
|
||||
//functions to manipulate starting positions of the different sides.
|
||||
const location& starting_position(int side) const;
|
||||
int is_starting_position(const location& loc) const;
|
||||
|
|
|
@ -334,6 +334,7 @@ namespace{
|
|||
// Unscathed probability.
|
||||
left_strings.push_back(_("Chance of being unscathed"));
|
||||
snprintf(str_buf, 10, "%.1f%%", (float) (u_unscathed * 100.0));
|
||||
str_buf[9] = '\0'; //prevents _snprintf error
|
||||
right_strings.push_back(str_buf);
|
||||
|
||||
#if 0 // might not be en English!
|
||||
|
@ -562,6 +563,7 @@ namespace{
|
|||
|
||||
// Print HP, aligned right.
|
||||
snprintf(str_buf, 10, "%d", hp);
|
||||
str_buf[9] = '\0'; //prevents _snprintf error
|
||||
int hp_width = font::line_width(str_buf, fs);
|
||||
|
||||
// Draw bars.
|
||||
|
@ -589,7 +591,8 @@ namespace{
|
|||
else if(prob >= 0.1) prob_str_format = "%4.1f %%";
|
||||
else prob_str_format = " %3.1f %%";
|
||||
|
||||
snprintf(str_buf, 10, prob_str_format, (float) (100.0 * (prob + 0.0005)));
|
||||
snprintf(str_buf, 10, prob_str_format, (float) (100.0 * (prob + 0.0005)));
|
||||
str_buf[9] = '\0'; //prevents _snprintf error
|
||||
int prob_width = font::line_width(str_buf, fs);
|
||||
font::draw_text_line(surf, clip_rect, fs, font::NORMAL_COLOUR, str_buf,
|
||||
width - prob_width - 4, 2 + (fs + 2) * i, 0, TTF_STYLE_NORMAL);
|
||||
|
|
Loading…
Add table
Reference in a new issue