From: Ingo Ruhnke Date: Wed, 24 Mar 2004 21:43:56 +0000 (+0000) Subject: - removed a few redundant "== true"'s X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a9b83d7e4034285af26de6e1da2139d4b7a3d541;p=supertux.git - removed a few redundant "== true"'s SVN-Revision: 340 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index f1d8c6635..9dd970cd7 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -482,13 +482,9 @@ void game_draw(void) // Draw background: for (int y = 0; y < 15; ++y) - { - for (int x = 0; x < 21; ++x) - { - drawshape(32*x - fmodf(scroll_x, 32), y * 32, - current_level.tiles[(int)y][(int)x + (int)(scroll_x / 32)]); - } - } + for (int x = 0; x < 21; ++x) + drawshape(32*x - fmodf(scroll_x, 32), y * 32, + current_level.tiles[y][x + (int)(scroll_x / 32)]); for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) bouncy_brick_draw(&bouncy_bricks[i]); @@ -692,7 +688,7 @@ int gameloop(const char * subset, int levelnb, int mode) SDL_Delay(50); } - if(debug_mode && debug_fps == true) + if(debug_mode && debug_fps) SDL_Delay(60); /*Draw the current scene to the screen */ diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 08ffd4721..7863015bd 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -612,7 +612,7 @@ void apply_level_settings_menu() i = true; } - if(i == true) + if(i) { level_free_gfx(); level_load_gfx(le_current_level); @@ -1014,13 +1014,13 @@ void le_checkevents() cursor_x = ((int)(pos_x + x) / 32) * 32; cursor_y = ((int) y / 32) * 32; - if(le_mouse_pressed[LEFT] == true) + if(le_mouse_pressed[LEFT]) { selection.x2 = x + pos_x; selection.y2 = y; } - if(le_mouse_pressed[RIGHT] == true) + if(le_mouse_pressed[RIGHT]) { pos_x += -1 * event.motion.xrel; } diff --git a/src/menu.cpp b/src/menu.cpp index fbc6362d4..646121875 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -285,7 +285,10 @@ Menu::check() { if(num_items != 0 && item != NULL) { - if((item[active_item].kind == MN_ACTION || item[active_item].kind == MN_TEXTFIELD || item[active_item].kind == MN_NUMFIELD) && item[active_item].toggled == true) + if((item[active_item].kind == MN_ACTION + || item[active_item].kind == MN_TEXTFIELD + || item[active_item].kind == MN_NUMFIELD) + && item[active_item].toggled) { item[active_item].toggled = false; show_menu = 0; @@ -328,7 +331,7 @@ Menu::draw_item(int index, // Position of the current item in the menu int list_width = strlen(string_list_active(pitem.list)) * font_width; text_type* text_font = &white_text; - if(arrange_left == true) + if (arrange_left) x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; if(index == active_item) @@ -427,7 +430,7 @@ Menu::draw_item(int index, // Position of the current item in the menu { text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size); - if(pitem.toggled == true) + if(pitem.toggled) texture_draw(&checkbox_checked, x_pos + (text_width+font_width)/2, y_pos - 8); diff --git a/src/player.cpp b/src/player.cpp index 9525e7011..617daf860 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -209,9 +209,8 @@ Player::action() score_multiplier = 1; } - if(jumped_in_solid == true) + if(jumped_in_solid) { - if (isbrick(base.x, base.y) || isfullbox(base.x, base.y)) { @@ -285,7 +284,8 @@ Player::action() } grabdistros(); - if(jumped_in_solid == true) + + if (jumped_in_solid) { ++base.y; ++old_base.y; @@ -460,7 +460,7 @@ Player::handle_vertical_input() } } } - else if(input_.up == UP && jumping == true) + else if(input_.up == UP && jumping) { if (on_ground()) { @@ -523,7 +523,7 @@ Player::input() /* Jump/jumping? */ - if ( input_.up == DOWN || (input_.up == UP && jumping == true)) + if ( input_.up == DOWN || (input_.up == UP && jumping)) { handle_vertical_input(); } @@ -549,7 +549,7 @@ Player::input() } else { - if (size == BIG && duck == true) + if (size == BIG && duck) { /* Make sure we're not standing back up into a solid! */ base.height = 64; @@ -978,7 +978,7 @@ Player::keep_in_bounds() base.x= 0; else if(base.x< scroll_x) base.x= scroll_x; - else if (base.x< 160 + scroll_x && scroll_x > 0 && debug_mode == true) + else if (base.x< 160 + scroll_x && scroll_x > 0 && debug_mode) { scroll_x = base.x- 160; /*base.x+= 160;*/ diff --git a/src/setup.cpp b/src/setup.cpp index 82326c870..49d530d45 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -439,13 +439,13 @@ void process_save_load_game_menu(int save) default: if(slot != -1) { - if(save == true) + if(save) { savegame(slot - 1); } else { - if(game_started == false) + if (game_started) { gameloop("default",slot - 1,ST_GL_LOAD_GAME); show_menu = true; @@ -479,7 +479,7 @@ void process_options_menu(void) case 4: if(use_music != options_menu->item[4].toggled) { - if(use_music == true) + if(use_music) { if(playing_music()) { @@ -603,7 +603,7 @@ void st_video_setup_sdl(void) { SDL_FreeSurface(screen); - if (use_fullscreen == true) + if (use_fullscreen) { screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ if (screen == NULL) @@ -641,7 +641,7 @@ void st_video_setup_gl(void) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if (use_fullscreen == true) + if (use_fullscreen) { screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */ if (screen == NULL) @@ -755,7 +755,7 @@ void st_audio_setup(void) /* Init SDL Audio silently even if --disable-sound : */ - if (audio_device == true) + if (audio_device) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { @@ -782,14 +782,14 @@ void st_audio_setup(void) /* Open sound silently regarless the value of "use_sound": */ - if (audio_device == true) + if (audio_device) { if (open_audio(44100, AUDIO_S16, 2, 2048) < 0) { /* only print out message if sound or music was not disabled at command-line */ - if ((use_sound == true) || (use_music == true)) + if (use_sound || use_music) { fprintf(stderr, "\nWarning: I could not set up audio for 44100 Hz " diff --git a/src/sound.cpp b/src/sound.cpp index 30a49a560..6bd7432e2 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -123,7 +123,7 @@ void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker) /* this won't call the function if the user has disabled sound * either via menu or via command-line option */ - if ((use_sound == true) && (audio_device == true)) + if (use_sound && audio_device) { Mix_PlayChannel( whichSpeaker, snd, 0); @@ -156,7 +156,7 @@ void free_chunk(Mix_Chunk *chunk) int playing_music(void) { - if (use_music == true) + if (use_music) { return Mix_PlayingMusic(); } @@ -170,7 +170,7 @@ int playing_music(void) int halt_music(void) { - if ((use_music == true) && (audio_device == true)) + if (use_music && audio_device) { return Mix_HaltMusic(); } @@ -183,7 +183,7 @@ int halt_music(void) int play_music(Mix_Music *music, int loops) { - if ((use_music == true) && (audio_device == true)) + if (use_music && audio_device) { DEBUG_MSG(__PRETTY_FUNCTION__); return Mix_PlayMusic(music, loops); diff --git a/src/timer.cpp b/src/timer.cpp index a31e93f18..858f3fedc 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -116,11 +116,13 @@ void timer_fread(timer_type* ptimer, FILE* fi) fread(&ptimer->period,sizeof(unsigned int),1,fi); fread(&diff_ticks,sizeof(unsigned int),1,fi); fread(&tick_mode,sizeof(unsigned int),1,fi); - if(tick_mode == true) + + if (tick_mode) ptimer->get_ticks = st_get_ticks; else ptimer->get_ticks = SDL_GetTicks; - if(diff_ticks != 0) + + if (diff_ticks != 0) ptimer->time = ptimer->get_ticks() - diff_ticks; else ptimer->time = 0;