[IDEA] [IDEA QUESTION] [CODE]

From: Jourge Fuzz Bush (modem-burn@GEOCITIES.COM)
Date: 10/02/98


well I have this idea but have no clue how to impliment it or have seens
it been done anywhere, I just herd people once talking about it.

First I was woundering if anyone has some ideas of how to impliment
freeze/jail times outs for example, a grgod types freeze TempChar 1
where the stynax is:
freeze name [years, months, days, hours, minutes]
now if years - minutes are 0 then they are frozen till the imm or a
higher level imm unfreezes.
well the main problem I have is how would you store that, well the main
problem is using the date functions, I have no clue which they are nor
are they mentioned in my programming book. Well I have the following
idea of how to do this but please tell me what I should add to it what I
should change that kinda thing.
I added a struct called timeout.
the declairations is following:
well 2 structs:
struct adate {
int year;
int month;
int day;
int minute;
}

struct timeout {
struct adate frozendate;
struct adate thawdates;
void freezecheck(struct char_date *ch);
}
and I mad a struct in player_data and player_file_elem I think. I'm not
quite sure on the exact names. but I added "struct timeout timeout" to
both of them. Then as the function to be done when the person enters the
game is a check like to following:
void freezecheck::timeout(struct char_date *ch) {
int curyear;
int curmonth;
int curday;
int curmin;
struct adate thawdate;
if  (frozendate.year != 0) {
        if (thawdate.month != 0) {
                if (thawdate.day != 0) {
                if (thawdate.minute != 0) {
                curmin = Get_cur_min;
                curday = get_cur_day;
                curmonth = get_cur_month;
                curyear = get_cur_year;
                thawdate.year = (frozendate.year + thawdates.year);
                thawdate.month = (frozendate.month + thawdates.month);
                thawdate.day = (frozendate.day + thawdates.day);
                thawdate.minute = (frozendate.minute + thawdates.minute);
                if (thawdate.year >= (curyear + 1)
                remove_bit(PLR_FROZEN, ch); return;
                else if (thawdate.year == curyear) {
                if (thawdate.month >= (curmonth + 1)
                remove_bit(PLR_FROZEN, ch); return;
                else if (thawdate.month == curmonth) {
                if (thawdate.day >= (curday + 1))
                remove_bit(PLR_FROZEN, ch); return;
                else if (thawdate.day == curday) {
                if (thawdate.minute >= curminute)
                remove_bit(PLR_FROZEN, ch); return;
                return;
                }
                return;
                }
                return;
                }

                }
                }
                /*well that's the procedure that will likely happen unless the imm
does this at exactly 1:00, 2:00 ect or sets the date less than 1                year
or 1 month or 1 day*/
                /* I didn't want to spamm everyone allot so the rest is not             included
but is practiclly identical to the one above, it should                 make sense
it's the same process*/
                }
        }
}

now that's just the code to see if it's the right date to unfreeze or
not. if it is it unfreezes the char.
I basicly wanted people to look at it check it out say what I should do
to fix it make it faster make it smaller and still work. ideas about it
comments. that kinda thing.

                Thank you,
        -Matt


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST