-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaster_items.cpp
More file actions
31 lines (27 loc) · 870 Bytes
/
master_items.cpp
File metadata and controls
31 lines (27 loc) · 870 Bytes
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
#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <string>
#include <cctype>
#include <math.h>
#include <strings.h>
#include <time.h>
#include <fstream>
#include "master_items.h"
#include "inventory_item.h"
#include "xcom_file.h"
using namespace std;
MasterItems::MasterItems() {
file_name = "GEODATA\\OBDATA.DAT";
xcom_file = new XcomFile( file_name );
xcom_file->copy_data_out( file_data, file_size );
master_list = new InventoryItem*[NUMBER_OF_ITEMS_IN_OBDATA_FILE];
unsigned char temp_data[INVENTORY_ITEM_BYTES];
for( unsigned char i = 0; i < NUMBER_OF_ITEMS_IN_OBDATA_FILE; i++ ) {
memcpy( temp_data, &file_data[i*INVENTORY_ITEM_BYTES], INVENTORY_ITEM_BYTES );
master_list[i] = new InventoryItem ( temp_data, i );
}
}
InventoryItem * MasterItems::get_item( unsigned char id_to_get ) {
return master_list[id_to_get];
}