mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r7065) Use simple assignment instead of memcpy()
This commit is contained in:
parent
60ea083b28
commit
2a53bcf2b0
@ -163,7 +163,7 @@ static void StartGeneratingLandscape(glwp_modes mode)
|
|||||||
/* Copy all XXX_newgame to XXX */
|
/* Copy all XXX_newgame to XXX */
|
||||||
UpdatePatches();
|
UpdatePatches();
|
||||||
_opt_ptr = &_opt;
|
_opt_ptr = &_opt;
|
||||||
memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions));
|
*_opt_ptr = _opt_newgame;
|
||||||
/* Load the right landscape stuff */
|
/* Load the right landscape stuff */
|
||||||
GfxLoadSprites();
|
GfxLoadSprites();
|
||||||
|
|
||||||
|
4
newgrf.c
4
newgrf.c
@ -1272,7 +1272,7 @@ static bool SoundEffectChangeInfo(uint sid, int numinfo, int prop, byte **bufp,
|
|||||||
FileEntry *oldfe = GetSound(orig_sound);
|
FileEntry *oldfe = GetSound(orig_sound);
|
||||||
|
|
||||||
/* Literally copy the data of the new sound over the original */
|
/* Literally copy the data of the new sound over the original */
|
||||||
memcpy(oldfe, newfe, sizeof(*oldfe));
|
*oldfe = *newfe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2939,7 +2939,7 @@ static void ImportGRFSound(byte *buf, int len)
|
|||||||
|
|
||||||
grfmsg(GMS_NOTICE, "ImportGRFSound: Copying sound %d (%d) from file %X", sound, file->sound_offset + sound, grfid);
|
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 */
|
/* Reset volume and priority, which TTDPatch doesn't copy */
|
||||||
se->volume = 128;
|
se->volume = 128;
|
||||||
|
@ -456,7 +456,7 @@ int ttd_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Make sure _patches is filled with _patches_newgame if we switch to a game directly */
|
/* Make sure _patches is filled with _patches_newgame if we switch to a game directly */
|
||||||
if (_switch_mode != SM_NONE) {
|
if (_switch_mode != SM_NONE) {
|
||||||
memcpy(&_opt, &_opt_newgame, sizeof(_opt));
|
_opt = _opt_newgame;
|
||||||
GfxLoadSprites();
|
GfxLoadSprites();
|
||||||
UpdatePatches();
|
UpdatePatches();
|
||||||
}
|
}
|
||||||
@ -662,7 +662,7 @@ static void StartScenario(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_opt_ptr = &_opt;
|
_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;
|
_opt.diff_level = _opt_newgame.diff_level;
|
||||||
|
|
||||||
// Inititalize data
|
// Inititalize data
|
||||||
|
@ -554,7 +554,7 @@ void ShowGameDifficulty(void)
|
|||||||
DeleteWindowById(WC_GAME_OPTIONS, 0);
|
DeleteWindowById(WC_GAME_OPTIONS, 0);
|
||||||
/* Copy current settings (ingame or in intro) to temporary holding place
|
/* Copy current settings (ingame or in intro) to temporary holding place
|
||||||
* change that when setting stuff, copy back on clicking 'OK' */
|
* 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);
|
AllocateWindowDesc(&_game_difficulty_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
sound.c
2
sound.c
@ -186,7 +186,7 @@ void SndCopyToPool(void)
|
|||||||
FileEntry *orig = &_files[_sound_idx[i]];
|
FileEntry *orig = &_files[_sound_idx[i]];
|
||||||
FileEntry *fe = AllocateFileEntry();
|
FileEntry *fe = AllocateFileEntry();
|
||||||
|
|
||||||
memcpy(fe, orig, sizeof(*orig));
|
*fe = *orig;
|
||||||
fe->volume = _sound_base_vol[i];
|
fe->volume = _sound_base_vol[i];
|
||||||
fe->priority = 0;
|
fe->priority = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user