- fixed a bug where translation parameters were simply not read right

- fixed some oddness about how SourceMod determines that a phrase does not exist

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40915
This commit is contained in:
David Anderson 2007-06-07 06:16:38 +00:00
parent ebf3afb35f
commit a2dff5f7d0

View File

@ -89,7 +89,7 @@ try_serverlang:
if (!TryTranslation(pl, key, langid, langcount, &pTrans))
{
if (target != LANG_SERVER)
if (target != LANG_SERVER && langid != g_Translator.GetServerLanguage())
{
target = LANG_SERVER;
goto try_serverlang;
@ -99,19 +99,31 @@ try_serverlang:
pCtx->ThrowNativeErrorEx(SP_ERROR_PARAM, "Language phrase \"%s\" not found", key);
goto error_out;
}
} else {
pCtx->ThrowNativeErrorEx(SP_ERROR_PARAM, "Language prhase \"%s\" not found", key);
goto error_out;
}
}
max_params = pTrans.fmt_count;
if (max_params)
{
/* Check if we're going to over the limit */
if ((*arg) + (max_params - 1) > (size_t)params[0])
{
pCtx->ThrowNativeErrorEx(SP_ERROR_PARAMS_MAX,
"Translation string formatted incorrectly - missing at least %d parameters",
((*arg + (max_params - 1)) - params[0])
);
goto error_out;
}
/* Translate the parameters to raw pointers */
for (size_t i=0; i<max_params; i++)
{
pCtx->LocalToPhysAddr(params[*arg], reinterpret_cast<cell_t **>(&new_params[i]));
(*arg)++;
if ((*arg) + i > (size_t)params[0])
{
pCtx->ThrowNativeErrorEx(SP_ERROR_PARAMS_MAX, "Translation string formatted incorrectly - parameter %d (total %d)", (*arg) + i, params[0]);
goto error_out;
}
}