changes to wose stats

This commit is contained in:
Dave White 2004-06-14 18:41:03 +00:00
parent 5ae112140a
commit e2597cbc83
18 changed files with 189 additions and 57 deletions

View file

@ -127,7 +127,7 @@
[/race]
[race]
name=wose
num_traits=2
num_traits=0
[/race]
[race]
name=human
@ -617,10 +617,10 @@
[resistance]
blade=100
pierce=70
impact=80
pierce=30
impact=50
fire=150
cold=100
cold=50
holy=80
[/resistance]
[/movetype]

View file

@ -400,6 +400,7 @@ vacant_slot="Vacant Slot"
vacant_slots="Vacant Slots"
host_game="Host Multiplayer Game"
join_server="Join Official Server"
join_game="Join Game"
observe_game="Observe Game"
load_game="Load Game"

View file

@ -11,7 +11,7 @@ alignment=chaotic
advanceto=Direwolf Rider
cost=28
usage=scout
unit_description="The Goblin Knights are the elite of the Goblin Wolf Riders. They travel with great speed, outpacing their human and Elvish counterparts."
unit_description="The Goblin Knights are the elite of the Goblin Wolf Riders. They travel with great speed, yet can inflict substantial damage in battle."
get_hit_sound=wolf-cry.wav
[attack]
name=fangs

View file

@ -1,5 +1,5 @@
[unit]
name=Wose
name=Elder Wose
race=wose
image=wose.png
image_defensive=wose-defend.png

View file

@ -1,23 +1,23 @@
[unit]
name=Wose Sapling
name=Wose
race=wose
image=wose-sapling.png
image_defensive=wose-sapling-defend.png
ability=ambush,regenerates
hitpoints=44
hitpoints=52
movement_type=treefolk
movement=3
experience=40
level=1
alignment=lawful
advanceto=Wose
advanceto=Elder Wose
cost=20
usage=fighter
[attack]
name=crush
type=impact
range=short
damage=9
damage=14
number=2
[frame]
begin=-100

View file

@ -191,7 +191,7 @@ void ai_interface::sync_network()
gamemap::location ai_interface::move_unit(location from, location to, std::map<location,paths>& possible_moves)
{
std::cerr << "ai_interface::move_unit " << (from.x+1) << (from.y+1) << " -> " << (to.x+1) << "," << (to.y+1) << "\n";
std::cerr << "ai_interface::move_unit " << (from.x+1) << "," << (from.y+1) << " -> " << (to.x+1) << "," << (to.y+1) << "\n";
//stop the user from issuing any commands while the unit is moving
const command_disabler disable_commands(&info_.disp);
@ -346,7 +346,6 @@ bool ai::multistep_move_possible(location from, location to, location via, std::
gamemap::location ai::move_unit(location from, location to, std::map<location,paths>& possible_moves)
{
std::cerr << "ai::move_unit " << (from.x+1) << (from.y+1) << " -> " << (to.x+1) << "," << (to.y+1) << "\n";
std::map<location,paths> temp_possible_moves;
std::map<location,paths>* possible_moves_ptr = &possible_moves;

View file

@ -22,8 +22,8 @@
#include <map>
#define AI_DIAGNOSTIC(MSG) if(game_config::debug) { diagnostic(MSG); std::cerr << "AI_DIAGNOSTIC: " << MSG << "\n"; }
#define AI_LOG(MSG) if(game_config::debug) { log_message(MSG); std::cerr << "AI_LOG: " << MSG << "\n";}
#define AI_DIAGNOSTIC(MSG) if(game_config::debug) { diagnostic(MSG); } std::cerr << "AI_DIAGNOSTIC: " << MSG << "\n";
#define AI_LOG(MSG) if(game_config::debug) { log_message(MSG); } std::cerr << "AI_LOG: " << MSG << "\n";
class ai_interface {
public:

View file

@ -329,6 +329,8 @@ int play_game(int argc, char** argv)
bool use_caching = true;
int force_bpp = -1;
for(arg = 1; arg != argc; ++arg) {
const std::string val(argv[arg]);
if(val.empty()) {
@ -351,6 +353,11 @@ int play_game(int argc, char** argv)
}
}
}
} else if(val == "--bpp") {
if(arg+1 != argc) {
++arg;
force_bpp = lexical_cast_default<int>(argv[arg],-1);
}
} else if(val == "--nogui") {
no_gui = true;
} else if(val == "--windowed" || val == "-w") {
@ -439,6 +446,10 @@ int play_game(int argc, char** argv)
}
}
if(force_bpp > 0) {
bpp = force_bpp;
}
std::cerr << "setting mode to " << resolution.first << "x" << resolution.second << "x" << bpp << "\n";
const int res = video.setMode(resolution.first,resolution.second,bpp,video_flags);
video.setBpp(bpp);
@ -713,7 +724,7 @@ int play_game(int argc, char** argv)
std::cerr << "title screen returned result\n";
if(res == gui::QUIT_GAME) {
std::cerr << "quiting game...\n";
std::cerr << "quitting game...\n";
return 0;
} else if(res == gui::LOAD_GAME) {
@ -904,13 +915,19 @@ int play_game(int argc, char** argv)
state.campaign_define = "MULTIPLAYER";
std::vector<std::string> host_or_join;
host_or_join.push_back(string_table["join_game"]);
host_or_join.push_back(string_table["host_game"]);
host_or_join.push_back(string_table["join_server"] + menu::HELP_STRING_SEPERATOR + string_table["join_server_help"]);
host_or_join.push_back(string_table["join_game"] + menu::HELP_STRING_SEPERATOR + string_table["join_game_help"]);
host_or_join.push_back(string_table["host_game"] + menu::HELP_STRING_SEPERATOR + string_table["host_game_help"]);
const int res = gui::show_dialog(disp,NULL,"","",gui::OK_CANCEL,&host_or_join);
std::string login = preferences::login();
const int res = gui::show_dialog(disp,NULL,string_table["multiplayer"],"",gui::OK_CANCEL,&host_or_join,NULL,string_table["login"] + ": ",&login);
if(res >= 0) {
preferences::set_login(login);
}
try {
if(res == 1) {
if(res == 2) {
std::vector<std::string> chat;
config game_data;
multiplayer_game_setup_dialog mp_dialog(disp,units_data,game_config,state,true);
@ -922,8 +939,13 @@ int play_game(int argc, char** argv)
if(res == lobby::CREATE) {
mp_dialog.start_game();
}
} else if(res == 0) {
play_multiplayer_client(disp,units_data,game_config,state);
} else if(res == 0 || res == 1) {
std::string host;
if(res == 0) {
host = preferences::official_network_host();
}
play_multiplayer_client(disp,units_data,game_config,state,host);
}
} catch(gamestatus::load_game_failed& e) {
gui::show_dialog(disp,NULL,"","error loading the game: " + e.message,gui::OK_ONLY);

View file

@ -465,12 +465,6 @@ void extract_summary_data_from_save(const game_state& state, config& out)
out["replay"] = has_replay ? "yes" : "no";
out["snapshot"] = has_snapshot ? "yes" : "no";
if(has_snapshot) {
out["map_data"] = state.snapshot["map_data"];
} else if(has_replay) {
out["map_data"] = state.starting_pos["map_data"];
}
out["campaign_type"] = state.campaign_type;
out["scenario"] = state.scenario;
out["difficulty"] = state.difficulty;
@ -492,6 +486,8 @@ void extract_summary_data_from_save(const game_state& state, config& out)
}
}
bool shrouded = false;
if(leader == "") {
const config& snapshot = has_snapshot ? state.snapshot : state.starting_pos;
const config::child_list& sides = snapshot.get_children("side");
@ -501,6 +497,10 @@ void extract_summary_data_from_save(const game_state& state, config& out)
continue;
}
if((**s)["shroud"] == "yes") {
shrouded = true;
}
const config::child_list& units = (**s).get_children("unit");
for(config::child_list::const_iterator u = units.begin(); u != units.end(); ++u) {
if((**u)["canrecruit"] == "1") {
@ -512,4 +512,12 @@ void extract_summary_data_from_save(const game_state& state, config& out)
}
out["leader"] = leader;
if(!shrouded) {
if(has_snapshot) {
out["map_data"] = state.snapshot["map_data"];
} else if(has_replay) {
out["map_data"] = state.starting_pos["map_data"];
}
}
}

View file

@ -206,19 +206,21 @@ private:
}
void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
game_state& state)
game_state& state, std::string& host)
{
log_scope("playing multiplayer client");
const network::manager net_manager;
std::string host = preferences::network_host();
if(host.empty()) {
host = preferences::network_host();
const int res = gui::show_dialog(disp,NULL,"","",
gui::OK_CANCEL,NULL,NULL,
string_table["remote_host"] + ": ",&host);
if(res != 0 || host.empty()) {
return;
}
}
network::connection sock;
@ -249,6 +251,7 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
//if we got a direction to login
if(data.child("mustlogin")) {
bool first_time = true;
config* error = NULL;
do {
@ -257,6 +260,8 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
}
std::string login = preferences::login();
if(!first_time) {
const int res = gui::show_dialog(disp,NULL,"",
string_table["must_login"],gui::OK_CANCEL,
NULL,NULL,string_table["login"] + ": ",&login);
@ -265,6 +270,9 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
}
preferences::set_login(login);
}
first_time = false;
config response;
response.add_child("login")["username"] = login;

View file

@ -10,7 +10,7 @@
//function to play a game as a client, joining either another player who is
//hosting a game, or connecting to a server.
void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
game_state& state);
game_state& state, std::string& host);
#endif

View file

@ -277,6 +277,12 @@ void set_grid(bool ison)
}
}
const std::string& official_network_host()
{
static const std::string host = "devsrv.wesnoth.org";
return host;
}
const std::string& network_host()
{
std::string& res = prefs["host"];

View file

@ -60,6 +60,8 @@ namespace preferences {
bool grid();
void set_grid(bool ison);
const std::string& official_network_host();
const std::string& network_host();
void set_network_host(const std::string& host);

View file

@ -591,8 +591,21 @@ int show_dialog(display& disp, SDL_Surface* image,
}
}
const int text_widget_y = yloc+top_padding+text_and_image_height-6+menu_hpadding;
if(use_textbox) {
const int text_widget_y_unpadded = text_widget_y + (text_widget_height - text_widget.location().h)/2;
text_widget.set_location(xloc + left_padding +
text_widget_width - text_widget.location().w,
text_widget_y_unpadded);
events::raise_draw_event();
font::draw_text(&disp, clipRect, message_font_size,
font::NORMAL_COLOUR, text_widget_label,
xloc + left_padding,text_widget_y_unpadded);
}
const int menu_xpos = xloc+total_image_width+left_padding+image_h_padding;
const int menu_ypos = yloc+top_padding+text_and_image_height+menu_hpadding;
const int menu_ypos = yloc+top_padding+text_and_image_height+menu_hpadding+ (use_textbox ? text_widget.location().h + top_padding : 0);
if(menu_.height() > 0) {
menu_.set_loc(menu_xpos,menu_ypos);
}
@ -622,19 +635,6 @@ int show_dialog(display& disp, SDL_Surface* image,
xloc+total_image_width+left_padding+image_h_padding,
yloc+top_padding);
const int text_widget_y = yloc+top_padding+text_and_image_height-6+menu_hpadding;
if(use_textbox) {
const int text_widget_y_unpadded = text_widget_y + (text_widget_height - text_widget.location().h)/2;
text_widget.set_location(xloc + left_padding +
text_widget_width - text_widget.location().w,
text_widget_y_unpadded);
events::raise_draw_event();
font::draw_text(&disp, clipRect, message_font_size,
font::NORMAL_COLOUR, text_widget_label,
xloc + left_padding,text_widget_y_unpadded);
}
//set the position of any tick boxes. they go right below the menu, slammed against
//the right side of the dialog
if(check_buttons.empty() == false) {

View file

@ -49,6 +49,7 @@ manager::manager()
manager::~manager()
{
std::cerr << "closing audio...\n";
if(!mix_ok)
return;
@ -65,7 +66,9 @@ manager::~manager()
Mix_FreeMusic(j->second);
}
std::cerr << "final closing audio...\n";
Mix_CloseAudio();
std::cerr << "done closing audio...\n";
}
void play_music(const std::string& file)

View file

@ -219,7 +219,9 @@ CVideo::CVideo( int x, int y, int bits_per_pixel, int flags)
CVideo::~CVideo()
{
std::cerr << "calling SDL_Quit()\n";
SDL_Quit();
std::cerr << "called SDL_Quit()\n";
}
void CVideo::make_fake()

View file

@ -18,7 +18,7 @@ namespace gui {
menu::menu(display& disp, const std::vector<std::string>& items,
bool click_selects, int max_height)
: max_height_(max_height), max_items_(-1), item_height_(-1),
display_(&disp), x_(0), y_(0), buffer_(NULL),
display_(&disp), x_(0), y_(0), cur_help_(-1,-1), help_string_(-1), buffer_(NULL),
selected_(click_selects ? -1:0), click_selects_(click_selects),
previous_button_(true), drawn_(false), show_result_(false),
height_(-1), width_(-1), first_item_on_screen_(0),
@ -45,6 +45,29 @@ menu::menu(display& disp, const std::vector<std::string>& items,
first_item.erase(first_item.begin());
}
}
create_help_strings();
}
void menu::create_help_strings()
{
help_.clear();
for(std::vector<std::vector<std::string> >::iterator i = items_.begin(); i != items_.end(); ++i) {
help_.resize(help_.size()+1);
for(std::vector<std::string>::iterator j = i->begin(); j != i->end(); ++j) {
if(std::find(j->begin(),j->end(),HELP_STRING_SEPERATOR) == j->end()) {
help_.back().push_back("");
} else {
const std::vector<std::string>& items = config::split(*j,HELP_STRING_SEPERATOR,0);
if(items.size() >= 2) {
*j = items.front();
help_.back().push_back(items.back());
} else {
help_.back().push_back("");
}
}
}
}
}
// The scrollbar height depends on the number of visible items versus
@ -641,6 +664,27 @@ int menu::hit(int x, int y) const
return -1;
}
std::pair<int,int> menu::hit_cell(int x, int y) const
{
if(x > x_ && x < x_ + width() - scrollbar_.get_width() &&
y > y_ && y < y_ + height()) {
for(size_t i = 0; i != items_.size(); ++i) {
const SDL_Rect& rect = get_item_rect(i);
if(y > rect.y && y < rect.y + rect.h) {
const std::vector<int>& widths = column_widths();
for(std::vector<int>::const_iterator w = widths.begin(); w != widths.end(); ++w) {
x -= *w;
if(x <= x_) {
return std::pair<int,int>(int(i),int(w-widths.begin()));
}
}
}
}
}
return std::pair<int,int>(-1,-1);
}
SDL_Rect menu::get_item_rect(int item) const
{
const SDL_Rect empty_rect = {0,0,0,0};
@ -709,4 +753,30 @@ size_t menu::get_item_height(int item) const
return item_height_ = max_height;
}
void menu::process_help_string(int mousex, int mousey)
{
const std::pair<int,int> loc = hit_cell(mousex,mousey);
if(loc == cur_help_) {
return;
} else if(loc.first == -1) {
display_->clear_help_string(help_string_);
help_string_ = -1;
} else {
if(help_string_ != -1) {
display_->clear_help_string(help_string_);
help_string_ = -1;
}
if(size_t(loc.first) < help_.size()) {
const std::vector<std::string>& row = help_[loc.first];
if(size_t(loc.second) < help_.size()) {
const std::string& help = row[loc.second];
help_string_ = display_->set_help_string(help);
}
}
}
cur_help_ = loc;
}
}

View file

@ -56,6 +56,8 @@ public:
void set_dirty() { drawn_ = false; }
enum { HELP_STRING_SEPERATOR = '|' };
private:
size_t max_items_onscreen() const;
@ -71,7 +73,14 @@ private:
display* display_;
int x_, y_;
std::vector<std::vector<std::string> > items_;
std::vector<std::vector<std::string> > items_, help_;
void create_help_strings();
void process_help_string(int mousex, int mousey);
std::pair<int,int> cur_help_;
int help_string_;
mutable std::vector<int> column_widths_;
scoped_sdl_surface buffer_;
@ -97,6 +106,8 @@ private:
void draw();
int hit(int x, int y) const;
std::pair<int,int> hit_cell(int x, int y) const;
mutable std::map<int,SDL_Rect> itemRects_;
SDL_Rect get_item_rect(int item) const;