| 90 | } |
| 91 | |
| 92 | bool cResourceHistory::LoadFile(const cString& filename, const cString& working_dir) |
| 93 | { |
| 94 | cInitFile file(filename, working_dir); |
| 95 | |
| 96 | if (!file.WasOpened()) { |
| 97 | // tConstListIterator<cString> err_it(file.GetErrors()); |
| 98 | // const cString* errstr = NULL; |
| 99 | // while ((errstr = err_it.Next())) m_world->GetDriver().RaiseException(*errstr); |
| 100 | // m_world->GetDriver().RaiseFatalException(1, cString("Could not open instruction set '") + filename + "'."); |
| 101 | return false; |
| 102 | } |
| 103 | |
| 104 | m_entries.Resize(file.GetNumLines()); |
| 105 | for (int line = 0; line < file.GetNumLines(); line++) { |
| 106 | cStringList cur_line(file.GetLine(line)); |
| 107 | assert(cur_line.GetSize()); |
| 108 | |
| 109 | m_entries[line].update = cur_line.Pop().AsInt(); |
| 110 | |
| 111 | int num_values = cur_line.GetSize(); |
| 112 | m_entries[line].values.Resize(num_values); |
| 113 | for (int i = 0; i < num_values; i++) m_entries[line].values[i] = cur_line.Pop().AsDouble(); |
| 114 | } |
| 115 | |
| 116 | return true; |
| 117 | } |
| 118 | |