~thindil/steamfort/development

« back to all changes in this revision

Viewing changes to src/designation.cpp

  • Committer: thindil
  • Date: 2011-08-06 11:51:31 UTC
  • Revision ID: thindil@tuxfamily.org-20110806115131-ybbbyk1yr8fszvhe
finished work on walls

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
              TCODLine::init(started[0], started[1], mouse->cx, mouse->cy);
180
180
              drawx = started[0];
181
181
              drawy = started[1];
 
182
              bool wall = false;
 
183
              int bindex = find_proto_build("", STOCKADE);
 
184
              if (designtype == 4)
 
185
                {
 
186
                  bindex = find_proto_build("", WALL);
 
187
                }
 
188
              Building build = protobuilds[bindex];
 
189
              build.underconstruction = 'Y';
182
190
              do
183
191
                {
184
192
                  if (fortmap[drawy + screeny][drawx + screenx].walkable)
185
193
                    {
 
194
                      wall = true;
 
195
                      build.x = drawx + screenx;
 
196
                      build.y = drawy + screeny;
 
197
                      fortbuilds.push_back(build);
186
198
                      fovmap->setProperties(drawx + screenx, drawy + screeny, true, false);
187
199
                      fortmap[drawy + screeny][drawx + screenx].walkable = false;
188
200
                      fortmap[drawy + screeny][drawx + screenx].color = TCODColor::black;
189
201
                      fortmap[drawy + screeny][drawx + screenx].ch = 'X';
 
202
                      fortmap[drawy + screeny][drawx + screenx].building = fortbuilds.size() - 1;
190
203
                      //Remove all items
191
204
                      if (!fortmap[drawy + screeny][drawx + screenx].items.isEmpty())
192
205
                        {
203
216
                        }
204
217
                    }
205
218
                } while(!TCODLine::step(&drawx,&drawy));
 
219
              if (wall)
 
220
                {
 
221
                  index = find_order("Construct " + build.name);
 
222
                  if (index == NONE)
 
223
                    {
 
224
                      Order *order = new Order();
 
225
                      order->name = "Construct " + build.name;
 
226
                      order->stages[0][0] = ITEM;
 
227
                      order->stages[0][1] = build.material;
 
228
                      order->stages[0][2] = 1;
 
229
                      order->stages[0][6] = 0;
 
230
                      order->stages[0][7] = 1;
 
231
                      order->stages[1][0] = BUILDING;
 
232
                      order->stages[1][1] = build.type;
 
233
                      order->stages[1][2] = build.mamount;
 
234
                      order->stages[1][6] = 0;
 
235
                      order->stages[1][7] = 1;
 
236
                      order->stages[2][0] = BUILDING;
 
237
                      order->stages[2][1] = build.type;
 
238
                      order->stages[2][2] = build.buildtime;
 
239
                      order->stages[2][6] = 1;
 
240
                      order->stages[2][7] = 1;
 
241
                      order->stages[2][8] = 3;
 
242
                      order->infinite = true;
 
243
                      order->curamount = build.mamount;
 
244
                      order->type = OBUILD;
 
245
                      fortorders.push_back(*order);
 
246
                      delete order;
 
247
                    }
 
248
                  else
 
249
                    {
 
250
                      fortorders[index].enabled = true;
 
251
                    }
 
252
                }
206
253
            }
207
254
          if (designated[TREE].size() == 0)
208
255
            {