|
|
|
@ -58,7 +58,65 @@ int Translation_Finish(DFHackObject* trans)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* Translation_TranslateNameEnglish(DFHackObject* trans, const DFHack::t_name* name, char* (*char_buffer_create)(int))
|
|
|
|
|
// char* Translation_TranslateNameEnglish(DFHackObject* trans, const DFHack::t_name* name, char* (*char_buffer_create)(int))
|
|
|
|
|
// {
|
|
|
|
|
// if(trans != NULL)
|
|
|
|
|
// {
|
|
|
|
|
// std::string nameTrans = ((DFHack::Translation*)trans)->TranslateName(*name, true);
|
|
|
|
|
|
|
|
|
|
// if(nameTrans.size() > 0)
|
|
|
|
|
// {
|
|
|
|
|
// char* buf = (*char_buffer_create)(nameTrans.size());
|
|
|
|
|
|
|
|
|
|
// if(buf != NULL)
|
|
|
|
|
// {
|
|
|
|
|
// size_t len = nameTrans.copy(buf, nameTrans.size());
|
|
|
|
|
|
|
|
|
|
// if(len > 0)
|
|
|
|
|
// buf[len] = '\0';
|
|
|
|
|
// else
|
|
|
|
|
// buf[0] = '\0';
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return buf;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// return NULL;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return NULL;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// char* Translation_TranslateNameNonEnglish(DFHackObject* trans, const DFHack::t_name* name, char* (*char_buffer_create)(int))
|
|
|
|
|
// {
|
|
|
|
|
// if(trans != NULL)
|
|
|
|
|
// {
|
|
|
|
|
// std::string nameTrans = ((DFHack::Translation*)trans)->TranslateName(*name, false);
|
|
|
|
|
|
|
|
|
|
// if(nameTrans.size() > 0)
|
|
|
|
|
// {
|
|
|
|
|
// char* buf = (*char_buffer_create)(nameTrans.size());
|
|
|
|
|
|
|
|
|
|
// if(buf != NULL)
|
|
|
|
|
// {
|
|
|
|
|
// size_t len = nameTrans.copy(buf, nameTrans.size());
|
|
|
|
|
|
|
|
|
|
// if(len > 0)
|
|
|
|
|
// buf[len] = '\0';
|
|
|
|
|
// else
|
|
|
|
|
// buf[0] = '\0';
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return buf;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// return NULL;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return NULL;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
char* Translation_TranslateNameEnglish(DFHackObject* trans, const DFHack::t_name* name)
|
|
|
|
|
{
|
|
|
|
|
if(trans != NULL)
|
|
|
|
|
{
|
|
|
|
@ -66,7 +124,9 @@ char* Translation_TranslateNameEnglish(DFHackObject* trans, const DFHack::t_name
|
|
|
|
|
|
|
|
|
|
if(nameTrans.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
char* buf = (*char_buffer_create)(nameTrans.size());
|
|
|
|
|
char* buf;
|
|
|
|
|
|
|
|
|
|
(*alloc_char_buffer_callback)(buf, nameTrans.size());
|
|
|
|
|
|
|
|
|
|
if(buf != NULL)
|
|
|
|
|
{
|
|
|
|
@ -87,7 +147,7 @@ char* Translation_TranslateNameEnglish(DFHackObject* trans, const DFHack::t_name
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* Translation_TranslateNameNonEnglish(DFHackObject* trans, const DFHack::t_name* name, char* (*char_buffer_create)(int))
|
|
|
|
|
char* Translation_TranslateNameNonEnglish(DFHackObject* trans, const DFHack::t_name* name)
|
|
|
|
|
{
|
|
|
|
|
if(trans != NULL)
|
|
|
|
|
{
|
|
|
|
@ -95,7 +155,9 @@ char* Translation_TranslateNameNonEnglish(DFHackObject* trans, const DFHack::t_n
|
|
|
|
|
|
|
|
|
|
if(nameTrans.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
char* buf = (*char_buffer_create)(nameTrans.size());
|
|
|
|
|
char* buf;
|
|
|
|
|
|
|
|
|
|
(*alloc_char_buffer_callback)(buf, nameTrans.size());
|
|
|
|
|
|
|
|
|
|
if(buf != NULL)
|
|
|
|
|
{
|
|
|
|
|