logically weird loop

Liste des GroupesRevenir à col advocacy 
Sujet : logically weird loop
De : profesor.fir (at) *nospam* gmail.com (fir)
Groupes : comp.lang.c
Date : 20. Nov 2024, 16:56:56
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <0e1c6d2e74d44a715bf7625ca2df022d169f878a@i2pn2.org>
User-Agent : Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19
i coded soem roguelike game loop which gave me
a lot of logical trouble
imagine game has micro turns, thise micro turns are
noted by
int game_time = 0; //styart with microturn 0
if you press a key on keyboard you update variable
of chuman character: character[HUM}.action_end = game_time+300
then the not human bits should execute in thise microturns
until you reacg turn 300 then you need to read keyboard again
what work is terribly weird, maybe becouse i started
with while loop and while loops from my experience
im not sure but imo tent do be logically heavy problematic
form tiem to time..what work is
void ProcessMicroturnsUntilHuman()
  {
if( game_time < character[HUM].action_end)
{
while(game_time < character[HUM].action_end)
{
DispatchActions();
game_time++;
}
if(game_time == character[HUM].action_end) //**
    DispatchActions();
}
  }
is there some more proper form of this loop?
(the line nioted by ** i know is not needed but
overally this loop is weird imo

Date Sujet#  Auteur
16 Apr 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal