[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r4023 - in trunk/pingus/src: actions components display edi
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r4023 - in trunk/pingus/src: actions components display editor pingus worldmap worldobjs |
Date: |
Wed, 4 Nov 2009 20:29:50 +0100 |
Author: grumbel
Date: 2009-11-04 20:29:46 +0100 (Wed, 04 Nov 2009)
New Revision: 4023
Modified:
trunk/pingus/src/actions/basher.cpp
trunk/pingus/src/actions/blocker.cpp
trunk/pingus/src/actions/boarder.cpp
trunk/pingus/src/actions/bomber.cpp
trunk/pingus/src/actions/bridger.cpp
trunk/pingus/src/actions/bridger.hpp
trunk/pingus/src/actions/climber.cpp
trunk/pingus/src/actions/digger.cpp
trunk/pingus/src/actions/drown.cpp
trunk/pingus/src/actions/exiter.cpp
trunk/pingus/src/actions/faller.cpp
trunk/pingus/src/actions/faller.hpp
trunk/pingus/src/actions/floater.cpp
trunk/pingus/src/actions/jumper.cpp
trunk/pingus/src/actions/jumper.hpp
trunk/pingus/src/actions/laser_kill.cpp
trunk/pingus/src/actions/miner.cpp
trunk/pingus/src/actions/rocket_launcher.cpp
trunk/pingus/src/actions/slider.cpp
trunk/pingus/src/actions/smashed.cpp
trunk/pingus/src/actions/splashed.cpp
trunk/pingus/src/actions/splashed.hpp
trunk/pingus/src/actions/waiter.cpp
trunk/pingus/src/actions/walker.cpp
trunk/pingus/src/components/action_button.cpp
trunk/pingus/src/components/button_panel.cpp
trunk/pingus/src/components/button_panel.hpp
trunk/pingus/src/components/check_box.cpp
trunk/pingus/src/components/menu_button.cpp
trunk/pingus/src/components/pingus_counter.cpp
trunk/pingus/src/components/pingus_counter.hpp
trunk/pingus/src/components/playfield.cpp
trunk/pingus/src/components/slider_box.cpp
trunk/pingus/src/components/smallmap.cpp
trunk/pingus/src/components/time_display.cpp
trunk/pingus/src/display/delta_framebuffer.cpp
trunk/pingus/src/display/drawing_context.cpp
trunk/pingus/src/display/rect_merger.cpp
trunk/pingus/src/display/scene_context.cpp
trunk/pingus/src/display/sdl_framebuffer.cpp
trunk/pingus/src/editor/button.cpp
trunk/pingus/src/editor/combobox.cpp
trunk/pingus/src/editor/file_list.cpp
trunk/pingus/src/editor/inputbox.cpp
trunk/pingus/src/editor/level_impl.hpp
trunk/pingus/src/editor/panel.cpp
trunk/pingus/src/pingus/story_screen.cpp
trunk/pingus/src/pingus/surface.cpp
trunk/pingus/src/pingus/worldobj.cpp
trunk/pingus/src/pingus/worldobj_factory.cpp
trunk/pingus/src/pingus/worldobj_factory.hpp
trunk/pingus/src/worldmap/dot.cpp
trunk/pingus/src/worldmap/path.cpp
trunk/pingus/src/worldmap/path.hpp
trunk/pingus/src/worldobjs/entrance.cpp
Log:
More -Weffc++ cleanup
Modified: trunk/pingus/src/actions/basher.cpp
===================================================================
--- trunk/pingus/src/actions/basher.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/basher.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -27,16 +27,19 @@
namespace Actions {
-Basher::Basher (Pingu* p)
- : PinguAction(p),
- bash_radius("other/bash_radius_gfx", "other/bash_radius"),
- basher_c(0),
- first_bash(true)
+Basher::Basher (Pingu* p) :
+ PinguAction(p),
+ sprite(),
+ bash_radius("other/bash_radius_gfx", "other/bash_radius"),
+ basher_c(0),
+ first_bash(true),
+ bash_radius_width(),
+ bash_reach()
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/basher/left"));
+ pingu->get_owner_str() +
"/basher/left"));
sprite.load(Direction::RIGHT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/basher/right"));
+ pingu->get_owner_str() +
"/basher/right"));
bash_radius_width = bash_radius.get_width();
@@ -62,42 +65,42 @@
++basher_c;
if (basher_c % 3 == 0)
+ {
+ walk_forward();
+
+ // If on walking forward the Basher has now walked on to water or lava
+ if (rel_getpixel(0, -1) == Groundtype::GP_WATER
+ || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
{
- walk_forward();
-
- // If on walking forward the Basher has now walked on to water or lava
- if (rel_getpixel(0, -1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
- {
- pingu->set_action(Actions::DROWN);
- }
- // If walking on to something (i.e. hasn't fallen)
- else if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- // If the Basher has walked into something that it won't be able to
- // bash
- if (rel_getpixel(0, 0) == Groundtype::GP_SOLID
- || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
- {
- // Change direction and let walk code walk forward/up to get out.
- Sound::PingusSound::play_sound("chink");
- pingu->direction.change();
- pingu->set_action(Actions::WALKER);
- }
- else if (have_something_to_dig())
- {
- // We only bash every second step, cause the Pingus would
- // get trapped otherwise in the bashing area.
- if (basher_c % 2 == 0)
- bash();
- }
- else if (sprite[pingu->direction].get_current_frame() // FIXME: Game
logic must be separate from Sprite
- / float(sprite[pingu->direction].get_frame_count()) > 0.6f)
- { // FIXME: EVIL! Engine must not relay on graphic
- pingu->set_action(Actions::WALKER);
- }
- }
+ pingu->set_action(Actions::DROWN);
}
+ // If walking on to something (i.e. hasn't fallen)
+ else if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
+ {
+ // If the Basher has walked into something that it won't be able to
+ // bash
+ if (rel_getpixel(0, 0) == Groundtype::GP_SOLID
+ || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
+ {
+ // Change direction and let walk code walk forward/up to get out.
+ Sound::PingusSound::play_sound("chink");
+ pingu->direction.change();
+ pingu->set_action(Actions::WALKER);
+ }
+ else if (have_something_to_dig())
+ {
+ // We only bash every second step, cause the Pingus would
+ // get trapped otherwise in the bashing area.
+ if (basher_c % 2 == 0)
+ bash();
+ }
+ else if (sprite[pingu->direction].get_current_frame() // FIXME: Game
logic must be separate from Sprite
+ / float(sprite[pingu->direction].get_frame_count()) > 0.6f)
+ { // FIXME: EVIL! Engine must not relay on graphic
+ pingu->set_action(Actions::WALKER);
+ }
+ }
+ }
}
void
@@ -115,47 +118,47 @@
// Find the correct y position to go to next
for (y_inc = 0; y_inc >= -max_steps_down; --y_inc)
- {
- // If there is something below, get out of this loop
- if (rel_getpixel(0, y_inc - 1) != Groundtype::GP_NOTHING)
- break;
- }
+ {
+ // If there is something below, get out of this loop
+ if (rel_getpixel(0, y_inc - 1) != Groundtype::GP_NOTHING)
+ break;
+ }
if (y_inc < -max_steps_down)
- {
- // The step down is too much. So stop being a Basher and be a Faller.
- pingu->set_action(Actions::FALLER);
- }
+ {
+ // The step down is too much. So stop being a Basher and be a Faller.
+ pingu->set_action(Actions::FALLER);
+ }
else
- {
- // Note that Pingu::set_pos() is the 'reverse' of the y co-ords of
- // rel_getpixel()
- pingu->set_pos(pingu->get_x() + static_cast<int>(pingu->direction),
- pingu->get_y() - y_inc);
- }
+ {
+ // Note that Pingu::set_pos() is the 'reverse' of the y co-ords of
+ // rel_getpixel()
+ pingu->set_pos(pingu->get_x() + static_cast<int>(pingu->direction),
+ pingu->get_y() - y_inc);
+ }
}
bool
Basher::have_something_to_dig()
{
if (first_bash)
- {
- first_bash = false;
- return true;
- }
+ {
+ first_bash = false;
+ return true;
+ }
// Check that there is something "within" the Basher's reach
for(int x = 0; x <= bash_reach; ++x)
+ {
+ for (int y = min_bash_height; y <= max_bash_height; ++y)
{
- for (int y = min_bash_height; y <= max_bash_height; ++y)
- {
- if (rel_getpixel(x, y) == Groundtype::GP_GROUND)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Basher: Found something to dig..."
<< std::endl;
- return true;
- }
- }
+ if (rel_getpixel(x, y) == Groundtype::GP_GROUND)
+ {
+ pout(PINGUS_DEBUG_ACTIONS) << "Basher: Found something to dig..." <<
std::endl;
+ return true;
+ }
}
+ }
//std::cout << "nothing to dig found" << std::endl;
return false;
Modified: trunk/pingus/src/actions/blocker.cpp
===================================================================
--- trunk/pingus/src/actions/blocker.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/blocker.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -22,8 +22,9 @@
namespace Actions {
-Blocker::Blocker(Pingu* p)
- : PinguAction(p)
+Blocker::Blocker(Pingu* p) :
+ PinguAction(p),
+ sprite()
{
sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/blocker/left");
sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/blocker/right");
Modified: trunk/pingus/src/actions/boarder.cpp
===================================================================
--- trunk/pingus/src/actions/boarder.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/boarder.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -21,10 +21,11 @@
namespace Actions {
-Boarder::Boarder (Pingu* p)
- : PinguAction(p),
- x_pos(pingu->get_x()),
- speed(0.0)
+Boarder::Boarder (Pingu* p) :
+ PinguAction(p),
+ x_pos(pingu->get_x()),
+ speed(0.0),
+ sprite()
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() + "/boarder/left"));
Modified: trunk/pingus/src/actions/bomber.cpp
===================================================================
--- trunk/pingus/src/actions/bomber.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/bomber.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -28,14 +28,15 @@
namespace Actions {
-Bomber::Bomber (Pingu* p)
- : PinguAction(p),
- particle_thrown(false),
- sound_played(false),
- gfx_exploded(false),
- colmap_exploded(false),
- bomber_radius("other/bomber_radius_gfx", "other/bomber_radius"),
- explo_surf(Sprite("pingus/player" + pingu->get_owner_str() + "/explo"))
+Bomber::Bomber (Pingu* p) :
+ PinguAction(p),
+ particle_thrown(false),
+ sound_played(false),
+ gfx_exploded(false),
+ colmap_exploded(false),
+ bomber_radius("other/bomber_radius_gfx", "other/bomber_radius"),
+ sprite(),
+ explo_surf(Sprite("pingus/player" + pingu->get_owner_str() + "/explo"))
{
sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/bomber/left");
sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/bomber/right");
@@ -51,10 +52,10 @@
Bomber::draw (SceneContext& gc)
{
if (sprite[pingu->direction].get_current_frame() >= 13 && !gfx_exploded)
- {
- gc.color().draw (explo_surf, Vector3f(pingu->get_x () - 32, pingu->get_y
() - 48));
- gfx_exploded = true;
- }
+ {
+ gc.color().draw (explo_surf, Vector3f(pingu->get_x () - 32, pingu->get_y
() - 48));
+ gfx_exploded = true;
+ }
gc.color().draw(sprite[pingu->direction], pingu->get_pos ());
}
@@ -75,19 +76,19 @@
// If the Bomber hasn't 'exploded' yet and it has hit Water or Lava
if (sprite[pingu->direction].get_current_frame() <= 9 && (rel_getpixel(0,
-1) == Groundtype::GP_WATER
- || rel_getpixel(0, -1) == Groundtype::GP_LAVA))
- {
- pingu->set_action(Actions::DROWN);
- return;
- }
+ || rel_getpixel(0,
-1) == Groundtype::GP_LAVA))
+ {
+ pingu->set_action(Actions::DROWN);
+ return;
+ }
// If the Bomber hasn't 'exploded' yet and it has hit the ground too quickly
if (sprite[pingu->direction].get_current_frame () <= 9 && rel_getpixel(0,
-1) != Groundtype::GP_NOTHING
&& velocity.y > deadly_velocity)
- {
- pingu->set_action(Actions::SPLASHED);
- return;
- }
+ {
+ pingu->set_action(Actions::SPLASHED);
+ return;
+ }
if (sprite[pingu->direction].get_current_frame () > 9 && !sound_played) {
WorldObj::get_world()->play_sound("plop", pingu->get_pos ());
@@ -96,26 +97,26 @@
// Throwing particles
if (sprite[pingu->direction].get_current_frame () > 12 && !particle_thrown)
- {
- particle_thrown = true;
-
WorldObj::get_world()->get_pingu_particle_holder()->add_particle(static_cast<int>(pingu->get_x()),
-
static_cast<int>(pingu->get_y()) - 5);
- }
+ {
+ particle_thrown = true;
+
WorldObj::get_world()->get_pingu_particle_holder()->add_particle(static_cast<int>(pingu->get_x()),
+
static_cast<int>(pingu->get_y()) - 5);
+ }
if (sprite[pingu->direction].get_current_frame () >= 13 && !colmap_exploded)
- {
- colmap_exploded = true;
- WorldObj::get_world()->remove(bomber_radius,
-
static_cast<int>(pingu->get_x () - (bomber_radius.get_width()/2)),
-
static_cast<int>(pingu->get_y () - 16 - (bomber_radius.get_width()/2)));
- }
+ {
+ colmap_exploded = true;
+ WorldObj::get_world()->remove(bomber_radius,
+ static_cast<int>(pingu->get_x () -
(bomber_radius.get_width()/2)),
+ static_cast<int>(pingu->get_y () - 16 -
(bomber_radius.get_width()/2)));
+ }
// The pingu explode
if (sprite[pingu->direction].is_finished ())
- {
- pingu->set_status(PS_DEAD);
- }
+ {
+ pingu->set_status(PS_DEAD);
+ }
}
} // namespace Actions
Modified: trunk/pingus/src/actions/bridger.cpp
===================================================================
--- trunk/pingus/src/actions/bridger.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/bridger.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -27,14 +27,16 @@
namespace Actions {
-Bridger::Bridger (Pingu* p)
- : PinguAction(p),
- mode(B_BUILDING),
- brick_l("other/brick_left"),
- brick_r("other/brick_right"),
- bricks(MAX_BRICKS),
- block_build(false),
- name(_("Bridger") + std::string(" (" + StringUtil::to_string(bricks) +
")"))
+Bridger::Bridger (Pingu* p) :
+ PinguAction(p),
+ mode(B_BUILDING),
+ walk_sprite(),
+ build_sprite(),
+ brick_l("other/brick_left"),
+ brick_r("other/brick_right"),
+ bricks(MAX_BRICKS),
+ block_build(false),
+ name(_("Bridger") + std::string(" (" + StringUtil::to_string(bricks) + ")"))
{
walk_sprite.load (Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() +
"/bridger_walk/left"));
@@ -66,57 +68,57 @@
}
switch (mode)
- {
- case B_BUILDING:
- gc.color().draw(build_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
-
pingu->get_pos().y + y_offset));
- break;
+ {
+ case B_BUILDING:
+ gc.color().draw(build_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
+
pingu->get_pos().y + y_offset));
+ break;
- case B_WALKING:
- gc.color().draw(walk_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
-
pingu->get_pos().y + y_offset));
- break;
- }
+ case B_WALKING:
+ gc.color().draw(walk_sprite[pingu->direction],
Vector3f(pingu->get_pos().x - (x_offset * pingu->direction),
+
pingu->get_pos().y + y_offset));
+ break;
+ }
}
void
Bridger::update()
{
switch (mode)
- {
- case B_BUILDING:
- update_build ();
- break;
+ {
+ case B_BUILDING:
+ update_build ();
+ break;
- case B_WALKING:
- update_walk ();
- break;
- }
+ case B_WALKING:
+ update_walk ();
+ break;
+ }
}
void
Bridger::update_walk ()
{
if (walk_sprite[pingu->direction].is_finished ()) // FIXME: Dangerous! might
not be fixed timing
+ {
+ if (way_is_free())
{
- if (way_is_free())
- {
- mode = B_BUILDING;
- block_build = false;
- walk_sprite[pingu->direction].restart();
- walk_one_step_up();
- }
- else // We reached a wall...
- {
- pingu->direction.change ();
- pingu->set_action (Actions::WALKER);
- return;
- }
+ mode = B_BUILDING;
+ block_build = false;
+ walk_sprite[pingu->direction].restart();
+ walk_one_step_up();
}
- else
+ else // We reached a wall...
{
- walk_sprite.update ();
+ pingu->direction.change ();
+ pingu->set_action (Actions::WALKER);
+ return;
}
+ }
+ else
+ {
+ walk_sprite.update ();
+ }
}
void
@@ -126,32 +128,32 @@
// FIXME: Game logic must not depend on Sprite states
if (build_sprite[pingu->direction].get_current_frame () >= 7 && !block_build)
+ {
+ block_build = true;
+
+ if (bricks > 0)
{
- block_build = true;
-
- if (bricks > 0)
- {
- if (brick_placement_allowed())
- place_a_brick();
- else
- {
- pingu->direction.change ();
- pingu->set_action (Actions::WALKER);
- return;
- }
- }
- else // Out of bricks
- {
- pingu->set_action(Actions::WAITER);
- return;
- }
+ if (brick_placement_allowed())
+ place_a_brick();
+ else
+ {
+ pingu->direction.change ();
+ pingu->set_action (Actions::WALKER);
+ return;
+ }
}
+ else // Out of bricks
+ {
+ pingu->set_action(Actions::WAITER);
+ return;
+ }
+ }
if (build_sprite[pingu->direction].is_finished ())
- {
- mode = B_WALKING;
- build_sprite[pingu->direction].restart();
- }
+ {
+ mode = B_WALKING;
+ build_sprite[pingu->direction].restart();
+ }
}
// way_is_free() needs to stop BRIDGERS from getting stuck between a brick
@@ -166,14 +168,14 @@
bool way_free = true;
for (int x_inc = 1; x_inc <= 4; x_inc++)
+ {
+ if (rel_getpixel(x_inc, 2) != Groundtype::GP_NOTHING
+ || head_collision_on_walk(x_inc, 2))
{
- if (rel_getpixel(x_inc, 2) != Groundtype::GP_NOTHING
- || head_collision_on_walk(x_inc, 2))
- {
- way_free = false;
- break;
- }
+ way_free = false;
+ break;
}
+ }
return way_free;
}
@@ -198,19 +200,19 @@
Sound::PingusSound::play_sound("ting");
if (pingu->direction.is_right())
- {
- WorldObj::get_world()->put(brick_r,
- static_cast<int>(pingu->get_pos().x + 10 -
brick_r.get_width()),
- static_cast<int>(pingu->get_pos().y),
- Groundtype::GP_BRIDGE);
- }
+ {
+ WorldObj::get_world()->put(brick_r,
+ static_cast<int>(pingu->get_pos().x + 10 -
brick_r.get_width()),
+ static_cast<int>(pingu->get_pos().y),
+ Groundtype::GP_BRIDGE);
+ }
else
- {
- WorldObj::get_world()->put(brick_l,
- static_cast<int>(pingu->get_pos().x - 10),
- static_cast<int>(pingu->get_pos().y),
- Groundtype::GP_BRIDGE);
- }
+ {
+ WorldObj::get_world()->put(brick_l,
+ static_cast<int>(pingu->get_pos().x - 10),
+ static_cast<int>(pingu->get_pos().y),
+ Groundtype::GP_BRIDGE);
+ }
}
void
Modified: trunk/pingus/src/actions/bridger.hpp
===================================================================
--- trunk/pingus/src/actions/bridger.hpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/bridger.hpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -42,6 +42,7 @@
bool block_build;
std::string name;
+
public:
Bridger(Pingu*);
Modified: trunk/pingus/src/actions/climber.cpp
===================================================================
--- trunk/pingus/src/actions/climber.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/climber.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -21,13 +21,16 @@
namespace Actions {
-Climber::Climber (Pingu* p)
- : PinguAction(p)
+Climber::Climber (Pingu* p) :
+ PinguAction(p),
+ sprite(),
+ sprite_width(),
+ sprite_height()
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/climber/left"));
+ pingu->get_owner_str() +
"/climber/left"));
sprite.load(Direction::RIGHT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/climber/right"));
+ pingu->get_owner_str() +
"/climber/right"));
}
void
@@ -37,42 +40,42 @@
// If above is free
if ( rel_getpixel(0, 1) == Groundtype::GP_NOTHING
- || rel_getpixel(0, 1) == Groundtype::GP_BRIDGE)
+ || rel_getpixel(0, 1) == Groundtype::GP_BRIDGE)
+ {
+ // and there is still ground to walk on
+ if (rel_getpixel(1, 1) != Groundtype::GP_NOTHING)
{
- // and there is still ground to walk on
- if (rel_getpixel(1, 1) != Groundtype::GP_NOTHING)
- {
- pingu->set_pos(pingu->get_x(),
- pingu->get_y() - 1);
- return;
- }
- else if (rel_getpixel(1, 1) == Groundtype::GP_NOTHING)
- {
- // std::cout << "Climber failed, no more wall" << std::endl;
+ pingu->set_pos(pingu->get_x(),
+ pingu->get_y() - 1);
+ return;
+ }
+ else if (rel_getpixel(1, 1) == Groundtype::GP_NOTHING)
+ {
+ // std::cout << "Climber failed, no more wall" << std::endl;
- // If Pingu able to get to new position without head collision
- if (!head_collision_on_walk(pingu->direction, 1))
- {
- // Get ready to walk
- pingu->set_pos(pingu->get_x() + pingu->direction,
- pingu->get_y() - 1);
- }
- else
- {
- // Get ready to fall
- pingu->direction.change();
- }
+ // If Pingu able to get to new position without head collision
+ if (!head_collision_on_walk(pingu->direction, 1))
+ {
+ // Get ready to walk
+ pingu->set_pos(pingu->get_x() + pingu->direction,
+ pingu->get_y() - 1);
+ }
+ else
+ {
+ // Get ready to fall
+ pingu->direction.change();
+ }
- // Finish climbing.
- pingu->set_action(Actions::WALKER);
- }
+ // Finish climbing.
+ pingu->set_action(Actions::WALKER);
}
+ }
else
- {
- // std::cout << "Climber failed, falling down" << std::endl;
- pingu->direction.change();
- pingu->set_action(Actions::WALKER);
- }
+ {
+ // std::cout << "Climber failed, falling down" << std::endl;
+ pingu->direction.change();
+ pingu->set_action(Actions::WALKER);
+ }
}
void
Modified: trunk/pingus/src/actions/digger.cpp
===================================================================
--- trunk/pingus/src/actions/digger.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/digger.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -25,10 +25,11 @@
namespace Actions {
-Digger::Digger (Pingu* p)
- : PinguAction(p),
- digger_radius("other/digger_radius_gfx", "other/digger_radius"),
- digger_c(0)
+Digger::Digger (Pingu* p) :
+ PinguAction(p),
+ digger_radius("other/digger_radius_gfx", "other/digger_radius"),
+ sprite(),
+ digger_c(0)
{
sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/digger/left");
}
Modified: trunk/pingus/src/actions/drown.cpp
===================================================================
--- trunk/pingus/src/actions/drown.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/drown.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,8 +21,9 @@
namespace Actions {
-Drown::Drown (Pingu* p)
- : PinguAction(p)
+Drown::Drown (Pingu* p) :
+ PinguAction(p),
+ sprite()
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() + "/drownfall/left"));
Modified: trunk/pingus/src/actions/exiter.cpp
===================================================================
--- trunk/pingus/src/actions/exiter.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/exiter.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -22,9 +22,10 @@
namespace Actions {
-Exiter::Exiter (Pingu* p)
- : PinguAction(p),
- sound_played(false)
+Exiter::Exiter (Pingu* p) :
+ PinguAction(p),
+ sprite(),
+ sound_played(false)
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() + "/exit/left"));
Modified: trunk/pingus/src/actions/faller.cpp
===================================================================
--- trunk/pingus/src/actions/faller.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/faller.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -27,8 +27,10 @@
namespace Actions {
-Faller::Faller (Pingu* p)
- : PinguAction(p)
+Faller::Faller (Pingu* p) :
+ PinguAction(p),
+ faller(),
+ tumbler()
{
faller.load(Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() +
"/faller/left"));
Modified: trunk/pingus/src/actions/faller.hpp
===================================================================
--- trunk/pingus/src/actions/faller.hpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/faller.hpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -28,8 +28,6 @@
StateSprite faller;
StateSprite tumbler;
- int falling;
-
public:
Faller(Pingu*);
virtual ~Faller();
Modified: trunk/pingus/src/actions/floater.cpp
===================================================================
--- trunk/pingus/src/actions/floater.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/floater.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -21,10 +21,11 @@
namespace Actions {
-Floater::Floater(Pingu* p)
- : PinguAction(p),
- falling_depth(0),
- step(0)
+Floater::Floater(Pingu* p) :
+ PinguAction(p),
+ falling_depth(0),
+ step(0),
+ sprite()
{
sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/floater/left");
}
@@ -37,18 +38,18 @@
pingu->set_velocity(Vector3f(0.0f, 1.0f));
if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
+ {
+ ++step;
+ if (step > 0)
{
- ++step;
- if (step > 0)
- {
- pingu->set_y(pingu->get_y() + 1);
- step = 0;
- }
+ pingu->set_y(pingu->get_y() + 1);
+ step = 0;
}
+ }
else
- {
- pingu->set_action (Actions::WALKER);
- }
+ {
+ pingu->set_action (Actions::WALKER);
+ }
}
void
Modified: trunk/pingus/src/actions/jumper.cpp
===================================================================
--- trunk/pingus/src/actions/jumper.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/jumper.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,8 +21,9 @@
namespace Actions {
-Jumper::Jumper (Pingu* p)
- : PinguAction(p)
+Jumper::Jumper (Pingu* p) :
+ PinguAction(p),
+ sprite()
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
pingu->get_owner_str() +
"/jumper/left"));
Modified: trunk/pingus/src/actions/jumper.hpp
===================================================================
--- trunk/pingus/src/actions/jumper.hpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/jumper.hpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -26,6 +26,7 @@
{
private:
StateSprite sprite;
+
public:
Jumper(Pingu*);
Modified: trunk/pingus/src/actions/laser_kill.cpp
===================================================================
--- trunk/pingus/src/actions/laser_kill.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/laser_kill.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -21,8 +21,9 @@
namespace Actions {
-LaserKill::LaserKill(Pingu* p)
- : PinguAction(p)
+LaserKill::LaserKill(Pingu* p) :
+ PinguAction(p),
+ sprite()
{
sprite.load(Direction::LEFT, Sprite("other/laser_kill/left"));
sprite.load(Direction::RIGHT, Sprite("other/laser_kill/right"));
Modified: trunk/pingus/src/actions/miner.cpp
===================================================================
--- trunk/pingus/src/actions/miner.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/miner.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -25,15 +25,16 @@
namespace Actions {
-Miner::Miner (Pingu* p)
- : PinguAction(p),
- miner_radius("other/bash_radius_gfx", "other/bash_radius"),
- slow_count(0)
+Miner::Miner (Pingu* p) :
+ PinguAction(p),
+ miner_radius("other/bash_radius_gfx", "other/bash_radius"),
+ sprite(),
+ slow_count(0)
{
sprite.load(Direction::LEFT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/miner/left"));
+ pingu->get_owner_str() +
"/miner/left"));
sprite.load(Direction::RIGHT, Sprite("pingus/player" +
- pingu->get_owner_str() + "/miner/right"));
+ pingu->get_owner_str() +
"/miner/right"));
}
void
@@ -43,38 +44,38 @@
++slow_count;
if (!(slow_count % 4))
+ {
+ if (!(slow_count % 3))
{
- if (!(slow_count % 3))
- {
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 1));
- }
-
- pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() + 1);
+ WorldObj::get_world()->remove(miner_radius,
+ static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
+ static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 1));
}
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() + 1);
+ }
+
if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
- {
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 3) );
- pingu->set_action(Actions::WALKER);
- }
+ {
+ WorldObj::get_world()->remove(miner_radius,
+ static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
+ static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 3) );
+ pingu->set_action(Actions::WALKER);
+ }
else if (rel_getpixel(0, -1) == Groundtype::GP_SOLID
- || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
- {
- if (rel_getpixel(0, -1) == Groundtype::GP_SOLID)
- Sound::PingusSound::play_sound("chink");
+ || rel_getpixel(0, pingu_height) == Groundtype::GP_SOLID)
+ {
+ if (rel_getpixel(0, -1) == Groundtype::GP_SOLID)
+ Sound::PingusSound::play_sound("chink");
- WorldObj::get_world()->remove(miner_radius,
- static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
- static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 1) );
- pingu->set_action(Actions::WALKER);
+ WorldObj::get_world()->remove(miner_radius,
+ static_cast<int>(pingu->get_x() -
(miner_radius.get_width() / 2) + pingu->direction),
+ static_cast<int>(pingu->get_y() -
miner_radius.get_width() + 1) );
+ pingu->set_action(Actions::WALKER);
- // Stop Pingu walking further into the solid.
- pingu->direction.change();
- }
+ // Stop Pingu walking further into the solid.
+ pingu->direction.change();
+ }
}
void
Modified: trunk/pingus/src/actions/rocket_launcher.cpp
===================================================================
--- trunk/pingus/src/actions/rocket_launcher.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/actions/rocket_launcher.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -24,32 +24,33 @@
namespace Actions {
-RocketLauncher::RocketLauncher (Pingu* p)
- : PinguAction(p),
- launched(false)
+RocketLauncher::RocketLauncher (Pingu* p) :
+ PinguAction(p),
+ sprite(),
+ launched(false)
{
sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
- "/rocketlauncher/left");
+ "/rocketlauncher/left");
sprite.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
- "/rocketlauncher/right");
+ "/rocketlauncher/right");
-/* Explosive Particles not supported right now
- WorldObj::get_world()->get_particle_holder()->add_particle
- (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
- static_cast<int>(pingu->get_y()) - 12,
- pingu->direction.is_left() ? -400.0f : 400.0f,
- 0.0f));
-*/
+ /* Explosive Particles not supported right now
+ WorldObj::get_world()->get_particle_holder()->add_particle
+ (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
+ static_cast<int>(pingu->get_y()) - 12,
+ pingu->direction.is_left() ? -400.0f : 400.0f,
+ 0.0f));
+ */
}
void
RocketLauncher::update ()
{
if (sprite[pingu->direction].is_finished())
- {
- pingu->set_action(Actions::WALKER);
- return;
- }
+ {
+ pingu->set_action(Actions::WALKER);
+ return;
+ }
sprite.update();
}
Modified: trunk/pingus/src/actions/slider.cpp
===================================================================
--- trunk/pingus/src/actions/slider.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/slider.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,9 +21,10 @@
namespace Actions {
-Slider::Slider (Pingu* p)
- : PinguAction(p),
- speed(10)
+Slider::Slider (Pingu* p) :
+ PinguAction(p),
+ sprite(),
+ speed(10)
{
sprite.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/slider/left");
Modified: trunk/pingus/src/actions/smashed.cpp
===================================================================
--- trunk/pingus/src/actions/smashed.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/smashed.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -22,9 +22,10 @@
namespace Actions {
-Smashed::Smashed (Pingu* p)
- : PinguAction(p),
- sound_played(false)
+Smashed::Smashed (Pingu* p) :
+ PinguAction(p),
+ sound_played(false),
+ sprite()
{
sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/bomber");
}
Modified: trunk/pingus/src/actions/splashed.cpp
===================================================================
--- trunk/pingus/src/actions/splashed.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/splashed.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -23,10 +23,11 @@
namespace Actions {
-Splashed::Splashed (Pingu* p)
- : PinguAction(p),
- particle_thrown(false),
- sound_played(false)
+Splashed::Splashed (Pingu* p) :
+ PinguAction(p),
+ particle_thrown(false),
+ sound_played(false),
+ sprite()
{
sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/splat");
}
Modified: trunk/pingus/src/actions/splashed.hpp
===================================================================
--- trunk/pingus/src/actions/splashed.hpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/actions/splashed.hpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -27,6 +27,7 @@
bool particle_thrown;
bool sound_played;
Sprite sprite;
+
public:
Splashed (Pingu*);
Modified: trunk/pingus/src/actions/waiter.cpp
===================================================================
--- trunk/pingus/src/actions/waiter.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/waiter.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,9 +21,10 @@
namespace Actions {
-Waiter::Waiter (Pingu* p)
- : PinguAction(p),
- countdown(2.0f)
+Waiter::Waiter (Pingu* p) :
+ PinguAction(p),
+ countdown(2.0f),
+ sprite()
{
sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/waiter/left");
}
Modified: trunk/pingus/src/actions/walker.cpp
===================================================================
--- trunk/pingus/src/actions/walker.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/actions/walker.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -23,8 +23,10 @@
namespace Actions {
-Walker::Walker (Pingu* p)
- : PinguAction(p)
+Walker::Walker (Pingu* p) :
+ PinguAction(p),
+ walker(),
+ floaterlayer()
{
walker.load(Direction::LEFT, "pingus/player" + pingu->get_owner_str() +
"/walker/left");
walker.load(Direction::RIGHT, "pingus/player" + pingu->get_owner_str() +
"/walker/right");
Modified: trunk/pingus/src/components/action_button.cpp
===================================================================
--- trunk/pingus/src/components/action_button.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/action_button.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -96,11 +96,12 @@
UNUSED_ARG(y);
}
-ForwardButton::ForwardButton(GameSession* s, int x, int y)
- : RectComponent(Rect(Vector2i(x, y), Size(38, 60))),
- session(s),
- background ("core/buttons/hbuttonbgb"),
- backgroundhl("core/buttons/hbuttonbg")
+ForwardButton::ForwardButton(GameSession* s, int x, int y) :
+ RectComponent(Rect(Vector2i(x, y), Size(38, 60))),
+ session(s),
+ surface(),
+ background ("core/buttons/hbuttonbgb"),
+ backgroundhl("core/buttons/hbuttonbg")
{
surface = Sprite("core/buttons/fast_forward");
}
Modified: trunk/pingus/src/components/button_panel.cpp
===================================================================
--- trunk/pingus/src/components/button_panel.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/button_panel.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -28,14 +28,15 @@
using namespace Actions;
-ButtonPanel::ButtonPanel(GameSession* s, const Vector2i& pos)
- : RectComponent(Rect()),
- session(s),
- background("core/buttons/buttonbackground"),
- highlight("core/buttons/buttonbackgroundhl"),
- current_button(0),
- show_tip(false),
- tip_button(0)
+ButtonPanel::ButtonPanel(GameSession* s, const Vector2i& pos) :
+ RectComponent(Rect()),
+ session(s),
+ background("core/buttons/buttonbackground"),
+ highlight("core/buttons/buttonbackgroundhl"),
+ buttons(),
+ current_button(0),
+ show_tip(false),
+ tip_button(0)
{
ActionHolder* aholder = session->get_server()->get_action_holder();
@@ -48,14 +49,14 @@
std::sort(actions.begin(), actions.end());
for(std::vector<ActionName>::size_type i = 0; i < actions.size(); ++i)
- {
- ActionButton button;
- button.name = actions[i];
- button.sprite = Sprite("pingus/player0/" + action_to_string(button.name)
+ "/right");
- button.sprite.set_hotspot(origin_center, 0, 0);
- button.sprite.set_play_loop(true);
- buttons.push_back(button);
- }
+ {
+ ActionButton button;
+ button.name = actions[i];
+ button.sprite = Sprite("pingus/player0/" + action_to_string(button.name) +
"/right");
+ button.sprite.set_hotspot(origin_center, 0, 0);
+ button.sprite.set_play_loop(true);
+ buttons.push_back(button);
+ }
}
ButtonPanel::~ButtonPanel()
Modified: trunk/pingus/src/components/button_panel.hpp
===================================================================
--- trunk/pingus/src/components/button_panel.hpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/button_panel.hpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -27,9 +27,15 @@
class ButtonPanel : public GUI::RectComponent
{
private:
- struct ActionButton {
+ struct ActionButton
+ {
Actions::ActionName name;
Sprite sprite;
+
+ ActionButton() :
+ name(),
+ sprite()
+ {}
};
GameSession* session;
Modified: trunk/pingus/src/components/check_box.cpp
===================================================================
--- trunk/pingus/src/components/check_box.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/components/check_box.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -21,7 +21,8 @@
CheckBox::CheckBox(const Rect& rect_) :
RectComponent(rect_),
- state(false)
+ state(false),
+ on_change()
{
}
Modified: trunk/pingus/src/components/menu_button.cpp
===================================================================
--- trunk/pingus/src/components/menu_button.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/components/menu_button.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -26,8 +26,18 @@
MenuButton::MenuButton(PingusMenu* menu_,
const Vector2i& pos_,
- const std::string& text_, const std::string& desc_)
- : menu(menu_)
+ const std::string& text_, const std::string& desc_) :
+ menu(menu_),
+ surface_p(),
+ highlight(),
+ font(),
+ font_large(),
+ x_pos(),
+ y_pos(),
+ desc(),
+ text(),
+ mouse_over(),
+ pressed()
{
surface_p = Sprite("core/menu/menuitem");
highlight = Sprite("core/menu/menuitem_highlight");
Modified: trunk/pingus/src/components/pingus_counter.cpp
===================================================================
--- trunk/pingus/src/components/pingus_counter.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/pingus_counter.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -25,9 +25,10 @@
#include "pingus/server.hpp"
#include "pingus/world.hpp"
-PingusCounter::PingusCounter(Server* s)
- : server(s),
- background("core/buttons/info")
+PingusCounter::PingusCounter(Server* s) :
+ server(s),
+ font(),
+ background("core/buttons/info")
{
font = Fonts::pingus_small_fixnum;
}
Modified: trunk/pingus/src/components/pingus_counter.hpp
===================================================================
--- trunk/pingus/src/components/pingus_counter.hpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/pingus_counter.hpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -31,6 +31,7 @@
Server* server;
Font font;
Sprite background;
+
public:
PingusCounter(Server* s);
virtual ~PingusCounter() {}
Modified: trunk/pingus/src/components/playfield.cpp
===================================================================
--- trunk/pingus/src/components/playfield.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/components/playfield.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -27,14 +27,20 @@
#include "pingus/game_session.hpp"
#include "components/playfield.hpp"
-Playfield::Playfield(Server* server_, GameSession* session_, const Rect& rect_)
- : RectComponent(rect_),
- server(server_),
- session(session_),
- current_pingu(0),
- scene_context(new SceneContext(rect_)),
- state(rect_.get_width(), rect_.get_height()),
- capture_rectangle(session)
+Playfield::Playfield(Server* server_, GameSession* session_, const Rect&
rect_) :
+ RectComponent(rect_),
+ server(server_),
+ session(session_),
+ current_pingu(0),
+ mouse_scrolling(),
+ scroll_speed(),
+ scroll_center(),
+ scene_context(new SceneContext(rect_)),
+ state(rect_.get_width(), rect_.get_height()),
+ capture_rectangle(session),
+ clipping_rectangles(),
+ mouse_pos(),
+ old_state_pos()
{
mouse_scrolling = false;
Modified: trunk/pingus/src/components/slider_box.cpp
===================================================================
--- trunk/pingus/src/components/slider_box.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/components/slider_box.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -23,7 +23,8 @@
SliderBox::SliderBox(const Rect& rect_)
: RectComponent(rect_),
value(10),
- drag_drop(false)
+ drag_drop(false),
+ on_change()
{
}
Modified: trunk/pingus/src/components/smallmap.cpp
===================================================================
--- trunk/pingus/src/components/smallmap.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/components/smallmap.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -29,11 +29,16 @@
#include "components/playfield.hpp"
#include "components/smallmap.hpp"
-SmallMap::SmallMap(Server* server_, Playfield* playfield_, const Rect& rect_)
- : RectComponent(rect_),
- server(server_),
- playfield(playfield_),
- gc_ptr(0)
+SmallMap::SmallMap(Server* server_, Playfield* playfield_, const Rect& rect_) :
+ RectComponent(rect_),
+ server(server_),
+ playfield(playfield_),
+ exit_sur(),
+ entrance_sur(),
+ image(),
+ scroll_mode(),
+ has_focus(),
+ gc_ptr(0)
{
image = std::auto_ptr<SmallMapImage>(new SmallMapImage(server,
rect.get_width(), rect.get_height()));
Modified: trunk/pingus/src/components/time_display.cpp
===================================================================
--- trunk/pingus/src/components/time_display.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/components/time_display.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -29,9 +29,10 @@
#include "components/time_display.hpp"
-TimeDisplay::TimeDisplay (GameSession* c)
- : server(c->get_server()),
- infinity_symbol("core/misc/infinity")
+TimeDisplay::TimeDisplay (GameSession* c) :
+ server(c->get_server()),
+ font(),
+ infinity_symbol("core/misc/infinity")
{
font = Fonts::pingus_small_fixnum;
}
Modified: trunk/pingus/src/display/delta_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/delta_framebuffer.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/display/delta_framebuffer.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -244,7 +244,9 @@
MemoryPool<DrawOp> mempool;
public:
- DrawOpBuffer()
+ DrawOpBuffer() :
+ draw_ops(),
+ mempool()
{
}
Modified: trunk/pingus/src/display/drawing_context.cpp
===================================================================
--- trunk/pingus/src/display/drawing_context.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/display/drawing_context.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -170,9 +170,11 @@
}
};
-DrawingContext::DrawingContext(const Rect& rect_, bool clip)
- : rect(rect_),
- do_clipping(clip)
+DrawingContext::DrawingContext(const Rect& rect_, bool clip) :
+ drawingrequests(),
+ translate_stack(),
+ rect(rect_),
+ do_clipping(clip)
{
translate_stack.push_back(Vector2i(0, 0));
}
Modified: trunk/pingus/src/display/rect_merger.cpp
===================================================================
--- trunk/pingus/src/display/rect_merger.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/display/rect_merger.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -30,10 +30,17 @@
};
// [top, bottom[
-struct Row {
+struct Row
+{
int top;
int bottom;
std::vector<Mark> marks;
+
+ Row() :
+ top(),
+ bottom(),
+ marks()
+ {}
};
bool rect_y_sorter(const Rect& lhs, const Rect& rhs)
Modified: trunk/pingus/src/display/scene_context.cpp
===================================================================
--- trunk/pingus/src/display/scene_context.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/display/scene_context.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -29,28 +29,32 @@
Rect cliprect;
bool use_cliprect;
- SceneContextImpl()
- : use_cliprect(false)
+ SceneContextImpl() :
+ color(),
+ light(),
+ highlight(),
+ cliprect(),
+ use_cliprect(false)
{
}
- SceneContextImpl(const Rect& rect)
- : color(rect),
- light(rect),
- highlight(rect),
- use_cliprect(false)
+ SceneContextImpl(const Rect& rect) :
+ color(rect),
+ light(rect),
+ highlight(rect),
+ use_cliprect(false)
{
}
};
-SceneContext::SceneContext()
+SceneContext::SceneContext() :
+ impl(new SceneContextImpl())
{
- impl = new SceneContextImpl();
}
-SceneContext::SceneContext(const Rect& rect)
+SceneContext::SceneContext(const Rect& rect) :
+ impl(new SceneContextImpl(rect))
{
- impl = new SceneContextImpl(rect);
}
SceneContext::~SceneContext()
Modified: trunk/pingus/src/display/sdl_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/display/sdl_framebuffer.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -138,8 +138,9 @@
} // namespace
-SDLFramebuffer::SDLFramebuffer()
- : screen(0)
+SDLFramebuffer::SDLFramebuffer() :
+ screen(0),
+ cliprect_stack()
{
}
Modified: trunk/pingus/src/editor/button.cpp
===================================================================
--- trunk/pingus/src/editor/button.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/editor/button.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -20,12 +20,13 @@
namespace Editor {
-Button::Button(const Rect& rect_, const std::string& text_)
- : RectComponent(rect_),
- text(text_),
- mouse_over(false),
- mouse_down(false),
- enabled(true)
+Button::Button(const Rect& rect_, const std::string& text_) :
+ RectComponent(rect_),
+ text(text_),
+ mouse_over(false),
+ mouse_down(false),
+ enabled(true),
+ on_click()
{
}
@@ -33,14 +34,14 @@
Button::draw (DrawingContext& gc)
{
if (enabled)
- {
- if (mouse_down && mouse_over)
- GUIStyle::draw_lowered_box(gc, rect, Color(237, 233, 227), 2);
- else if (mouse_over)
- GUIStyle::draw_raised_box(gc, rect, Color(255, 255, 255), 2);
- else
- GUIStyle::draw_raised_box(gc, rect, Color(237, 233, 227), 2);
- }
+ {
+ if (mouse_down && mouse_over)
+ GUIStyle::draw_lowered_box(gc, rect, Color(237, 233, 227), 2);
+ else if (mouse_over)
+ GUIStyle::draw_raised_box(gc, rect, Color(255, 255, 255), 2);
+ else
+ GUIStyle::draw_raised_box(gc, rect, Color(237, 233, 227), 2);
+ }
gc.print_center(Fonts::verdana11,
Vector2i(rect.left + rect.get_width()/2, rect.top +
rect.get_height()/2 - 6),
Modified: trunk/pingus/src/editor/combobox.cpp
===================================================================
--- trunk/pingus/src/editor/combobox.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/editor/combobox.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -26,11 +26,15 @@
namespace Editor {
-Combobox::Combobox(const Rect& rect_)
- : RectComponent(rect_),
- sprite("core/editor/combobox"),
- current_item(-1),
- drop_down(false)
+Combobox::Combobox(const Rect& rect_) :
+ RectComponent(rect_),
+ sprite("core/editor/combobox"),
+ list_rect(),
+ item_list(),
+ current_item(-1),
+ hover_item(),
+ drop_down(false),
+ list_offset()
{
}
@@ -69,29 +73,29 @@
Combobox::on_primary_button_press(int x, int y)
{
if (drop_down)
+ {
+ // Determine which item was selected, if any, and set the current item to
it.
+ drop_down = false;
+ ungrab();
+
+ if (hover_item != -1)
{
- // Determine which item was selected, if any, and set the current item
to it.
- drop_down = false;
- ungrab();
-
- if (hover_item != -1)
- {
- current_item = hover_item;
- on_select(item_list[current_item]);
- }
+ current_item = hover_item;
+ on_select(item_list[current_item]);
}
+ }
else
- {
- drop_down = true;
- grab();
+ {
+ drop_down = true;
+ grab();
- list_rect = Rect(Vector2i(rect.left,
- rect.top + get_box_offset()),
- Size(rect.get_width(),
- rect.get_height() * item_list.size()));
+ list_rect = Rect(Vector2i(rect.left,
+ rect.top + get_box_offset()),
+ Size(rect.get_width(),
+ rect.get_height() * item_list.size()));
- on_pointer_move(x,y);
- }
+ on_pointer_move(x,y);
+ }
}
void
@@ -103,33 +107,33 @@
gc.draw_rect(rect, Color(0,0,0));
if (current_item != -1)
- {
- gc.print_left(Fonts::verdana11,
- Vector2i(rect.left + 5,
- rect.top + rect.get_height()/2 -
Fonts::verdana11.get_height()/2),
- item_list[current_item].label);
- }
+ {
+ gc.print_left(Fonts::verdana11,
+ Vector2i(rect.left + 5,
+ rect.top + rect.get_height()/2 -
Fonts::verdana11.get_height()/2),
+ item_list[current_item].label);
+ }
}
if (drop_down && !item_list.empty())
+ {
+ gc.draw_fillrect(list_rect, Color(255,255,255), 90);
+
+ for (int i = 0; i < int(item_list.size()); ++i)
{
- gc.draw_fillrect(list_rect, Color(255,255,255), 90);
+ if (i == hover_item)
+ gc.draw_fillrect(Rect(Vector2i(rect.left, list_rect.top +
rect.get_height()*i),
+ Size(rect.get_width(), rect.get_height())),
+ Color(150,200,255), 95);
- for (int i = 0; i < int(item_list.size()); ++i)
- {
- if (i == hover_item)
- gc.draw_fillrect(Rect(Vector2i(rect.left, list_rect.top +
rect.get_height()*i),
- Size(rect.get_width(), rect.get_height())),
- Color(150,200,255), 95);
+ gc.print_left(Fonts::verdana11,
+ Vector2i(list_rect.left + 5,
+ list_rect.top + i * rect.get_height() +
rect.get_height()/2 - Fonts::verdana11.get_height()/2),
+ item_list[i].label, 100);
+ }
- gc.print_left(Fonts::verdana11,
- Vector2i(list_rect.left + 5,
- list_rect.top + i * rect.get_height() +
rect.get_height()/2 - Fonts::verdana11.get_height()/2),
- item_list[i].label, 100);
- }
-
- gc.draw_rect(list_rect, Color(0,0,0), 100);
- }
+ gc.draw_rect(list_rect, Color(0,0,0), 100);
+ }
}
int
@@ -147,10 +151,10 @@
{
for(int i = 0; i < int(item_list.size()); ++i)
if (item_list[i].id == id)
- {
- current_item = i;
- return true;
- }
+ {
+ current_item = i;
+ return true;
+ }
return false;
}
@@ -158,17 +162,17 @@
Combobox::on_pointer_move(int x, int y)
{
if (drop_down)
+ {
+ if (list_rect.contains(Vector2i(x,y)))
{
- if (list_rect.contains(Vector2i(x,y)))
- {
- hover_item = (y - list_rect.top) / rect.get_height();
- hover_item = Math::clamp(0, hover_item, int(item_list.size()-1));
- }
- else
- {
- hover_item = -1;
- }
+ hover_item = (y - list_rect.top) / rect.get_height();
+ hover_item = Math::clamp(0, hover_item, int(item_list.size()-1));
}
+ else
+ {
+ hover_item = -1;
+ }
+ }
}
} // namespace Editor
Modified: trunk/pingus/src/editor/file_list.cpp
===================================================================
--- trunk/pingus/src/editor/file_list.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/editor/file_list.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -24,12 +24,17 @@
namespace Editor {
-FileList::FileList(const Rect& rect_)
- : RectComponent(rect_),
- current_item(-1),
- click_item(-1),
- page(0),
- num_pages(0)
+FileList::FileList(const Rect& rect_) :
+ RectComponent(rect_),
+ hspace(),
+ vspace(),
+ file_icon(),
+ directory_icon(),
+ directory(),
+ current_item(-1),
+ click_item(-1),
+ page(0),
+ num_pages(0)
{
update_layout();
}
@@ -54,16 +59,16 @@
const System::DirectoryEntry& rhs)
{
if (lhs.type == rhs.type)
- {
- return lhs.name < rhs.name;
- }
+ {
+ return lhs.name < rhs.name;
+ }
else
- {
- if (lhs.type == System::DE_DIRECTORY)
- return true;
- else
- return false;
- }
+ {
+ if (lhs.type == System::DE_DIRECTORY)
+ return true;
+ else
+ return false;
+ }
}
};
@@ -93,31 +98,31 @@
int y = rect.top;
for(System::Directory::iterator i = directory.begin() + page *
items_per_page();
i != directory.begin() + end; ++i)
+ {
+ if (i->type == System::DE_DIRECTORY)
+ gc.draw(directory_icon, Vector2i(x, y));
+ else if (i->type == System::DE_FILE)
+ gc.draw(file_icon, Vector2i(x, y));
+
+ if ((click_item == -1 && (i - directory.begin()) == current_item) ||
+ (i - directory.begin()) == click_item)
{
- if (i->type == System::DE_DIRECTORY)
- gc.draw(directory_icon, Vector2i(x, y));
- else if (i->type == System::DE_FILE)
- gc.draw(file_icon, Vector2i(x, y));
-
- if ((click_item == -1 && (i - directory.begin()) == current_item) ||
- (i - directory.begin()) == click_item)
- {
- if (click_item == current_item)
- gc.draw_fillrect(Rect(x, y, x + hspace, y + vspace), Color(0, 0,
255));
- else
- gc.draw_rect(Rect(x, y, x + hspace, y + vspace), Color(0, 0, 255));
- }
+ if (click_item == current_item)
+ gc.draw_fillrect(Rect(x, y, x + hspace, y + vspace), Color(0, 0, 255));
+ else
+ gc.draw_rect(Rect(x, y, x + hspace, y + vspace), Color(0, 0, 255));
+ }
- gc.print_left(Fonts::verdana11, Vector2i(x + 4, y + 3),
- ((i->type == System::DE_DIRECTORY) ? "[DIR] " : "[FILE]
") + i->name);
+ gc.print_left(Fonts::verdana11, Vector2i(x + 4, y + 3),
+ ((i->type == System::DE_DIRECTORY) ? "[DIR] " : "[FILE] ")
+ i->name);
- y += 20;
- if (y > rect.bottom - vspace)
- {
- y = rect.top;
- x += hspace;
- }
+ y += 20;
+ if (y > rect.bottom - vspace)
+ {
+ y = rect.top;
+ x += hspace;
}
+ }
}
void
@@ -132,10 +137,10 @@
{
on_pointer_move(x,y);
if (click_item == current_item && current_item != -1)
- {
- //std::cout << directory[current_item].name << std::endl;
- on_click(directory[current_item]);
- }
+ {
+ //std::cout << directory[current_item].name << std::endl;
+ on_click(directory[current_item]);
+ }
click_item = -1;
}
Modified: trunk/pingus/src/editor/inputbox.cpp
===================================================================
--- trunk/pingus/src/editor/inputbox.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/editor/inputbox.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -22,8 +22,9 @@
namespace Editor {
-Inputbox::Inputbox(const Rect& rect_)
- : RectComponent(rect_)
+Inputbox::Inputbox(const Rect& rect_) :
+ RectComponent(rect_),
+ text()
{
}
Modified: trunk/pingus/src/editor/level_impl.hpp
===================================================================
--- trunk/pingus/src/editor/level_impl.hpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/editor/level_impl.hpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -44,7 +44,8 @@
difficulty(),
author(),
comment(),
- music("none")
+ music("none"),
+ objects()
{
// Do nothing
}
Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/editor/panel.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -138,6 +138,10 @@
int get_width() const {
return 34;
}
+
+private:
+ PanelButton(const PanelButton&);
+ PanelButton & operator=(const PanelButton&);
};
Panel::Panel(EditorScreen* editor_)
Modified: trunk/pingus/src/pingus/story_screen.cpp
===================================================================
--- trunk/pingus/src/pingus/story_screen.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/pingus/story_screen.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -137,10 +137,11 @@
StoryScreenSkipButton & operator=(const StoryScreenSkipButton&);
};
-StoryScreen::StoryScreen(FileReader reader)
- : story(new WorldmapNS::WorldmapStory(reader)),
- continue_button(0),
- skip_button(0)
+StoryScreen::StoryScreen(FileReader reader) :
+ story(new WorldmapNS::WorldmapStory(reader)),
+ story_comp(),
+ continue_button(0),
+ skip_button(0)
{
story_comp = new StoryScreenComponent(story.get());
gui_manager->add(story_comp);
@@ -157,8 +158,16 @@
{
}
-StoryScreenComponent::StoryScreenComponent (WorldmapNS::WorldmapStory
*arg_story)
- : story(arg_story)
+StoryScreenComponent::StoryScreenComponent (WorldmapNS::WorldmapStory
*arg_story) :
+ background(),
+ blackboard(),
+ display_text(),
+ time_passed(),
+ page_displayed_completly(),
+ story(arg_story),
+ pages(),
+ page_surface(),
+ current_page()
{
page_displayed_completly = false;
time_passed = 0;
Modified: trunk/pingus/src/pingus/surface.cpp
===================================================================
--- trunk/pingus/src/pingus/surface.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/pingus/surface.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -47,16 +47,18 @@
SurfaceImpl & operator=(const SurfaceImpl&);
};
-Surface::Surface()
+Surface::Surface() :
+ impl()
{
}
-Surface::Surface(boost::shared_ptr<SurfaceImpl> impl_)
- : impl(impl_)
+Surface::Surface(boost::shared_ptr<SurfaceImpl> impl_) :
+ impl(impl_)
{
}
-Surface::Surface(const Pathname& pathname)
+Surface::Surface(const Pathname& pathname) :
+ impl()
{
SDL_Surface* surface = IMG_Load(pathname.get_sys_path().c_str());
if (surface)
Modified: trunk/pingus/src/pingus/worldobj.cpp
===================================================================
--- trunk/pingus/src/pingus/worldobj.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/pingus/worldobj.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -28,12 +28,14 @@
world = arg_world;
}
-WorldObj::WorldObj(const FileReader& reader)
+WorldObj::WorldObj(const FileReader& reader) :
+ id()
{
reader.read_string("id", id);
}
-WorldObj::WorldObj()
+WorldObj::WorldObj() :
+ id()
{
// z_pos = 0;
}
Modified: trunk/pingus/src/pingus/worldobj_factory.cpp
===================================================================
--- trunk/pingus/src/pingus/worldobj_factory.cpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/pingus/worldobj_factory.cpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -81,13 +81,14 @@
WorldObjFactoryImpl& operator= (const WorldObjFactoryImpl&);
};
-WorldObjFactory::WorldObjFactory ()
+WorldObjFactory::WorldObjFactory() :
+ factories()
{
// Register all WorldObj's
}
WorldObjFactory*
-WorldObjFactory::instance ()
+WorldObjFactory::instance()
{
if ( ! instance_)
{
Modified: trunk/pingus/src/pingus/worldobj_factory.hpp
===================================================================
--- trunk/pingus/src/pingus/worldobj_factory.hpp 2009-11-04 18:34:19 UTC
(rev 4022)
+++ trunk/pingus/src/pingus/worldobj_factory.hpp 2009-11-04 19:29:46 UTC
(rev 4023)
@@ -36,6 +36,7 @@
WorldObjFactory ();
void free_factories();
+
public:
/** Return the singleton instance */
static WorldObjFactory* instance ();
Modified: trunk/pingus/src/worldmap/dot.cpp
===================================================================
--- trunk/pingus/src/worldmap/dot.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/worldmap/dot.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,8 +21,9 @@
namespace WorldmapNS {
-Dot::Dot(FileReader reader)
- : Drawable()
+Dot::Dot(FileReader reader) :
+ Drawable(),
+ pos()
{
reader.read_vector("position", pos);
reader.read_string("name", name);
Modified: trunk/pingus/src/worldmap/path.cpp
===================================================================
--- trunk/pingus/src/worldmap/path.cpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/worldmap/path.cpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -21,8 +21,10 @@
namespace WorldmapNS {
-Path::Path()
- : path_length_valid (false)
+Path::Path() :
+ vec(),
+ path_length_valid (false),
+ path_length()
{
}
Modified: trunk/pingus/src/worldmap/path.hpp
===================================================================
--- trunk/pingus/src/worldmap/path.hpp 2009-11-04 18:34:19 UTC (rev 4022)
+++ trunk/pingus/src/worldmap/path.hpp 2009-11-04 19:29:46 UTC (rev 4023)
@@ -34,6 +34,7 @@
bool path_length_valid;
float path_length;
+private:
float calc_length();
public:
typedef Vec::iterator iterator;
Modified: trunk/pingus/src/worldobjs/entrance.cpp
===================================================================
--- trunk/pingus/src/worldobjs/entrance.cpp 2009-11-04 18:34:19 UTC (rev
4022)
+++ trunk/pingus/src/worldobjs/entrance.cpp 2009-11-04 19:29:46 UTC (rev
4023)
@@ -28,6 +28,7 @@
Entrance::Entrance(const FileReader& reader) :
direction(MISC),
+ pos(),
release_rate(150),
owner_id(0),
type("generic"),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r4023 - in trunk/pingus/src: actions components display editor pingus worldmap worldobjs,
grumbel at BerliOS <=