From 4384adec9848742c3823601ee38663aebdb05745 Mon Sep 17 00:00:00 2001 From: Allanis Date: Tue, 19 Feb 2013 20:04:04 +0000 Subject: [PATCH] [Add] Spaceport bar. (no missions or hirelings or alchol available yet). --- dat/planet.xml | 2 ++ src/land.c | 23 +++++++++++++++++++++++ src/space.c | 2 ++ src/space.h | 6 ++++-- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/dat/planet.xml b/dat/planet.xml index 5b24af5..d766ed2 100644 --- a/dat/planet.xml +++ b/dat/planet.xml @@ -8,6 +8,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. + The bar is just off the starport with a fantastic view of the harbour. You could watch the fishermen run frantically about attending their duties for hours. Independent 7 0 @@ -26,6 +27,7 @@ A SaraCraft is a desert planet with no natural precipitation. + The SaraCraft canteen is a shady place. Many scoundrels and lowlifes make this thier home to avoid notice from the universal police. Independent 3 0 diff --git a/src/land.c b/src/land.c index a6013e1..d7de7fd 100644 --- a/src/land.c +++ b/src/land.c @@ -12,6 +12,10 @@ #define NEWS_WIDTH 400 #define NEWS_HEIGHT 400 +// Bar window. +#define BAR_WIDTH 600 +#define BAR_HEIGHT 400 + int landed = 0; static int land_wid = 0; // Primary land window. @@ -22,6 +26,7 @@ static void commodity_exchange(coid); static void outfits(void); static void shipyard(void); static void spaceport_bar(void); +static void spaceport_bar_close(char* str); static void news(void); static void news_close(char* str); @@ -37,10 +42,28 @@ static void shipyard(void) { } +// Spaceport bar. static void spaceport_bar(void) { + secondary_wid = window_create(-1, -1, BAR_WIDTH, BAR_HEIGHT); + // Window title. + window_addText(secondary_wid, 0, -20, BAR_WIDTH, 0, 1, + "txtTitle", NULL, &cBlack, "Spaceport Bar"); + + window_addText(secondary_wid, 20, 20 + BUTTON_HEIGHT + 20, + BAR_WIDTH-140, BAR_HEIGHT - 40 - BUTTON_HEIGHT - 60, + 0, "txtDescription", &gl_smallFont, &cBlack, planet->bar_description); + + window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, + "btnCloseBar", "Close", spaceport_bar_close); + +} +static void spaceport_bar_close(char* str) { + if(strcmp(str, "btnCloseBar")==0) + window_destroy(secondary_wid); } +// Planet news reports. static void news(void) { secondary_wid = window_create(-1, -1, NEWS_WIDTH, NEWS_HEIGHT); diff --git a/src/space.c b/src/space.c index 34d9d56..62c4af3 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, "bar")) + tmp->bar_description = strdup(xml_get(cur)); else if(xml_isNode(cur, "services")) tmp->services = xml_getInt(cur); } while((cur = cur->next)); diff --git a/src/space.h b/src/space.h index f7603ff..8169e0b 100644 --- a/src/space.h +++ b/src/space.h @@ -46,9 +46,11 @@ typedef struct { Vec2 pos; // Position in star system. PlanetClass class; // Planet type. - char* description; // Planet description. - int services; // Offered services. Faction* faction; // Planet faction. + + char* description; // Planet description. + char* bar_description; // Spaceport bar description. + int services; // Offered services. glTexture* gfx_space; // Graphics in space. glTexture* gfx_exterior; // Graphics in the exterior. } Planet;