Skip to content

Bugfixes #8545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/disease.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3115,7 +3115,9 @@ void manage_sleep(player& p, disease& dis)
if ((int(calendar::turn) % (3600 / strength) == 0) && one_in(3)) {
// Select a dream
std::string dream = p.get_category_dream(highcat, strength);
add_msg("%s",dream.c_str());
if( !dream.empty() ) {
add_msg( "%s", dream.c_str() );
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4396,13 +4396,13 @@ void game::debug()
m.vehicle_list.clear();
const int nlevx = tmp.x * 2 - int(MAPSIZE / 2);
const int nlevy = tmp.y * 2 - int(MAPSIZE / 2);
// TODO: make this use the normal map shifting function all the time?
shift_monsters( nlevx - levx, nlevy - levy, tmp.z - levz );
cur_om = &overmap_buffer.get_om_global(tmp.x, tmp.y);
levx = nlevx - cur_om->pos().x * OMAPX * 2;
levy = nlevy - cur_om->pos().y * OMAPY * 2;
levz = tmp.z;
m.load(levx, levy, levz, true, cur_om);
// TODO: make this use the normal map shifting function all the time?
shift_monsters( nlevx - levx, nlevy - levy, tmp.z - levz );
load_npcs();
m.spawn_monsters(); // Static monsters
update_overmap_seen();
Expand Down
33 changes: 17 additions & 16 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,22 +558,23 @@ void initOptions()
////////////////////////////INTERFACE////////////////////////
// TODO: scan for languages like we do for tilesets.
optionNames[""] = _("System language");
optionNames["cs"] = _("Czech");
optionNames["en"] = _("English");
optionNames["fr_FR"] = _("French");
optionNames["de_DE"] = _("German");
optionNames["it"] = _("Italian");
optionNames["es_ES"] = _("Spanish");
optionNames["ja"] = _("Japanese");
optionNames["ko"] = _("Korean");
optionNames["pl"] = _("Polish");
optionNames["pt_BR"] = _("Brazilian Portuguese");
optionNames["pt_PT"] = _("Portuguese, Portugal");
optionNames["ru"] = _("Russian");
optionNames["sr"] = _("Serbian");
optionNames["vi"] = _("Vietnamese");
optionNames["zh_CN"] = _("Simplified Chinese");
optionNames["zh_TW"] = _("Traditional Chinese");
// Note: language names are in their own language and are *not* translated at all.
optionNames["cs"] = "čeština";
optionNames["en"] = "English";
optionNames["fr_FR"] = "français (France)";
optionNames["de_DE"] = "Deutsch (Deutschland)";
optionNames["it"] = "italiano";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more caps. I'll see what I can do.

Update: I don't have font support for Chinese, Japanese, or Korean, so can't speak for those. Sorry. All other languages are capitalized.

optionNames["es_ES"] = "español (España)";
optionNames["ja"] = "日本語";
optionNames["ko"] = "한국어";
optionNames["pl"] = "polski";
optionNames["pt_BR"] = "Português (Brasil)";
optionNames["pt_PT"] = "português (Portugal)";
optionNames["ru"] = "Русский";
optionNames["sr"] = "srpski";
optionNames["vi"] = "Tiếng Việt";
optionNames["zh_CN"] = "中文(中华人民共和国)";
optionNames["zh_TW"] = "中文(台灣)";
OPTIONS["USE_LANG"] = cOpt("interface", _("Language"), _("Switch Language. Requires restart."),
",cs,en,fr_FR,de_DE,it,es_ES,ja,ko,pl,pt_BR,pt_PT,ru,sr,vi,zh_CN,zh_TW",
""
Expand Down
6 changes: 4 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3735,7 +3735,9 @@ std::string player::get_category_dream(const std::string &cat, int strength) con
valid_dreams.push_back(dreams[i]); // Put the valid ones into our list
}
}

if( valid_dreams.empty() ) {
return "";
}
int index = rng(0, valid_dreams.size() - 1); // Randomly select a dream from the valid list
selected_dream = valid_dreams[index];
index = rng(0, selected_dream.messages.size() - 1); // Randomly selected a message from the chosen dream
Expand Down Expand Up @@ -7187,7 +7189,7 @@ std::list<item> player::use_charges(itype_id it, long quantity)
if (weapon.use_charges(it, quantity, ret)) {
remove_weapon();
}
for( auto a = worn.begin(); a != worn.end() && quantity > 0; ++a ) {
for( auto a = worn.begin(); a != worn.end() && quantity > 0; ) {
if( a->use_charges( it, quantity, ret ) ) {
a = worn.erase( a );
} else {
Expand Down
4 changes: 1 addition & 3 deletions src/trapdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ void release_traps()
{
std::vector<trap *>::iterator it;
for (it = traplist.begin(); it != traplist.end(); it++) {
if (*it != NULL) {
delete *it;
}
delete *it;
}
traplist.clear();
trapmap.clear();
Expand Down
28 changes: 10 additions & 18 deletions src/worldfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,21 @@ WORLD::WORLD()
}

worldfactory::worldfactory()
: active_world( nullptr )
, all_worlds()
, all_worldnames()
, mman( nullptr )
, mman_ui( nullptr )
{
active_world = NULL;
mman = new mod_manager;
mman.reset( new mod_manager );
mman->refresh_mod_list();
mman_ui = new mod_ui(mman);
mman_ui.reset( new mod_ui( mman.get() ) );
}

worldfactory::~worldfactory()
{
for (std::map<std::string, WORLDPTR>::iterator it = all_worlds.begin(); it != all_worlds.end();
++it) {
delete it->second;
it->second = NULL;
}
all_worlds.clear();
all_worldnames.clear();
if (mman) {
delete mman;
mman = NULL;
}
if (mman_ui) {
delete mman_ui;
mman_ui = NULL;
for( auto &wp : all_worlds ) {
delete wp.second;
}
}

Expand Down Expand Up @@ -1330,5 +1322,5 @@ std::unordered_map<std::string, cOpt> worldfactory::get_world_options(std::strin

mod_manager *worldfactory::get_mod_manager()
{
return mman;
return mman.get();
}
6 changes: 3 additions & 3 deletions src/worldfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <unordered_map>
#include <vector>
#include <string>
#include <algorithm>
#include <memory>

struct WORLD {
std::string world_path;
Expand Down Expand Up @@ -73,8 +73,8 @@ class worldfactory

std::unordered_map<std::string, cOpt> get_default_world_options();
std::unordered_map<std::string, cOpt> get_world_options(std::string path);
mod_manager *mman;
mod_ui *mman_ui;
std::unique_ptr<mod_manager> mman;
std::unique_ptr<mod_ui> mman_ui;
};

extern worldfactory *world_generator;
Expand Down