Skip to content
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

Show messages when pet is captured or released #37487

Merged
merged 1 commit into from Jan 29, 2020

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented Jan 29, 2020

Summary

SUMMARY: Interface "Show animal capture/release messages on success"

Purpose of change

I wanted to see success messages when capturing or releasing pets from a pet carrier, such as:

  • "You capture the cat in your pet carrier."
  • "You release the cat."

Describe the solution

Following the example of similar log messages in these functions, I added one message for successful capture, and one for successful release.

This commit was going to be a simple two-line addition, but I discovered that release_monster was deleting the name of the contained animal as part of releasing it, thus I got an empty string when trying to log it.

The solution, setting a local contained_name variable to remember the animal name, had a nice side-effect of making several other lines a little cleaner and more readable after slight refactoring, so I am including that too.

Describe alternatives you've considered

Considered leaving as-is, but capturing even a tame animal is no easy task, and is worth mentioning.

Testing

Tested with debug spawning, pet carrier, cat, and Chihuahua (plus food to make them friendly. Captured and released from the carrier, and got nice messages about it.

Additional context

Sample message output with a cat and Chihuahua:

image

When using a pet carrier to capture or release a pet, it was not
displaying any kind of success message in the log. Now you will get i.e.

    "You capture the cat in your pet carrier."
    "You release the cat."

Following the example of similar log messages in these functions, I
added one message for successful capture, and one for successful
release.

This commit was going to be a simple two-line addition, but I discovered
that `release_monster` was deleting the name of the contained animal as
part of releaseing it, thus I got an empty string when trying to log it.

The solution, setting a local `contained_name` variable to remember the
animal name, had a nice side-effect of making several other lines a
little cleaner and more readable after slight refactoring, so I am
including that too.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Items / Item Actions / Item Qualities Items and how they work and interact labels Jan 29, 2020
@ZhilkinSerg ZhilkinSerg merged commit 1e0185d into CleverRaven:master Jan 29, 2020
fengjixuchui added a commit to fengjixuchui/Cataclysm-DDA that referenced this pull request Jan 29, 2020
Merge pull request CleverRaven#37487 from wapcaplet/pet-carrier-messages
@wapcaplet wapcaplet deleted the pet-carrier-messages branch February 9, 2020 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Items / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants