Initial scripts and core...
This commit is contained in:
parent
2eea767707
commit
7783f04701
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
xerbia
|
7
compile.sh
Normal file
7
compile.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
gcc -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -o xerbia xerbia.c
|
||||||
|
|
||||||
|
exit
|
7
install.sh
Normal file
7
install.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
cp xerbia /usr/bin/xerbia
|
||||||
|
|
||||||
|
exit
|
68
xerbia.c
Normal file
68
xerbia.c
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include <xolatile/xtandard.c>
|
||||||
|
|
||||||
|
static int wheat = 0;
|
||||||
|
static int gold = 0;
|
||||||
|
static int wood = 0;
|
||||||
|
static int stone = 0;
|
||||||
|
|
||||||
|
static int granaries = 1;
|
||||||
|
static int mines = 1;
|
||||||
|
static int storehouses = 1;
|
||||||
|
static int quarries = 1;
|
||||||
|
|
||||||
|
static char * king_list = "King Ognjen Milan Robovic";
|
||||||
|
|
||||||
|
static void print_if_no_resources (int have, int need, char * name) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void build_granary (void) {
|
||||||
|
if ((gold < 10) || (wood < 60) || (stone < 30)) {
|
||||||
|
echo ("> Your architects humbly refused to build the granary, complaining about lacking the resources for that.\n");
|
||||||
|
|
||||||
|
print_if_no_resources (gold, 10, "gold");
|
||||||
|
print_if_no_resources (wood, 60, "wood");
|
||||||
|
print_if_no_resources (stone, 30, "stone");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void build_mine (void) {
|
||||||
|
if ((gold < 120) || (wood < 60) || (stone < 30)) {
|
||||||
|
echo ("> Your architects humbly refused to build the mine, complaining about lacking the resources for that.\n");
|
||||||
|
|
||||||
|
print_if_no_resources (gold, 120, "gold");
|
||||||
|
print_if_no_resources (wood, 60, "wood");
|
||||||
|
print_if_no_resources (stone, 30, "stone");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void build_storehouse (void) {
|
||||||
|
if ((gold < 30) || (wood < 10) || (stone < 60)) {
|
||||||
|
echo ("> Your architects humbly refused to build the storehouse, complaining about lacking the resources for that.\n");
|
||||||
|
|
||||||
|
print_if_no_resources (gold, 30, "gold");
|
||||||
|
print_if_no_resources (wood, 10, "wood");
|
||||||
|
print_if_no_resources (stone, 60, "stone");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void build_quarry (void) {
|
||||||
|
if ((gold < 60) || (wood < 30) || (stone < 10)) {
|
||||||
|
echo ("> Your architects humbly refused to build the quarry, complaining about lacking the resources for that.\n");
|
||||||
|
|
||||||
|
print_if_no_resources (gold, 60, "gold");
|
||||||
|
print_if_no_resources (wood, 30, "wood");
|
||||||
|
print_if_no_resources (stone, 10, "stone");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (void) {
|
||||||
|
build_granary ();
|
||||||
|
build_mine ();
|
||||||
|
build_storehouse ();
|
||||||
|
build_quarry ();
|
||||||
|
|
||||||
|
return (log_success);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user