(svn r25169) [1.3] -Backport from trunk:

- Fix: Several typos/inconsistencies in English strings [FS#5496] (r25144, r25143)
- Fix: When extra dynamite was disabled, towns would be allowed to clear bridges with trams (r25141)
- Fix: Towns are build as OWNER_TOWN, so they also need to be removed as OWNER_TOWN otherwise parts might remain [FS#5519] (r25140)
- Fix: Editboxes could become too small when resizing windows (r25121)
- Fix: Game script language files did not work, when inside a tar [FS#5509] (r25117, r25114)
This commit is contained in:
rubidium 2013-04-08 20:56:30 +00:00
parent 6bb922953d
commit 283ab728f2
8 changed files with 55 additions and 48 deletions

View File

@ -5079,7 +5079,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetPlaneType(): -1
Engine 211
IsValidEngine(): true
GetName(): Yate Cargo ship
GetName(): Yate Cargo Ship
GetCargoType(): 5
CanRefitCargo(): true
GetCapacity(): 160

View File

@ -112,11 +112,6 @@ public:
*/
static class GameInstance *GetInstance() { return Game::instance; }
/**
* Get the current active mainscript.
*/
static const char *GetMainScript();
#if defined(ENABLE_NETWORK)
/** Wrapper function for GameScanner::HasGame */
static bool HasGame(const struct ContentInfo *ci, bool md5sum);

View File

@ -27,11 +27,6 @@
/* static */ GameScannerInfo *Game::scanner_info = NULL;
/* static */ GameScannerLibrary *Game::scanner_library = NULL;
/* static */ const char *Game::GetMainScript()
{
return Game::info->GetMainScript();
}
/* static */ void Game::GameLoop()
{
if (_networking && !_network_server) return;

View File

@ -13,10 +13,12 @@
#include "../strgen/strgen.h"
#include "../debug.h"
#include "../fileio_func.h"
#include "../tar_type.h"
#include "../script/squirrel_class.hpp"
#include "../strings_func.h"
#include "game_text.hpp"
#include "game.hpp"
#include "game_info.hpp"
#include "table/strings.h"
@ -208,22 +210,6 @@ struct StringNameWriter : HeaderWriter {
}
};
static void GetBasePath(char *buffer, size_t length)
{
strecpy(buffer, Game::GetMainScript(), buffer + length);
char *s = strrchr(buffer, PATHSEPCHAR);
if (s != NULL) {
/* Keep the PATHSEPCHAR there, remove the rest */
s++;
*s = '\0';
}
/* Tars dislike opening files with '/' on Windows.. so convert it to '\\' */
#if (PATHSEPCHAR != '/')
for (char *n = buffer; *n != '\0'; n++) if (*n == '/') *n = PATHSEPCHAR;
#endif
}
/**
* Scanner to find language files in a GameScript directory.
*/
@ -260,20 +246,45 @@ public:
*/
GameStrings *LoadTranslations()
{
const GameInfo *info = Game::GetInfo();
char filename[512];
strecpy(filename, info->GetMainScript(), lastof(filename));
char *e = strrchr(filename, PATHSEPCHAR);
if (e == NULL) return NULL;
e++; // Make 'e' point after the PATHSEPCHAR
strecpy(e, "lang" PATHSEP "english.txt", lastof(filename));
if (!FioCheckFileExists(filename, GAME_DIR)) return NULL;
GameStrings *gs = new GameStrings();
try {
char filename[512];
GetBasePath(filename, sizeof(filename));
char *e = filename + strlen(filename);
seprintf(e, filename + sizeof(filename), "lang" PATHSEP "english.txt");
if (!FioCheckFileExists(filename, GAME_DIR)) throw std::exception();
*gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
/* Scan for other language files */
LanguageScanner scanner(gs, filename);
strecpy(e, "lang" PATHSEP, filename + sizeof(filename));
scanner.Scan(filename);
strecpy(e, "lang" PATHSEP, lastof(filename));
size_t len = strlen(filename);
const char *tar_filename = info->GetTarFile();
TarList::iterator iter;
if (tar_filename != NULL && (iter = _tar_list[GAME_DIR].find(tar_filename)) != _tar_list[GAME_DIR].end()) {
/* The main script is in a tar file, so find all files that
* are in the same tar and add them to the langfile scanner. */
TarFileList::iterator tar;
FOR_ALL_TARS(tar, GAME_DIR) {
/* Not in the same tar. */
if (tar->second.tar_filename != iter->first) continue;
/* Check the path and extension. */
if (tar->first.size() <= len || tar->first.compare(0, len, filename) != 0) continue;
if (tar->first.compare(tar->first.size() - 4, 4, ".txt") != 0) continue;
scanner.AddFile(tar->first.c_str(), 0, tar_filename);
}
} else {
/* Scan filesystem */
scanner.Scan(filename);
}
gs->Compile();
return gs;

View File

@ -1361,9 +1361,9 @@ STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Play sound for
STR_CONFIG_SETTING_SOUND_NEWS :Newspaper: {STRING2}
STR_CONFIG_SETTING_SOUND_NEWS_HELPTEXT :Play sound upon display of newspapers
STR_CONFIG_SETTING_SOUND_NEW_YEAR :End of year: {STRING2}
STR_CONFIG_SETTING_SOUND_NEW_YEAR_HELPTEXT :Play sound effect at the end of a year summarising the company's performance during the year compared to the previous year
STR_CONFIG_SETTING_SOUND_NEW_YEAR_HELPTEXT :Play sound at the end of a year summarising the company's performance during the year compared to the previous year
STR_CONFIG_SETTING_SOUND_CONFIRM :Construction: {STRING2}
STR_CONFIG_SETTING_SOUND_CONFIRM_HELPTEXT :Play sound effect on successful constructions or other actions
STR_CONFIG_SETTING_SOUND_CONFIRM_HELPTEXT :Play sound on successful constructions or other actions
STR_CONFIG_SETTING_SOUND_CLICK :Button clicks: {STRING2}
STR_CONFIG_SETTING_SOUND_CLICK_HELPTEXT :Beep when clicking buttons
STR_CONFIG_SETTING_SOUND_DISASTER :Disasters/accidents: {STRING2}
@ -1371,7 +1371,7 @@ STR_CONFIG_SETTING_SOUND_DISASTER_HELPTEXT :Play sound effe
STR_CONFIG_SETTING_SOUND_VEHICLE :Vehicles: {STRING2}
STR_CONFIG_SETTING_SOUND_VEHICLE_HELPTEXT :Play sound effects of vehicles
STR_CONFIG_SETTING_SOUND_AMBIENT :Ambient: {STRING2}
STR_CONFIG_SETTING_SOUND_AMBIENT_HELPTEXT :Play ambient sound effects of landscape, industries and towns
STR_CONFIG_SETTING_SOUND_AMBIENT_HELPTEXT :Play ambient sounds of landscape, industries and towns
STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING :Disable infrastructure building when no suitable vehicles are available: {STRING2}
STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING_HELPTEXT :When enabled, infrastructure is only available if there are also vehicles available, preventing waste of time and money on unusable infrastructure
@ -1428,7 +1428,7 @@ STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OWN_HELPTEXT :Display a newsp
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER :Arrival of first vehicle at competitor's station: {STRING2}
STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER_HELPTEXT :Display a newspaper when the first vehicle arrives at a new competitor's station
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS :Accidents / disasters: {STRING2}
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT :Display a newspaper when accidents or disasters occurs
STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT :Display a newspaper when accidents or disasters occur
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION :Company information: {STRING2}
STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION_HELPTEXT :Display a newspaper when a new company starts, or when companies are risking to bankrupt
STR_CONFIG_SETTING_NEWS_INDUSTRY_OPEN :Opening of industries: {STRING2}
@ -1471,7 +1471,7 @@ STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY :When dragging,
STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY_HELPTEXT :Set the distance at which signals will be built on a track up to the next obstacle (signal, junction), if signals are dragged
STR_CONFIG_SETTING_DRAG_SIGNALS_DENSITY_VALUE :{COMMA} tile{P 0 "" s}
STR_CONFIG_SETTING_DRAG_SIGNALS_FIXED_DISTANCE :When dragging, keep fixed distance between signals: {STRING2}
STR_CONFIG_SETTING_DRAG_SIGNALS_FIXED_DISTANCE_HELPTEXT :Select the behaviour of signal placement when Ctrl+dragging signals. If disabled, signals are placed around tunnels or bridges to avoid long stretches without signals. If enabled, signals are placed every N tiles, making alignment of signals at parallel tracks easier
STR_CONFIG_SETTING_DRAG_SIGNALS_FIXED_DISTANCE_HELPTEXT :Select the behaviour of signal placement when Ctrl+dragging signals. If disabled, signals are placed around tunnels or bridges to avoid long stretches without signals. If enabled, signals are placed every n tiles, making alignment of signals at parallel tracks easier
STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE :Automatically build semaphores before: {STRING2}
STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE_HELPTEXT :Set the year when electric signals will be used for tracks. Before this year, non-electric signals will be used (which have the exact same function, but different looks)
STR_CONFIG_SETTING_ENABLE_SIGNAL_GUI :Enable the signal GUI: {STRING2}
@ -3719,7 +3719,7 @@ STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Fill the
STR_TIMETABLE_EXPECTED :{BLACK}Expected
STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and schedule
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and scheduled
STR_TIMETABLE_ARRIVAL_ABBREVIATION :A:
STR_TIMETABLE_DEPARTURE_ABBREVIATION :D:
@ -4555,10 +4555,10 @@ STR_VEHICLE_NAME_SHIP_FFP_PASSENGER_FERRY :FFP Passenger F
STR_VEHICLE_NAME_SHIP_BAKEWELL_300_HOVERCRAFT :Bakewell 300 Hovercraft
STR_VEHICLE_NAME_SHIP_CHUGGER_CHUG_PASSENGER :Chugger-Chug Passenger Ferry
STR_VEHICLE_NAME_SHIP_SHIVERSHAKE_PASSENGER_FERRY :Shivershake Passenger Ferry
STR_VEHICLE_NAME_SHIP_YATE_CARGO_SHIP :Yate Cargo ship
STR_VEHICLE_NAME_SHIP_BAKEWELL_CARGO_SHIP :Bakewell Cargo ship
STR_VEHICLE_NAME_SHIP_MIGHTYMOVER_CARGO_SHIP :Mightymover Cargo ship
STR_VEHICLE_NAME_SHIP_POWERNAUT_CARGO_SHIP :Powernaut Cargo ship
STR_VEHICLE_NAME_SHIP_YATE_CARGO_SHIP :Yate Cargo Ship
STR_VEHICLE_NAME_SHIP_BAKEWELL_CARGO_SHIP :Bakewell Cargo Ship
STR_VEHICLE_NAME_SHIP_MIGHTYMOVER_CARGO_SHIP :Mightymover Cargo Ship
STR_VEHICLE_NAME_SHIP_POWERNAUT_CARGO_SHIP :Powernaut Cargo Ship
STR_VEHICLE_NAME_AIRCRAFT_SAMPSON_U52 :Sampson U52
STR_VEHICLE_NAME_AIRCRAFT_COLEMAN_COUNT :Coleman Count
STR_VEHICLE_NAME_AIRCRAFT_FFP_DART :FFP Dart

View File

@ -1847,7 +1847,10 @@ static Town *CreateRandomTown(uint attempts, uint32 townnameparts, TownSize size
/* if the population is still 0 at the point, then the
* placement is so bad it couldn't grow at all */
if (t->cache.population > 0) return t;
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
CommandCost rc = DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
cur_company.Restore();
assert(rc.Succeeded());
/* We already know that we can allocate a single town when

View File

@ -718,7 +718,8 @@ static inline CommandCost CheckAllowRemoveTunnelBridge(TileIndex tile)
if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
/* We can remove unowned road and if the town allows it */
if (road_owner == OWNER_TOWN && !(_settings_game.construction.extra_dynamite || _cheats.magic_bulldozer.value)) {
if (road_owner == OWNER_TOWN && _current_company != OWNER_TOWN && !(_settings_game.construction.extra_dynamite || _cheats.magic_bulldozer.value)) {
/* Town does not allow */
return CheckTileOwnership(tile);
}
if (road_owner == OWNER_NONE || road_owner == OWNER_TOWN) road_owner = _current_company;

View File

@ -2082,10 +2082,12 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint16 data,
this->SetFill(0, 0);
break;
case WWT_EDITBOX:
this->SetMinimalSize(10, 0);
case WWT_EDITBOX: {
Dimension sprite_size = GetSpriteSize(_current_text_dir == TD_RTL ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
this->SetMinimalSize(30 + sprite_size.width, sprite_size.height);
this->SetFill(0, 0);
break;
}
case WWT_CAPTION:
this->SetFill(1, 0);