[Fix] Uninitailized code error.
This commit is contained in:
parent
127e76c542
commit
5e68d64085
22
src/ai.c
22
src/ai.c
@ -331,7 +331,8 @@ void ai_think(Pilot* pilot) {
|
|||||||
L = cur_pilot->ai->L; // Set the AI profile to the current pilot's.
|
L = cur_pilot->ai->L; // Set the AI profile to the current pilot's.
|
||||||
|
|
||||||
// Clean up some variables.
|
// Clean up some variables.
|
||||||
pilot_acc = pilot_turn = 0.;
|
pilot_acc = 0.;
|
||||||
|
pilot_turn = 0.;
|
||||||
pilot_flags = 0;
|
pilot_flags = 0;
|
||||||
pilot_target = 0;
|
pilot_target = 0;
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ void ai_think(Pilot* pilot) {
|
|||||||
lua_getglobal(L, "control_rate");
|
lua_getglobal(L, "control_rate");
|
||||||
cur_pilot->tcontrol = SDL_GetTicks() + 1000*(int)lua_tonumber(L, -1);
|
cur_pilot->tcontrol = SDL_GetTicks() + 1000*(int)lua_tonumber(L, -1);
|
||||||
}
|
}
|
||||||
if(cur_pilot->task != NULL)
|
if(cur_pilot->task)
|
||||||
// Pilot has a currently running task.
|
// Pilot has a currently running task.
|
||||||
ai_run(cur_pilot->task->name);
|
ai_run(cur_pilot->task->name);
|
||||||
|
|
||||||
@ -535,8 +536,11 @@ static int ai_pshield(lua_State* L) {
|
|||||||
|
|
||||||
// Get the distance from the pointer.
|
// Get the distance from the pointer.
|
||||||
static int ai_getdistance(lua_State* L) {
|
static int ai_getdistance(lua_State* L) {
|
||||||
|
Vec2* vect;
|
||||||
|
|
||||||
MIN_ARGS(1);
|
MIN_ARGS(1);
|
||||||
Vec2* vect = (Vec2*)lua_topointer(L,1);
|
vect = (lua_islightuserdata(L,1)) ?
|
||||||
|
(Vec2*)lua_topointer(L,1) : NULL;
|
||||||
lua_pushnumber(L, vect_dist(vect, &cur_pilot->solid->pos));
|
lua_pushnumber(L, vect_dist(vect, &cur_pilot->solid->pos));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -672,16 +676,16 @@ static int ai_face(lua_State* L) {
|
|||||||
vect_cset(&sv, VX(cur_pilot->solid->pos) + FACE_WVEL*VX(cur_pilot->solid->vel),
|
vect_cset(&sv, VX(cur_pilot->solid->pos) + FACE_WVEL*VX(cur_pilot->solid->vel),
|
||||||
VY(cur_pilot->solid->pos) + FACE_WVEL*VY(cur_pilot->solid->vel));
|
VY(cur_pilot->solid->pos) + FACE_WVEL*VY(cur_pilot->solid->vel));
|
||||||
|
|
||||||
if(v != NULL)
|
if(v == NULL)
|
||||||
// Target is static.
|
|
||||||
diff = angle_diff(cur_pilot->solid->dir,
|
|
||||||
(n==-1) ? VANGLE(cur_pilot->solid->pos) :
|
|
||||||
vect_angle(&cur_pilot->solid->pos, v));
|
|
||||||
else
|
|
||||||
// Target is dynamic.
|
// Target is dynamic.
|
||||||
diff = angle_diff(cur_pilot->solid->dir,
|
diff = angle_diff(cur_pilot->solid->dir,
|
||||||
(n==-1) ? VANGLE(sv) :
|
(n==-1) ? VANGLE(sv) :
|
||||||
vect_angle(&sv, &tv));
|
vect_angle(&sv, &tv));
|
||||||
|
else
|
||||||
|
// Target is static.
|
||||||
|
diff = angle_diff(cur_pilot->solid->dir,
|
||||||
|
(n==-1) ? VANGLE(cur_pilot->solid->pos) :
|
||||||
|
vect_angle(&cur_pilot->solid->pos, v));
|
||||||
|
|
||||||
pilot_turn = mod*diff;
|
pilot_turn = mod*diff;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user