src/screenshot.cpp
branchnoai
changeset 9629 66dde6412125
parent 9628 b5c2449616b5
child 9631 8a2d1c2ceb88
equal deleted inserted replaced
9628:b5c2449616b5 9629:66dde6412125
   483 /* screenshot generator that dumps the current video buffer */
   483 /* screenshot generator that dumps the current video buffer */
   484 static void CurrentScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
   484 static void CurrentScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
   485 {
   485 {
   486 	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
   486 	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
   487 	void *src = blitter->MoveTo(_screen.dst_ptr, 0, y);
   487 	void *src = blitter->MoveTo(_screen.dst_ptr, 0, y);
   488 	blitter->CopyToBuffer(src, buf, _screen.width, n, pitch);
   488 	blitter->CopyImageToBuffer(src, buf, _screen.width, n, pitch);
   489 }
   489 }
   490 
   490 
   491 /* generate a large piece of the world */
   491 /* generate a large piece of the world */
   492 static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
   492 static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
   493 {
   493 {
   529 	size_t len;
   529 	size_t len;
   530 
   530 
   531 	if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_player == PLAYER_SPECTATOR) {
   531 	if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_player == PLAYER_SPECTATOR) {
   532 		ttd_strlcpy(_screenshot_name, "screenshot", lengthof(_screenshot_name));
   532 		ttd_strlcpy(_screenshot_name, "screenshot", lengthof(_screenshot_name));
   533 	} else {
   533 	} else {
   534 		const Player* p = GetPlayer(_local_player);
   534 		SetDParam(0, _local_player);
   535 		SetDParam(0, p->name_1);
   535 		SetDParam(1, _date);
   536 		SetDParam(1, p->name_2);
       
   537 		SetDParam(2, _date);
       
   538 		GetString(_screenshot_name, STR_4004, lastof(_screenshot_name));
   536 		GetString(_screenshot_name, STR_4004, lastof(_screenshot_name));
   539 	}
   537 	}
   540 
   538 
   541 	/* Add extension to screenshot file */
   539 	/* Add extension to screenshot file */
   542 	SanitizeFilename(_screenshot_name);
   540 	SanitizeFilename(_screenshot_name);