diff --git a/dat/planet.xml b/dat/planet.xml index 1da7967..5b24af5 100644 --- a/dat/planet.xml +++ b/dat/planet.xml @@ -9,7 +9,7 @@ A 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. Independent - 1 + 7 0 1 @@ -27,7 +27,7 @@ A SaraCraft is a desert planet with no natural precipitation. Independent - 1 + 3 0 1 diff --git a/src/land.c b/src/land.c index 8bc09ab..845f28a 100644 --- a/src/land.c +++ b/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; } diff --git a/src/space.c b/src/space.c index 7a6d0ba..34d9d56 100644 --- a/src/space.c +++ b/src/space.c @@ -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)); diff --git a/src/space.h b/src/space.h index 9903b96..f7603ff 100644 --- a/src/space.h +++ b/src/space.h @@ -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.