@@ -1139,6 +1139,7 @@ void GameContext::UpdateSimInputEvents(float dt)
1139
1139
}
1140
1140
1141
1141
// forward commands from character
1142
+ ActorPtr actor_to_reset_commandkeys;
1142
1143
if (!m_player_actor)
1143
1144
{
1144
1145
// Find nearest actor
@@ -1155,16 +1156,14 @@ void GameContext::UpdateSimInputEvents(float dt)
1155
1156
}
1156
1157
}
1157
1158
1158
- ActorPtr actor_to_reset_inputs;
1159
-
1160
1159
// Evaluate
1161
1160
if (nearest_actor != nullptr &&
1162
1161
nearest_actor->ar_import_commands &&
1163
1162
min_squared_distance < (nearest_actor->getMinCameraRadius ()*nearest_actor->getMinCameraRadius ()))
1164
1163
{
1165
1164
if (nearest_actor != m_actor_remotely_receiving_commands)
1166
1165
{
1167
- actor_to_reset_inputs = m_actor_remotely_receiving_commands;
1166
+ actor_to_reset_commandkeys = m_actor_remotely_receiving_commands;
1168
1167
}
1169
1168
m_actor_remotely_receiving_commands = nearest_actor;
1170
1169
@@ -1189,18 +1188,26 @@ void GameContext::UpdateSimInputEvents(float dt)
1189
1188
{
1190
1189
if (m_actor_remotely_receiving_commands)
1191
1190
{
1192
- actor_to_reset_inputs = m_actor_remotely_receiving_commands;
1191
+ // Just left the vicinity of the actor, but still on foot
1192
+ actor_to_reset_commandkeys = m_actor_remotely_receiving_commands;
1193
+ m_actor_remotely_receiving_commands = nullptr ;
1193
1194
}
1194
- m_actor_remotely_receiving_commands = nullptr ;
1195
1195
}
1196
+ }
1197
+ else if (m_actor_remotely_receiving_commands)
1198
+ {
1199
+ // Just left the vicinity of the actor by entering vehicle
1200
+ actor_to_reset_commandkeys = m_actor_remotely_receiving_commands;
1201
+ m_actor_remotely_receiving_commands = nullptr ;
1202
+ }
1196
1203
1197
- if (actor_to_reset_inputs)
1204
+ if (actor_to_reset_commandkeys)
1205
+ {
1206
+ for (int i = 1 ; i <= MAX_COMMANDS; i++) // BEWARE: commandkeys are indexed 1-MAX_COMMANDS!
1198
1207
{
1199
- for (int i = 1 ; i <= MAX_COMMANDS; i++) // BEWARE: commandkeys are indexed 1-MAX_COMMANDS!
1200
- {
1201
- actor_to_reset_inputs->ar_command_key [i].playerInputValue = 0 .f ;
1202
- }
1208
+ actor_to_reset_commandkeys->ar_command_key [i].playerInputValue = 0 .f ;
1203
1209
}
1210
+ actor_to_reset_commandkeys = nullptr ;
1204
1211
}
1205
1212
1206
1213
// AI waypoint recording
0 commit comments