185 |
namespace { |
namespace { |
186 |
const char *vstrf(const char *format, va_list argPtr) { |
const char *vstrf(const char *format, va_list argPtr) { |
187 |
static size_t buf_size = 256; |
static size_t buf_size = 256; |
|
// /*!!*/ [ant]: fixme: does this ever get deleted? |
|
188 |
static char *buffer = new char[buf_size]; |
static char *buffer = new char[buf_size]; |
189 |
|
// Note: buffer intentionally exists over the whole program-lifetime |
190 |
|
|
191 |
size_t length; |
size_t length; |
192 |
while (1) { |
while (1) { |
329 |
}; |
}; |
330 |
} |
} |
331 |
|
|
332 |
|
// ------------------ |
333 |
|
// FallenBox |
334 |
|
// ------------------ |
335 |
|
|
336 |
|
namespace |
337 |
|
{ |
338 |
|
class FallenBox : public Floor { |
339 |
|
CLONEOBJ(FallenBox); |
340 |
|
public: |
341 |
|
FallenBox(const char *kind) |
342 |
|
: Floor(modify_kind(kind), 6.4, 2.0) // uses same traits as fl-wood |
343 |
|
{} |
344 |
|
|
345 |
|
private: |
346 |
|
const char *modify_kind(const char *kind) { |
347 |
|
if (0 == strcmp(kind, "fl-stwood")) { |
348 |
|
return enigma::IntegerRand(0, 1) ? "fl-stwood1" : "fl-stwood2"; |
349 |
|
} |
350 |
|
return kind; |
351 |
|
} |
352 |
|
}; |
353 |
|
} |
354 |
|
|
355 |
// ------------------- |
// ------------------- |
356 |
// DummyFloor |
// DummyFloor |
357 |
// ------------------- |
// ------------------- |
689 |
return "st-stone"; |
return "st-stone"; |
690 |
} |
} |
691 |
|
|
692 |
bool Stone::move_stone(Direction dir) { |
/* Move a stone (regardless whether it is_movable() or not) if |
693 |
|
the destination field is free. |
694 |
|
Returns: true if stone has been moved. |
695 |
|
|
696 |
|
Note: This should be used by on_impulse() to perform a move. |
697 |
|
*/ |
698 |
|
bool |
699 |
|
Stone::move_stone(Direction dir) { |
700 |
GridPos p = get_pos(); |
GridPos p = get_pos(); |
701 |
GridPos newPos = move(p, dir); |
GridPos newPos = move(p, dir); |
702 |
|
|
774 |
add_templ(new Water); |
add_templ(new Water); |
775 |
add_templ(new Swamp); |
add_templ(new Swamp); |
776 |
add_templ(new DummyFloor); |
add_templ(new DummyFloor); |
777 |
|
add_templ(new FallenBox("fl-stwood")); |
778 |
|
add_templ(new FallenBox("fl-stwood1")); |
779 |
|
add_templ(new FallenBox("fl-stwood2")); |
780 |
add_templ(new Bridge); |
add_templ(new Bridge); |
781 |
add_templ("fl-bridge-open", new Bridge(true)); |
add_templ("fl-bridge-open", new Bridge(true)); |
782 |
add_templ("fl-bridge-closed", new Bridge(false)); |
add_templ("fl-bridge-closed", new Bridge(false)); |