1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

shmup:: incorrect cpid protection (just in case)

This commit is contained in:
Zeno Rogue 2019-11-14 20:08:23 +01:00
parent 7602048b06
commit ef98e048bb
2 changed files with 9 additions and 2 deletions

View File

@ -457,6 +457,8 @@ EX namespace inv {
EX void show() { EX void show() {
multi::cpid = 0; /* just in case */
if(remaining[itOrbSword]) items[itOrbSword]++; if(remaining[itOrbSword]) items[itOrbSword]++;
if(remaining[itOrbSword2]) items[itOrbSword2]++; if(remaining[itOrbSword2]) items[itOrbSword2]++;
gamescreen(2); gamescreen(2);

View File

@ -1583,8 +1583,13 @@ void spawn_asteroids(monster *bullet, monster *target) {
} }
} }
EX int protect_pid(int i) {
if(i < 0 || i >= players) return 0;
return i;
}
void moveBullet(monster *m, int delta) { void moveBullet(monster *m, int delta) {
cpid = m->pid; cpid = protect_pid(m->pid);
m->findpat(); m->findpat();
virtualize(m); virtualize(m);
@ -3015,7 +3020,7 @@ bool celldrawer::draw_shmup_monster() {
col = winf[c->wall].color; col = winf[c->wall].color;
col |= (col >> 1); col |= (col >> 1);
} }
cpid = m->pid; cpid = protect_pid(m->pid);
if(m->stunoff > curtime) if(m->stunoff > curtime)
c->stuntime = 1 + (m->stunoff - curtime-1)/300; c->stuntime = 1 + (m->stunoff - curtime-1)/300;
if(hasHitpoints(m->type)) if(hasHitpoints(m->type))