Comically stupid but cute...
This commit is contained in:
parent
7783f04701
commit
dcf1480dc8
91
xerbia.c
91
xerbia.c
@ -1,68 +1,89 @@
|
|||||||
#include <xolatile/xtandard.c>
|
#include <xolatile/xtandard.c>
|
||||||
|
|
||||||
static int wheat = 0;
|
static int wheat = 600,
|
||||||
static int gold = 0;
|
gold = 600,
|
||||||
static int wood = 0;
|
wood = 600,
|
||||||
static int stone = 0;
|
stone = 600;
|
||||||
|
|
||||||
static int granaries = 1;
|
static int granaries = 1,
|
||||||
static int mines = 1;
|
mines = 1,
|
||||||
static int storehouses = 1;
|
storehouses = 1,
|
||||||
static int quarries = 1;
|
quarries = 1;
|
||||||
|
|
||||||
static char * king_list = "King Ognjen Milan Robovic";
|
static int check_resource (int have, int need, char * name) {
|
||||||
|
|
||||||
static void print_if_no_resources (int have, int need, char * name) {
|
|
||||||
if (have < need) {
|
if (have < need) {
|
||||||
print ("> You have only /3%i %s/- and you need /3%i/-, meaning that you miss /1%i/- more.\n", have, name, need, need - have);
|
print ("You have only /3%i %s/- and you need /3%i/-, meaning that you miss /1%i/- more.\n", have, name, need, need - have);
|
||||||
|
|
||||||
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_granary (void) {
|
static void build_granary (void) {
|
||||||
if ((gold < 10) || (wood < 60) || (stone < 30)) {
|
if (check_resource (gold, 10, "gold") || check_resource (wood, 60, "wood") || check_resource (stone, 30, "stone")) {
|
||||||
echo ("> Your architects humbly refused to build the granary, complaining about lacking the resources for that.\n");
|
print ("Your architects humbly refused to build the /1granary/-, complaining about lacking the resources for that.\n");
|
||||||
|
} else {
|
||||||
|
gold -= 10;
|
||||||
|
wood -= 60;
|
||||||
|
stone -= 30;
|
||||||
|
|
||||||
print_if_no_resources (gold, 10, "gold");
|
print ("/2Granary/- that you ordered to be built was finished without issues, now you have /2%i/- granaries.\n", ++granaries);
|
||||||
print_if_no_resources (wood, 60, "wood");
|
|
||||||
print_if_no_resources (stone, 30, "stone");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_mine (void) {
|
static void build_mine (void) {
|
||||||
if ((gold < 120) || (wood < 60) || (stone < 30)) {
|
if (check_resource (gold, 120, "gold") || check_resource (wood, 60, "wood") || check_resource (stone, 30, "stone")) {
|
||||||
echo ("> Your architects humbly refused to build the mine, complaining about lacking the resources for that.\n");
|
print ("Your architects humbly refused to build the /1mine/-, complaining about lacking the resources for that.\n");
|
||||||
|
} else {
|
||||||
|
gold -= 120;
|
||||||
|
wood -= 60;
|
||||||
|
stone -= 30;
|
||||||
|
|
||||||
print_if_no_resources (gold, 120, "gold");
|
print ("/2Mine/- that you ordered to be built was finished without issues, now you have /2%i/- mines.\n", ++mines);
|
||||||
print_if_no_resources (wood, 60, "wood");
|
|
||||||
print_if_no_resources (stone, 30, "stone");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_storehouse (void) {
|
static void build_storehouse (void) {
|
||||||
if ((gold < 30) || (wood < 10) || (stone < 60)) {
|
if (check_resource (gold, 30, "gold") || check_resource (wood, 10, "wood") || check_resource (stone, 60, "stone")) {
|
||||||
echo ("> Your architects humbly refused to build the storehouse, complaining about lacking the resources for that.\n");
|
print ("Your architects humbly refused to build the /1storehouse/-, complaining about lacking the resources for that.\n");
|
||||||
|
} else {
|
||||||
|
gold -= 30;
|
||||||
|
wood -= 10;
|
||||||
|
stone -= 60;
|
||||||
|
|
||||||
print_if_no_resources (gold, 30, "gold");
|
print ("/2Storehouse/- that you ordered to be built was finished without issues, now you have /2%i/- storehouses.\n", ++storehouses);
|
||||||
print_if_no_resources (wood, 10, "wood");
|
|
||||||
print_if_no_resources (stone, 60, "stone");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_quarry (void) {
|
static void build_quarry (void) {
|
||||||
if ((gold < 60) || (wood < 30) || (stone < 10)) {
|
if (check_resource (gold, 60, "gold") || check_resource (wood, 30, "wood") || check_resource (stone, 10, "stone")) {
|
||||||
echo ("> Your architects humbly refused to build the quarry, complaining about lacking the resources for that.\n");
|
print ("Your architects humbly refused to build the /1quarry/-, complaining about lacking the resources for that.\n");
|
||||||
|
} else {
|
||||||
|
gold -= 60;
|
||||||
|
wood -= 30;
|
||||||
|
stone -= 10;
|
||||||
|
|
||||||
print_if_no_resources (gold, 60, "gold");
|
print ("/2Quarry/- that you ordered to be built was finished without issues, now you have /2%i/- quarries.\n", ++quarries);
|
||||||
print_if_no_resources (wood, 30, "wood");
|
|
||||||
print_if_no_resources (stone, 10, "stone");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_resources (void) {
|
||||||
|
print ("Wheat = %i\n", wheat);
|
||||||
|
print ("Gold = %i\n", gold);
|
||||||
|
print ("Wood = %i\n", wood);
|
||||||
|
print ("Stone = %i\n", stone);
|
||||||
|
}
|
||||||
|
|
||||||
int main (void) {
|
int main (void) {
|
||||||
build_granary ();
|
print_resources ();
|
||||||
build_mine ();
|
|
||||||
|
build_granary ();
|
||||||
|
build_mine ();
|
||||||
build_storehouse ();
|
build_storehouse ();
|
||||||
build_quarry ();
|
build_quarry ();
|
||||||
|
|
||||||
|
print_resources ();
|
||||||
|
|
||||||
return (log_success);
|
return (log_success);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user