From 7a8b2b11e989e474dceb30330852174d877b1601 Mon Sep 17 00:00:00 2001 From: Aaron Marks Date: Sun, 29 May 2005 12:06:58 +0000 Subject: Added getAccount & getCharacter to storage class. Cleaned up storage code. Added test in main.cpp. --- src/main.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 13d310b..b67fa4d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -198,6 +198,28 @@ int main(int argc, char *argv[]) std::cout << "Number of accounts on server: " << store.accountCount() << std::endl; + // Test the database retrieval code + std::cout << "Attempting to retrieve account with username 'nym'" << std::endl; + Account* acc = store.getAccount("nym"); + if (acc) + { + std::cout << "Account name: " << acc->getName() << std::endl + << "Account email: " << acc->getEmail() << std::endl; + + std::cout << "Attempting to get character of 'nym'" << std::endl; + Being* character = store.getCharacter("nym"); + if (character) + { + std::cout << "Character name: " << character->getName() << std::endl; + } else + { + std::cout << "No characters found" << std::endl; + } + } else + { + std::cout << "Account 'nym' not found" << std::endl; + } + SDL_Event event; while (running) @@ -211,7 +233,7 @@ int main(int argc, char *argv[]) // Print world time at 10 second intervals to show we're alive if (worldTime % 100 == 0) { - printf("World time: %d\n", worldTime); + //printf("World time: %d\n", worldTime); logger->log("World time: %d", worldTime); } -- cgit