Skip to content
Permalink
Browse files

Merge translation instructions, initial serbian translation, cleanup …

…wood shield remnants, and fix item damage label display.
  • Loading branch information...
kevingranade committed Aug 4, 2013
4 parents 35772b9 + bc85248 + 9d0d315 + 36c9b33 commit 14d63ab95b77b1b636878d4ca2ded6518be773f3
Showing with 49,996 additions and 3,450 deletions.
  1. +3 −4 data/raw/item_groups.json
  2. +1 −1 data/raw/items/ammo.json
  3. +2 −2 data/raw/items/armor.json
  4. +7 −10 data/raw/professions.json
  5. +0 −11 data/raw/recipes.json
  6. +12 −4 game.cpp
  7. +3 −2 item.cpp
  8. +87 −58 item_factory.cpp
  9. +1 −1 item_factory.h
  10. +4,771 −3,313 lang/po/cataclysm-dda.pot
  11. +45,058 −0 lang/po/sr_SR.po
  12. +26 −2 npcmove.cpp
  13. +24 −41 player.cpp
  14. +1 −1 veh_interact.cpp
@@ -531,7 +531,6 @@
["mag_dodge", 20],
["mag_comic", 20],
["mag_throwing", 20],
["novel_firstaid", 10],
["mag_gaming", 20],
["mag_swimming", 10],
["flyer", 10]
@@ -1446,7 +1445,7 @@
["vacutainer", 10],
["usb_drive", 5],
["disinfectant", 35],
["gauze", 10],
["medical_gauze", 10],
["medical_tape", 45],
["wrapped_rad_badge", 15],
["jar_glass", 20],
@@ -1471,7 +1470,7 @@
["vacutainer", 10],
["rag_bloody", 1],
["disinfectant", 35],
["gauze", 10],
["medical_gauze", 10],
["medical_tape", 45],
["jar_glass", 20],
["jar_3l_glass", 15]
@@ -2505,7 +2504,7 @@
["jar_glass", 10],
["jar_3l_glass", 8],
["flyer", 10],
["gasoline_lanern", 10],
["gasoline_lantern", 10],
["umbrella",1]
]
},
@@ -205,7 +205,7 @@
"symbol" : "=",
"color" : "light_gray",
"description" : "A box of ball bearings, useful as ammunition for slings.",
"material" : "stone",
"material" : "steel",
"volume" : 1,
"weight" : 2,
"bashing" : 1,
@@ -443,7 +443,7 @@
"phase" : "solid",
"enviromental_protection" : 0,
"rarity" : 60,
"encumberance" : -1,
"encumberance" : 0,
"bashing" : -4,
"flags" : ["VARSIZE"],
"coverage" : 65,
@@ -593,7 +593,7 @@
"phase" : "solid",
"enviromental_protection" : 0,
"rarity" : 75,
"encumberance" : -1,
"encumberance" : 0,
"bashing" : -5,
"flags" : ["VARSIZE", "FEMALE_TYPICAL"],
"coverage" : 60,
@@ -201,10 +201,10 @@
"ident":"homeless",
"items":[
"pants",
"bottle_glass"
"whiskey"
],
"name":"Hobo",
"points":-2
"points":-4
},
{
"description":"Ever since you were a child you loved hunting, and you loved the challenge of hunting with a bow even more. You start with a level in archery and survival.",
@@ -499,24 +499,21 @@
{
"addictions":[
{
"intensity":10,
"type":"opiate"
},
{
"intensity":10,
"intensity":20,
"type":"crack"
}
],
"description":"You were on your way to collect your check, when your pimp tried to kill you, you only wished that it wasn't a common occurence. You start with a skirt, tank top,a pair of high heels, a strong crack and heroin addiction.",
"description":"You were on your way to collect your check, when your pimp tried to kill you. You wish that it wasn't a common occurence. You start with a skirt, tank top, a pair of high heels, your stash, and a strong crack addiction.",
"ident":"hooker",
"items":[
"skirt",
"heels",
"tank_top",
"crackpipe"
"crackpipe",
"crack"
],
"name":"Prostitute",
"points":-3
"points":-4
},
{
"description":"You spent most of your life trapping with your father. Both of you made a decent living off of your catches, and trapping tutorials. You start with a skill in trapping.",
@@ -10349,17 +10349,6 @@
"components": [ [ ["string_36", 2], ["string_6", 12] ],
[ ["scrap", 15] ] ]
},
{
"result": "shield_wood",
"category": "CC_ARMOR",
"skill_pri": "survival",
"difficulty": 1,
"time": 50000,
"reversible": false,
"autolearn": true,
"components": [ [ ["rag", 10] ],
[ ["2x4", 3] ] ]
},
{
"result": "still",
"category": "CC_CHEM",
@@ -8101,9 +8101,9 @@ void game::list_items()
WINDOW* w_item_info = newwin(iInfoHeight-1, width - 2, TERMY-iInfoHeight-VIEW_OFFSET_Y, TERRAIN_WINDOW_WIDTH+1+VIEW_OFFSET_X);
WINDOW* w_item_info_border = newwin(iInfoHeight, width, TERMY-iInfoHeight-VIEW_OFFSET_Y, TERRAIN_WINDOW_WIDTH+VIEW_OFFSET_X);

//Area to search +- of players position. TODO: Use Perception
const int iSearchX = 12 + ((VIEWX > 12) ? ((VIEWX-12)/2) : 0);
const int iSearchY = 12 + ((VIEWY > 12) ? ((VIEWY-12)/2) : 0);
//Area to search +- of players position.
const int iSearchX = 12 + (u.per_cur * 2);
const int iSearchY = 12 + (u.per_cur * 2);

//this stores the items found, along with the coordinates
std::vector<map_item_stack> ground_items = find_nearby_items(iSearchX, iSearchY);
@@ -9345,7 +9345,15 @@ void game::plthrow(char chInput)
return;
if (passtarget != -1)
last_target = targetindices[passtarget];
u.i_rem(ch);

// Throw a single charge of a stacking object.
if( thrown.count_by_charges() && thrown.charges > 1 ) {
u.i_at(ch).charges--;
thrown.charges = 1;
} else {
u.i_rem(ch);
}

u.moves -= 125;
u.practice(turn, "throw", 10);

@@ -637,7 +637,8 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump, game *g, bool
dump->push_back(iteminfo("ARMOR", _("Coverage: "), _("<num> percent"), int(armor->coverage)));
if (has_flag("FIT"))
{
dump->push_back(iteminfo("ARMOR", _("Encumberment: "), "<num> (fits)", int(armor->encumber) - 1, "", true, true));
dump->push_back(iteminfo("ARMOR", _("Encumberment: "), "<num> (fits)",
std::min(0, int(armor->encumber) - 1), "", true, true));
}
else
{
@@ -834,7 +835,7 @@ std::string item::tname(game *g)
if (damage == 3) damtext = rm_prefix(_("<dam_adj>mangled "));
if (damage == 4) damtext = rm_prefix(_("<dam_adj>pulped "));
} else {
damtext = type->dmg_adj(damage);
damtext = rmp_format("%s ", type->dmg_adj(damage).c_str());
}
}
}
@@ -232,6 +232,8 @@ void Item_factory::init(game* main_game) throw(std::string){
for(std::map<Item_tag, itype*>::iterator iter = new_templates.begin(); iter != new_templates.end(); ++iter) {
standard_itype_ids.push_back(iter->first);
}
load_item_groups_from(main_game, "data/raw/item_groups.json");

}

//Returns the template with the given identification tag
@@ -326,7 +328,6 @@ void Item_factory::load_item_templates() throw(std::string){
load_item_templates_from("data/raw/items/armor.json");
load_item_templates_from("data/raw/items/books.json");
load_item_templates_from("data/raw/items/archery.json");
load_item_groups_from("data/raw/item_groups.json");
}
catch (std::string &error_message) {
throw;
@@ -558,14 +559,14 @@ void Item_factory::load_item_templates_from(const std::string file_name) throw (
}

// Load values from this data file into m_template_groups
void Item_factory::load_item_groups_from(const std::string file_name) throw (std::string){
void Item_factory::load_item_groups_from( game *g, const std::string file_name ) throw ( std::string ) {
std::ifstream data_file;
picojson::value input_value;

data_file.open(file_name.c_str());

if(! data_file.good()) {
throw "Could not read " + file_name;
throw "Could not read " + file_name;
}

data_file >> input_value;
@@ -580,90 +581,118 @@ void Item_factory::load_item_groups_from(const std::string file_name) throw (std

//Crawl through once and create an entry for every definition
const picojson::array& all_items = input_value.get<picojson::array>();
for (picojson::array::const_iterator entry = all_items.begin(); entry != all_items.end(); ++entry) {
for (picojson::array::const_iterator entry = all_items.begin();
entry != all_items.end(); ++entry) {
// TODO: Make sure we have at least an item or group child, as otherwise
// later things will bug out.

if( !(entry->is<picojson::object>()) ){
debugmsg("Invalid group definition, entry not a JSON object");
continue;
}
else{
const picojson::value::object& entry_body = entry->get<picojson::object>();

// The one element we absolutely require for an item definition is an id
picojson::value::object::const_iterator key_pair = entry_body.find("id");
if( key_pair == entry_body.end() || !(key_pair->second.is<std::string>()) ){
debugmsg("Group definition skipped, no id found or id was malformed.");
} else {
Item_tag group_id = key_pair->second.get<std::string>();
m_template_groups[group_id] = new Item_group(group_id);
}
const picojson::value::object& entry_body = entry->get<picojson::object>();

// The one element we absolutely require for an item definition is an id
picojson::value::object::const_iterator key_pair = entry_body.find( "id" );
if( key_pair == entry_body.end() || !(key_pair->second.is<std::string>()) ) {
debugmsg("Group definition skipped, no id found or id was malformed.");
continue;
}

Item_tag group_id = key_pair->second.get<std::string>();
m_template_groups[group_id] = new Item_group(group_id);
}
//Once all the group definitions are set, fill them out
for (picojson::array::const_iterator entry = all_items.begin(); entry != all_items.end(); ++entry) {
for (picojson::array::const_iterator entry = all_items.begin();
entry != all_items.end(); ++entry) {
const picojson::value::object& entry_body = entry->get<picojson::object>();

Item_tag group_id = entry_body.find("id")->second.get<std::string>();
Item_group *current_group = m_template_groups.find(group_id)->second;

//Add items
picojson::value::object::const_iterator key_pair = entry_body.find("items");
if( key_pair != entry_body.end() ){
if( !(key_pair->second.is<picojson::array>()) ){
debugmsg("Invalid item list for group definition '%s', list of items not an array.",group_id.c_str());
} else {
//We have confirmed that we have a list of SOMETHING, now let's add them one at a time.
const picojson::array& items_to_add = key_pair->second.get<picojson::array>();
for (picojson::array::const_iterator item_pair = items_to_add.begin(); item_pair != items_to_add.end(); ++item_pair) {
//Before adding, make sure this element is in the right format, namely ["TAG_NAME", frequency number]
if(!(item_pair->is<picojson::array>())){
debugmsg("Invalid item list for group definition '%s', element is not an array.",group_id.c_str());
} else if(item_pair->get<picojson::array>().size()!=2){
debugmsg("Invalid item list for group definition '%s', element does not have 2 values.",group_id.c_str());
} else {
picojson::array item_frequency_array = item_pair->get<picojson::array>();
//Finally, insure that the first value is a string, and the second is a number
if(!item_frequency_array[0].is<std::string>() || !item_frequency_array[1].is<double>() ){
debugmsg("Invalid item list for group definition '%s', element is not a valid tag/frequency pair.",group_id.c_str());
} else {
current_group->add_entry(item_frequency_array[0].get<std::string>(), (int)item_frequency_array[1].get<double>());
}
}
if( key_pair != entry_body.end() ) {
if( !(key_pair->second.is<picojson::array>()) ) {
debugmsg("Invalid item list for group definition '%s', list of items not an array.",
group_id.c_str());
// We matched the find above, so we're NOT a group.
continue;
}
//We have confirmed that we have a list of SOMETHING, now let's add them one at a time.
const picojson::array& items_to_add = key_pair->second.get<picojson::array>();
for (picojson::array::const_iterator item_pair = items_to_add.begin();
item_pair != items_to_add.end(); ++item_pair) {
// Before adding, make sure this element is in the right format,
// namely ["TAG_NAME", frequency number]
if( !(item_pair->is<picojson::array>()) ) {
debugmsg("Invalid item list for group definition '%s', element is not an array.",
group_id.c_str());
continue;
}
if( item_pair->get<picojson::array>().size() != 2 ) {
debugmsg( "Invalid item list for group definition '%s', element does not have 2 values.",
group_id.c_str() );
continue;
}
picojson::array item_frequency_array = item_pair->get<picojson::array>();
// Insure that the first value is a string, and the second is a number
if( !item_frequency_array[0].is<std::string>() ||
!item_frequency_array[1].is<double>() ) {
debugmsg("Invalid item list for group definition '%s', element is not a valid tag/frequency pair.",
group_id.c_str());
continue;
}
if( m_missing_item == find_template( item_frequency_array[0].get<std::string>() ) &&
0 == g->itypes.count( item_frequency_array[0].get<std::string>() ) ) {
debugmsg( "Item '%s' listed in group '%s' does not exist.",
item_frequency_array[0].get<std::string>().c_str(), group_id.c_str() );
continue;
}
current_group->add_entry(item_frequency_array[0].get<std::string>(),
(int)item_frequency_array[1].get<double>());
}
}

//Add groups
key_pair = entry_body.find("groups");
if(key_pair != entry_body.end()){
if( !(key_pair->second.is<picojson::array>()) ){
debugmsg("Invalid group list for group definition '%s', list of items not an array.",group_id.c_str());
} else {
//We have confirmed that we have a list of SOMETHING, now let's add them one at a time.
const picojson::array& items_to_add = key_pair->second.get<picojson::array>();
for (picojson::array::const_iterator item_pair = items_to_add.begin(); item_pair != items_to_add.end(); ++item_pair) {
//Before adding, make sure this element is in the right format, namely ["TAG_NAME", frequency number]
if(!(item_pair->is<picojson::array>())){
debugmsg("Invalid group list for group definition '%s', element is not an array.",group_id.c_str());
} else if(item_pair->get<picojson::array>().size()!=2){
debugmsg("Invalid group list for group definition '%s', element does not have 2 values.",group_id.c_str());
} else {
picojson::array item_frequency_array = item_pair->get<picojson::array>();
//Finally, insure that the first value is a string, and the second is a number
if(!item_frequency_array[0].is<std::string>() || !item_frequency_array[1].is<double>() ){
debugmsg("Invalid group list for group definition '%s', element is not a valid tag/frequency pair.",group_id.c_str());
} else {
Item_group* subgroup = m_template_groups.find(item_frequency_array[0].get<std::string>())->second;
current_group->add_group(subgroup, (int)item_frequency_array[1].get<double>());
}
}
debugmsg("Invalid group list for group definition '%s', list of items not an array.",
group_id.c_str());
continue;
}
//We have confirmed that we have a list of SOMETHING, now let's add them one at a time.
const picojson::array& items_to_add = key_pair->second.get<picojson::array>();
for ( picojson::array::const_iterator item_pair = items_to_add.begin();
item_pair != items_to_add.end(); ++item_pair ) {
//Before adding, make sure this element is in the right format, namely ["TAG_NAME", frequency number]
if( !(item_pair->is<picojson::array>()) ) {
debugmsg("Invalid group list for group definition '%s', element is not an array.",
group_id.c_str());
continue;
}
if( item_pair->get<picojson::array>().size() != 2 ) {
debugmsg("Invalid group list for group definition '%s', element does not have 2 values.",
group_id.c_str());
continue;
}
picojson::array item_frequency_array = item_pair->get<picojson::array>();
//Finally, insure that the first value is a string, and the second is a number
if(!item_frequency_array[0].is<std::string>() ||
!item_frequency_array[1].is<double>() ){
debugmsg("Invalid group list for group definition '%s', element is not a valid tag/frequency pair.",
group_id.c_str());
continue;
}
Item_group* subgroup = m_template_groups.find(item_frequency_array[0].get<std::string>())->second;
current_group->add_group( subgroup, (int)item_frequency_array[1].get<double>() );
}
}
}
if(!json_good())
if( !json_good() ) {
throw "There was an error reading " + file_name;
}
}

//Grab color, with appropriate error handling
@@ -53,7 +53,7 @@ class Item_factory
//json data handlers
void load_item_templates() throw (std::string);
void load_item_templates_from(const std::string file_name) throw (std::string);
void load_item_groups_from(const std::string file_name) throw (std::string);
void load_item_groups_from(game *g, const std::string file_name) throw (std::string);

nc_color color_from_string(std::string color);
Use_function use_from_string(std::string name);

0 comments on commit 14d63ab

Please sign in to comment.
You can’t perform that action at this time.