diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-13 13:54:09 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-13 13:54:09 +0000 |
| commit | 5b67651831ad9b160b41990288c938c7a05c1db1 (patch) | |
| tree | 6380e378eae351d40abe85b66aed40f5c88f2951 /src/modules/modAI.c | |
| parent | 54d61c622ba721b4ea57852e0ba6c87acfa66a2b (diff) | |
- upravene indexovanie v index.c a space.c ktore indexovanie pouziva
git-svn-id: http://opensvn.csie.org/tuxanci_ng@194 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/modules/modAI.c')
| -rwxr-xr-x | src/modules/modAI.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/modules/modAI.c b/src/modules/modAI.c index 105b410..ccd444a 100755 --- a/src/modules/modAI.c +++ b/src/modules/modAI.c @@ -137,15 +137,15 @@ int draw(int x, int y, int w, int h) } #endif -tux_t *findOtherTux(list_t *list) +tux_t *findOtherTux(space_t *space) { int i; - for( i = 0 ; i < list->count ; i++ ) + for( i = 0 ; i < getSpaceCount(space) ; i++ ) { tux_t *thisTux; - thisTux = list->list[i]; + thisTux = getItemFromSpace(space, i); if( thisTux->control != TUX_CONTROL_AI ) { @@ -191,7 +191,7 @@ static void shotTux(arena_t *arena, tux_t *tux_ai, tux_t *tux_rival) } } -static void eventTux(tux_t *tux) +static void eventTuxAI(tux_t *tux) { arena_t *arena; tux_t *rivalTux; @@ -218,7 +218,7 @@ static void eventTux(tux_t *tux) arena = export_fce->fce_getCurrentArena(); - rivalTux = findOtherTux(arena->spaceTux->list); + rivalTux = findOtherTux(arena->spaceTux); if( rivalTux == NULL || rivalTux->status != TUX_STATUS_ALIVE ) { @@ -340,13 +340,22 @@ static void eventTux(tux_t *tux) */ } +static void action_tuxAI(space_t *space, tux_t *tux, void *p) +{ + if( tux->control == TUX_CONTROL_AI && + tux->status == TUX_STATUS_ALIVE ) + { + eventTuxAI(tux); + } +} + int event() { static my_time_t lastEvent = 0; my_time_t curentTime; arena_t *arena; int countTuxAI; - int i; + //int i; if( lastEvent == 0 ) { @@ -372,6 +381,8 @@ int event() countTuxAI = 0; + actionSpace(arena->spaceTux, action_tuxAI, NULL); +/* for( i = 0 ; i < arena->spaceTux->list->count ; i++ ) { tux_t *thisTux; @@ -385,7 +396,7 @@ int event() countTuxAI = 0; } } - +*/ return 0; } |