made 'Valley of Death' easier on 'hard' level

This commit is contained in:
Dave White 2003-11-21 19:55:43 +00:00
parent 19ac46178b
commit 0f99a4a097
10 changed files with 66 additions and 37 deletions

View File

@ -67,7 +67,7 @@ Defeat:
#ifdef HARD
recruit=Skeleton,Revenant,Chocobone,Wraith,Bone Shooter,Dark Adept
recruitment_pattern=fighter,fighter,archer,scout
gold=700
gold=500
#endif
enemy=1
@ -96,7 +96,7 @@ Defeat:
#ifdef HARD
recruitment_pattern=fighter,fighter,fighter,scout
gold=700
gold=500
#endif
enemy=1
@ -127,7 +127,7 @@ Defeat:
#ifdef HARD
recruit=Wraith,Chocobone,Bone Shooter,Revenant,Skeleton,Dark Adept
recruitment_pattern=fighter,fighter,archer,scout,scout
gold=800
gold=500
#endif
enemy=1

View File

@ -14,6 +14,7 @@
#include "dialogs.hpp"
#include "language.hpp"
#include "replay.hpp"
#include "show_dialog.hpp"
#include <map>
#include <string>
@ -113,6 +114,36 @@ int get_save_name(display & disp,const std::string& caption, const std::string&
return res;
}
std::string load_game_dialog(display& disp, bool* show_replay)
{
const std::vector<std::string>& games = get_saves_list();
if(games.empty()) {
gui::show_dialog(disp,NULL,
string_table["no_saves_heading"],
string_table["no_saves_message"],
gui::OK_ONLY);
return "";
}
//create an option for whether the replay should be shown or not
std::vector<gui::check_item> options;
if(show_replay != NULL)
options.push_back(gui::check_item(string_table["show_replay"],false));
const int res = gui::show_dialog(disp,NULL,
string_table["load_game_heading"],
string_table["load_game_message"],
gui::OK_CANCEL,&games,NULL,"",NULL,NULL,&options);
if(res == -1)
return "";
if(show_replay != NULL)
*show_replay = options.front().checked;
return games[res];
}
} //end namespace dialogs

View File

@ -31,6 +31,12 @@ void show_objectives(display& disp, config& level_info);
int get_save_name(display & disp, const std::string& caption,
const std::string& message, std::string * name);
//allow user to select the game they want to load. Returns the name
//of the save they want to load. Stores whether the user wants to show
//a replay of the game in show_replay. If show_replay is NULL, then
//the user will not be asked if they want to show a replay.
std::string load_game_dialog(display& disp, bool* show_replay);
}
#endif

View File

@ -508,11 +508,11 @@ void display::draw_sidebar()
//otherwise we display the unit that is selected
std::map<gamemap::location,unit>::const_iterator i
= units_.find(mouseoverHex_);
if(i == units_.end() || shrouded(i->first.x,i->first.y)) {
if(i == units_.end() || fogged(i->first.x,i->first.y)) {
i = units_.find(selectedHex_);
}
if(i != units_.end() && !shrouded(i->first.x,i->first.y)) {
if(i != units_.end() && !fogged(i->first.x,i->first.y)) {
draw_unit_details(mapx()+SideBarText_x,SideBarUnit_y,selectedHex_,
i->second,unitDescriptionRect_,
mapx()+SideBarText_x,SideBarUnitProfile_y);
@ -1431,7 +1431,6 @@ std::vector<SDL_Surface*> display::getAdjacentTerrain(int x, int y,
SDL_Surface* display::getTerrain(gamemap::TERRAIN terrain,image::TYPE image_type,
int x, int y, const std::string& direction)
{
const bool tower = (map_.underlying_terrain(terrain) == gamemap::TOWER);
std::string image = "terrain/" + (direction.empty() ?
map_.get_terrain_info(terrain).image(x,y) :
map_.get_terrain_info(terrain).default_image());

View File

@ -15,7 +15,6 @@
//functions. They may have to be altered to port to new platforms
#include <sys/types.h>
//for mkdir
#include <sys/stat.h>
#include <sys/types.h>
@ -32,6 +31,8 @@
#else
#include <unistd.h>
#include <dirent.h>
#endif
@ -269,3 +270,9 @@ bool file_exists(const std::string& name)
return true;
}
time_t file_last_access(const std::string& fname)
{
struct stat buf;
::stat(fname.c_str(),&buf);
return buf.st_atime;
}

View File

@ -40,4 +40,6 @@ bool is_directory(const std::string& fname);
//function which returns true iff file with name already exists
bool file_exists(const std::string& name);
time_t file_last_access(const std::string& fname);
#endif

View File

@ -289,31 +289,15 @@ int play_game(int argc, char** argv)
} else if(res == gui::LOAD_GAME) {
srand(SDL_GetTicks());
const std::vector<std::string>& games = get_saves_list();
bool show_replay;
if(games.empty()) {
gui::show_dialog(disp,NULL,
string_table["no_saves_heading"],
string_table["no_saves_message"],
gui::OK_ONLY);
const std::string game = dialogs::load_game_dialog(disp,&show_replay);
if(game == "")
continue;
}
//create an option for whether the replay should be shown or not
std::vector<gui::check_item> options;
options.push_back(gui::check_item(string_table["show_replay"],false));
const int res = gui::show_dialog(disp,NULL,
string_table["load_game_heading"],
string_table["load_game_message"],
gui::OK_CANCEL,&games,NULL,"",NULL,NULL,&options);
if(res == -1)
continue;
const bool show_replay = options.front().checked;
try {
load_game(units_data,games[res],state);
load_game(units_data,game,state);
if(state.version != game_config::version) {
const int res = gui::show_dialog(disp,NULL,"",
string_table["version_save_message"],

View File

@ -249,7 +249,7 @@ SDL_Surface* get_image(const std::string& filename,TYPE type)
SDL_Surface* get_image_dim(const std::string& filename, size_t x, size_t y)
{
SDL_Surface* const surf = get_image(filename,UNSCALED);
if(surf != NULL && (surf->w != x || surf->h != y)) {
if(surf != NULL && (size_t(surf->w) != x || size_t(surf->h) != y)) {
SDL_Surface* const new_image = scale_surface(surf,x,y);
images_.erase(filename);
SDL_FreeSurface(surf);

View File

@ -201,9 +201,9 @@ void turn_info::handle_event(const SDL_Event& event)
path_turns_ = new_path_turns;
unit_map::iterator u = units_.find(selected_hex_);
if(u == units_.end()) {
if(u == units_.end() || gui_.fogged(u->first.x,u->first.y)) {
u = units_.find(last_hex_);
if(u != units_.end() && u->second.side() == team_num_) {
if(u != units_.end() && (u->second.side() == team_num_ || gui_.fogged(u->first.x,u->first.y))) {
u = units_.end();
}
} else if(u->second.side() != team_num_) {
@ -304,8 +304,6 @@ void turn_info::mouse_press(const SDL_MouseButtonEvent& event)
{
if(commands_disabled)
return;
const team& current_team = teams_[team_num_-1];
if(event.button == SDL_BUTTON_LEFT && event.state == SDL_PRESSED) {
left_click(event);
@ -667,7 +665,8 @@ void turn_info::cycle_units()
if(it != units_.end()) {
for(++it; it != units_.end(); ++it) {
if(it->second.side() == team_num_ &&
unit_can_move(it->first,units_,map_,teams_)) {
unit_can_move(it->first,units_,map_,teams_) &&
!gui_.fogged(it->first.x,it->first.y)) {
break;
}
}
@ -676,7 +675,8 @@ void turn_info::cycle_units()
if(it == units_.end()) {
for(it = units_.begin(); it != units_.end(); ++it) {
if(it->second.side() == team_num_ &&
unit_can_move(it->first,units_,map_,teams_)) {
unit_can_move(it->first,units_,map_,teams_) &&
!gui_.fogged(it->first.x,it->first.y)) {
break;
}
}
@ -989,7 +989,7 @@ void turn_info::status_table()
const bool fog = teams_[team_num_-1].uses_fog() || teams_[team_num_-1].uses_shroud();
for(size_t n = 0; n != teams_.size(); ++n) {
if(fog && team_num_-1 != n)
if(fog && team_num_-1 != int(n))
continue;
const team_data data = calculate_team_data(teams_[n],n+1,units_);

View File

@ -335,7 +335,7 @@ SDL_Rect menu::get_item_rect(int item) const
static const SDL_Rect area = {0,0,display_->x(),display_->y()};
//use the first field that is non-blank
int n;
size_t n;
for(n = 0; n != items_[item].size(); ++n) {
if(items_[item][n] != "")
break;