Merge branch 'master' into dev

Conflicts:
	scripts/ai/empire.lua
	scripts/ai/pirate.lua
	src/comm.c
This commit is contained in:
Allanis 2014-02-02 20:00:23 +00:00
commit 35b4339abd
11 changed files with 26 additions and 10 deletions

2
TODO
View File

@ -1,10 +1,10 @@
Vital: Vital:
-- Pilot Communication system. -- Pilot Communication system.
-- Request fuel.
-- Introductory screen (text + image?). -- Introductory screen (text + image?).
-- System obstacles and such. -- System obstacles and such.
-- Interference -- Interference
-- Asteroids. -- Asteroids.
-- More loading screens.
-- Real news. -- Real news.
-- Dynamic Economy. -- Dynamic Economy.

View File

@ -74,6 +74,7 @@ DATA_AI := $(wildcard ../scripts/ai/*.lua \
../scripts/ai/include/*.lua \ ../scripts/ai/include/*.lua \
../scripts/ai/tpl/*.lua) ../scripts/ai/tpl/*.lua)
DATA_GFX := $(wildcard ../gfx/*.png \ DATA_GFX := $(wildcard ../gfx/*.png \
../gfx/loading/*.png \
../gfx/gui/*.png \ ../gfx/gui/*.png \
../gfx/logo/*.png \ ../gfx/logo/*.png \
../gfx/outfit/space/*.png \ ../gfx/outfit/space/*.png \

BIN
gfx/loading/admonisher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

BIN
gfx/loading/gawain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

BIN
gfx/loading/goddard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

BIN
gfx/loading/llama.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

BIN
gfx/loading/mule.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

View File

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 423 KiB

View File

@ -121,6 +121,7 @@ static void comm_bribe(unsigned int wid, char* unused) {
int answer; int answer;
int price; int price;
char* str; char* str;
lua_State* L;
/* Set up for the comm_get* functions. */ /* Set up for the comm_get* functions. */
ai_setPilot(comm_pilot); ai_setPilot(comm_pilot);
@ -162,7 +163,15 @@ static void comm_bribe(unsigned int wid, char* unused) {
dialogue_msg("Bribe Pilot", "\"Pleasure to do business with you.\""); dialogue_msg("Bribe Pilot", "\"Pleasure to do business with you.\"");
else else
dialogue_msg("Bribe Pilot", "%s", str); dialogue_msg("Bribe Pilot", "%s", str);
/* Mark as bribed and don't allow bribing again. */
pilot_setFlag(comm_pilot, PILOT_BRIBED); pilot_setFlag(comm_pilot, PILOT_BRIBED);
L = comm_pilot->ai->L;
lua_getglobal(L, "mem");
lua_pushnil(L);
lua_setfield(L, -2, "bribe");
lua_pop(L, 1);
/* Reopen window. */ /* Reopen window. */
window_destroy(wid); window_destroy(wid);
comm_open(comm_pilot->id); comm_open(comm_pilot->id);

View File

@ -279,6 +279,7 @@ int main(int argc, char** argv) {
void loadscreen_load(void) { void loadscreen_load(void) {
int i; int i;
char file_path[PATH_MAX]; char file_path[PATH_MAX];
char** loadscreens;
char** files; char** files;
uint32_t nfiles; uint32_t nfiles;
size_t len; size_t len;
@ -286,11 +287,14 @@ void loadscreen_load(void) {
/* Count the loading screens. */ /* Count the loading screens. */
files = pack_listfiles(data, &nfiles); files = pack_listfiles(data, &nfiles);
len = strlen("../gfx/loading"); len = strlen("../gfx/loading/");
nload = 0; nload = 0;
loadscreens = malloc(sizeof(char*) * nfiles);
for(i = 0; i < (int)nfiles; i++) { for(i = 0; i < (int)nfiles; i++) {
if(strncmp(files[i], "../gfx/loading", len)==0) if(strncmp(files[i], "../gfx/loading/", len)==0) {
loadscreens[nload] = files[i];
nload++; nload++;
} else
free(files[i]); free(files[i]);
} }
@ -301,8 +305,13 @@ void loadscreen_load(void) {
} }
/* Load the texture. */ /* Load the texture. */
snprintf(file_path, PATH_MAX, "../gfx/loading%03d.png", RNG(0, nload-1)); snprintf(file_path, PATH_MAX, loadscreens[RNG(0, nload-1)]);
loading = gl_newImage(file_path); loading = gl_newImage(file_path);
/* Clean up. */
for(i = 0; i < nload; i++)
free(loadscreens[i]);
free(loadscreens);
} }
/** /**

View File

@ -1,7 +1,4 @@
#ifdef _POSIX_SOURCE #include <stdio.h> /* remove() */
#include <unistd.h> /* Unlink. */
#endif
#include "lephisto.h" #include "lephisto.h"
#include "log.h" #include "log.h"
#include "xml.h" #include "xml.h"
@ -191,7 +188,7 @@ static void load_menu_delete(unsigned int wdw, char* str) {
return; return;
snprintf(path, PATH_MAX, "%ssaves/%s.ls", lfile_basePath(), save); snprintf(path, PATH_MAX, "%ssaves/%s.ls", lfile_basePath(), save);
unlink(path); remove(path); /* Remove is more portable and will call unlink on Linux. */
/* Need to reload the menu. */ /* Need to reload the menu. */
load_menu_close(wdw, NULL); load_menu_close(wdw, NULL);