-
Notifications
You must be signed in to change notification settings - Fork 288
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
Misc bugfixes from DDA 6 #316
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
387060c
Fix auto mining cancelation
Ramza13 c24013b
Fix fungal friendly fire
Ramza13 0cf2e32
Check for items in vehicle for warmth when sleeping
RoyBerube 469d8a1
Allow stripping unclosed color tags
ZhilkinSerg 6a5c15b
Fix trim_by_length off-by-one error on wide characters
BrettDong 5eeb529
Added trim_by_length test cases
BrettDong a0ae0d4
Fix monster spawning when they are loaded from monster_map
EvgenijM86 6501faa
Default profession cleanly
Ramza13 5f81057
Fixes turret warning messages issue for blind/deaf characters
SkyBlueFlash 1f028d6
Fix sarcophagus elevator reactivation
Salty-Panda 1e9c39b
Only inform about enemies regenerating if the player can see it
Salty-Panda 1a1618b
Fix multi tile door closing
Ramza13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,7 +435,9 @@ static void damage_targets( const spell &sp, Creature &caster, | |
cr->deal_projectile_attack( &caster, atk, true ); | ||
} else if( sp.damage() < 0 ) { | ||
sp.heal( target ); | ||
add_msg( m_good, _( "%s wounds are closing up!" ), cr->disp_name( true ) ); | ||
if( g->u.sees( cr->pos() ) ) { | ||
add_msg( m_good, _( "%s wounds are closing up!" ), cr->disp_name( true ) ); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not caused here, but it seems that it still prints the message even if there are no wounds to close up. |
||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1486,6 +1486,27 @@ bool vehicle::is_open( int part_index ) const | |
return parts[part_index].open; | ||
} | ||
|
||
bool vehicle::can_close( int part_index, Character &who ) | ||
{ | ||
for( auto const &vec : find_lines_of_parts( part_index, "OPENABLE" ) ) { | ||
for( auto const &partID : vec ) { | ||
const Creature *const mon = g->critter_at( global_part_pos3( parts[partID] ) ); | ||
if( mon ) { | ||
if( mon->is_player() ) { | ||
who.add_msg_if_player( m_info, _( "There's some buffoon in the way!" ) ); | ||
} else if( mon->is_monster() ) { | ||
// TODO: Houseflies, mosquitoes, etc shouldn't count | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We won't have those. |
||
who.add_msg_if_player( m_info, _( "The %s is in the way!" ), mon->get_name() ); | ||
} else { | ||
who.add_msg_if_player( m_info, _( "%s is in the way!" ), mon->disp_name() ); | ||
} | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
void vehicle::open_all_at( int p ) | ||
{ | ||
std::vector<int> parts_here = parts_at_relative( parts[p].mount, true ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "catch/catch.hpp" | ||
|
||
#include <string> | ||
|
||
#include "output.h" | ||
|
||
static void test_remove_color_tags( const std::string &original, const std::string &expected ) | ||
{ | ||
CHECK( remove_color_tags( original ) == expected ); | ||
} | ||
|
||
TEST_CASE( "string_test" ) | ||
{ | ||
SECTION( "Case 1 - test remove_color_tags" ) { | ||
test_remove_color_tags( "<color_red>TestString</color>", | ||
"TestString" ); | ||
test_remove_color_tags( "TestStringWithoutOpeningColorTag</color>", | ||
"TestStringWithoutOpeningColorTag" ); | ||
test_remove_color_tags( "<color_yellow>TestStringWithoutClosingColorTag", | ||
"TestStringWithoutClosingColorTag" ); | ||
test_remove_color_tags( "<color_green>Test</color>StringWithMultiple<color_light_gray>ColorTags", | ||
"TestStringWithMultipleColorTags" ); | ||
} | ||
} | ||
|
||
TEST_CASE( "trim_by_length" ) | ||
{ | ||
CHECK( trim_by_length( "ABC", 2 ) == "A…" ); | ||
CHECK( trim_by_length( "ABC", 3 ) == "ABC" ); | ||
CHECK( trim_by_length( "ABCDEF", 4 ) == "ABC…" ); | ||
CHECK( trim_by_length( "AB文字", 6 ) == "AB文字" ); | ||
CHECK( trim_by_length( "AB文字", 5 ) == "AB文…" ); | ||
CHECK( trim_by_length( "AB文字", 4 ) == "AB…" ); | ||
CHECK( trim_by_length( "MRE 主菜(鸡肉意大利香蒜沙司通心粉)(新鲜)", | ||
5 ) == "MRE …" ); | ||
CHECK( trim_by_length( "MRE 主菜(鸡肉意大利香蒜沙司通心粉)(新鲜)", | ||
6 ) == "MRE …" ); | ||
CHECK( trim_by_length( "MRE 主菜(鸡肉意大利香蒜沙司通心粉)(新鲜)", | ||
36 ) == "MRE 主菜(鸡肉意大利香蒜沙司通心粉…" ); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be skipped.
The items under the vehicle are still reachable anyway.