mirror of https://github.com/OpenTTD/OpenTTD
(svn r24606) [1.2] -Backport from trunk:
- Fix: [Script] API documentation mistakes/omissions (r24584) - Fix: Do not add duplicates to the ban list [FS#5308] (r24580) - Fix: Draw the window resize sprite bottom-aligned [FS#5324] (r24577) - Fix: Vehicle list at buoys did no longer work [FS#5319] (r24576) - Fix: [Windows] Do not cast away const in OS specific code (r24572, r24571)release/1.2
parent
98dfb55e54
commit
ec3e1b8846
|
@ -57,7 +57,7 @@ static inline int OTTDgetnameinfo(const struct sockaddr *sa, socklen_t salen, ch
|
||||||
|
|
||||||
if (getnameinfo != NULL) return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
if (getnameinfo != NULL) return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||||
|
|
||||||
strncpy(host, inet_ntoa(((struct sockaddr_in *)sa)->sin_addr), hostlen);
|
strncpy(host, inet_ntoa(((const struct sockaddr_in *)sa)->sin_addr), hostlen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#define getnameinfo OTTDgetnameinfo
|
#define getnameinfo OTTDgetnameinfo
|
||||||
|
|
|
@ -2052,7 +2052,16 @@ uint NetworkServerKickOrBanIP(ClientID client_id, bool ban)
|
||||||
uint NetworkServerKickOrBanIP(const char *ip, bool ban)
|
uint NetworkServerKickOrBanIP(const char *ip, bool ban)
|
||||||
{
|
{
|
||||||
/* Add address to ban-list */
|
/* Add address to ban-list */
|
||||||
if (ban) *_network_ban_list.Append() = strdup(ip);
|
if (ban) {
|
||||||
|
bool contains = false;
|
||||||
|
for (char **iter = _network_ban_list.Begin(); iter != _network_ban_list.End(); iter++) {
|
||||||
|
if (strcmp(*iter, ip) == 0) {
|
||||||
|
contains = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!contains) *_network_ban_list.Append() = strdup(ip);
|
||||||
|
}
|
||||||
|
|
||||||
uint n = 0;
|
uint n = 0;
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb
|
||||||
* http://www.gamedev.net/community/forums/topic.asp?topic_id=294070&whichpage=1�
|
* http://www.gamedev.net/community/forums/topic.asp?topic_id=294070&whichpage=1�
|
||||||
* XXX - not entirely correct, since filetimes on FAT aren't UTC but local,
|
* XXX - not entirely correct, since filetimes on FAT aren't UTC but local,
|
||||||
* this won't entirely be correct, but we use the time only for comparsion. */
|
* this won't entirely be correct, but we use the time only for comparsion. */
|
||||||
sb->st_mtime = (time_t)((*(uint64*)&fd->ftLastWriteTime - posix_epoch_hns) / 1E7);
|
sb->st_mtime = (time_t)((*(const uint64*)&fd->ftLastWriteTime - posix_epoch_hns) / 1E7);
|
||||||
sb->st_mode = (fd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG;
|
sb->st_mode = (fd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -560,7 +560,7 @@ bool GetClipboardContents(char *buffer, size_t buff_len)
|
||||||
cbuf = GetClipboardData(CF_UNICODETEXT);
|
cbuf = GetClipboardData(CF_UNICODETEXT);
|
||||||
|
|
||||||
ptr = (const char*)GlobalLock(cbuf);
|
ptr = (const char*)GlobalLock(cbuf);
|
||||||
const char *ret = convert_from_fs((wchar_t*)ptr, buffer, buff_len);
|
const char *ret = convert_from_fs((const wchar_t*)ptr, buffer, buff_len);
|
||||||
GlobalUnlock(cbuf);
|
GlobalUnlock(cbuf);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the maximum allowed distance between two orders for an engine.
|
* Get the maximum allowed distance between two orders for an engine.
|
||||||
|
* The distance returned is a vehicle-type specific distance indepenent from other
|
||||||
|
* map distances, you may use the result of this function to compare it
|
||||||
|
* with the result of ScriptOrder::GetOrderDistance.
|
||||||
* @param engine_id The engine to get the max distance for.
|
* @param engine_id The engine to get the max distance for.
|
||||||
* @pre IsValidEngine(engine_id).
|
* @pre IsValidEngine(engine_id).
|
||||||
* @return The maximum distance between two orders for the engine
|
* @return The maximum distance between two orders for the engine
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
/** Destination of new order is to far away from the previous order */
|
/** Destination of new order is to far away from the previous order */
|
||||||
ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, // [STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION]
|
ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, // [STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION]
|
||||||
|
|
||||||
/* Aircraft has not enough range to copy/share orders. */
|
/** Aircraft has not enough range to copy/share orders. */
|
||||||
ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, // [STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE]
|
ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, // [STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -585,9 +585,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the distance between two points for a vehicle type.
|
* Get the distance between two points for a vehicle type.
|
||||||
|
* Use this function to compute the distance between two tiles wrt. a vehicle type.
|
||||||
|
* These vehicle-type specific distances are indepenent from other map distances, you may
|
||||||
|
* use the result of this function to compare it with the result of
|
||||||
|
* ScriptEngine::GetMaximumOrderDistance or ScriptVehicle::GetMaximumOrderDistance.
|
||||||
* @param vehicle_type The vehicle type to get the distance for.
|
* @param vehicle_type The vehicle type to get the distance for.
|
||||||
* @param origin_tile Origin, can be any tile or a tile of a specific station.
|
* @param origin_tile Origin, can be any tile or a tile of a specific station.
|
||||||
* @param dest_tile Destination, ca be any tile or a tile of a specific station.
|
* @param dest_tile Destination, can be any tile or a tile of a specific station.
|
||||||
* @return The distance between the origin and the destination for a vehicle of the given vehicle type.
|
* @return The distance between the origin and the destination for a vehicle of the given vehicle type.
|
||||||
* @see ScriptEngine::GetMaximumOrderDistance and ScriptVehicle::GetMaximumOrderDistance
|
* @see ScriptEngine::GetMaximumOrderDistance and ScriptVehicle::GetMaximumOrderDistance
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -400,7 +400,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Level all tiles in the rectangle between start_tile and end_tile so they
|
* Level all tiles in the rectangle between start_tile and end_tile so they
|
||||||
* are at the same height. All tiles will be raised or lowered until
|
* are at the same height. All tiles will be raised or lowered until
|
||||||
* they are at height ScriptTile::GetHeight(start_tile).
|
* they are at height ScriptTile::GetCornerHeight(start_tile, ScriptTile::CORNER_N).
|
||||||
* @param start_tile One corner of the rectangle to level.
|
* @param start_tile One corner of the rectangle to level.
|
||||||
* @param end_tile The opposite corner of the rectangle.
|
* @param end_tile The opposite corner of the rectangle.
|
||||||
* @pre start_tile < ScriptMap::GetMapSize().
|
* @pre start_tile < ScriptMap::GetMapSize().
|
||||||
|
|
|
@ -549,6 +549,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the maximum allowed distance between two orders for a vehicle.
|
* Get the maximum allowed distance between two orders for a vehicle.
|
||||||
|
* The distance returned is a vehicle-type specific distance indepenent from other
|
||||||
|
* map distances, you may use the result of this function to compare it
|
||||||
|
* with the result of ScriptOrder::GetOrderDistance.
|
||||||
* @param vehicle_id The vehicle to get the distance for.
|
* @param vehicle_id The vehicle to get the distance for.
|
||||||
* @pre IsValidVehicle(vehicle_id).
|
* @pre IsValidVehicle(vehicle_id).
|
||||||
* @return The maximum distance between two orders for this vehicle
|
* @return The maximum distance between two orders for this vehicle
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_W_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
case WID_W_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
||||||
ShowVehicleListWindow(this->owner, this->vt, this->wp->index);
|
ShowVehicleListWindow(this->wp->owner, this->vt, this->wp->index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,9 +480,11 @@ static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bo
|
||||||
{
|
{
|
||||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
|
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
|
||||||
if (at_left) {
|
if (at_left) {
|
||||||
DrawSprite(SPR_WINDOW_RESIZE_LEFT, PAL_NONE, r.left + WD_RESIZEBOX_RIGHT + clicked, r.top + WD_RESIZEBOX_TOP + clicked);
|
DrawSprite(SPR_WINDOW_RESIZE_LEFT, PAL_NONE, r.left + WD_RESIZEBOX_RIGHT + clicked,
|
||||||
|
r.bottom - WD_RESIZEBOX_BOTTOM - GetSpriteSize(SPR_WINDOW_RESIZE_LEFT).height + clicked);
|
||||||
} else {
|
} else {
|
||||||
DrawSprite(SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.left + WD_RESIZEBOX_LEFT + clicked, r.top + WD_RESIZEBOX_TOP + clicked);
|
DrawSprite(SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.left + WD_RESIZEBOX_LEFT + clicked,
|
||||||
|
r.bottom - WD_RESIZEBOX_BOTTOM - GetSpriteSize(SPR_WINDOW_RESIZE_RIGHT).height + clicked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue