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
45
openkknd2-am-coder/src/ok_buildings.c
Normal file
45
openkknd2-am-coder/src/ok_buildings.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "ok_buildings.h"
|
||||
#include "ok_map.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void ok_buildings_init(OkWorld *w) {
|
||||
// Initialize buildings array - for now we'll use a simple approach
|
||||
// In a more complete implementation, we'd have an actual building array
|
||||
}
|
||||
|
||||
void ok_buildings_place(OkWorld *w, int x, int y, OkBuildingKind kind, OkFaction faction) {
|
||||
// Check if placement is valid (walkable tile and not occupied)
|
||||
if (!ok_map_walkable(w, x, y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For now, we'll just update the resource count when a building is placed
|
||||
int cost = 0;
|
||||
switch (kind) {
|
||||
case OK_BUILDING_HQ:
|
||||
cost = 50;
|
||||
break;
|
||||
case OK_BUILDING_BARRACKS:
|
||||
cost = 30;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if faction has enough resources
|
||||
int *resources = (faction == OK_FACTION_A) ? &w->resources_a : &w->resources_b;
|
||||
if (*resources < cost) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Deduct cost and mark building as placed
|
||||
*resources -= cost;
|
||||
|
||||
printf("Faction %d placed %s at (%d,%d)\n", faction,
|
||||
(kind == OK_BUILDING_HQ) ? "HQ" : "Barracks", x, y);
|
||||
}
|
||||
|
||||
void ok_buildings_update(OkWorld *w) {
|
||||
// Simple building update logic - in a real implementation this would handle
|
||||
// building construction, production, etc.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue