openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: textbuf.cpp 25708 2013-08-10 12:47:11Z fonsinchen $ */
/* $Id: textbuf.cpp 26758 2014-08-24 10:34:43Z michi_cc $ */
/*
* This file is part of OpenTTD.
@@ -20,13 +20,17 @@
#include "window_func.h"
#include "core/alloc_func.hpp"
#include "safeguards.h"
/**
* Try to retrieve the current clipboard contents.
*
* @note OS-specific function.
* @param buffer Clipboard content.
* @param last The pointer to the last element of the destination buffer
* @return True if some text could be retrieved.
*/
bool GetClipboardContents(char *buffer, size_t buff_len);
bool GetClipboardContents(char *buffer, const char *last);
int _caret_timer;
@@ -224,7 +228,7 @@ bool Textbuf::InsertClipboard()
{
char utf8_buf[512];
if (!GetClipboardContents(utf8_buf, lengthof(utf8_buf))) return false;
if (!GetClipboardContents(utf8_buf, lastof(utf8_buf))) return false;
return this->InsertString(utf8_buf, false);
}
@@ -404,7 +408,7 @@ void Textbuf::Assign(StringID string)
*/
void Textbuf::Assign(const char *text)
{
ttd_strlcpy(this->buf, text, this->max_bytes);
strecpy(this->buf, text, &this->buf[this->max_bytes - 1]);
this->UpdateSize();
}
@@ -415,7 +419,7 @@ void Textbuf::Print(const char *format, ...)
{
va_list va;
va_start(va, format);
vsnprintf(this->buf, this->max_bytes, format, va);
vseprintf(this->buf, &this->buf[this->max_bytes - 1], format, va);
va_end(va);
this->UpdateSize();
}
@@ -473,16 +477,10 @@ HandleKeyPressResult Textbuf::HandleKeyPress(WChar key, uint16 keycode)
case WKC_RETURN: case WKC_NUM_ENTER: return HKPR_CONFIRM;
#ifdef WITH_COCOA
case (WKC_META | 'V'):
#endif
case (WKC_CTRL | 'V'):
edited = this->InsertClipboard();
break;
#ifdef WITH_COCOA
case (WKC_META | 'U'):
#endif
case (WKC_CTRL | 'U'):
this->DeleteAll();
edited = true;