1 |
//====================================================================== |
/* |
2 |
// Copyright (C) 2002 Daniel Heck |
* Copyright (C) 2002,2003 Daniel Heck |
3 |
// |
* |
4 |
// This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
// modify it under the terms of the GNU General Public License |
* modify it under the terms of the GNU General Public License |
6 |
// as published by the Free Software Foundation; either version 2 |
* as published by the Free Software Foundation; either version 2 |
7 |
// of the License, or (at your option) any later version. |
* of the License, or (at your option) any later version. |
8 |
// |
* |
9 |
// This program is distributed in the hope that it will be useful, |
* This program is distributed in the hope that it will be useful, |
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
// GNU General Public License for more details. |
* GNU General Public License for more details. |
13 |
// |
* |
14 |
// You should have received a copy of the GNU General Public License along |
* You should have received a copy of the GNU General Public License along |
15 |
// with this program; if not, write to the Free Software Foundation, Inc., |
* with this program; if not, write to the Free Software Foundation, Inc., |
16 |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
17 |
//====================================================================== |
* |
18 |
|
* $Id$ |
19 |
|
*/ |
20 |
#include "display.hh" |
#include "display.hh" |
21 |
#include "player.hh" |
#include "player.hh" |
22 |
#include "tools.hh" |
#include "tools.hh" |
263 |
} |
} |
264 |
|
|
265 |
|
|
266 |
|
/* Try to respawn player pl. Return true if this was possible. */ |
267 |
|
static bool |
268 |
|
respawn_player (unsigned pl) |
269 |
|
{ |
270 |
|
Inventory *inv = &players[pl].inventory; |
271 |
|
|
272 |
|
for (int i=0; i<inv->size(); ++i) |
273 |
|
if (0 == strcmp(inv->get_item(i)->get_kind(), "it-extralife")) { |
274 |
|
delete inv->yield_item(i); |
275 |
|
players[pl].main_actor->respawn(); |
276 |
|
return true; |
277 |
|
} |
278 |
|
return false; |
279 |
|
} |
280 |
|
|
281 |
|
|
282 |
bool |
bool |
283 |
player::AllActorsDead() |
player::AllActorsDead() |
284 |
{ |
{ |
285 |
for (unsigned i=0; i<players.size(); ++i) { |
for (unsigned i=0; i<players.size(); ++i) { |
286 |
if (players[i].main_actor && !players[i].main_actor->is_dead()) |
if (!players[i].main_actor) |
287 |
|
continue; |
288 |
|
if (!players[i].main_actor->is_dead()) |
289 |
|
return false; |
290 |
|
// actor is dead |
291 |
|
if (enigma::ConserveLevel && respawn_player(i)) |
292 |
return false; |
return false; |
293 |
} |
} |
294 |
return true; |
return true; |