fixed bug where tooltips could be left behind after 'load game' dialog.

Fixed bug where themes with multiple resolution specifiers could be
displayed incorrectly
This commit is contained in:
Dave White 2004-07-18 18:49:04 +00:00
parent 8cdf28578c
commit aeb6d675d9
14 changed files with 51 additions and 16 deletions

View file

@ -107,7 +107,7 @@ fffffffffffffcffffff"
[message]
id=council_7
description=Parandra
message="How quickly do the race of men mature! Only nineteen winters have passed since I last laid eyes on you, Konrad, yet you are now a grown man. A brave warrior stands before me!"
message="How quickly do the race of men mature! Only fourteen winters have passed since I last laid eyes on you, Konrad, yet you are now a grown man. A brave warrior stands before me!"
[/message]
[message]
id=council_8

View file

@ -179,7 +179,7 @@ hordes_undead="The Dark Hordes"
error_no_campaigns="There are no campaigns available"
new_campaign="Campaign"
new_campaign=_"Campaign"
choose_campaign="Choose the campaign you want to play:"
difficulty="Difficulty"

View file

@ -11,7 +11,7 @@ experience=52
level=2
alignment=chaotic
advanceto=Troll Warrior
cost=25
cost=32
unit_description="Trolls are strong and brutal humanoid monsters with the amazing ability to regenerate themselves, so that they recover from wounds on their own, even during battle."
get_hit_sound=ugg.wav
usage=fighter

View file

@ -7,7 +7,7 @@ ability=regenerates
hitpoints=42
movement_type=largefoot
movement=4
experience=25
experience=32
level=1
alignment=chaotic
advanceto=Troll

View file

@ -934,6 +934,11 @@ bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const m
const location loc = move_unit(i->second,i->first,possible_moves);
++moves_made;
//if we didn't make it to the destination, it means we were ambushed.
if(loc != i->first) {
return true;
}
const unit_map::const_iterator new_unit = units_.find(loc);
if(new_unit != units_.end() && power_projection(i->first,enemy_srcdst,enemy_dstsrc) >= new_unit->second.hitpoints()/4) {

View file

@ -301,7 +301,7 @@ public:
virtual void play_turn();
virtual int choose_weapon(const location& att, const location& def,
battle_stats& cur_stats, gamemap::TERRAIN terrain);
battle_stats& cur_stats, gamemap::TERRAIN terrain, bool use_cache=false);
struct target {
enum TYPE { VILLAGE, LEADER, EXPLICIT, THREAT, BATTLE_AID, MASS, SUPPORT };

View file

@ -230,7 +230,7 @@ bool operator==(const battle_type& a, const battle_type& b)
std::set<battle_type> weapon_choice_cache;
int ai::choose_weapon(const location& att, const location& def,
battle_stats& cur_stats, gamemap::TERRAIN terrain)
battle_stats& cur_stats, gamemap::TERRAIN terrain, bool use_cache)
{
const std::map<location,unit>::const_iterator itor = units_.find(att);
if(itor == units_.end())
@ -239,6 +239,10 @@ int ai::choose_weapon(const location& att, const location& def,
static int cache_hits = 0;
static int cache_misses = 0;
if(use_cache == false) {
weapon_choice_cache.clear();
}
battle_type battle(att,def,terrain);
const std::set<battle_type>::const_iterator cache_itor = weapon_choice_cache.find(battle);
@ -347,7 +351,7 @@ void ai::attack_analysis::analyze(const gamemap& map,
std::vector<std::pair<location,location> >::const_iterator m;
for(m = movements.begin(); m != movements.end(); ++m) {
battle_stats bat_stats;
const int weapon = ai_obj.choose_weapon(m->first,target, bat_stats, map[m->second.x][m->second.y]);
const int weapon = ai_obj.choose_weapon(m->first,target, bat_stats, map[m->second.x][m->second.y],true);
assert(weapon != -1);
weapons.push_back(weapon);

View file

@ -306,7 +306,13 @@ bool ai::move_group(const location& dst, const std::vector<location>& route, con
if(best_loc.valid()) {
res = true;
move_unit(*i,best_loc,possible_moves);
const location res = move_unit(*i,best_loc,possible_moves);
//if we were ambushed, abort the group's movement.
if(res != best_loc) {
return true;
}
preferred_moves.erase(std::find(preferred_moves.begin(),preferred_moves.end(),best_loc));
//find locations that are 'perpendicular' to the direction of movement for further units to move to.

View file

@ -540,7 +540,7 @@ void config::read(const std::string& data,
std::string var;
std::string value;
bool in_quotes = false, has_quotes = false, in_comment = false, escape_next = false;
bool in_quotes = false, has_quotes = false, in_comment = false, escape_next = false, translatable = false;;
int line = 0;
@ -690,6 +690,15 @@ void config::read(const std::string& data,
} else if(c == '"') {
in_quotes = !in_quotes;
has_quotes = true;
//if we have an underscore outside of quotes in front, then
//we strip it away, since it simply indicates that this value is translatable.
if(value.empty() == false && std::count(value.begin(),value.end(),'_') == 1) {
std::string val = value;
if(strip(val) == "_") {
value = "";
}
}
} else if(c == '\n' && !in_quotes) {
//see if this is a CVS list=CVS list style assignment (e.g. x,y=5,8)
@ -720,6 +729,10 @@ void config::read(const std::string& data,
strip(value);
}
if(translatable) {
//translate 'value' here using gettext
}
if(n < vars.size()) {
elements.top()->values[vars[n]] = value;
} else {
@ -733,6 +746,7 @@ void config::read(const std::string& data,
value = "";
has_quotes = false;
escape_next = false;
translatable = false;
} else if(in_quotes || !has_quotes) {
push_back(value, c);
}

View file

@ -1702,6 +1702,11 @@ void display::blit_surface(int x, int y, SDL_Surface* surface, SDL_Rect* srcrect
SDL_Surface* display::get_minimap(int w, int h)
{
if(minimap_ != NULL && (minimap_->w != w || minimap_->h != h)) {
SDL_FreeSurface(minimap_);
minimap_ = NULL;
}
if(minimap_ == NULL) {
minimap_ = image::getMinimap(w,h,map_,
status_.get_time_of_day().lawful_bonus,

View file

@ -738,7 +738,6 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
std::string text;
gamemap::location loc;
bool remove_overlay = false;
if(filter != NULL) {
for(unit_map::const_iterator u = units->begin(); u != units->end(); ++u) {
if(game_events::unit_matches_filter(u,*filter)) {
@ -749,7 +748,6 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
}
if(loc.valid() == false) {
remove_overlay = true;
loc = event_info.loc1;
}
@ -764,10 +762,6 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
u->second.add_modification("object",cfg);
if(remove_overlay) {
screen->remove_overlay(event_info.loc1);
}
screen->select_hex(event_info.loc1);
screen->invalidate_unit();

View file

@ -13,6 +13,8 @@
#ifndef SCOPED_RESOURCE_H_INCLUDED
#define SCOPED_RESOURCE_H_INCLUDED
#include <cstdio> //for FILE
/**
* The util namespace should take all classes which are of a generic type,
* used to perform common tasks which are not BibleTime-specific. See

View file

@ -20,6 +20,7 @@
#include "font.hpp"
#include "halo.hpp"
#include "network.hpp"
#include "tooltips.hpp"
#include "unit.hpp"
#include "video.hpp"
@ -117,7 +118,7 @@ struct check_item {
class preview_pane : public widget {
public:
preview_pane(display& disp) : widget(disp) {}
virtual ~preview_pane() {}
virtual ~preview_pane() { tooltips::clear_tooltips(location()); }
virtual bool show_above() const { return false; }
virtual bool left_side() const = 0;

View file

@ -250,11 +250,15 @@ bool theme::set_resolution(const SDL_Rect& screen)
const config* const main_map_cfg = cfg.child("main_map");
if(main_map_cfg != NULL) {
main_map_ = object(*main_map_cfg);
} else {
main_map_ = object();
}
const config* const mini_map_cfg = cfg.child("mini_map");
if(mini_map_cfg != NULL) {
mini_map_ = object(*mini_map_cfg);
} else {
mini_map_ = object();
}
const config* const status_cfg = cfg.child("status");