void do_addchange( CHAR_DATA * ch, char *argument ) { CHANGE_DATA *new_table; char arg1[MAX_INPUT_LENGTH]; char buf[MSL]; argument = one_argument( argument, arg1 ); if( IS_NPC( ch ) ) return; if( argument[0] == '\0' ) { send_to_char( "Syntax: Addchange <type> <string>\n\r", ch ); send_to_char( "#wTypes are: code, area, help, rule, typo.#n\n\r", ch ); send_to_char( "#wType '#Rchanges#w' to view the list.#n\n\r", ch ); return; } /* * Addchange must have an argument now - Zarius */ if( str_cmp( arg1, "code" ) && str_cmp( arg1, "area" ) && str_cmp( arg1, "help" ) && str_cmp( arg1, "rule" ) && str_cmp( arg1, "typo" ) ) { send_to_char( "Incorrect Type! Must be code, area, help, rule or typo ONLY\n\r", ch ); return; } if( strlen( argument ) < 10 ) { send_to_char( "The change description must be longer than 10 chars.\n\r", ch ); return; } maxChanges++; new_table = ( CHANGE_DATA * ) realloc( changes_table, sizeof( CHANGE_DATA ) * ( maxChanges + 1 ) ); if( !new_table ) /* realloc failed */ { send_to_char( "Memory allocation failed. Brace for impact.\n\r", ch ); return; } changes_table = new_table; changes_table[maxChanges - 1].change = str_dup( argument ); changes_table[maxChanges - 1].coder = str_dup( ch->name ); changes_table[maxChanges - 1].date = str_dup( current_date( ) ); changes_table[maxChanges - 1].type = str_dup( capitalize( arg1 ) ); changes_table[maxChanges - 1].mudtime = current_time; send_to_char( "Changes Created.\n\r", ch ); send_to_char( "Type 'changes' to see the changes.\n\r", ch ); xprintf( buf, "#D<#CCHANGE#D> #w%s change #R##%d #wadded, type '#Rchanges#w' to see the details.#D\n\r", capitalize( arg1 ), maxChanges ); do_echo( ch, buf ); save_changes( ); return; }
int num_changes( void ) { char *test = current_date( ); int today = 0, i = 0; for( i = 0; i < maxChanges; i++ ) if( !str_cmp( test, changes_table[i].date ) ) today++; return today; }
void do_log( CHAR_DATA *ch, char *argument ) { char arg1[MAX_INPUT_LENGTH]; argument = one_argument( argument, arg1 ); LOG_DATA * new_table; if ( IS_NPC( ch ) ) return; if ( arg1[0] == '\0' || argument[0] == '\0' ) { send_to_char( "Syntax: log [bug/typo/idea] [string]\n\r", ch ); send_to_char( "Type 'logs' to view the list.\n\r", ch ); return; } if ( !str_cmp( arg1, "bug" ) || !str_cmp( arg1, "typo" ) || !str_cmp( arg1, "idea" ) ) { maxLogs++; new_table = realloc( log_table, sizeof( LOG_DATA ) *(maxLogs+1) ); if (!new_table) /* realloc failed */ { send_to_char ("Memory allocation failed. Brace for impact.\n\r",ch); return; } log_table = new_table; log_table[maxLogs-1].reporter = str_dup( ch->name ); log_table[maxLogs-1].type = str_dup( arg1 ); log_table[maxLogs-1].date = str_dup( current_date()); log_table[maxLogs-1].log = str_dup( argument ); save_logs(); load_logs(); send_to_char("Thank you for posting this log, we'll look into it as soon as possible.\r\n", ch ); return; } else { send_to_char( "Syntax: log [bug/typo/idea] [string]\n\r", ch ); send_to_char( "Type 'logs' to view the list.\n\r", ch ); return; } }
void Level::MenuTick(double deltaTime) { switch (m_GameMenu->GetSelection()) { case GameMenu::SelectionState::NONE: m_GameMenu->Tick(deltaTime); break; case GameMenu::SelectionState::RESUME: DeleteResource(m_GameMenu); SetActive(true); m_LevelState = LevelState::PLAYING; break; case GameMenu::SelectionState::SAVE: { std::wstring path = SaveGames::SAVEGAMES_DIRECTORY_PATH + m_GameMenu->GetSaveName() + L".xml"; SaveToFile(path, true); m_LastSaveConfigPath = path; std::wstring date = current_date(DATE_FORMAT); // Create a save game entry SaveGameEntry entry; entry.name = m_GameMenu->GetSaveName(); entry.file = path; entry.date = date; entry.level = m_LevelName; SAVEGAMES_MANAGER->AddSaveGameEntry(entry); SAVEGAMES_MANAGER->SaveToFile(); } m_GameMenu->Reset(); break; case GameMenu::SelectionState::LOAD: // Load the latest saved game of the level Singleton<StreetJustice911>::GetInstance()->LoadLevel(m_LastSaveConfigPath); break; case GameMenu::SelectionState::RESET: // Reset the level with the standard configuration Singleton<StreetJustice911>::GetInstance()->LoadLevel(m_StandardConfigPath); break; case GameMenu::SelectionState::EXIT: DeleteResource(m_GameMenu); { StreetJustice911* game = Singleton<StreetJustice911>::GetInstance(); game->QuitGame(); } break; } }
void Level::CompletedTick(double deltaTime) { m_FadeTimer -= deltaTime; if (m_FadeTimer < 0) { m_FadeTimer = LEVEL_FADE_TIMER; // Calculate the score of the player HighScoreEntry highScoreEntry; highScoreEntry.level = m_LevelName; highScoreEntry.score = m_ScorePtr->CalculateScore(); highScoreEntry.date = current_date(DATE_FORMAT); Singleton<StreetJustice911>::GetInstance()->LevelCompleted(highScoreEntry, *m_ScorePtr); } }
void do_addchange(CHAR_DATA *ch, char *argument ) { CHANGE_DATA * new_table; char buf[MSL]; if ( IS_NPC( ch ) ) return; if ( argument[0] == '\0' ) { send_to_char( "Syntax: Addchange ChangeString\n\r", ch ); send_to_char( "Type '#Rchanges#n' to view the list.#n\n\r", ch ); return; } maxChanges++; totChanges++; new_table = realloc( changes_table, sizeof( CHANGE_DATA ) *(maxChanges+1) ); if (!new_table) /* realloc failed */ { send_to_char ("Memory allocation failed. Brace for impact.\n\r",ch); return; } changes_table = new_table; changes_table[maxChanges-1].change = str_dup( argument ); changes_table[maxChanges-1].coder = str_dup( ch->name ); changes_table[maxChanges-1].date = str_dup(current_date()); changes_table[maxChanges-1].mudtime = current_time; send_to_char("Changes Created.\n\r",ch); send_to_char("Type 'changes' to see the changes.\n\r",ch); sprintf(buf,"New Change (##%d) added to the mud, type '#Cchanges#n' to see it.",totChanges); do_info(ch,buf); save_changes(); return; }
void do_addchange(CHAR_DATA *ch, char *argument ) { CHANGE_DATA * new_table; if ( IS_NPC( ch ) ) return; if ( argument[0] == '\0' ) { send_to_char( "Syntax: addchange [change string]\n\r", ch ); send_to_char( "Type 'changes' to view the list.\n\r", ch ); return; } maxChanges++; new_table = realloc( changes_table, sizeof( CHANGE_DATA ) *(maxChanges+1) ); if (!new_table) /* realloc failed */ { send_to_char ("Memory allocation failed. Brace for impact.\n\r",ch); return; } changes_table = new_table; changes_table[maxChanges-1].change = str_dup( argument ); changes_table[maxChanges-1].coder = str_dup( ch->name ); changes_table[maxChanges-1].date = str_dup(current_date()); changes_table[maxChanges-1].mudtime = current_time; send_to_char("Changes Created.\n\r",ch); send_to_char("Type '@@echanges@@w' to see the changes.\n\r",ch); info("New change added to the MUD, type '@@echanges@@g' to see it.", 0); save_changes(); load_changes(); return; }
void do_addchange( CHAR_DATA * ch, char *argument ) { CHANGE_DATA *new_table; if( IS_NPC( ch ) ) return; if( argument[0] == '\0' ) { send_to_char( "Syntax: Addchange ChangeString\r\n", ch ); send_to_char( "&cType '&cchanges&c' to view the list.&d\r\n", ch ); return; } maxChanges++; new_table = realloc( changes_table, sizeof( CHANGE_DATA ) * ( maxChanges + 1 ) ); if( !new_table ) /* realloc failed */ { send_to_char( "Memory allocation failed. Brace for impact.\r\n", ch ); return; } changes_table = new_table; changes_table[maxChanges - 1].change = str_dup( argument ); changes_table[maxChanges - 1].coder = str_dup( ch->name ); changes_table[maxChanges - 1].date = str_dup( current_date( ) ); changes_table[maxChanges - 1].mudtime = current_time; send_to_char( "Changes Created.\r\n", ch ); send_to_char( "Type 'changes' to see the changes.\r\n", ch ); do_info( ch, " &zNew Change added to the mud, type '&Cchanges&z' to see it&z" ); save_changes( ); return; }
void do_changes(CHAR_DATA *ch, char *argument) { char arg[MAX_INPUT_LENGTH]; char buf[MSL]; char *test; int today; int i = 0; bool fAll = FALSE; int totalpages = 0; one_argument( argument, arg ); if (IS_NPC(ch)) return; test = current_date(); today = 0; for ( i = 0; i < maxChanges; i++) if (!str_cmp(test,changes_table[i].date)) today++; if( NULLSTR( arg ) ) fAll = FALSE; else fAll = !str_cmp( arg, "all" ); send_to_char("#R----------------------------------------\n\r", ch ); send_to_char("#7No. Coder Date Change#n\n\r",ch ); send_to_char("#R----------------------------------------\n\r", ch ); totalpages = 1 + ( totChanges / 10 ); if( !is_number( arg ) ) { // start new /* for (i = (10); i < totChanges; i++) { int number; number = (0); if( ( i > (number - 11) ) && ( i < number ) && ( i < totChanges ) ) { stcf(ch,"#0[#R%2d#0]#7 %-9s #c*%-6s #n%-55s#n\n\r", ( i + 1 ), changes_table[i].coder, changes_table[i].date, changes_table[i].change); } } */ //end new stcf(ch,"#RYou must type changes 1 through %d. To view the changes.#n\n\r", totalpages ); return; } if( totalpages < 1 ) totalpages = 1; if( is_number( arg ) ) { int page = atoi( arg ); int number; number = page * 10; if( page < 0 || page > totalpages ) { stcf( ch, "#RPage must be between 1 and %d!!!#n\n\r", totalpages ); return; } for (i = 0; i < totChanges; i++) { // if( !fAll // if(changes_table[i].mudtime + (2*24L*36000L) < current_time ) // continue; if( ( i > (number - 11) ) && ( i < number ) && ( i < totChanges ) ) { stcf(ch,"#0[#R%2d#0]#7 %-9s #c*%-6s #n%-55s#n\n\r", ( i + 1 ), changes_table[i].coder, changes_table[i].date, changes_table[i].change); } // i++; } } // sprintf( buf,"#0[#R%2d#0]#7 %-9s #c*%-6s #n%-55s#n\n\r", // (i+1), // changes_table[i].coder , // changes_table[i].date, // changes_table[i].change ); // change_justify( changes_table[i].change, 55 )); // send_to_char( buf, ch ); send_to_char("#R----------------------------------------\n\r", ch ); sprintf(buf, "#7There is a total of #0[ #y%3d #0] #7changes in the database.#n\n\r", maxChanges); send_to_char( buf, ch ); // send_to_char("#0Also see: '#Cchanges all#0' for a list of all the changes.#n\n\r",ch); send_to_char("#R----------------------------------------\n\r", ch ); sprintf(buf, "#7There is a total of #0[ #y%2d #0] #7new changes that have been added today.#n\n\r", today); send_to_char( buf, ch ); send_to_char("#R----------------------------------------\n\r", ch ); send_to_char("#R----------------------------------------\n\r", ch ); sprintf(buf, "#7There are a total of #0[ #y%d #0] #7pages of changes to view with changes (page number).#n\n\r", totalpages); send_to_char( buf, ch ); send_to_char("#R----------------------------------------\n\r", ch ); send_to_char("#R----------------------------------------\n\r", ch ); return; }
void do_changes( CHAR_DATA * ch, char *argument ) { char arg[MIL], buf[MSL], *test; int i, change, today; bool fAll, fchange = FALSE; one_argument( argument, arg ); if( IS_NPC( ch ) || maxChanges < 1 ) return; change = i = today = 0; test = current_date( ); for( i = 0; i < maxChanges; i++ ) if( !str_cmp( test, changes_table[i].date ) ) today++; if( NULLSTR( arg ) ) fAll = FALSE; else fAll = !str_cmp( arg, "all" ); if( is_number( arg ) ) { if( atoi( arg ) < 1 || atoi( arg ) > maxChanges ) { ch_printf( ch, "\r\n&WValid numbers are from 1 to %d&D\r\n", maxChanges ); return; } change = atoi( arg ); fAll = FALSE; fchange = TRUE; } send_to_char( "&wNo. Coder Date Change&d\r\n", ch ); for( i = 0; i < maxChanges; i++ ) { if( !fchange && !fAll && changes_table[i].mudtime + ( 7 * 24L * 3600L ) < current_time ) continue; if( !fchange && !fAll && str_cmp( test, changes_table[i].date ) ) continue; if( fchange && change != i + 1 ) continue; if( !fAll ) send_to_char( "\r\n", ch ); sprintf( buf, "&W[&R%4d&W]&B %-9s &C*%-6s &D\r\n", ( i + 1 ), changes_table[i].coder, changes_table[i].date ); send_to_char( buf, ch ); ch_printf( ch, "&D%s&D\r\n", changes_table[i].change ); } if( today > 0 ) { if( !fAll ) send_to_char( "\r\n", ch ); sprintf( buf, "&cThere&C-&cwas&C-&W[&R%4d&W]&C-&cchange%s-&ctoday.&C----------&D\r\n", today, today > 1 ? "s&C" : "&C-" ); send_to_char( buf, ch ); } else { if( !fAll ) send_to_char( "\r\n", ch ); } sprintf( buf, "&cThere&C-&care&C-&W[&R%4d&W]&C-&ctotal&C-&cchanges.&C----------&D\r\n", maxChanges ); send_to_char( buf, ch ); send_to_char( "&cType&C-&c'changes #'&C-&cto&C-&csee&C-&cthat&C-&cchange.&C-----&D\r\n", ch ); send_to_char( "&cType&C-&c'changes all'&C-&cto&C-&csee&C-&call&C-&cchanges.&C---&D\r\n", ch ); return; }
void do_changes(CHAR_DATA *ch, char *argument) { char arg[MAX_INPUT_LENGTH]; char buf[MSL]; char *test; int today; int i = 0; int totalpages = 0; one_argument( argument, arg ); if (IS_NPC(ch)) return; test = current_date(); today = 0; for ( i = 0; i < maxChanges; i++) if (!str_cmp(test,changes_table[i].date)) today++; send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); send_to_char("@@WNo. Coder Date Change\n\r",ch ); send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); totalpages = 1 + ( totChanges / 10 ); if ( !is_number( arg ) && strcmp(arg, "") ) { sprintf(buf,"@@wType changes @@d[@@y1@@d]@@w through @@d[@@y%d@@d]@@w to view the changes.@@w\n\r" "@@e------------------------------------------------------------------------------@@w\n\r", totalpages); send_to_char(buf, ch); return; } if ( totalpages < 1 ) totalpages = 1; if ( is_number( arg ) || !strcmp(arg, "") ) { int page; int number; if (!strcmp(arg, "")) page = totalpages; else page = atoi(arg); number = page * 10; if ( page < 0 || page > totalpages ) { sprintf( buf, "@@ePage must be between 1 and %d!@@N\n\r", totalpages ); send_to_char(buf, ch); return; } for (i = 0; i < totChanges; i++) { if ( ( i > (number - 11) ) && ( i < number ) && ( i < totChanges ) ) { sprintf(buf,"@@d[@@y%2d@@d]@@N @@r%-9s @@a*%-6s @@W%-55s@@N\n\r", ( i + 1 ), changes_table[i].coder, changes_table[i].date, changes_table[i].change ); send_to_char(buf, ch); } } } send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); sprintf(buf, "@@wThere are a total of @@d[@@y %3d @@d]@@w changes in the database.@@w\n\r", maxChanges); send_to_char( buf, ch ); send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); sprintf(buf, "@@wThere are a total of @@d[@@y %3d @@d]@@w new changes that have been added today.@@w\n\r", today); send_to_char( buf, ch ); send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); sprintf(buf, "@@wThere are a total of @@d[@@y %3d @@d]@@w pages of changes to view with '@@Gchanges #@@N'.@@w\n\r", totalpages); send_to_char( buf, ch ); send_to_char("@@e------------------------------------------------------------------------------@@w\n\r", ch ); return; }
void do_changes( CHAR_DATA * ch, char *argument ) { char arg[MIL]; char buf[MSL]; char *test; int today; int i; bool fAll; int totalpages = 1; one_argument( argument, arg ); if( IS_NPC( ch ) ) return; if( str_cmp( arg, "code" ) && str_cmp( arg, "area" ) && str_cmp( arg, "help" ) && str_cmp( arg, "rule" ) && str_cmp( arg, "typo" ) && str_cmp( arg, "all" ) && !NULLSTR( arg ) ) { send_to_char( "Incorrect Type! Must be code, area, help, rule, type or ALL\n\r", ch ); return; } if( maxChanges < 1 ) return; i = 0; test = current_date( ); today = 0; for( i = 0; i < maxChanges; i++ ) if( !str_cmp( test, changes_table[i].date ) ) today++; if( NULLSTR( arg ) ) fAll = FALSE; else fAll = TRUE; send_to_char( "\n\r", ch ); xprintf( buf, "#R-=[ #W%s Changelog #R]=-", MUDNAME ); cent_to_char( buf, ch ); pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch ); pager_to_char( "#wNo. Coder Date Type Change#n\n\r", ch ); pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch ); if( is_number( arg ) ) { int page = atoi( arg ); int number; number = page * 10; if( page < 0 || page > totalpages ) { ch_printf( ch, "#RPage must be between 1 and %d!!!\n\r", totalpages ); return; } for( i = ( number - 10 ); ( i < number && i < maxChanges ); i++ ) { pager_printf( ch, "#0[#R%3d#0] %-11s #c*%-6s #P%-5s #w%-45s#n\n\r", ( i + 1 ), changes_table[i].coder, changes_table[i].date, changes_table[i].type, change_justify( changes_table[i].change, 45 ) ); } } else { for( i = 0; i < maxChanges; i++ ) { if( !fAll && changes_table[i].mudtime + ( 7 * 24L * 3600L ) < current_time ) continue; if( !str_cmp( arg, "code" ) && str_cmp( changes_table[i].type, "code" ) ) continue; if( !str_cmp( arg, "area" ) && str_cmp( changes_table[i].type, "area" ) ) continue; if( !str_cmp( arg, "help" ) && str_cmp( changes_table[i].type, "help" ) ) continue; if( !str_cmp( arg, "rule" ) && str_cmp( changes_table[i].type, "rule" ) ) continue; if( !str_cmp( arg, "typo" ) && str_cmp( changes_table[i].type, "typo" ) ) continue; pager_printf( ch, "#0[#R%3d#0] %-11s #c*%-6s #P%-5s #w%-55s#D\n\r", ( i + 1 ), changes_table[i].coder, changes_table[i].date, changes_table[i].type, change_justify( changes_table[i].change, 55 ) ); } } pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch ); pager_printf( ch, "#w There are #D[ #Y%d#D ] #wchanges in the database, #Y%d #wof them were added today.#n\n\r", maxChanges, today ); pager_to_char( "#0 Also see: '#Cchanges all#0' for a list of all the changes.#0\n\r", ch ); pager_to_char( "#0 Or: '#Cchanges <type>#0' for a filtered list of all.#n\n\r", ch ); if( totalpages > 1 ) { pager_printf( ch, "#0 Or: '#Cchanges <1 to %d>#0' for individual pages.#n\n\r", totalpages ); } pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch ); return; }