From fdaabd259ead83173d4e7c34593fd9e04cd9e921 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sat, 16 Mar 2013 17:02:09 +0000 Subject: [PATCH] [Add] Possibility to deny landing. --- dat/planet.xml | 6 +++--- src/player.c | 7 ++++++- src/space.h | 39 ++++++++++++++++++++------------------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/dat/planet.xml b/dat/planet.xml index 8c7ff0e..c4e2538 100644 --- a/dat/planet.xml +++ b/dat/planet.xml @@ -10,7 +10,7 @@ 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 - 15 + 31 0 1 @@ -29,7 +29,7 @@ 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 + 7 0 1 @@ -48,7 +48,7 @@ Built to defend the Empire from the Collective. The Omega Station has been the observer of countless battles fought in it's sector. It's helped keep a stalemate in the sector. The Omega Canteen is a dark place that seems calm, although everytime a robotic drone approaches, an alarm is sounded, sending pilots to man their ships to fight off the menace. Empire - 7 + 15 0 1 diff --git a/src/player.c b/src/player.c index c1939db..65399d1 100644 --- a/src/player.c +++ b/src/player.c @@ -932,7 +932,12 @@ void player_land(void) { } Planet* planet = &cur_system->planets[planet_target]; if(planet_target >= 0) { - if(!player_isFlag(PLAYER_LANDACK)) { + if(!planet_hasService(planet, PLANET_SERVICE_LAND)) { + player_message("You can't land here."); + return; + } + else if(!player_isFlag(PLAYER_LANDACK)) { + // No landing authorization. if(!areEnemies(player->faction, planet->faction)) { player_message("%s> Permission to land cleared.", planet->name); player_setFlag(PLAYER_LANDACK); diff --git a/src/space.h b/src/space.h index 6c542b5..96326bd 100644 --- a/src/space.h +++ b/src/space.h @@ -36,45 +36,46 @@ typedef enum PlanetClass_ { } 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_SERVICE_LAND (1<<0) // Can we land? +#define PLANET_SERVICE_BASIC (1<<1) // Refueling, spaceport bar, new. +#define PLANET_SERVICE_COMMODITY (1<<2) +#define PLANET_SERVICE_OUTFITS (1<<3) +#define PLANET_SERVICE_SHIPYARD (1<<4) #define planet_hasService(p,s) ((p)->services & s) typedef struct Planet_ { char* name; // Planet name - Vec2 pos; // Position in star system. + Vec2 pos; // Position in star system. - PlanetClass class; // Planet type. - Faction* faction; // Planet faction. + PlanetClass class; // Planet type. + 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. + char* description; // Planet description. + char* bar_description; // Spaceport bar description. + unsigned int services; // Offered services. + glTexture* gfx_space; // Graphics in space. + glTexture* gfx_exterior; // Graphics in the exterior. } Planet; // Star systems. typedef struct SystemFleet_ { Fleet* fleet; // Fleet to appear. - int chance; // Chance of fleet appearing in the system. + int chance; // Chance of fleet appearing in the system. } SystemFleet; typedef struct StarSystem_ { char* name; // Star system identifier. - Vec2 pos; // Position. + Vec2 pos; // Position. int stars, asteroids; // Un numero! - double interference; // Un uh.. Percentage. + double interference; // Un uh.. Percentage. Faction* faction; // Overall faction. - Planet* planets; // Planets. - int nplanets; // Total number of planets. + Planet* planets; // Planets. + int nplanets; // Total number of planets. - SystemFleet* fleets; // Fleets that can appear in the current system. - int nfleets; // Total number of fleets. + SystemFleet* fleets; // Fleets that can appear in the current system. + int nfleets; // Total number of fleets. int* jumps; // Adjacent star system index number. int njumps; // Number of adjacent jumps.