diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 12:21:04 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 12:21:04 (GMT) |
| commit | 16d3895e9c054e908ca8b230719f4294e824a4a2 (patch) | |
| tree | 8246b0ebc3b94ed05427b8ffa5ea1e1764c7a37a /src/game | |
| parent | 1c993435efc7fe6702d21c892e1d4dd8347d2e7f (diff) | |
| download | powder-16d3895e9c054e908ca8b230719f4294e824a4a2.zip powder-16d3895e9c054e908ca8b230719f4294e824a4a2.tar.gz | |
Redo Wall IDs
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameModel.cpp | 2 | ||||
| -rw-r--r-- | src/game/Tool.h | 40 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index c3477bc..453232f 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -88,7 +88,7 @@ GameModel::GameModel(): //Build other menus from wall data for(int i = 0; i < UI_WALLCOUNT; i++) { - Tool * tempTool = new ElementTool(i+UI_WALLSTART, "", PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); + Tool * tempTool = new WallTool(i, "", PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour)); menuList[SC_WALL]->AddTool(tempTool); //sim->wtypes[i] } diff --git a/src/game/Tool.h b/src/game/Tool.h index 00b1184..107c8cc 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -39,21 +39,43 @@ class ElementTool: public Tool { public: ElementTool(int id, string name, int r, int g, int b): - Tool(id, name, r, g, b) + Tool(id, name, r, g, b) { } virtual ~ElementTool() {} virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ - sim->create_parts(position.X, position.Y, 1, 1, toolID, 0, brush); + sim->CreateParts(position.X, position.Y, 1, 1, toolID, 0, brush); + } + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); + } + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); + } + virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { + sim->FloodParts(position.X, position.Y, toolID, -1, -1, 0); + } +}; + +class WallTool: public Tool +{ +public: + WallTool(int id, string name, int r, int g, int b): + Tool(id, name, r, g, b) + { + } + virtual ~WallTool() {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ + sim->CreateWalls(position.X, position.Y, 1, 1, toolID, 0, brush); } virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_line(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); + sim->CreateWallLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush); } virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_box(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); + sim->CreateWallBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0); } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { - sim->flood_parts(position.X, position.Y, toolID, -1, -1, 0); + sim->FloodWalls(position.X, position.Y, toolID, -1, -1, 0); } }; @@ -66,16 +88,16 @@ public: } virtual ~GolTool() {} virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ - sim->create_parts(position.X, position.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); + sim->CreateParts(position.X, position.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); } virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_line(position1.X, position1.Y, position2.X, position2.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); + sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush); } virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->create_box(position1.X, position1.Y, position2.X, position2.Y, PT_LIFE|(toolID<<8), 0); + sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, PT_LIFE|(toolID<<8), 0); } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { - sim->flood_parts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0); + sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0); } }; |
