[Add] We now have some unimplmented planet services.
This commit is contained in:
parent
7b72a35b9e
commit
1307661363
@ -9,7 +9,7 @@
|
||||
<class>A</class>
|
||||
<description>The surface of the planet is predominantly covered with water and the planetary climate is characterised by abundant precipitation and strong winds, yet tolerable enough to make special and expensive weather control measurements unnecessary. Habitable land is characterised by soft meadows, swamps and dense forests. The resource base of KonoSphere consits mainly of agriculture and biomass, with the locally bred and grown kono rice being its main export, and fishing a traditional source of sustenance for its people. Other traditional products include wine, and various livestock, most prominently cattle. Cuisine on KonoSphere is rather refined, with most dishes containing meat.</description>
|
||||
<faction>Independent</faction>
|
||||
<services>1</services>
|
||||
<services>7</services>
|
||||
<tech>0</tech>
|
||||
<commodities>1</commodities>
|
||||
</general>
|
||||
@ -27,7 +27,7 @@
|
||||
<class>A</class>
|
||||
<description>SaraCraft is a desert planet with no natural precipitation.</description>
|
||||
<faction>Independent</faction>
|
||||
<services>1</services>
|
||||
<services>3</services>
|
||||
<tech>0</tech>
|
||||
<commodities>1</commodities>
|
||||
</general>
|
||||
|
53
src/land.c
53
src/land.c
@ -4,7 +4,7 @@
|
||||
|
||||
#define LAND_WIDTH 700
|
||||
#define LAND_HEIGHT 600
|
||||
#define BUTTON_WIDTH 80
|
||||
#define BUTTON_WIDTH 200
|
||||
#define BUTTON_HEIGHT 40
|
||||
|
||||
int landed = 0;
|
||||
@ -12,6 +12,32 @@ int landed = 0;
|
||||
static int land_wid = 0;
|
||||
static Planet* planet = NULL;
|
||||
|
||||
static void commodity_exchange(coid);
|
||||
static void outfits(void);
|
||||
static void shipyard(void);
|
||||
static void spaceport_bar(void);
|
||||
static void news(void);
|
||||
|
||||
static void commodity_exchange(void) {
|
||||
|
||||
}
|
||||
|
||||
static void outfits(void) {
|
||||
|
||||
}
|
||||
|
||||
static void shipyard(void) {
|
||||
|
||||
}
|
||||
|
||||
static void spaceport_bar(void) {
|
||||
|
||||
}
|
||||
|
||||
static void news(void) {
|
||||
|
||||
}
|
||||
|
||||
// Land the player.
|
||||
void land(Planet* p) {
|
||||
if(landed) return;
|
||||
@ -26,6 +52,31 @@ void land(Planet* p) {
|
||||
// Buttons.
|
||||
window_addButton(land_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnTakeoff", "Takeoff", (void(*)(char*))takeoff);
|
||||
|
||||
if(planet_hasService(planet, PLANET_SERVICE_COMMODITY))
|
||||
window_addButton(land_wid, -20., 20. + BUTTON_HEIGHT + 20.,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnCommodity",
|
||||
"Commodity Exchange", (void(*)(char*))commodity_exchange);
|
||||
|
||||
if(planet_hasService(planet, PLANET_SERVICE_SHIPYARD))
|
||||
window_addButton(land_wid, -20. - BUTTON_WIDTH - 20., 20.,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnShipyard",
|
||||
"Shipyard", (void(*)(char*))shipyard);
|
||||
|
||||
if(planet_hasService(planet, PLANET_SERVICE_OUTFITS))
|
||||
window_addButton(land_wid, -20. - BUTTON_WIDTH - 20., 20. + BUTTON_HEIGHT + 20.,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnOutfits",
|
||||
"Outfits", (void(*)(char*))outfits);
|
||||
|
||||
if(planet_hasService(planet, PLANET_SERVICE_BASIC))
|
||||
window_addButton(land_wid, 20., 20.,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnNews",
|
||||
"News", (void(*)(char*))news);
|
||||
window_addButton(land_wid, 20., 20. + BUTTON_HEIGHT + 20.,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar",
|
||||
"SpaceBar", (void(*)(char*))spaceport_bar);
|
||||
|
||||
|
||||
landed = 1;
|
||||
}
|
||||
|
||||
|
@ -291,6 +291,8 @@ static Planet* planet_get(const char* name) {
|
||||
tmp->faction = faction_get(xml_get(cur));
|
||||
else if(xml_isNode(cur, "description"))
|
||||
tmp->description = strdup(xml_get(cur));
|
||||
else if(xml_isNode(cur, "services"))
|
||||
tmp->services = xml_getInt(cur);
|
||||
} while((cur = cur->next));
|
||||
}
|
||||
} while((node = node->next));
|
||||
|
@ -34,12 +34,20 @@ typedef enum {
|
||||
PLANET_CLASS_Z // Demon.
|
||||
} PlanetClass;
|
||||
|
||||
// Planet services.
|
||||
#define PLANET_SERVICE_BASIC (1<<0) // Refueling, spaceport bar, new.
|
||||
#define PLANET_SERVICE_COMMODITY (1<<1)
|
||||
#define PLANET_SERVICE_OUTFITS (1<<2)
|
||||
#define PLANET_SERVICE_SHIPYARD (1<<3)
|
||||
#define planet_hasService(p,s) ((p)->services & s)
|
||||
|
||||
typedef struct {
|
||||
char* name; // Planet name
|
||||
Vec2 pos; // Position in star system.
|
||||
|
||||
PlanetClass class; // Planet type.
|
||||
char* description; // Planet description.
|
||||
int services; // Offered services.
|
||||
Faction* faction; // Planet faction.
|
||||
glTexture* gfx_space; // Graphics in space.
|
||||
glTexture* gfx_exterior; // Graphics in the exterior.
|
||||
|
Loading…
Reference in New Issue
Block a user