55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "unit_card.h"
|
|
|
|
int main() {
|
|
printf("=== openkknd - Demo Game ===\n");
|
|
printf("KKND-style RTS Game Engine\n");
|
|
printf("Version 1.0.0\n");
|
|
printf("\n");
|
|
|
|
// Create unit registry
|
|
UnitRegistry* registry = create_registry();
|
|
|
|
// Test unit creation
|
|
UnitCard* marine = create_unit_card(
|
|
"Terran Marine", "Allied", 100, 100, 15,
|
|
12, 4, 6, "Standard Terran infantry",
|
|
"assets/units/marine.png", UNIT_INFANTRY
|
|
);
|
|
|
|
if (marine) {
|
|
printf("✓ Created unit: %s (%s)\n", marine->name, marine->faction);
|
|
printf(" Cost: %d, HP: %d, Attack: %d, Defense: %d, Speed: %d, Range: %d\n",
|
|
marine->cost, marine->hp, marine->attack, marine->defense,
|
|
marine->speed, marine->range);
|
|
}
|
|
|
|
// Test unit addition
|
|
if (add_unit(registry, marine) == 0) {
|
|
printf("✓ Unit added to registry\n");
|
|
|
|
// Print registry statistics
|
|
print_performance_stats(registry);
|
|
|
|
// Test unit lookup
|
|
UnitCard* found = get_unit_by_name(registry, "Terran Marine");
|
|
if (found) {
|
|
printf("✓ Unit lookup successful: %s\n", found->name);
|
|
}
|
|
|
|
// Clean up
|
|
destroy_registry(registry);
|
|
free_unit_card(marine);
|
|
|
|
printf("\n✓ Demo game completed successfully!\n");
|
|
return 0;
|
|
}
|
|
|
|
printf("\n✗ Demo game failed\n");
|
|
destroy_registry(registry);
|
|
if (marine) free_unit_card(marine);
|
|
|
|
return 1;
|
|
}
|