PDA

View Full Version : [AI.obj] unknown code


Sauron
19.03.2006, 01:03
i was working on ai.obj when i saw this code, and this isn't just the only one i found :?


shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const 1427
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 20
less
branch_false L7347
L7346
push_const 1
branch_false L7349
L7348
push_event // c1
push_const 276
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
shift_sp -1


what i don't get is the second part


L7346
push_const 1
branch_false L7349
L7348

SoaPy
19.03.2006, 01:06
too weird :S

Xellos
19.03.2006, 01:20
that's not weird...

it's a simple
if (true) {
do something
}

it's in some AIs
and one of the results of some code realigns like the introduction of the TimerEx events and the .top_desire_target (just compare the decompiler output with the old source and u will see some more strange things :P )

Sauron
19.03.2006, 01:38
well i still don't get it, what does that push_const 1 do? if(1) ????


if(OwnItemCount(c1, @nectar) < 20)
{
/*
push_const 1 <---- ??
branch_false L7349 <---- ??

*/
c1.quest_last_reward_time = GetCurrentTick();

Xellos
19.03.2006, 01:44
yes,

if (1) = if (true)

in the pre c1 AI there was a check that was removed...
some lazy programmer simply changed the expression inside the macro to 1

Sauron
19.03.2006, 01:59
thx