[Fix] Fixed some valgrind errors.
This commit is contained in:
parent
014b71e8d6
commit
8c4a7a045a
3
README
3
README
@ -76,7 +76,8 @@ Keys:
|
||||
|
||||
KEY_IDENTIFIER is the indetifier given below:
|
||||
KEY_TYPE can be one of keyboard, jaxis or jbutton.
|
||||
KEY_NUMBER is the number of the key (found with xev)
|
||||
KEY_NUMBER is the number of the key (found with xev usually, just
|
||||
convert the keysym from hex to base 10).
|
||||
KEY_REVERSE is whether it is reversed or not, which
|
||||
is only useful in the case of jaxis.
|
||||
MOD_IDENTIFIER is the modifier to take into account, can be on of:
|
||||
|
@ -235,10 +235,11 @@ static int planetL_get(lua_State* L) {
|
||||
|
||||
/* Get a planet from faction list. */
|
||||
else if(lua_istable(L, 1)) {
|
||||
/* Get table length and preallocate. */
|
||||
nfactions = (int) lua_objlen(L, 1);
|
||||
factions = malloc(sizeof(int) * nfactions);
|
||||
/* Load up the table. */
|
||||
lua_pushnil(L);
|
||||
nfactions = (int)lua_gettop(L);
|
||||
factions = malloc(sizeof(int) * nfactions);
|
||||
i = 0;
|
||||
while(lua_next(L, -2) != 0) {
|
||||
f = lua_tofaction(L, -1);
|
||||
|
@ -1688,6 +1688,7 @@ void player_land(void) {
|
||||
int i;
|
||||
int tp;
|
||||
double td, d;
|
||||
Planet* planet;
|
||||
|
||||
if(landed) {
|
||||
/* Player is already landed. */
|
||||
@ -1701,8 +1702,8 @@ void player_land(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
Planet* planet = cur_system->planets[planet_target];
|
||||
if(planet_target >= 0) {
|
||||
planet = cur_system->planets[planet_target];
|
||||
if(!planet_hasService(planet, PLANET_SERVICE_LAND)) {
|
||||
player_message("You can't land here.");
|
||||
return;
|
||||
@ -1741,8 +1742,9 @@ void player_land(void) {
|
||||
td = -1; /* Temp distance. */
|
||||
tp = -1; /* Temp planet. */
|
||||
for(i = 0; i < cur_system->nplanets; i++) {
|
||||
d = vect_dist(&player->solid->pos, &cur_system->planets[i]->pos);
|
||||
if(planet_hasService(cur_system->planets[i], PLANET_SERVICE_LAND) &&
|
||||
planet = cur_system->planets[i];
|
||||
d = vect_dist(&player->solid->pos, &planet->pos);
|
||||
if(planet_hasService(planet, PLANET_SERVICE_LAND) &&
|
||||
((tp == -1) || ((td == -1) || (td > d)))) {
|
||||
tp = i;
|
||||
td = d;
|
||||
|
Loading…
Reference in New Issue
Block a user