-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoad.cpp
More file actions
41 lines (38 loc) · 1.18 KB
/
Copy pathLoad.cpp
File metadata and controls
41 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "Load.h"
#include "Grid.h"
#include"fstream"
#include "DEFS.h"
void Load::ReadActionParameters()
{
Grid* pGride = pManager->GetGrid();
Output* pOut = pGride->GetOutput();
Input* pIn = pGride->GetInput();
pOut->PrintMessage("Please Enter File Name: ");
filname = pIn->GetSrting(pOut) + ".txt";
pOut->ClearStatusBar();
}
void Load::Execute()
{
Grid* pGride = pManager->GetGrid();
Output* pOut = pGride->GetOutput();
pGride->removeGrid(); //to remove any changes done before loading the grid
ReadActionParameters();
ifstream infile(filname, ios::in); //Opens the file to read
if (!infile.is_open()) //to check if the file is opened or not
{
pGride->PrintErrorMessage("Error: Could not open file ");
return;
}
pGride->LoadAll(infile, filname, Flags);
pGride->LoadAll(infile, filname, WaterPits);
pGride->LoadAll(infile, filname, DangerZones);
pGride->LoadAll(infile, filname, Belts);
pGride->LoadAll(infile, filname, Workshops);
pGride->LoadAll(infile, filname, Antennas);
pGride->LoadAll(infile, filname, RotatingGears);
infile.close();
pGride->GetOutput()->PrintMessage("Grid Has Been Laded Successfully");
}
Load::~Load()
{
}