diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-09 20:05:20 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-09 20:05:20 (GMT) |
| commit | 9971ea63b7aca6f23dfdee9ceb5d7cb3dcd1fa58 (patch) | |
| tree | d68699db22c32bddcdb8421a822ee207f1578b4e | |
| parent | ac45502de917bae206ae511366926c235d7bff1d (diff) | |
| download | powder-9971ea63b7aca6f23dfdee9ceb5d7cb3dcd1fa58.zip powder-9971ea63b7aca6f23dfdee9ceb5d7cb3dcd1fa58.tar.gz | |
Slow LIGH creation speed, fixes #86
| -rw-r--r-- | src/game/Tool.cpp | 16 | ||||
| -rw-r--r-- | src/game/Tool.h | 4 | ||||
| -rw-r--r-- | src/simulation/Simulation.cpp | 1 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp index 10b7b0d..763fc82 100644 --- a/src/game/Tool.cpp +++ b/src/game/Tool.cpp @@ -166,13 +166,17 @@ void WindTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {} void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position) { - int p = sim->create_part(-2, position.X, position.Y, toolID); - if (p != -1) + if(sim->currentTick >= nextUse) { - sim->parts[p].life = brush->GetRadius().X+brush->GetRadius().Y; - if (sim->parts[p].life > 55) - sim->parts[p].life = 55; - sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting + int p = sim->create_part(-2, position.X, position.Y, toolID); + if (p != -1) + { + sim->parts[p].life = brush->GetRadius().X+brush->GetRadius().Y; + if (sim->parts[p].life > 55) + sim->parts[p].life = 55; + sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting + nextUse = sim->currentTick+sim->parts[p].life/4; + } } } diff --git a/src/game/Tool.h b/src/game/Tool.h index bee1fd8..f6327cf 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -73,9 +73,11 @@ public: class Element_LIGH_Tool: public Tool { + int nextUse; public: Element_LIGH_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL): - Tool(id, name, description, r, g, b) + Tool(id, name, description, r, g, b), + nextUse(0) { } virtual ~Element_LIGH_Tool() {} diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 64969e1..880d2b1 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -3093,7 +3093,6 @@ void Simulation::update_particles_i(int start, int inc) int excessive_stacking_found = 0; currentTick++; - currentTick %= 3600; if (lighting_recreate>0) { |
