void TattooEngine::initialize() { initGraphics(640, 480); // Initialize the base engine SherlockEngine::initialize(); // Initialise the global flags _flags.resize(3200); _flags[1] = _flags[4] = _flags[76] = true; _runningProlog = true; // Add some more files to the cache _res->addToCache("walk.lib"); // Set up list of people TattooFixedText &fixedText = *(TattooFixedText *)_fixedText; const char *peopleNamePtr = nullptr; for (int idx = 0; idx < TATTOO_MAX_PEOPLE; ++idx) { peopleNamePtr = fixedText.getText(PEOPLE_DATA[idx].fixedTextId); _people->_characters.push_back(PersonData( peopleNamePtr, PEOPLE_DATA[idx].portrait, nullptr, nullptr)); } // Load the inventory loadInventory(); // Starting scene _scene->_goToScene = STARTING_INTRO_SCENE; // Load an initial palette loadInitialPalette(); }
void TattooEngine::initialize() { initGraphics(640, 480, true); // Initialize the base engine SherlockEngine::initialize(); // Initialise the global flags _flags.resize(3200); _flags[1] = _flags[4] = _flags[76] = true; _runningProlog = true; // Add some more files to the cache _res->addToCache("walk.lib"); // Set up list of people for (int idx = 0; idx < TATTOO_MAX_PEOPLE; ++idx) { _people->_characters.push_back(PersonData( getLanguage() == Common::FR_FRA ? FRENCH_NAMES[idx] : ENGLISH_NAMES[idx], PORTRAITS[idx], nullptr, nullptr)); } // Load the inventory loadInventory(); // Starting scene _scene->_goToScene = STARTING_INTRO_SCENE; // Load an initial palette loadInitialPalette(); }
int main() { printf("- Inventory Program -\n"); printf("What do you want to do?\n"); printf("1. Add a record to the file.\n"); printf("2. Display all records in the file.\n"); printf("3. Modify a record.\n"); char menuOption[2]; scanf("%s", menuOption); if (menuOption[0] == '1') { inventorydata i; printf("Enter an item description: "); scanf("%s", i.description); printf("Enter the quantity on hand: "); scanf("%d", &i.quantity); printf("Enter the wholesale cost: "); scanf("%f", &i.wholesaleCost); printf("Enter the retail cost: "); scanf("%f", &i.retailCost); printf("Enter the date it was added to the inventory (DD/MM/YYYY): "); scanf("%s", i.dateAdded); FILE *f = fopen("inventory.txt", "a+"); char *encoded = i.encode(); fwrite(encoded, strlen(encoded), 1, f); fwrite("\n", 1, 1, f); fclose(f); } else if (menuOption[0] == '2') { loadInventory(); for (unsigned int i = 0; i < numItems; i++) { printf("%d. %32s\t\t%d in stock\n", i+1, items[i]->description, items[i]->quantity); } } else if (menuOption[0] == '3') { loadInventory(); printf("Enter the index of the record you want to modify: "); int idx = 0; scanf("%d", &idx); idx--; printf("-- RECORD INFO --\n"); printf("Index: %d\n", idx+1); printf("(1) Description: %s\n", items[idx]->description); printf("(2) Quantity: %d\n", items[idx]->quantity); printf("(3) Wholesale Cost: %.2f\n", items[idx]->wholesaleCost); printf("(4) Retail Cost: %.2f\n", items[idx]->retailCost); printf("(5) Date Added: %s\n", items[idx]->dateAdded); printf("Enter the appropriate number pertaining to the record attribute you want to modify: "); int option = 0; scanf("%d", &option); if (option == 1) { printf("Enter a new description: "); scanf("%s", items[idx]->description); } else if (option == 2) { printf("Enter a new quantity: "); scanf("%d", &items[idx]->quantity); } else if (option == 3) { printf("Enter a new wholesale cost: "); scanf("%f", &items[idx]->wholesaleCost); } else if (option == 4) { printf("Enter a new retail cost: "); scanf("%f", &items[idx]->retailCost); } else if (option == 5) { printf("Enter a new date added: "); scanf("%s", items[idx]->dateAdded); } saveInventory(); printf("Changes saved.\n"); } system("pause"); }