mirror of https://github.com/OpenTTD/OpenTTD
(svn r23255) [1.1] -Backport from trunk:
- Fix: When any keys on the on-screen keyboard were pressed the text cursor disappeared (r23132) - Fix: [NoAI] AIOrder::IsCurrentOrderPartOfOrderList return false for valid vehicles and crashed for invalid ones (r23131) - Fix: [NoAI] calling require() to include a file gave you 100.000 opcodes for free (r23117) - Fix: Allow accessing the server's client info as well in the admin network [FS#4813] (r23115)release/1.1
parent
5d9975cad1
commit
a04aad0df3
|
@ -8456,7 +8456,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||
GetNumWagons(): 3
|
||||
GetLength(): 24
|
||||
GetWagonEngineType(): 9
|
||||
GetWagonAge(): 0
|
||||
GetWagonAge(): 1
|
||||
GetWagonEngineType(): 27
|
||||
GetWagonAge(): 0
|
||||
GetWagonEngineType(): 27
|
||||
|
@ -8492,11 +8492,11 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||
14 => 1
|
||||
12 => 1
|
||||
Age ListDump:
|
||||
17 => 1
|
||||
16 => 1
|
||||
14 => 1
|
||||
13 => 1
|
||||
12 => 1
|
||||
17 => 0
|
||||
16 => 0
|
||||
MaxAge ListDump:
|
||||
16 => 10980
|
||||
14 => 10980
|
||||
|
@ -8504,9 +8504,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||
13 => 5490
|
||||
12 => 5490
|
||||
AgeLeft ListDump:
|
||||
16 => 10980
|
||||
16 => 10979
|
||||
14 => 10979
|
||||
17 => 7320
|
||||
17 => 7319
|
||||
13 => 5489
|
||||
12 => 5489
|
||||
CurrentSpeed ListDump:
|
||||
|
|
|
@ -119,7 +119,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
|||
|
||||
/* static */ bool AIOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
|
||||
{
|
||||
if (AIVehicle::IsValidVehicle(vehicle_id)) return false;
|
||||
if (!AIVehicle::IsValidVehicle(vehicle_id)) return false;
|
||||
if (GetOrderCount(vehicle_id) == 0) return false;
|
||||
|
||||
const Order *order = &::Vehicle::Get(vehicle_id)->current_order;
|
||||
|
|
|
@ -199,16 +199,20 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
|
|||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs)
|
||||
/**
|
||||
* Send an initial set of data from some client's information.
|
||||
* @param cs The socket of the client.
|
||||
* @param ci The information about the client.
|
||||
*/
|
||||
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs, const NetworkClientInfo *ci)
|
||||
{
|
||||
/* Only send data when we're a proper client, not just someone trying to query the server. */
|
||||
const NetworkClientInfo *ci = cs->GetInfo();
|
||||
if (ci == NULL) return NETWORK_RECV_STATUS_OKAY;
|
||||
|
||||
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_INFO);
|
||||
|
||||
p->Send_uint32(ci->client_id);
|
||||
p->Send_string(const_cast<NetworkAddress &>(cs->client_address).GetHostname());
|
||||
p->Send_string(cs == NULL ? "" : const_cast<NetworkAddress &>(cs->client_address).GetHostname());
|
||||
p->Send_string(ci->client_name);
|
||||
p->Send_uint8 (ci->client_lang);
|
||||
p->Send_uint32(ci->join_date);
|
||||
|
@ -571,12 +575,17 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_POLL)
|
|||
/* The admin is requesting client info. */
|
||||
const NetworkClientSocket *cs;
|
||||
if (d1 == UINT32_MAX) {
|
||||
this->SendClientInfo(NULL, NetworkClientInfo::GetByClientID(CLIENT_ID_SERVER));
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
this->SendClientInfo(cs);
|
||||
this->SendClientInfo(cs, cs->GetInfo());
|
||||
}
|
||||
} else {
|
||||
cs = NetworkClientSocket::GetByClientID((ClientID)d1);
|
||||
if (cs != NULL) this->SendClientInfo(cs);
|
||||
if (d1 == CLIENT_ID_SERVER) {
|
||||
this->SendClientInfo(NULL, NetworkClientInfo::GetByClientID(CLIENT_ID_SERVER));
|
||||
} else {
|
||||
cs = NetworkClientSocket::GetByClientID((ClientID)d1);
|
||||
if (cs != NULL) this->SendClientInfo(cs, cs->GetInfo());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -658,7 +667,7 @@ void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client)
|
|||
ServerNetworkAdminSocketHandler *as;
|
||||
FOR_ALL_ACTIVE_ADMIN_SOCKETS(as) {
|
||||
if (as->update_frequency[ADMIN_UPDATE_CLIENT_INFO] & ADMIN_FREQUENCY_AUTOMATIC) {
|
||||
as->SendClientInfo(cs);
|
||||
as->SendClientInfo(cs, cs->GetInfo());
|
||||
if (new_client) {
|
||||
as->SendClientJoin(cs->client_id);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
NetworkRecvStatus SendDate();
|
||||
NetworkRecvStatus SendClientJoin(ClientID client_id);
|
||||
NetworkRecvStatus SendClientInfo(const NetworkClientSocket *cs);
|
||||
NetworkRecvStatus SendClientInfo(const NetworkClientSocket *cs, const NetworkClientInfo *ci);
|
||||
NetworkRecvStatus SendClientUpdate(const NetworkClientInfo *ci);
|
||||
NetworkRecvStatus SendClientQuit(ClientID client_id);
|
||||
NetworkRecvStatus SendClientError(ClientID client_id, NetworkErrorCode error);
|
||||
|
|
|
@ -157,16 +157,13 @@ struct OskWindow : public Window {
|
|||
this->GetWidget<NWidgetCore>(OSK_WIDGET_SHIFT)->colour = HasBit(_keystate, KEYS_SHIFT) ? COLOUR_WHITE : COLOUR_GREY;
|
||||
this->SetDirty();
|
||||
}
|
||||
/* Return focus to the parent widget and window. */
|
||||
this->parent->SetFocusedWidget(this->text_btn);
|
||||
SetFocusedWindow(this->parent);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (widget) {
|
||||
case OSK_WIDGET_TEXT:
|
||||
/* Return focus to the parent widget and window. */
|
||||
this->parent->SetFocusedWidget(this->text_btn);
|
||||
SetFocusedWindow(this->parent);
|
||||
break;
|
||||
|
||||
case OSK_WIDGET_BACKSPACE:
|
||||
if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateParent();
|
||||
break;
|
||||
|
@ -229,6 +226,9 @@ struct OskWindow : public Window {
|
|||
}
|
||||
break;
|
||||
}
|
||||
/* Return focus to the parent widget and window. */
|
||||
this->parent->SetFocusedWidget(this->text_btn);
|
||||
SetFocusedWindow(this->parent);
|
||||
}
|
||||
|
||||
void InvalidateParent()
|
||||
|
|
|
@ -481,15 +481,19 @@ static SQInteger _io_file_read(SQUserPointer file, SQUserPointer buf, SQInteger
|
|||
/* Make sure we are always in the root-table */
|
||||
if (in_root) sq_pushroottable(vm);
|
||||
|
||||
SQInteger ops_left = vm->_ops_till_suspend;
|
||||
/* Load and run the script */
|
||||
if (SQ_SUCCEEDED(LoadFile(vm, script, SQTrue))) {
|
||||
sq_push(vm, -2);
|
||||
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue, 100000))) {
|
||||
sq_pop(vm, 1);
|
||||
/* After compiling the file we want to reset the amount of opcodes. */
|
||||
vm->_ops_till_suspend = ops_left;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
vm->_ops_till_suspend = ops_left;
|
||||
DEBUG(misc, 0, "[squirrel] Failed to compile '%s'", script);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue