summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-03 17:26:06 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-03 17:26:06 (GMT)
commit0e5c3da0f5d932c9b1652b6c55476f467b15a2ce (patch)
tree808187e476ee529cda128c4ebdd50c7b2d797df6 /src
parent9260b2c3e8740afae051761067f9afe05c6cdb04 (diff)
downloadpowder-0e5c3da0f5d932c9b1652b6c55476f467b15a2ce.zip
powder-0e5c3da0f5d932c9b1652b6c55476f467b15a2ce.tar.gz
Use plop tool to place single units of an element (Used for Stickman, Fighter), fixes issue 53
Diffstat (limited to 'src')
-rw-r--r--src/game/GameModel.cpp4
-rw-r--r--src/game/Tool.cpp5
-rw-r--r--src/game/Tool.h15
3 files changed, 24 insertions, 0 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 28ed550..7566044 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -169,6 +169,10 @@ void GameModel::BuildMenus()
{
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
}
+ else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
+ {
+ tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
+ }
else
{
tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp
index 3525876..43c2800 100644
--- a/src/game/Tool.cpp
+++ b/src/game/Tool.cpp
@@ -151,4 +151,9 @@ void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position
sim->parts[p].life = 55;
sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting
}
+}
+
+void PlopTool::Click(Simulation * sim, Brush * brush, ui::Point position)
+{
+ sim->create_part(-1, position.X, position.Y, toolID);
} \ No newline at end of file
diff --git a/src/game/Tool.h b/src/game/Tool.h
index f10d5f7..1b70768 100644
--- a/src/game/Tool.h
+++ b/src/game/Tool.h
@@ -96,6 +96,21 @@ public:
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
+class PlopTool: public ElementTool
+{
+public:
+ PlopTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL):
+ ElementTool(id, name, description, r, g, b)
+ {
+ }
+ virtual ~PlopTool() {}
+ virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {}
+ virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
+ virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
+ virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
+ virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
+};
+
class WallTool: public Tool
{
public: