changeset 5024:7df29e14767e draft

(svn r7065) Use simple assignment instead of memcpy()
author tron <tron@openttd.org>
date Sun, 05 Nov 2006 08:24:52 +0000
parents 0d126a226159
children 531be72c6bf8
files genworld_gui.c newgrf.c openttd.c settings_gui.c sound.c
diffstat 5 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/genworld_gui.c
+++ b/genworld_gui.c
@@ -163,7 +163,7 @@
 	/* Copy all XXX_newgame to XXX */
 	UpdatePatches();
 	_opt_ptr = &_opt;
-	memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions));
+	*_opt_ptr = _opt_newgame;
 	/* Load the right landscape stuff */
 	GfxLoadSprites();
 
--- a/newgrf.c
+++ b/newgrf.c
@@ -1272,7 +1272,7 @@
 					FileEntry *oldfe = GetSound(orig_sound);
 
 					/* Literally copy the data of the new sound over the original */
-					memcpy(oldfe, newfe, sizeof(*oldfe));
+					*oldfe = *newfe;
 				}
 			}
 			break;
@@ -2939,7 +2939,7 @@
 
 	grfmsg(GMS_NOTICE, "ImportGRFSound: Copying sound %d (%d) from file %X", sound, file->sound_offset + sound, grfid);
 
-	memcpy(se, GetSound(file->sound_offset + sound), sizeof(*se));
+	*se = *GetSound(file->sound_offset + sound);
 
 	/* Reset volume and priority, which TTDPatch doesn't copy */
 	se->volume   = 128;
--- a/openttd.c
+++ b/openttd.c
@@ -456,7 +456,7 @@
 
 	/* Make sure _patches is filled with _patches_newgame if we switch to a game directly */
 	if (_switch_mode != SM_NONE) {
-		memcpy(&_opt, &_opt_newgame, sizeof(_opt));
+		_opt = _opt_newgame;
 		GfxLoadSprites();
 		UpdatePatches();
 	}
@@ -662,7 +662,7 @@
 	}
 
 	_opt_ptr = &_opt;
-	memcpy(&_opt_ptr->diff, &_opt_newgame.diff, sizeof(_opt_ptr->diff));
+	_opt_ptr->diff = _opt_newgame.diff;
 	_opt.diff_level = _opt_newgame.diff_level;
 
 	// Inititalize data
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -554,7 +554,7 @@
 	DeleteWindowById(WC_GAME_OPTIONS, 0);
 	/* Copy current settings (ingame or in intro) to temporary holding place
 	 * change that when setting stuff, copy back on clicking 'OK' */
-	memcpy(&_opt_mod_temp, _opt_ptr, sizeof(GameOptions));
+	_opt_mod_temp = *_opt_ptr;
 	AllocateWindowDesc(&_game_difficulty_desc);
 }
 
--- a/sound.c
+++ b/sound.c
@@ -186,7 +186,7 @@
 		FileEntry *orig = &_files[_sound_idx[i]];
 		FileEntry *fe = AllocateFileEntry();
 
-		memcpy(fe, orig, sizeof(*orig));
+		*fe = *orig;
 		fe->volume = _sound_base_vol[i];
 		fe->priority = 0;
 	}