From: Holger Schemel Date: Sat, 29 Nov 2003 18:54:17 +0000 (+0100) Subject: rnd-20031129-3-src X-Git-Tag: 3.0.8^2~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=74c0f7de91268e40d15948f473eac51a9760b9c0;p=rocksndiamonds.git rnd-20031129-3-src --- diff --git a/src/cartoons.c b/src/cartoons.c index e6892ebb..fd53e502 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -26,13 +26,13 @@ static void PrepareBackbuffer() /* Fill empty backbuffer for animation functions */ if (setup.direct_draw && game_status == GAME_MODE_PLAYING) { - int xx,yy; + int xx, yy; SetDrawtoField(DRAW_BACKBUFFER); - for(xx=0; xx 0) printf("#\n"); - for (j=0; j < *editor_elements_info[i].element_list_size; j++) + for (j = 0; j < *editor_elements_info[i].element_list_size; j++) { int element = (*editor_elements_info[i].element_list)[j]; @@ -3176,7 +3176,7 @@ static void ReinitializeElementListButtons() if (last_setup_value_headlines != setup.editor.el_headlines) initialization_needed = TRUE; - for (i=0; editor_elements_info[i].setup_value != NULL; i++) + for (i = 0; editor_elements_info[i].setup_value != NULL; i++) if (editor_elements_info[i].last_setup_value != *editor_elements_info[i].setup_value) initialization_needed = TRUE; @@ -3190,7 +3190,7 @@ static void ReinitializeElementListButtons() /* store current setup values for next invocation of this function */ last_setup_value_headlines = setup.editor.el_headlines; - for (i=0; editor_elements_info[i].setup_value != NULL; i++) + for (i = 0; editor_elements_info[i].setup_value != NULL; i++) editor_elements_info[i].last_setup_value = *editor_elements_info[i].setup_value; @@ -3210,8 +3210,8 @@ static void DrawElementBorder(int dest_x, int dest_y, int width, int height, getMiniGraphicSource(border_graphic, &src_bitmap, &src_x, &src_y); - for (y=0; y < num_mini_tiley; y++) - for (x=0; x < num_mini_tilex; x++) + for (y = 0; y < num_mini_tiley; y++) + for (x = 0; x < num_mini_tilex; x++) BlitBitmap(src_bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY, dest_x - MINI_TILEX / 2 + x * MINI_TILEX, dest_y - MINI_TILEY / 2 + y * MINI_TILEY); @@ -3233,8 +3233,8 @@ static void DrawDrawingArea(int id) DrawMiniGraphicExt(drawto, gi->x, gi->y, el2edimg(custom_element.gfx_element)); else if (id == ED_DRAWING_ID_CUSTOM_CONTENT) - for (y=0; y<3; y++) - for (x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) DrawMiniGraphicExt(drawto, gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY, el2edimg(custom_element.content[x][y])); @@ -3242,8 +3242,8 @@ static void DrawDrawingArea(int id) DrawMiniGraphicExt(drawto, gi->x, gi->y, el2edimg(custom_element_change.target_element)); else if (id == ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT) - for (y=0; y < 3; y++) - for (x=0; x < 3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) DrawMiniGraphicExt(drawto, gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY, el2edimg(custom_element_change.content[x][y])); @@ -3255,8 +3255,8 @@ static void DrawDrawingArea(int id) { int nr = id - ED_DRAWING_ID_ELEMENT_CONTENT_0; - for (y=0; y < 3; y++) - for (x=0; x < 3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) DrawMiniGraphicExt(drawto, gi->x + x * MINI_TILEX, gi->y + y * MINI_TILEY, el2edimg(level.yamyam_content[nr][x][y])); @@ -3279,13 +3279,13 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll) if (dx) { x = (dx == 1 ? 0 : ed_fieldx - 1); - for(y=0; y selectbox_info[i].size) selectbox_info[i].size = strlen(selectbox_info[i].options[j].text); @@ -3906,7 +3906,7 @@ static void CreateTextbuttonGadgets() int max_infotext_len = getMaxInfoTextLength(); int i; - for (i=0; ix < SX + SXSIZE) UnmapGadget(level_editor_gadget[i]); } @@ -4622,7 +4622,7 @@ void UnmapLevelEditorGadgets() { int i; - for (i=0; i < NUM_EDITOR_GADGETS; i++) + for (i = 0; i < NUM_EDITOR_GADGETS; i++) UnmapGadget(level_editor_gadget[i]); } @@ -4651,8 +4651,8 @@ static boolean LevelChanged() boolean level_changed = FALSE; int x, y; - for(y=0; ydescription[i] = ei_from->description[i]; /* ---------- copy element properties ---------- */ @@ -4731,8 +4731,8 @@ static void copy_custom_element_settings(int element_from, int element_to) ei_to->slippery_type = ei_from->slippery_type; - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) ei_to->content[x][y] = ei_from->content[x][y]; ei_to->num_change_pages = ei_from->num_change_pages; @@ -4764,8 +4764,8 @@ static void copy_custom_element_settings(int element_from, int element_to) change_to->random = change_from->random; change_to->power = change_from->power; - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) change_to->content[x][y] = change_from->content[x][y]; change_to->can_change = change_from->can_change; @@ -4782,12 +4782,12 @@ static void replace_custom_element_in_settings(int element_from, { int i, j, x, y; - for (i=0; i < NUM_FILE_ELEMENTS; i++) + for (i = 0; i < NUM_FILE_ELEMENTS; i++) { struct ElementInfo *ei = &element_info[i]; - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) if (ei->content[x][y] == element_from) ei->content[x][y] = element_to; @@ -4801,8 +4801,8 @@ static void replace_custom_element_in_settings(int element_from, if (change->trigger_element == element_from) change->trigger_element = element_to; - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) if (change->content[x][y] == element_from) change->content[x][y] = element_to; } @@ -4814,8 +4814,8 @@ static void replace_custom_element_in_playfield(int element_from, { int x, y; - for(x=0; x < lev_fieldx; x++) - for(y=0; y < lev_fieldy; y++) + for (x = 0; x < lev_fieldx; x++) + for (y = 0; y < lev_fieldy; y++) if (Feld[x][y] == element_from) Feld[x][y] = element_to; } @@ -4855,7 +4855,7 @@ static void CopyCustomElementPropertiesToEditor(int element) int current_change_page = element_info[element].current_change_page; /* dynamically (re)build selectbox for selecting change page */ - for (i=0; i < element_info[element].num_change_pages; i++) + for (i = 0; i < element_info[element].num_change_pages; i++) { sprintf(options_change_page_strings[i], "%d", i + 1); @@ -4876,13 +4876,13 @@ static void CopyCustomElementPropertiesToEditor(int element) custom_element_change = *element_info[element].change; /* needed to initially set selectbox value variables to reliable defaults */ - for (i=0; i < ED_NUM_SELECTBOX; i++) + for (i = 0; i < ED_NUM_SELECTBOX; i++) setSelectboxValue(i, *selectbox_info[i].value); - for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) + for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++) custom_element_properties[i] = HAS_PROPERTY(element, i); - for (i=0; i < NUM_CHANGE_EVENTS; i++) + for (i = 0; i < NUM_CHANGE_EVENTS; i++) custom_element_change_events[i] = HAS_CHANGE_EVENT(element, i); /* ---------- element settings: configure (custom elements) ------------- */ @@ -5107,10 +5107,10 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_change_events[custom_element_change.other_action] = custom_element_change_events[CE_BY_OTHER_ACTION]; - for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) + for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++) SET_PROPERTY(element, i, custom_element_properties[i]); - for (i=0; i < NUM_CHANGE_EVENTS; i++) + for (i = 0; i < NUM_CHANGE_EVENTS; i++) SET_CHANGE_EVENT(element, i, custom_element_change_events[i]); /* copy change events also to special level editor variable */ @@ -5313,7 +5313,7 @@ static void ModifyEditorElementList() { int i; - for (i=0; i to_x) swap_numbers(&from_x, &to_x); - for (x=from_x; x<=to_x; x++) + for (x = from_x; x <= to_x; x++) DrawLineElement(x, y, element, change_level); } else if (from_x == to_x) /* vertical line */ @@ -6162,7 +6162,7 @@ static void DrawLine(int from_x, int from_y, int to_x, int to_y, if (from_y > to_y) swap_numbers(&from_y, &to_y); - for (y=from_y; y<=to_y; y++) + for (y = from_y; y <= to_y; y++) DrawLineElement(x, y, element, change_level); } else /* diagonal line */ @@ -6178,7 +6178,7 @@ static void DrawLine(int from_x, int from_y, int to_x, int to_y, if (from_x > to_x) swap_number_pairs(&from_x, &from_y, &to_x, &to_y); - for (x=0; x<=len_x; x++) + for (x = 0; x <= len_x; x++) { y = (int)(a * x + 0.5) * (to_y < from_y ? -1 : +1); DrawLineElement(from_x + x, from_y + y, element, change_level); @@ -6191,7 +6191,7 @@ static void DrawLine(int from_x, int from_y, int to_x, int to_y, if (from_y > to_y) swap_number_pairs(&from_x, &from_y, &to_x, &to_y); - for (y=0; y<=len_y; y++) + for (y = 0; y <= len_y; y++) { x = (int)(a * y + 0.5) * (to_x < from_x ? -1 : +1); DrawLineElement(from_x + x, from_y + y, element, change_level); @@ -6217,7 +6217,7 @@ static void DrawFilledBox(int from_x, int from_y, int to_x, int to_y, if (from_y > to_y) swap_number_pairs(&from_x, &from_y, &to_x, &to_y); - for (y=from_y; y<=to_y; y++) + for (y = from_y; y <= to_y; y++) DrawLine(from_x, y, to_x, y, element, change_level); } @@ -6235,7 +6235,7 @@ static void DrawArcExt(int from_x, int from_y, int to_x2, int to_y2, /* not optimal (some points get drawn twice) but simple, and fast enough for the few points we are drawing */ - for (x=0; x<=radius; x++) + for (x = 0; x <= radius; x++) { int sx, sy, lx, ly; @@ -6250,7 +6250,7 @@ static void DrawArcExt(int from_x, int from_y, int to_x2, int to_y2, DrawLineElement(sx, sy, element, change_level); } - for (y=0; y<=radius; y++) + for (y = 0; y <= radius; y++) { int sx, sy, lx, ly; @@ -6363,9 +6363,9 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y, from_lx = from_x + level_xpos; from_ly = from_y + level_ypos; - for (y=0; y= num_free_positions) { - for (x=0; xinventory_size < MAX_INVENTORY_SIZE) local_player->inventory_element[local_player->inventory_size++] = EL_DYNAMITE; @@ -813,7 +813,7 @@ void HandleKey(Key key, int key_status) { int i; - for(i=0; irandom = 100; change->power = CP_NON_DESTRUCTIVE; - for(x=0; x<3; x++) - for(y=0; y<3; y++) + for (x = 0; x < 3; x++) + for (y = 0; y < 3; y++) change->content[x][y] = EL_EMPTY_SPACE; change->direct_action = 0; @@ -117,8 +117,8 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->fieldx = STD_LEV_FIELDX; level->fieldy = STD_LEV_FIELDY; - for(x=0; xfield[x][y] = EL_SAND; level->time = 100; @@ -135,45 +135,45 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->use_custom_template = FALSE; - for(i=0; iname[i] = '\0'; - for(i=0; iauthor[i] = '\0'; strcpy(level->name, NAMELESS_LEVEL_NAME); strcpy(level->author, ANONYMOUS_NAME); - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { level->envelope_text[i][0] = '\0'; level->envelope_xsize[i] = MAX_ENVELOPE_XSIZE; level->envelope_ysize[i] = MAX_ENVELOPE_YSIZE; } - for(i=0; iscore[i] = 10; level->num_yamyam_contents = STD_ELEMENT_CONTENTS; - for(i=0; iyamyam_content[i][x][y] = (i < STD_ELEMENT_CONTENTS ? EL_ROCK : EL_EMPTY); level->field[0][0] = EL_PLAYER_1; level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED; - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) { setElementChangePages(&element_info[i], 1); setElementChangeInfoToDefaults(element_info[i].change); } - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; - for(j=0; j < MAX_ELEMENT_NAME_LEN + 1; j++) + for (j = 0; j < MAX_ELEMENT_NAME_LEN + 1; j++) element_info[element].description[j] = '\0'; if (element_info[element].custom_description != NULL) strncpy(element_info[element].description, @@ -199,8 +199,8 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].slippery_type = SLIPPERY_ANY_RANDOM; - for(x=0; x<3; x++) - for(y=0; y<3; y++) + for (x = 0; x < 3; x++) + for (y = 0; y < 3; y++) element_info[element].content[x][y] = EL_EMPTY_SPACE; element_info[element].access_type = 0; @@ -217,7 +217,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].current_change_page = 0; /* start with no properties at all */ - for (j=0; j < NUM_EP_BITFIELDS; j++) + for (j = 0; j < NUM_EP_BITFIELDS; j++) Properties[element][j] = EP_BITMASK_DEFAULT; element_info[element].modified_settings = FALSE; @@ -356,17 +356,17 @@ static int LoadLevel_HEAD(FILE *file, int chunk_size, struct LevelInfo *level) level->time = getFile16BitBE(file); level->gems_needed = getFile16BitBE(file); - for(i=0; iname[i] = getFile8Bit(file); level->name[MAX_LEVEL_NAME_LEN] = 0; - for(i=0; iscore[i] = getFile8Bit(file); level->num_yamyam_contents = STD_ELEMENT_CONTENTS; - for(i=0; iyamyam_content[i][x][y] = checkLevelElement(getFile8Bit(file)); level->amoeba_speed = getFile8Bit(file); @@ -389,7 +389,7 @@ static int LoadLevel_AUTH(FILE *file, int chunk_size, struct LevelInfo *level) { int i; - for(i=0; iauthor[i] = getFile8Bit(file); level->author[MAX_LEVEL_NAME_LEN] = 0; @@ -415,8 +415,8 @@ static int LoadLevel_BODY(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size_expected; } - for(y=0; yfieldy; y++) - for(x=0; xfieldx; x++) + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) level->field[x][y] = checkLevelElement(level->encoding_16bit_field ? getFile16BitBE(file) : getFile8Bit(file)); @@ -454,9 +454,9 @@ static int LoadLevel_CONT(FILE *file, int chunk_size, struct LevelInfo *level) level->num_yamyam_contents > MAX_ELEMENT_CONTENTS) level->num_yamyam_contents = STD_ELEMENT_CONTENTS; - for(i=0; iyamyam_content[i][x][y] = checkLevelElement(level->encoding_16bit_field ? getFile16BitBE(file) : getFile8Bit(file)); @@ -477,9 +477,9 @@ static int LoadLevel_CNT2(FILE *file, int chunk_size, struct LevelInfo *level) ReadUnusedBytesFromFile(file, LEVEL_CHUNK_CNT2_UNUSED); - for(i=0; inum_yamyam_contents = num_contents; - for(i=0; iyamyam_content[i][x][y] = content_array[i][x][y]; } else if (element == EL_BD_AMOEBA) @@ -536,7 +536,7 @@ static int LoadLevel_CNT3(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size_expected; } - for(i=0; i < envelope_len; i++) + for (i = 0; i < envelope_len; i++) level->envelope_text[envelope_nr][i] = getFile8Bit(file); return chunk_size; @@ -554,7 +554,7 @@ static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size_expected; } - for (i=0; i < num_changed_custom_elements; i++) + for (i = 0; i < num_changed_custom_elements; i++) { int element = getFile16BitBE(file); int properties = getFile32BitBE(file); @@ -580,7 +580,7 @@ static int LoadLevel_CUS2(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size_expected; } - for (i=0; i < num_changed_custom_elements; i++) + for (i = 0; i < num_changed_custom_elements; i++) { int element = getFile16BitBE(file); int custom_target_element = getFile16BitBE(file); @@ -606,7 +606,7 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size_expected; } - for (i=0; i < num_changed_custom_elements; i++) + for (i = 0; i < num_changed_custom_elements; i++) { int element = getFile16BitBE(file); @@ -617,7 +617,7 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level) element = EL_DUMMY; } - for(j=0; jrandom = getFile8Bit(file); element_info[element].change->power = getFile8Bit(file); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) element_info[element].change->content[x][y] = checkLevelElement(getFile16BitBE(file)); @@ -702,7 +702,7 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) ei = &element_info[element]; - for(i=0; i < MAX_ELEMENT_NAME_LEN; i++) + for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++) ei->description[i] = getFile8Bit(file); ei->description[MAX_ELEMENT_NAME_LEN] = 0; @@ -740,8 +740,8 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) ei->slippery_type = getFile8Bit(file); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) ei->content[x][y] = checkLevelElement(getFile16BitBE(file)); /* some free bytes for future custom property values and padding */ @@ -751,7 +751,7 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) setElementChangePages(ei, ei->num_change_pages); - for (i=0; i < ei->num_change_pages; i++) + for (i = 0; i < ei->num_change_pages; i++) { struct ElementChangeInfo *change = &ei->change_page[i]; @@ -776,8 +776,8 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) change->random = getFile8Bit(file); change->power = getFile8Bit(file); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) change->content[x][y] = checkLevelElement(getFile16BitBE(file)); change->can_change = getFile8Bit(file); @@ -1027,12 +1027,12 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) (these following values were accidentally changed in version 3.0.1) */ if (level->game_version <= VERSION_IDENT(3,0,0,0)) { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; /* order of checking and copying events to be mapped is important */ - for (j=CE_BY_OTHER_ACTION; j >= CE_BY_PLAYER; j--) + for (j = CE_BY_OTHER_ACTION; j >= CE_BY_PLAYER; j--) { if (HAS_CHANGE_EVENT(element, j - 2)) { @@ -1042,7 +1042,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } /* order of checking and copying events to be mapped is important */ - for (j=CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--) + for (j = CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--) { if (HAS_CHANGE_EVENT(element, j - 1)) { @@ -1054,7 +1054,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } /* some custom element change events get mapped since version 3.0.3 */ - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1071,7 +1071,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) /* initialize "can_change" field for old levels with only one change page */ if (level->game_version <= VERSION_IDENT(3,0,2,0)) { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1094,7 +1094,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } /* set uninitialized push delay values of custom elements in older levels */ - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1114,9 +1114,9 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) int x, y; /* map elements that have changed in newer versions */ - for(y=0; yfieldy; y++) + for (y = 0; y < level->fieldy; y++) { - for(x=0; xfieldx; x++) + for (x = 0; x < level->fieldx; x++) { int element = level->field[x][y]; @@ -1144,8 +1144,8 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) } /* copy elements to runtime playfield array */ - for(x=0; xfield[x][y]; /* initialize level size variables for faster access */ @@ -1202,15 +1202,15 @@ static void SaveLevel_HEAD(FILE *file, struct LevelInfo *level) putFile16BitBE(file, level->time); putFile16BitBE(file, level->gems_needed); - for(i=0; iname[i]); - for(i=0; iscore[i]); - for(i=0; iencoding_16bit_yamyam ? EL_EMPTY : level->yamyam_content[i][x][y])); putFile8Bit(file, level->amoeba_speed); @@ -1232,7 +1232,7 @@ static void SaveLevel_AUTH(FILE *file, struct LevelInfo *level) { int i; - for(i=0; iauthor[i]); } @@ -1240,8 +1240,8 @@ static void SaveLevel_BODY(FILE *file, struct LevelInfo *level) { int x, y; - for(y=0; yfieldy; y++) - for(x=0; xfieldx; x++) + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) if (level->encoding_16bit_field) putFile16BitBE(file, level->field[x][y]); else @@ -1258,9 +1258,9 @@ static void SaveLevel_CONT(FILE *file, struct LevelInfo *level) putFile8Bit(file, 0); putFile8Bit(file, 0); - for(i=0; iencoding_16bit_field) putFile16BitBE(file, level->yamyam_content[i][x][y]); else @@ -1280,9 +1280,9 @@ static void SaveLevel_CNT2(FILE *file, struct LevelInfo *level, int element) content_xsize = 3; content_ysize = 3; - for(i=0; iyamyam_content[i][x][y]; } else if (element == EL_BD_AMOEBA) @@ -1291,9 +1291,9 @@ static void SaveLevel_CNT2(FILE *file, struct LevelInfo *level, int element) content_xsize = 1; content_ysize = 1; - for(i=0; iamoeba_content; } @@ -1313,9 +1313,9 @@ static void SaveLevel_CNT2(FILE *file, struct LevelInfo *level, int element) WriteUnusedBytesToFile(file, LEVEL_CHUNK_CNT2_UNUSED); - for(i=0; ienvelope_text[envelope_nr][i]); } @@ -1344,7 +1344,7 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level, putFile16BitBE(file, num_changed_custom_elements); - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1373,7 +1373,7 @@ static void SaveLevel_CUS2(FILE *file, struct LevelInfo *level, putFile16BitBE(file, num_changed_custom_elements); - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1402,7 +1402,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, putFile16BitBE(file, num_changed_custom_elements); - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1412,7 +1412,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, { putFile16BitBE(file, element); - for(j=0; jevents); @@ -1457,8 +1457,8 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, putFile8Bit(file, element_info[element].change->random); putFile8Bit(file, element_info[element].change->power); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) putFile16BitBE(file, element_info[element].change->content[x][y]); putFile8Bit(file, element_info[element].slippery_type); @@ -1483,7 +1483,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) putFile16BitBE(file, element); - for(i=0; i < MAX_ELEMENT_NAME_LEN; i++) + for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++) putFile8Bit(file, ei->description[i]); putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]); @@ -1513,8 +1513,8 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) putFile8Bit(file, ei->slippery_type); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) putFile16BitBE(file, ei->content[x][y]); /* some free bytes for future custom property values and padding */ @@ -1522,7 +1522,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) /* write change property values */ - for (i=0; i < ei->num_change_pages; i++) + for (i = 0; i < ei->num_change_pages; i++) { struct ElementChangeInfo *change = &ei->change_page[i]; @@ -1544,8 +1544,8 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) putFile8Bit(file, change->random); putFile8Bit(file, change->power); - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) putFile16BitBE(file, change->content[x][y]); putFile8Bit(file, change->can_change); @@ -1574,16 +1574,16 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename) /* check level field for 16-bit elements */ level->encoding_16bit_field = FALSE; - for(y=0; yfieldy; y++) - for(x=0; xfieldx; x++) + for (y = 0; y < level->fieldy; y++) + for (x = 0; x < level->fieldx; x++) if (level->field[x][y] > 255) level->encoding_16bit_field = TRUE; /* check yamyam content for 16-bit elements */ level->encoding_16bit_yamyam = FALSE; - for(i=0; inum_yamyam_contents; i++) - for(y=0; y<3; y++) - for(x=0; x<3; x++) + for (i = 0; i < level->num_yamyam_contents; i++) + for (y = 0; y < 3; y++) + for (x = 0; x < 3; x++) if (level->yamyam_content[i][x][y] > 255) level->encoding_16bit_yamyam = TRUE; @@ -1625,7 +1625,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename) } /* check for envelope content */ - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { if (strlen(level->envelope_text[i]) > 0) { @@ -1639,7 +1639,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename) /* check for non-default custom elements (unless using template level) */ if (!level->use_custom_template) { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -1715,7 +1715,7 @@ static void setTapeInfoToDefaults() /* default values (also for pre-1.2 tapes) with only the first player */ tape.player_participates[0] = TRUE; - for(i=1; inum_participating_players = 0; - for(i=0; iplayer_participates[i] = FALSE; @@ -1787,7 +1787,7 @@ static int LoadTape_INFO(FILE *file, int chunk_size, struct TapeInfo *tape) tape->level_identifier = checked_realloc(tape->level_identifier, level_identifier_size); - for(i=0; i < level_identifier_size; i++) + for (i = 0; i < level_identifier_size; i++) tape->level_identifier[i] = getFile8Bit(file); tape->level_nr = getFile16BitBE(file); @@ -1809,12 +1809,12 @@ static int LoadTape_BODY(FILE *file, int chunk_size, struct TapeInfo *tape) return chunk_size_expected; } - for(i=0; ilength; i++) + for (i = 0; i < tape->length; i++) { if (i >= MAX_TAPELEN) break; - for(j=0; jpos[i].action[j] = MV_NO_MOVING; @@ -1833,7 +1833,7 @@ static int LoadTape_BODY(FILE *file, int chunk_size, struct TapeInfo *tape) byte action = tape->pos[i].action[0]; int k, num_moves = 0; - for (k=0; k<4; k++) + for (k = 0; k<4; k++) { if (action & joy_dir[k]) { @@ -1862,7 +1862,7 @@ static int LoadTape_BODY(FILE *file, int chunk_size, struct TapeInfo *tape) tape->pos[i + 1].delay = 1; /* delay part */ - for(j=0; jpos[i].action[j] = MV_NO_MOVING; tape->pos[i].delay--; @@ -2023,7 +2023,7 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape) byte store_participating_players = 0; /* set bits for participating players for compact storage */ - for(i=0; iplayer_participates[i]) store_participating_players |= (1 << i); @@ -2046,7 +2046,7 @@ static void SaveTape_INFO(FILE *file, struct TapeInfo *tape) putFile16BitBE(file, level_identifier_size); - for(i=0; i < level_identifier_size; i++) + for (i = 0; i < level_identifier_size; i++) putFile8Bit(file, tape->level_identifier[i]); putFile16BitBE(file, tape->level_nr); @@ -2056,9 +2056,9 @@ static void SaveTape_BODY(FILE *file, struct TapeInfo *tape) { int i, j; - for(i=0; ilength; i++) + for (i = 0; i < tape->length; i++) { - for(j=0; jplayer_participates[j]) putFile8Bit(file, tape->pos[i].action[j]); @@ -2096,7 +2096,7 @@ void SaveTape(int level_nr) tape.game_version = GAME_VERSION_ACTUAL; /* count number of participating players */ - for(i=0; ilevel_identifier); printf_line("-", 79); - for(i=0; ilength; i++) + for (i = 0; i < tape->length; i++) { if (i >= MAX_TAPELEN) break; printf("%03d: ", i); - for(j=0; jplayer_participates[j]) { @@ -2189,7 +2189,7 @@ void LoadScore(int level_nr) FILE *file; /* always start with reliable default values */ - for(i=0; ishortcut.load_game = DEFAULT_KEY_LOAD_GAME; si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE; - for (i=0; iinput[i].use_joystick = FALSE; si->input[i].joy.device_name=getStringCopy(getDeviceNameFromJoystickNr(i)); @@ -2530,34 +2530,34 @@ static void decodeSetupFileHash(SetupFileHash *setup_file_hash) /* global setup */ si = setup; - for (i=0; i %d\n", helpanim_info[i].element, helpanim_info[i].action, @@ -3243,7 +3243,7 @@ void LoadHelpTextInfo() /* use reliable default values from static configuration */ helptext_info = newSetupFileHash(); - for (i=0; helptext_config[i].token; i++) + for (i = 0; helptext_config[i].token; i++) setHashEntry(helptext_info, helptext_config[i].token, helptext_config[i].value); diff --git a/src/game.c b/src/game.c index e0423a0c..22a65dc7 100644 --- a/src/game.c +++ b/src/game.c @@ -756,8 +756,8 @@ void DrawGameDoorValues() { int i, j; - for (i=0; ichange_events = CE_BITMASK_DEFAULT; - for (j=0; j < NUM_CHANGE_EVENTS; j++) + for (j = 0; j < NUM_CHANGE_EVENTS; j++) { ei->event_page_nr[j] = 0; ei->event_page[j] = &ei->change_page[0]; @@ -844,7 +844,7 @@ static void InitGameEngine() } /* add changing elements from pre-defined list */ - for (i=0; change_delay_list[i].element != EL_UNDEFINED; i++) + for (i = 0; change_delay_list[i].element != EL_UNDEFINED; i++) { struct ChangingElementInfo *ch_delay = &change_delay_list[i]; struct ElementInfo *ei = &element_info[ch_delay->element]; @@ -861,16 +861,16 @@ static void InitGameEngine() #if 1 /* add change events from custom element configuration */ - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { struct ElementInfo *ei = &element_info[EL_CUSTOM_START + i]; - for (j=0; j < ei->num_change_pages; j++) + for (j = 0; j < ei->num_change_pages; j++) { if (!ei->change_page[j].can_change) continue; - for (k=0; k < NUM_CHANGE_EVENTS; k++) + for (k = 0; k < NUM_CHANGE_EVENTS; k++) { /* only add event page for the first page found with this event */ if (ei->change_page[j].events & CH_EVENT_BIT(k) && @@ -887,7 +887,7 @@ static void InitGameEngine() #else /* add change events from custom element configuration */ - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -900,16 +900,16 @@ static void InitGameEngine() /* ---------- initialize trigger events ---------------------------------- */ /* initialize trigger events information */ - for (i=0; inum_change_pages; j++) + for (j = 0; j < ei->num_change_pages; j++) { if (!ei->change_page[j].can_change) continue; @@ -924,7 +924,7 @@ static void InitGameEngine() } #else /* add trigger events from element change event properties */ - for (i=0; itrigger_element] |= element_info[i].change->events; @@ -933,7 +933,7 @@ static void InitGameEngine() /* ---------- initialize push delay -------------------------------------- */ /* initialize push delay values to default */ - for (i=0; ilights_still_needed = 0; player->friends_still_needed = 0; - for (j=0; j < 4; j++) + for (j = 0; j < 4; j++) player->key[j] = FALSE; player->dynabomb_count = 0; @@ -1076,11 +1076,11 @@ void InitGame() player->num_special_action_sleeping = 0; /* determine number of special actions for bored and sleeping animation */ - for (j=ACTION_BORING_1; j <= ACTION_BORING_LAST; j++) + for (j = ACTION_BORING_1; j <= ACTION_BORING_LAST; j++) { boolean found = FALSE; - for (k=0; k < NUM_DIRECTIONS; k++) + for (k = 0; k < NUM_DIRECTIONS; k++) if (el_act_dir2img(player->element_nr, j, k) != el_act_dir2img(player->element_nr, ACTION_DEFAULT, k)) found = TRUE; @@ -1090,11 +1090,11 @@ void InitGame() else break; } - for (j=ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++) + for (j = ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++) { boolean found = FALSE; - for (k=0; k < NUM_DIRECTIONS; k++) + for (k = 0; k < NUM_DIRECTIONS; k++) if (el_act_dir2img(player->element_nr, j, k) != el_act_dir2img(player->element_nr, ACTION_DEFAULT, k)) found = TRUE; @@ -1166,18 +1166,18 @@ void InitGame() game.envelope_active = FALSE; - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { game.belt_dir[i] = MV_NO_MOVING; game.belt_dir_nr[i] = 3; /* not moving, next moving left */ } - for (i=0; iconnected && !player->present) { - for (j=0; jjx, jy = some_player->jy; @@ -1263,7 +1263,7 @@ void InitGame() { /* when playing a tape, eliminate all players who do not participate */ - for (i=0; iscore < highscore[MAX_SCORE_ENTRIES - 1].Score) return -1; - for (k=0; kscore > highscore[k].Score) { @@ -1840,14 +1840,14 @@ int NewHiScore() int m = MAX_SCORE_ENTRIES - 1; #ifdef ONE_PER_NAME - for (l=k; lk; l--) + for (l = m; l > k; l--) { strcpy(highscore[l].Name, highscore[l - 1].Name); highscore[l].Score = highscore[l - 1].Score; @@ -2236,7 +2236,7 @@ void Explode(int ex, int ey, int phase, int mode) Feld[ex][ey] = center_element; } - for (y = ey - 1; y <= ey + 1; y++) for(x = ex - 1; x <= ex + 1; x++) + for (y = ey - 1; y <= ey + 1; y++) for (x = ex - 1; x <= ex + 1; x++) { int xx = x - ex + 1; int yy = y - ey + 1; @@ -2556,9 +2556,9 @@ void DynaExplode(int ex, int ey) Explode(ex, ey, EX_PHASE_START, EX_CENTER); - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { - for (j=1; j<=dynabomb_size; j++) + for (j = 1; j <= dynabomb_size; j++) { int x = ex + j * xy[i % 4][0]; int y = ey + j * xy[i % 4][1]; @@ -2704,11 +2704,11 @@ static void InitBeltMovement() int x, y, i, j; /* set frame order for belt animation graphic according to belt direction */ - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { int belt_nr = i; - for (j=0; j<3; j++) + for (j = 0; j < 3; j++) { int element = belt_base_active_element[belt_nr] + j; int graphic = el2img(element); @@ -2720,13 +2720,13 @@ static void InitBeltMovement() } } - for(y=0; yjx, jy = player->jy; @@ -3571,7 +3571,7 @@ inline static void TurnRoundExt(int x, int y) { 0, +1 } }; - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { int ex = x + xy[i % 4][0]; int ey = y + xy[i % 4][1]; @@ -3743,7 +3743,7 @@ inline static void TurnRoundExt(int x, int y) { int i; - for (i=0; ijx, jy = player->jy; @@ -3833,7 +3833,7 @@ static boolean JustBeingPushed(int x, int y) { int i; - for (i=0; irandom) return FALSE; - for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++) + for (yy = 0; yy < 3; yy++) for (xx = 0; xx < 3 ; xx++) { int ex = x + xx - 1; int ey = y + yy - 1; @@ -5897,7 +5897,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly, if (!(trigger_events[trigger_element] & CH_EVENT_BIT(trigger_event))) return FALSE; - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -5907,7 +5907,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly, if (!CAN_CHANGE(element) || !HAS_ANY_CHANGE_EVENT(element, trigger_event)) continue; - for (j=0; j < element_info[element].num_change_pages; j++) + for (j = 0; j < element_info[element].num_change_pages; j++) { struct ElementChangeInfo *change = &element_info[element].change_page[j]; @@ -5934,7 +5934,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly, if (!change_element) continue; - for (y=0; yeffective_action = summarized_player_action; - for (i=0; i < MAX_PLAYERS; i++) + for (i = 0; i < MAX_PLAYERS; i++) { int actual_player_action = stored_player[i].effective_action; @@ -6333,14 +6333,14 @@ void GameActions() FrameCounter++; TimeFrames++; - for (i=0; ijx; @@ -6361,7 +6361,7 @@ void GameActions() } #endif - for (y=0; yinventory_size < MAX_INVENTORY_SIZE) player->inventory_element[player->inventory_size++] = element; @@ -8392,7 +8392,7 @@ int DigField(struct PlayerInfo *player, { int xx, yy; - for (yy=0; yy < lev_fieldy; yy++) for (xx=0; xx < lev_fieldx; xx++) + for (yy = 0; yy < lev_fieldy; yy++) for (xx=0; xx < lev_fieldx; xx++) { if (Feld[xx][yy] == EL_SP_DISK_YELLOW) Bang(xx, yy); @@ -8905,7 +8905,7 @@ void CreateGameButtons() { int i; - for (i=0; iclip_mask) { @@ -149,11 +149,11 @@ static void InitTileClipmasks() clip_gc_valuemask, &clip_gc_values); /* create only those clipping Pixmaps we really need */ - for (i=0; tile_needs_clipping[i].start>=0; i++) + for (i = 0; tile_needs_clipping[i].start >= 0; i++) { int j; - for (j=0; jstored_clip_gc) { @@ -246,15 +246,15 @@ void InitElementSmallImages() int i; /* initialize normal images from static configuration */ - for (i=0; element_to_graphic[i].element > -1; i++) + for (i = 0; element_to_graphic[i].element > -1; i++) CreateImageWithSmallImages(element_to_graphic[i].graphic); /* initialize special images from static configuration */ - for (i=0; element_to_special_graphic[i].element > -1; i++) + for (i = 0; element_to_special_graphic[i].element > -1; i++) CreateImageWithSmallImages(element_to_special_graphic[i].graphic); /* initialize images from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) if (property_mapping[i].artwork_index < MAX_NUM_ELEMENTS) CreateImageWithSmallImages(property_mapping[i].artwork_index); } @@ -295,15 +295,15 @@ void InitFontGraphicInfo() /* always start with reliable default values (normal font graphics) */ #if 1 - for (i=0; i < NUM_FONTS; i++) + for (i = 0; i < NUM_FONTS; i++) font_info[i].graphic = IMG_FONT_INITIAL_1; #else - for (i=0; i < NUM_FONTS; i++) + for (i = 0; i < NUM_FONTS; i++) font_info[i].graphic = FONT_INITIAL_1; #endif /* initialize normal font/graphic mapping from static configuration */ - for (i=0; font_to_graphic[i].font_nr > -1; i++) + for (i = 0; font_to_graphic[i].font_nr > -1; i++) { int font_nr = font_to_graphic[i].font_nr; int special = font_to_graphic[i].special; @@ -316,9 +316,9 @@ void InitFontGraphicInfo() } /* always start with reliable default values (special font graphics) */ - for (i=0; i < NUM_FONTS; i++) + for (i = 0; i < NUM_FONTS; i++) { - for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++) + for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++) { font_info[i].special_graphic[j] = font_info[i].graphic; font_info[i].special_bitmap_id[j] = i; @@ -326,7 +326,7 @@ void InitFontGraphicInfo() } /* initialize special font/graphic mapping from static configuration */ - for (i=0; font_to_graphic[i].font_nr > -1; i++) + for (i = 0; font_to_graphic[i].font_nr > -1; i++) { int font_nr = font_to_graphic[i].font_nr; int special = font_to_graphic[i].special; @@ -341,7 +341,7 @@ void InitFontGraphicInfo() } /* initialize special element/graphic mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int font_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS; int special = property_mapping[i].ext3_index; @@ -368,7 +368,7 @@ void InitFontGraphicInfo() /* ---------- initialize font bitmap definitions ---------- */ - for (i=0; i < NUM_FONTS; i++) + for (i = 0; i < NUM_FONTS; i++) { if (i < NUM_INITIAL_FONTS) { @@ -376,7 +376,7 @@ void InitFontGraphicInfo() continue; } - for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++) + for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++) { int font_bitmap_id = font_info[i].special_bitmap_id[j]; int graphic = font_info[i].special_graphic[j]; @@ -414,14 +414,14 @@ void InitElementGraphicInfo() int i, act, dir; /* set values to -1 to identify later as "uninitialized" values */ - for (i=0; i -1; i++) + for (i = 0; element_to_graphic[i].element > -1; i++) { int element = element_to_graphic[i].element; int action = element_to_graphic[i].action; @@ -475,7 +475,7 @@ void InitElementGraphicInfo() } /* initialize normal element/graphic mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int element = property_mapping[i].base_index; int action = property_mapping[i].ext1_index; @@ -502,7 +502,7 @@ void InitElementGraphicInfo() if (crumbled) { if (direction < 0) - for (dir=0; dir -1) @@ -513,7 +513,7 @@ void InitElementGraphicInfo() else { if (direction < 0) - for (dir=0; dir -1) @@ -524,7 +524,7 @@ void InitElementGraphicInfo() } /* now copy all graphics that are defined to be cloned from other graphics */ - for (i=0; i 0 && graphic_info[graphic].bitmap == NULL) element_info[i].crumbled[act] = -1; - for (dir=0; dir 0 && graphic_info[graphic].bitmap == NULL) @@ -587,7 +587,7 @@ void InitElementGraphicInfo() #endif /* now set all '-1' values to element specific default values */ - for (i=0; i -1; i++) + for (i = 0; element_to_special_graphic[i].element > -1; i++) { int element = element_to_special_graphic[i].element; int special = element_to_special_graphic[i].special; @@ -761,7 +761,7 @@ void InitElementSpecialGraphicInfo() } /* initialize special element/graphic mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int element = property_mapping[i].base_index; int special = property_mapping[i].ext3_index; @@ -776,8 +776,8 @@ void InitElementSpecialGraphicInfo() #if 1 /* now set all undefined/invalid graphics to default */ - for (i=0; i < MAX_NUM_ELEMENTS; i++) - for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) + for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++) if (graphic_info[element_info[i].special_graphic[j]].bitmap == NULL) element_info[i].special_graphic[j] = element_info[i].graphic[ACTION_DEFAULT]; @@ -788,7 +788,7 @@ static int get_element_from_token(char *token) { int i; - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) if (strcmp(element_info[i].token_name, token) == 0) return i; @@ -804,7 +804,7 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) int i; /* get integer values from string parameters */ - for (i=0; i < NUM_GFX_ARGS; i++) + for (i = 0; i < NUM_GFX_ARGS; i++) { parameter[i] = get_parameter_value(image_config_suffix[i].token, parameter_raw[i], @@ -979,7 +979,7 @@ static void InitGraphicInfo() #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) if (clipmasks_initialized) { - for (i=0; i -1; i++) + for (i = 0; element_to_sound[i].element > -1; i++) { int element = element_to_sound[i].element; int action = element_to_sound[i].action; @@ -1135,14 +1135,14 @@ static void InitElementSoundInfo() if (!is_class) element_info[element].sound[action] = sound; else - for (j=0; j < MAX_NUM_ELEMENTS; j++) + for (j = 0; j < MAX_NUM_ELEMENTS; j++) if (strcmp(element_info[j].class_name, element_info[element].class_name) == 0) element_info[j].sound[action] = sound; } /* initialize element class/sound mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int element_class = property_mapping[i].base_index - MAX_NUM_ELEMENTS; int action = property_mapping[i].ext1_index; @@ -1154,14 +1154,14 @@ static void InitElementSoundInfo() if (action < 0) action = ACTION_DEFAULT; - for (j=0; j < MAX_NUM_ELEMENTS; j++) + for (j = 0; j < MAX_NUM_ELEMENTS; j++) if (strcmp(element_info[j].class_name, element_info[element_class].class_name) == 0) element_info[j].sound[action] = sound; } /* initialize element/sound mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int element = property_mapping[i].base_index; int action = property_mapping[i].ext1_index; @@ -1177,9 +1177,9 @@ static void InitElementSoundInfo() } /* now set all '-1' values to element specific default values */ - for (i=0; i -1; i++) + for (i = 0; gamemode_to_sound[i].sound > -1; i++) { int gamemode = gamemode_to_sound[i].gamemode; int sound = gamemode_to_sound[i].sound; @@ -1224,13 +1224,13 @@ static void InitGameModeSoundInfo() } /* now set all '-1' values to levelset specific default values */ - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) if (menu.sound[i] == -1) menu.sound[i] = menu.sound[GAME_MODE_DEFAULT]; #if 0 /* TEST ONLY */ - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) if (menu.sound[i] != -1) printf("::: menu.sound[%d] == %d\n", i, menu.sound[i]); #endif @@ -1242,7 +1242,7 @@ static void set_sound_parameters(int sound, char **parameter_raw) int i; /* get integer values from string parameters */ - for (i=0; i < NUM_SND_ARGS; i++) + for (i = 0; i < NUM_SND_ARGS; i++) parameter[i] = get_parameter_value(sound_config_suffix[i].token, parameter_raw[i], sound_config_suffix[i].type); @@ -1269,11 +1269,11 @@ static void InitSoundInfo() sound_info = checked_calloc(num_sounds * sizeof(struct SoundInfo)); /* initialize sound effect for all elements to "no sound" */ - for (i=0; i < MAX_NUM_ELEMENTS; i++) - for (j=0; j < NUM_ACTIONS; j++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) + for (j = 0; j < NUM_ACTIONS; j++) element_info[i].sound[j] = SND_UNDEFINED; - for (i=0; i < num_sounds; i++) + for (i = 0; i < num_sounds; i++) { struct FileInfo *sound = getSoundListEntry(i); int len_effect_text = strlen(sound->token); @@ -1287,7 +1287,7 @@ static void InitSoundInfo() /* determine all loop sounds and identify certain sound classes */ - for (j=0; element_action_info[j].suffix; j++) + for (j = 0; element_action_info[j].suffix; j++) { int len_action_text = strlen(element_action_info[j].suffix); @@ -1309,7 +1309,7 @@ static void InitSoundInfo() /* associate elements and some selected sound actions */ - for (j=0; j < MAX_NUM_ELEMENTS; j++) + for (j = 0; j < MAX_NUM_ELEMENTS; j++) { if (element_info[j].class_name) { @@ -1335,7 +1335,7 @@ static void InitSoundInfo() #if 0 /* !!! now handled in InitElementSoundInfo() !!! */ /* initialize element/sound mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int element = property_mapping[i].base_index; int action = property_mapping[i].ext1_index; @@ -1396,13 +1396,13 @@ static void InitGameModeMusicInfo() int i; /* set values to -1 to identify later as "uninitialized" values */ - for (i=0; i < MAX_LEVELS; i++) + for (i = 0; i < MAX_LEVELS; i++) levelset.music[i] = -1; - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) menu.music[i] = -1; /* initialize gamemode/music mapping from static configuration */ - for (i=0; gamemode_to_music[i].music > -1; i++) + for (i = 0; gamemode_to_music[i].music > -1; i++) { int gamemode = gamemode_to_music[i].gamemode; int music = gamemode_to_music[i].music; @@ -1418,7 +1418,7 @@ static void InitGameModeMusicInfo() } /* initialize gamemode/music mapping from dynamic configuration */ - for (i=0; i < num_property_mappings; i++) + for (i = 0; i < num_property_mappings; i++) { int prefix = property_mapping[i].base_index; int gamemode = property_mapping[i].ext1_index; @@ -1455,19 +1455,19 @@ static void InitGameModeMusicInfo() /* now set all '-1' values to menu specific default values */ /* (undefined values of "levelset.music[]" might stay at "-1" to allow dynamic selection of music files from music directory!) */ - for (i=0; i < MAX_LEVELS; i++) + for (i = 0; i < MAX_LEVELS; i++) if (levelset.music[i] == -1) levelset.music[i] = default_levelset_music; - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) if (menu.music[i] == -1) menu.music[i] = menu.music[GAME_MODE_DEFAULT]; #if 0 /* TEST ONLY */ - for (i=0; i < MAX_LEVELS; i++) + for (i = 0; i < MAX_LEVELS; i++) if (levelset.music[i] != -1) printf("::: levelset.music[%d] == %d\n", i, levelset.music[i]); - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) if (menu.music[i] != -1) printf("::: menu.music[%d] == %d\n", i, menu.music[i]); #endif @@ -1479,7 +1479,7 @@ static void set_music_parameters(int music, char **parameter_raw) int i; /* get integer values from string parameters */ - for (i=0; i < NUM_MUS_ARGS; i++) + for (i = 0; i < NUM_MUS_ARGS; i++) parameter[i] = get_parameter_value(music_config_suffix[i].token, parameter_raw[i], music_config_suffix[i].type); @@ -1499,7 +1499,7 @@ static void InitMusicInfo() music_info = checked_calloc(num_music * sizeof(struct MusicInfo)); - for (i=0; i < num_music; i++) + for (i = 0; i < num_music; i++) { struct FileInfo *music = getMusicListEntry(i); int len_music_text = strlen(music->token); @@ -1508,7 +1508,7 @@ static void InitMusicInfo() /* determine all loop music */ - for (j=0; music_prefix_info[j].prefix; j++) + for (j = 0; music_prefix_info[j].prefix; j++) { int len_prefix_text = strlen(music_prefix_info[j].prefix); @@ -2906,21 +2906,21 @@ void InitElementPropertiesStatic() int i, j, k; /* always start with reliable default values (element has no properties) */ - for (i=0; i < MAX_NUM_ELEMENTS; i++) - for (j=0; j < NUM_ELEMENT_PROPERTIES; j++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) + for (j = 0; j < NUM_ELEMENT_PROPERTIES; j++) SET_PROPERTY(i, j, FALSE); /* set all base element properties from above array definitions */ - for (i=0; element_properties[i].elements != NULL; i++) - for (j=0; (element_properties[i].elements)[j] != -1; j++) + for (i = 0; element_properties[i].elements != NULL; i++) + for (j = 0; (element_properties[i].elements)[j] != -1; j++) SET_PROPERTY((element_properties[i].elements)[j], element_properties[i].property, TRUE); /* copy properties to some elements that are only stored in level file */ - for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) - for (j=0; copy_properties[j][0] != -1; j++) + for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++) + for (j = 0; copy_properties[j][0] != -1; j++) if (HAS_PROPERTY(copy_properties[j][0], i)) - for (k=1; k<=4; k++) + for (k = 1; k <= 4; k++) SET_PROPERTY(copy_properties[j][k], i, TRUE); } @@ -2993,10 +2993,10 @@ void InitElementPropertiesEngine(int engine_version) #endif /* set all special, combined or engine dependent element properties */ - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) { #if 0 - for (j=EP_ACCESSIBLE_OVER; j < NUM_ELEMENT_PROPERTIES; j++) + for (j = EP_ACCESSIBLE_OVER; j < NUM_ELEMENT_PROPERTIES; j++) SET_PROPERTY(i, j, FALSE); #endif @@ -3038,7 +3038,7 @@ void InitElementPropertiesEngine(int engine_version) /* ---------- WALL ----------------------------------------------------- */ SET_PROPERTY(i, EP_WALL, TRUE); /* default: element is wall */ - for (j=0; no_wall_properties[j] != -1; j++) + for (j = 0; no_wall_properties[j] != -1; j++) if (HAS_PROPERTY(i, no_wall_properties[j]) || i >= EL_FIRST_RUNTIME_UNREAL) SET_PROPERTY(i, EP_WALL, FALSE); @@ -3103,7 +3103,7 @@ void InitElementPropertiesEngine(int engine_version) /* ---------- CAN_CHANGE ----------------------------------------------- */ SET_PROPERTY(i, EP_CAN_CHANGE, FALSE); /* default: cannot change */ - for (j=0; j < element_info[i].num_change_pages; j++) + for (j = 0; j < element_info[i].num_change_pages; j++) if (element_info[i].change_page[j].can_change) SET_PROPERTY(i, EP_CAN_CHANGE, TRUE); @@ -3114,11 +3114,11 @@ void InitElementPropertiesEngine(int engine_version) #if 0 /* determine inactive elements (used for engine main loop optimization) */ - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) { boolean active = FALSE; - for (j=0; i < NUM_ELEMENT_PROPERTIES; j++) + for (j = 0; i < NUM_ELEMENT_PROPERTIES; j++) { if (HAS_PROPERTY(i, j)) active = TRUE; @@ -3145,7 +3145,7 @@ void InitElementPropertiesEngine(int engine_version) }; /* special EM style gems behaviour */ - for (i=0; ep_em_slippery_wall[i] != -1; i++) + for (i = 0; ep_em_slippery_wall[i] != -1; i++) SET_PROPERTY(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL, level.em_slippery_gems); @@ -3169,7 +3169,7 @@ void InitElementPropertiesEngine(int engine_version) } /* set uninitialized push delay values of custom elements in older levels */ - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -3204,7 +3204,7 @@ void Execute_Command(char *command) printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); printf("\n"); - for (i=0; image_config[i].token != NULL; i++) + for (i = 0; image_config[i].token != NULL; i++) printf("# %s\n", getFormattedSetupEntry(image_config[i].token, image_config[i].value)); @@ -3220,7 +3220,7 @@ void Execute_Command(char *command) printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); printf("\n"); - for (i=0; sound_config[i].token != NULL; i++) + for (i = 0; sound_config[i].token != NULL; i++) printf("# %s\n", getFormattedSetupEntry(sound_config[i].token, sound_config[i].value)); @@ -3236,7 +3236,7 @@ void Execute_Command(char *command) printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); printf("\n"); - for (i=0; music_config[i].token != NULL; i++) + for (i = 0; music_config[i].token != NULL; i++) printf("# %s\n", getFormattedSetupEntry(music_config[i].token, music_config[i].value)); @@ -3258,7 +3258,7 @@ void Execute_Command(char *command) printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); - for (i=0; helpanim_config[i].token != NULL; i++) + for (i = 0; helpanim_config[i].token != NULL; i++) { printf("# %s\n", getFormattedSetupEntry(helpanim_config[i].token, helpanim_config[i].value)); @@ -3275,7 +3275,7 @@ void Execute_Command(char *command) printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); - for (i=0; helptext_config[i].token != NULL; i++) + for (i = 0; helptext_config[i].token != NULL; i++) printf("# %s\n", getFormattedSetupEntry(helptext_config[i].token, helptext_config[i].value)); @@ -3342,7 +3342,7 @@ static void InitPlayerInfo() /* choose default local player */ local_player = &stored_player[0]; - for (i=0; iconnected = TRUE; @@ -3423,18 +3423,18 @@ static void InitArtworkConfig() /* dynamically determine list of generic tokens to be ignored */ num_ignore_generic_tokens = 0; - for (i=0; ignore_generic_tokens[i] != NULL; i++) + for (i = 0; ignore_generic_tokens[i] != NULL; i++) num_ignore_generic_tokens++; /* dynamically determine list of image tokens to be ignored */ num_ignore_image_tokens = num_ignore_generic_tokens; - for (i=0; image_config_vars[i].token != NULL; i++) + for (i = 0; image_config_vars[i].token != NULL; i++) num_ignore_image_tokens++; ignore_image_tokens = checked_malloc((num_ignore_image_tokens + 1) * sizeof(char *)); - for (i=0; i < num_ignore_generic_tokens; i++) + for (i = 0; i < num_ignore_generic_tokens; i++) ignore_image_tokens[i] = ignore_generic_tokens[i]; - for (i=0; i < num_ignore_image_tokens - num_ignore_generic_tokens; i++) + for (i = 0; i < num_ignore_image_tokens - num_ignore_generic_tokens; i++) ignore_image_tokens[num_ignore_generic_tokens + i] = image_config_vars[i].token; ignore_image_tokens[num_ignore_image_tokens] = NULL; @@ -3443,7 +3443,7 @@ static void InitArtworkConfig() num_ignore_sound_tokens = num_ignore_generic_tokens; ignore_sound_tokens = checked_malloc((num_ignore_sound_tokens + 1) * sizeof(char *)); - for (i=0; i < num_ignore_generic_tokens; i++) + for (i = 0; i < num_ignore_generic_tokens; i++) ignore_sound_tokens[i] = ignore_generic_tokens[i]; ignore_sound_tokens[num_ignore_sound_tokens] = NULL; @@ -3451,40 +3451,40 @@ static void InitArtworkConfig() num_ignore_music_tokens = num_ignore_generic_tokens; ignore_music_tokens = checked_malloc((num_ignore_music_tokens + 1) * sizeof(char *)); - for (i=0; i < num_ignore_generic_tokens; i++) + for (i = 0; i < num_ignore_generic_tokens; i++) ignore_music_tokens[i] = ignore_generic_tokens[i]; ignore_music_tokens[num_ignore_music_tokens] = NULL; - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) image_id_prefix[i] = element_info[i].token_name; - for (i=0; i < NUM_FONTS; i++) + for (i = 0; i < NUM_FONTS; i++) image_id_prefix[MAX_NUM_ELEMENTS + i] = font_info[i].token_name; image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS] = NULL; - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) sound_id_prefix[i] = element_info[i].token_name; - for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (i = 0; i < MAX_NUM_ELEMENTS; i++) sound_id_prefix[MAX_NUM_ELEMENTS + i] = get_string_in_brackets(element_info[i].class_name); sound_id_prefix[2 * MAX_NUM_ELEMENTS] = NULL; - for (i=0; i < NUM_MUSIC_PREFIXES; i++) + for (i = 0; i < NUM_MUSIC_PREFIXES; i++) music_id_prefix[i] = music_prefix_info[i].prefix; music_id_prefix[MAX_LEVELS] = NULL; - for (i=0; i < NUM_ACTIONS; i++) + for (i = 0; i < NUM_ACTIONS; i++) action_id_suffix[i] = element_action_info[i].suffix; action_id_suffix[NUM_ACTIONS] = NULL; - for (i=0; i < NUM_DIRECTIONS; i++) + for (i = 0; i < NUM_DIRECTIONS; i++) direction_id_suffix[i] = element_direction_info[i].suffix; direction_id_suffix[NUM_DIRECTIONS] = NULL; - for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) special_id_suffix[i] = special_suffix_info[i].suffix; special_id_suffix[NUM_SPECIAL_GFX_ARGS] = NULL; - for (i=0; i < MAX_LEVELS; i++) + for (i = 0; i < MAX_LEVELS; i++) level_id_suffix[i] = get_level_id_suffix(i); level_id_suffix[MAX_LEVELS] = NULL; @@ -3512,9 +3512,9 @@ void InitGfx() int i, j; /* determine settings for initial font (for displaying startup messages) */ - for (i=0; image_config[i].token != NULL; i++) + for (i = 0; image_config[i].token != NULL; i++) { - for (j=0; j < NUM_INITIAL_FONTS; j++) + for (j = 0; j < NUM_INITIAL_FONTS; j++) { char font_token[128]; int len_font_token; @@ -3539,7 +3539,7 @@ void InitGfx() } } - for (j=0; j < NUM_INITIAL_FONTS; j++) + for (j = 0; j < NUM_INITIAL_FONTS; j++) { font_initial[j].num_chars = DEFAULT_NUM_CHARS_PER_FONT; font_initial[j].num_chars_per_line = DEFAULT_NUM_CHARS_PER_LINE; @@ -3562,7 +3562,7 @@ void InitGfx() bitmap_font_initial = LoadCustomImage(filename_font_initial); - for (j=0; j < NUM_INITIAL_FONTS; j++) + for (j = 0; j < NUM_INITIAL_FONTS; j++) font_initial[j].bitmap = bitmap_font_initial; InitFontGraphicInfo(); @@ -3588,8 +3588,8 @@ void InitGfxBackground() ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE); - for (x=0; xbitmap, drawto, gd->x, gd->y + gi->border.ysize, gi->width, design_body, @@ -636,7 +636,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) xpos, ypos); /* middle part of gadget */ - for (i=0; ibitmap, drawto, gd->x + gi->border.xsize, gd->y, design_body, gi->height, diff --git a/src/libgame/hash.c b/src/libgame/hash.c index 805190bf..bce20519 100644 --- a/src/libgame/hash.c +++ b/src/libgame/hash.c @@ -58,7 +58,7 @@ create_hashtable(unsigned int minsize, float maxloadfactor, h->table = (struct entry **)malloc(sizeof(struct entry*) * size); if (NULL == h->table) { free(h); return NULL; } /*oom*/ - for (i=0;itable[i] = NULL; } + for (i=0; i < size; i++) { h->table[i] = NULL; } h->tablelength = size; h->entrycount = 0; h->hashfn = hashf; diff --git a/src/libgame/image.c b/src/libgame/image.c index f06a126e..e267fd80 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -47,7 +47,7 @@ Image *newImage(unsigned int width, unsigned int height, unsigned int depth) image->bytes_per_row = width * bytes_per_pixel; image->rgb.used = 0; - for (i=0; irgb.color_used[i] = FALSE; image->type = (depth < 8 ? IMAGETYPE_BITMAP : @@ -115,14 +115,14 @@ static Pixmap Image_to_Mask(Image *image, Display *display, Window window) * the corresponding image pixmap */ - for (y=0; yheight; y++) + for (y = 0; y < image->height; y++) { bitmask = 0x01; /* start with leftmost bit in the byte */ dst_ptr2 = dst_ptr; /* start with leftmost byte in the row */ - for (x=0; xwidth; x++) + for (x = 0; x < image->width; x++) { - for (i=0; ibytes_per_pixel; i++) + for (i = 0; i < image->bytes_per_pixel; i++) if (*src_ptr++) /* source pixel solid? (pixel index != 0) */ *dst_ptr2 |= bitmask; /* then write a bit into the image mask */ @@ -152,7 +152,7 @@ static int bitsPerPixelAtDepth(Display *display, int screen, int depth) pixmap_format = XListPixmapFormats(display, &num_pixmap_formats); /* find format that matches the given depth */ - for (i=0; ired_mask) redcolors <<= 1; @@ -251,7 +251,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, redbottom = greenbottom = bluebottom = 0; redtop = greentop = bluetop = 0; - for (a=0; amap_entries; a++) + for (a = 0; a < visual->map_entries; a++) { if (redbottom < 256) redtop = redbottom + redstep; @@ -307,7 +307,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, ximageinfo->cmap = global_cmap; - for (a=0; a=0; i--) + for (i = num_cmap_entries - 1; i >= 0; i--) { xcolor2.pixel = *(global_cmap_index + i); xcolor2 = xcolor_private[xcolor2.pixel]; @@ -464,9 +464,9 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, { case IMAGETYPE_RGB: { - for (y=0; yheight; y++) /* general case */ + for (y = 0; y < image->height; y++) /* general case */ { - for (x=0; xwidth; x++) + for (x = 0; x < image->width; x++) { pixval = *src_ptr++; pixval = @@ -483,9 +483,9 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, case IMAGETYPE_TRUECOLOR: { - for (y=0; yheight; y++) /* general case */ + for (y = 0; y < image->height; y++) /* general case */ { - for (x=0; xwidth; x++) + for (x = 0; x < image->width; x++) { pixval = memory_to_value(src_ptr, image->bytes_per_pixel); pixval = @@ -515,15 +515,15 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, { if (display_bytes_per_pixel == 1) /* special case */ { - for (y=0; yheight; y++) - for (x=0; xwidth; x++) + for (y = 0; y < image->height; y++) + for (x = 0; x < image->width; x++) *dst_ptr++ = ximageinfo->index[c + *src_ptr++]; } else /* general case */ { - for (y=0; yheight; y++) + for (y = 0; y < image->height; y++) { - for (x=0; xwidth; x++) + for (x = 0; x < image->width; x++) { value_to_memory(ximageinfo->index[c + *src_ptr++], dst_ptr, display_bytes_per_pixel); @@ -611,9 +611,9 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, row_skip = col_skip * src_width; /* scale image down by scaling factor 'zoom_factor' */ - for (y=0; y < src_height; y += zoom_factor, src_ptr += row_skip) - for (x=0; x < src_width; x += zoom_factor, src_ptr += col_skip) - for (i=0; i < bytes_per_pixel; i++) + for (y = 0; y < src_height; y += zoom_factor, src_ptr += row_skip) + for (x = 0; x < src_width; x += zoom_factor, src_ptr += col_skip) + for (i = 0; i < bytes_per_pixel; i++) *dst_ptr++ = *src_ptr++; /* copy scaled image to destination pixmap */ @@ -822,7 +822,7 @@ int getImageIDFromToken(char *token) int num_list_entries = image_info->num_file_list_entries; int i; - for (i=0; i < num_list_entries; i++) + for (i = 0; i < num_list_entries; i++) if (strcmp(file_list[i].token, token) == 0) return i; @@ -866,7 +866,7 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, image_info->dynamic_file_list = NULL; image_info->num_suffix_list_entries = 0; - for (i=0; config_suffix_list[i].token != NULL; i++) + for (i = 0; config_suffix_list[i].token != NULL; i++) image_info->num_suffix_list_entries++; image_info->suffix_list = config_suffix_list; @@ -874,23 +874,23 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, /* ---------- initialize base prefix and suffixes lists ---------- */ image_info->num_base_prefixes = 0; - for (i=0; base_prefixes[i] != NULL; i++) + for (i = 0; base_prefixes[i] != NULL; i++) image_info->num_base_prefixes++; image_info->num_ext1_suffixes = 0; - for (i=0; ext1_suffixes[i] != NULL; i++) + for (i = 0; ext1_suffixes[i] != NULL; i++) image_info->num_ext1_suffixes++; image_info->num_ext2_suffixes = 0; - for (i=0; ext2_suffixes[i] != NULL; i++) + for (i = 0; ext2_suffixes[i] != NULL; i++) image_info->num_ext2_suffixes++; image_info->num_ext3_suffixes = 0; - for (i=0; ext3_suffixes[i] != NULL; i++) + for (i = 0; ext3_suffixes[i] != NULL; i++) image_info->num_ext3_suffixes++; image_info->num_ignore_tokens = 0; - for (i=0; ignore_tokens[i] != NULL; i++) + for (i = 0; ignore_tokens[i] != NULL; i++) image_info->num_ignore_tokens++; image_info->base_prefixes = base_prefixes; diff --git a/src/libgame/joystick.c b/src/libgame/joystick.c index 32efad6f..d9cad128 100644 --- a/src/libgame/joystick.c +++ b/src/libgame/joystick.c @@ -28,7 +28,7 @@ void UnixInitJoysticks() { int i; - for (i=0; i= setup.input[i].joy.xmiddle) setup.input[i].joy.xleft = setup.input[i].joy.xmiddle - distance; @@ -317,7 +317,7 @@ int AnyJoystick() int i; int result = 0; - for (i=0; ifilename, filename); /* when file definition found, set all parameters to default values */ - for (i=0; suffix_list[i].token != NULL; i++) + for (i = 0; suffix_list[i].token != NULL; i++) setString(&file_list_entry->parameter[i], suffix_list[i].value); file_list_entry->redefined = TRUE; @@ -1867,7 +1867,7 @@ static void read_token_parameters(SetupFileHash *setup_file_hash, #endif /* check for config tokens that can be build by base token and suffixes */ - for (i=0; suffix_list[i].token != NULL; i++) + for (i = 0; suffix_list[i].token != NULL; i++) { char *token = getStringCat2(file_list_entry->token, suffix_list[i].token); char *value = getHashEntry(setup_file_hash, token); @@ -1963,11 +1963,11 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, return; /* read parameters for all known config file tokens */ - for (i=0; itype), 150, FC_YELLOW); /* always start with reliable default values */ - for (i=0; idynamic_file_list != NULL) { - for (i=0; inum_dynamic_file_list_entries; i++) + for (i = 0; i < artwork_info->num_dynamic_file_list_entries; i++) { free(artwork_info->dynamic_file_list[i].token); free(artwork_info->dynamic_file_list[i].filename); @@ -2508,7 +2508,7 @@ void ReloadCustomArtworkList(struct ArtworkListInfo *artwork_info) num_file_list_entries); #endif - for(i=0; idynamic_artwork_list[i], dynamic_file_list[i].filename, i); @@ -2554,7 +2554,7 @@ static void FreeCustomArtworkList(struct ArtworkListInfo *artwork_info, if (*list == NULL) return; - for(i=0; i<*num_list_entries; i++) + for (i = 0; i < *num_list_entries; i++) deleteArtworkListEntry(artwork_info, &(*list)[i]); free(*list); diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index ec19ef63..02c6a96e 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -60,10 +60,10 @@ static void allegro_init_drivers() { int i; - for (i=0; i>= 10; /* try to use existing colors from the global colormap */ - for (i=0; irgb.color_used[i]) continue; @@ -527,8 +527,8 @@ static BITMAP *Image_to_AllegroBitmap(Image *image) } /* copy bitmap data */ - for (y=0; yheight; y++) - for (x=0; xwidth; x++) + for (y = 0; y < image->height; y++) + for (x = 0; x < image->width; x++) putpixel(bitmap, x, y, pixel_mapping[*src_ptr++]); return bitmap; @@ -671,7 +671,7 @@ static void HandleKeyboardRaw(int mode) { int i; - for (i=0; irgb.red[i] = *buffer_ptr++ << 8; image->rgb.green[i] = *buffer_ptr++ << 8; @@ -256,7 +256,7 @@ static boolean PCX_ReadColormap(FILE *file,struct PCX_Header *pcx,Image *image) while (value != PCX_256COLORS_MAGIC); /* read 256 colors from PCX colormap */ - for(i = 0; i < PCX_MAXCOLORS; i++) + for (i = 0; i < PCX_MAXCOLORS; i++) { image->rgb.red[i] = (byte)fgetc(file) << 8; image->rgb.green[i] = (byte)fgetc(file) << 8; @@ -265,7 +265,7 @@ static boolean PCX_ReadColormap(FILE *file,struct PCX_Header *pcx,Image *image) } else { - for(i = 0; i < num_colors; i++) + for (i = 0; i < num_colors; i++) { image->rgb.red[i] = pcx->palette[i][0] << 8; image->rgb.green[i] = pcx->palette[i][1] << 8; @@ -375,7 +375,7 @@ Image *Read_PCX_to_Image(char *filename) if (pcx_depth == 8) { /* determine number of used colormap entries for 8-bit PCX images */ - for (i=0; irgb.color_used[i]) image->rgb.used++; } diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 74123228..e9d10df5 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -71,7 +71,7 @@ inline void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window, fullscreen_yoffset = 0; #ifdef FULLSCREEN_BUG - for (i=0; screen_xy[i][0] != -1; i++) + for (i = 0; screen_xy[i][0] != -1; i++) { if (video.width <= screen_xy[i][0] && video.height <= screen_xy[i][1]) { @@ -340,11 +340,11 @@ inline void SDLDrawLines(SDL_Surface *surface, struct XY *points, int i, x, y; int line_width = 4; - for (i=0; iformat->palette->ncolors; i++) + for (i = 0; i < zoom_src->format->palette->ncolors; i++) zoom_dst->format->palette->colors[i] = zoom_src->format->palette->colors[i]; zoom_dst->format->palette->ncolors = zoom_src->format->palette->ncolors; @@ -1454,7 +1454,7 @@ void SDLInitJoysticks() } } - for (i=0; inext = sort_array[i + 1]; sort_array[num_nodes - 1]->next = NULL; @@ -1180,7 +1180,7 @@ char *getFormattedSetupEntry(char *token, char *value) /* start with the token and some spaces to format output line */ sprintf(entry, "%s:", token); - for (i=strlen(entry); i= 0) break; @@ -645,7 +645,7 @@ void Mixer_InitChannels() { int i; - for(i=0; i 0 && IS_LOOP(snd_ctrl)) { - for(i=audio.first_sound_channel; idata_ptr + num_channels * sample_pos; - for (i=0; inum_channels == 1 ? 0 : i); - for (j=0; jdata_ptr + num_channels * sample_pos; - for (i=0; inum_channels == 1 ? 0 : i); - for (j=0; j= mixer[i].data_len) Mixer_StopChannel(i); - for(i=0; i> 8) ^ 0x80; /* finally play the sound fragment */ @@ -1449,7 +1449,7 @@ void Mixer_Main() FD_ZERO(&mixer_fdset); FD_SET(audio.mixer_pipe[0], &mixer_fdset); - while(1) /* wait for sound playing commands from client */ + while (1) /* wait for sound playing commands from client */ { struct timeval delay = { 0, 0 }; @@ -1822,11 +1822,11 @@ static void *Load_WAV(char *filename) int i; if (snd_ctrl->format == AUDIO_FORMAT_U8) - for (i=0; idynamic_file_list = NULL; sound_info->num_suffix_list_entries = 0; - for (i=0; config_suffix_list[i].token != NULL; i++) + for (i = 0; config_suffix_list[i].token != NULL; i++) sound_info->num_suffix_list_entries++; sound_info->suffix_list = config_suffix_list; @@ -2071,23 +2071,23 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, /* ---------- initialize base prefix and suffixes lists ---------- */ sound_info->num_base_prefixes = 0; - for (i=0; base_prefixes[i] != NULL; i++) + for (i = 0; base_prefixes[i] != NULL; i++) sound_info->num_base_prefixes++; sound_info->num_ext1_suffixes = 0; - for (i=0; ext1_suffixes[i] != NULL; i++) + for (i = 0; ext1_suffixes[i] != NULL; i++) sound_info->num_ext1_suffixes++; sound_info->num_ext2_suffixes = 0; - for (i=0; ext2_suffixes[i] != NULL; i++) + for (i = 0; ext2_suffixes[i] != NULL; i++) sound_info->num_ext2_suffixes++; sound_info->num_ext3_suffixes = 0; - for (i=0; ext3_suffixes[i] != NULL; i++) + for (i = 0; ext3_suffixes[i] != NULL; i++) sound_info->num_ext3_suffixes++; sound_info->num_ignore_tokens = 0; - for (i=0; ignore_tokens[i] != NULL; i++) + for (i = 0; ignore_tokens[i] != NULL; i++) sound_info->num_ignore_tokens++; sound_info->base_prefixes = base_prefixes; @@ -2143,7 +2143,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, music_info->dynamic_file_list = NULL; music_info->num_suffix_list_entries = 0; - for (i=0; config_suffix_list[i].token != NULL; i++) + for (i = 0; config_suffix_list[i].token != NULL; i++) music_info->num_suffix_list_entries++; music_info->suffix_list = config_suffix_list; @@ -2151,23 +2151,23 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, /* ---------- initialize base prefix and suffixes lists ---------- */ music_info->num_base_prefixes = 0; - for (i=0; base_prefixes[i] != NULL; i++) + for (i = 0; base_prefixes[i] != NULL; i++) music_info->num_base_prefixes++; music_info->num_ext1_suffixes = 0; - for (i=0; ext1_suffixes[i] != NULL; i++) + for (i = 0; ext1_suffixes[i] != NULL; i++) music_info->num_ext1_suffixes++; music_info->num_ext2_suffixes = 0; - for (i=0; ext2_suffixes[i] != NULL; i++) + for (i = 0; ext2_suffixes[i] != NULL; i++) music_info->num_ext2_suffixes++; music_info->num_ext3_suffixes = 0; - for (i=0; ext3_suffixes[i] != NULL; i++) + for (i = 0; ext3_suffixes[i] != NULL; i++) music_info->num_ext3_suffixes++; music_info->num_ignore_tokens = 0; - for (i=0; ignore_tokens[i] != NULL; i++) + for (i = 0; ignore_tokens[i] != NULL; i++) music_info->num_ignore_tokens++; music_info->base_prefixes = base_prefixes; @@ -2423,7 +2423,7 @@ static void FreeAllMusic_NoConf() if (Music_NoConf == NULL) return; - for(i=0; i < num_music_noconf; i++) + for (i = 0; i < num_music_noconf; i++) FreeMusic(Music_NoConf[i]); free(Music_NoConf); diff --git a/src/libgame/system.c b/src/libgame/system.c index 96adfcfe..1c33deb6 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -194,9 +194,9 @@ static void DrawBitmapFromTile(Bitmap *bitmap, Bitmap *tile, int tile_ysteps = (bitmap_ysize + tile_ysize - 1) / tile_ysize; int x, y; - for (y=0; y < tile_ysteps; y++) + for (y = 0; y < tile_ysteps; y++) { - for (x=0; x < tile_xsteps; x++) + for (x = 0; x < tile_xsteps; x++) { int draw_x = dest_x + x * tile_xsize; int draw_y = dest_y + y * tile_ysize; @@ -559,9 +559,9 @@ inline void DrawLine(Bitmap *bitmap, int from_x, int from_y, { int x, y; - for (x=0; xwidth, &cursor->height); i = -1; - for (y=0; y < cursor->width; y++) + for (y = 0; y < cursor->width; y++) { - for (x=0; x < cursor->height; x++) + for (x = 0; x < cursor->height; x++) { int bit_nr = x % 8; int bit_mask = 0x01 << (bit_order_msb ? 7 - bit_nr : bit_nr ); @@ -1165,7 +1165,7 @@ inline void InitJoysticks() /* always start with reliable default values */ joystick.status = JOYSTICK_NOT_AVAILABLE; - for (i=0; iclip_mask; @@ -87,11 +87,11 @@ static void FreeFontClipmasks() if (gfx.num_fonts == 0 || gfx.font_bitmap_info[0].bitmap == NULL) return; - for (i=0; i < gfx.num_fonts; i++) + for (i = 0; i < gfx.num_fonts; i++) { if (gfx.font_bitmap_info[i].clip_mask) { - for (j=0; j < gfx.font_bitmap_info[i].num_chars; j++) + for (j = 0; j < gfx.font_bitmap_info[i].num_chars; j++) XFreePixmap(display, gfx.font_bitmap_info[i].clip_mask[j]); free(gfx.font_bitmap_info[i].clip_mask); } @@ -351,7 +351,7 @@ void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length, char buffer[MAX_OUTPUT_LINESIZE + 1]; int i; - for (i=0; i < line_length && *text; i++) + for (i = 0; i < line_length && *text; i++) if ((buffer[i] = *text++) == '\n') break; buffer[MIN(i, area_xsize)] = '\0'; diff --git a/src/libgame/x11.c b/src/libgame/x11.c index d7acc801..ce520f64 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -214,7 +214,7 @@ static DrawWindow *X11InitWindow() XCreateGC(display, new_window->drawable, gc_valuemask, &gc_values); /* create GCs for line drawing (black and white) */ - for(i=0; i<2; i++) + for (i = 0; i < 2; i++) { gc_values.graphics_exposures = False; gc_values.foreground = (i ? pen_fg : pen_bg); diff --git a/src/netserv.c b/src/netserv.c index 11fd9bc8..71834c3b 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -89,8 +89,9 @@ static void broadcast(struct NetworkServerPlayerInfo *except, realbuffer[0] = realbuffer[1] = realbuffer[2] = 0; realbuffer[3] = (unsigned char)len; - for (player=first_player; player; player=player->next) - if (player != except && (player->active || !activeonly) && player->introduced) + for (player = first_player; player; player = player->next) + if (player != except && player->introduced && + (player->active || !activeonly)) addtobuffer(player, realbuffer, 4 + len); } @@ -113,7 +114,7 @@ static void RemovePlayer(struct NetworkServerPlayerInfo *player) first_player = player->next; else { - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { if (v->next && v->next == player) { @@ -149,6 +150,7 @@ static void AddPlayer(int fd) { struct NetworkServerPlayerInfo *player, *v; unsigned char nxn; + boolean again = TRUE; player = checked_malloc(sizeof (struct NetworkServerPlayerInfo)); @@ -166,9 +168,28 @@ static void AddPlayer(int fd) nxn = 1; +#if 1 + while (again) + { + again = FALSE; + v = player->next; + + while (v) + { + if (v->number == nxn) + { + nxn++; + + again = TRUE; + break; + } + v = v->next; + } + } +#else again: v = player->next; - while(v) + while (v) { if (v->number == nxn) { @@ -177,6 +198,7 @@ static void AddPlayer(int fd) } v = v->next; } +#endif player->number = nxn; if (options.verbose) @@ -233,7 +255,7 @@ static void Handle_OP_NUMBER_WANTED(struct NetworkServerPlayerInfo *player) Error(ERR_NETWORK_SERVER, "client %d (%s) wants to switch to # %d", player->number, player->player_name, nr_wanted); - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { if (v->number == nr_wanted) { @@ -281,7 +303,7 @@ static void Handle_OP_PLAYER_NAME(struct NetworkServerPlayerInfo *player, len=16; memcpy(player->player_name, &buffer[2], len-2); player->player_name[len-2] = 0; - for (i=0; iplayer_name[i] < ' ' || ((unsigned char)(player->player_name[i]) > 0x7e && @@ -307,7 +329,7 @@ static void Handle_OP_PLAYER_NAME(struct NetworkServerPlayerInfo *player, if (!player->introduced) { - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { if (v != player && v->introduced) { @@ -336,7 +358,7 @@ static void Handle_OP_START_PLAYING(struct NetworkServerPlayerInfo *player) (buffer[4] << 8) + buffer[5], &buffer[6]); - for (w=first_player; w; w=w->next) + for (w = first_player; w; w = w->next) if (w->introduced) w->active = 1; @@ -344,7 +366,7 @@ static void Handle_OP_START_PLAYING(struct NetworkServerPlayerInfo *player) ServerFrameCounter = 0; /* reset player actions */ - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { v->action = 0; v->action_received = FALSE; @@ -384,7 +406,7 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) int i; /* store player action */ - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { if (v->number == player->number) { @@ -394,7 +416,7 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) } /* check if server received action from each player */ - for (v=first_player; v; v=v->next) + for (v = first_player; v; v = v->next) { if (!v->action_received) return; @@ -404,11 +426,11 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) } /* initialize all player actions to zero */ - for (i=0; inext) + for (v = first_player; v; v = v->next) { buffer[6 + v->number-1] = v->action; v->action = 0; @@ -478,7 +500,7 @@ void NetworkServer(int port, int serveronly) { /* become a daemon, breaking all ties with the controlling terminal */ options.verbose = FALSE; - for (i=0; i<255; i++) + for (i = 0; i < 255; i++) { if (i != lfd) close(i); @@ -504,11 +526,11 @@ void NetworkServer(int port, int serveronly) PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, PROTOCOL_VERSION_3); } - while(1) + while (1) { interrupt = 0; - for (player=first_player; player; player=player->next) + for (player = first_player; player; player = player->next) flushuser(player); FD_ZERO(&fds); diff --git a/src/network.c b/src/network.c index 5511d176..73a13b1f 100644 --- a/src/network.c +++ b/src/network.c @@ -100,7 +100,7 @@ char *getNetworkPlayerName(int player_nr) else if (player_nr == first_player.nr) return("you"); else - for (player=&first_player; player; player=player->next) + for (player = &first_player; player; player = player->next) if (player->nr == player_nr && player->name && strlen(player->name)) return(player->name); @@ -173,7 +173,7 @@ boolean ConnectToServer(char *hostname, int port) StartNetworkServer(port); /* wait for server to start up and try connecting several times */ - for (i=0; i<6; i++) + for (i = 0; i < 6; i++) { Delay(500); /* wait 500 ms == 0.5 seconds */ close(sfd); @@ -378,7 +378,7 @@ static void Handle_OP_PLAYER_CONNECTED() printf("OP_PLAYER_CONNECTED: %d\n", new_client_nr); Error(ERR_NETWORK_CLIENT, "new client %d connected", new_client_nr); - for (player=&first_player; player; player=player->next) + for (player = &first_player; player; player = player->next) { if (player->nr == new_client_nr) Error(ERR_EXIT, "multiplayer server sent duplicate player id"); @@ -405,7 +405,7 @@ static void Handle_OP_PLAYER_DISCONNECTED() Error(ERR_NETWORK_CLIENT, "client %d (%s) disconnected", player_nr, getNetworkPlayerName(buffer[0])); - for (player=&first_player; player; player=player->next) + for (player = &first_player; player; player = player->next) if (player->next == player_disconnected) player->next = player_disconnected->next; free(player_disconnected); @@ -506,7 +506,7 @@ static void Handle_OP_MOVE_PLAYER(unsigned int len) } /* copy valid player actions */ - for (i=0; i 3 ? i-3 : 0); @@ -2214,7 +2214,7 @@ void CustomizeKeyboard(int player_nr) DrawText(mSX + 4*32, mSY + (2+2*step_nr+1)*32, getKeyNameFromKey(*customize_step[step_nr].key), FONT_VALUE_OLD); - while(!finished) + while (!finished) { if (PendingEvent()) /* got event */ { @@ -2243,7 +2243,7 @@ void CustomizeKeyboard(int player_nr) key = *customize_step[step_nr].key; /* check if key already used */ - for (i=0; iclip_mask = None; @@ -2815,7 +2815,7 @@ void FreeScreenGadgets() } #endif - for (i=0; i= x1 && xx <= x2 && yy >= y1 && yy <= y2) DrawScreenField(xx, yy); DrawAllPlayers(); @@ -263,8 +263,8 @@ void BackToFront() if (redraw_mask & REDRAW_TILES) { - for(x=0; xstored_clip_gc; @@ -2785,7 +2785,7 @@ void CreateToolButtons() { int i; - for (i=0; i