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

Allow shooting npcs #6075

Closed
wants to merge 5 commits into from

Conversation

Projects
None yet
2 participants
@BevapDin
Copy link
Contributor

commented Feb 12, 2014

  • Make game::npc_at return the npc object directly (not the index in game::active_npc)
  • Add game::critter_at to get any kind of critter, be it a monster, a npc or the player, this should make many things easier, instead of
if(there a monster) {
    do something
} else if(there is a npc) {
    do something
} else if(there is the player) {
    do something
}

one can write

Creature *critter = critter_at();
if(critter != NULL) {
    do something
}

The function is currently only used in the projectile attack code, because the other code uses different functions for npc and monsters, those have not been ported to Creature.

Bug report here http://smf.cataclysmdda.com/index.php?topic=5324 should be fixed by this.

Fixes #6026

Superseded by #6091

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Feb 12, 2014

While this certainly allows us to target and shoot at NPCs, it also causes the game to immedately crash whenever the bullet actually hits them.

@BevapDin

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2014

I can't reproduce this, tried it with several npcs at once, some hostile, some not. How did you trigger that crash?

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Feb 13, 2014

It happens almost every time I shoot an NPC and hit.

Program received signal SIGSEGV, Segmentation fault. Segmentation fault 0xfeeefeee in ?? ()

Windows 7 console, by the way.

@BevapDin

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2014

Turns out I had forgotten to change some calls to npc_at to the new return type, but that should only affect the tiles build and should result in a compile error.

Seems I have to get hands on a windows machine.

@BevapDin BevapDin closed this Feb 13, 2014

@BevapDin BevapDin deleted the BevapDin:npc-to-critter-tracker branch Feb 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.