kitchen: README + MISSIONS/engine-c keep-drop notes
This commit is contained in:
parent
1d351918da
commit
575d7d29b8
130 changed files with 9817 additions and 1 deletions
55
engine-c/src/demo_unitcard.c
Normal file
55
engine-c/src/demo_unitcard.c
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue