[Change] Only have ai land once.

This commit is contained in:
Allanis 2014-01-22 15:38:19 +00:00
parent fadd885c80
commit deeea15889
3 changed files with 12 additions and 2 deletions

View File

@ -9,6 +9,12 @@
-- Attempt to land on a planet.
--]]
function land()
-- Only want to land once, prevents guys fomr never leaving.
if mem.landed then
ai.poptask()
return
end
target = mem.land
dir = ai.face(target)
dist = ai.dist(target)
@ -45,6 +51,7 @@ function landwait()
ai.pushtask(0, "land")
elseif ai.timeup(0) then
mem.landed = true -- Mark as landed so they don't spend time forever floating around.
ai.poptask() -- Ready to do whatever we were doing before.
end
end
@ -55,6 +62,7 @@ end
function runaway()
target = ai.target()
-- Target must exist.
if not ai.exists(target) then
ai.poptask()
return

View File

@ -1273,8 +1273,10 @@ void land_cleanup(void) {
land_visited = 0;
/* Destroy window. */
if(land_wid > 0)
if(land_wid > 0) {
window_destroy(land_wid);
land_wid = 0;
}
/* Clean up possible stray graphic. */
if(gfx_exterior != NULL) {

View File

@ -35,10 +35,10 @@ char* lfile_basePath(void) {
if(lephisto_base[0] == '\0') {
#ifdef LINUX
home = getenv("HOME");
snprintf(lephisto_base, PATH_MAX, "%s/.lephisto/", home);
#else
#error "Needs implentation."
#endif
snprintf(lephisto_base, PATH_MAX, "%s/.lephisto/", home);
}
return lephisto_base;