refactor!: globals (#717)

* refactor(globals): use macro's for to_json/from_json
* refactor(globals): switch from global pointer to global instance
This commit is contained in:
Yimura
2022-12-18 23:15:52 +01:00
committed by GitHub
parent 4041370763
commit f6c00f113d
147 changed files with 1280 additions and 1902 deletions

View File

@ -31,16 +31,16 @@ namespace big
components::small_text("Teleports");
if (ImGui::BeginCombo("##apartment", apartment_names[g->session.send_to_apartment_idx]))
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
{
for (int i = 1; i < apartment_names.size(); i++)
{
if (ImGui::Selectable(apartment_names[i], i == g->session.send_to_apartment_idx))
if (ImGui::Selectable(apartment_names[i], i == g.session.send_to_apartment_idx))
{
g->session.send_to_apartment_idx = i;
g.session.send_to_apartment_idx = i;
}
if (i == g->session.send_to_apartment_idx)
if (i == g.session.send_to_apartment_idx)
{
ImGui::SetItemDefaultFocus();
}
@ -51,18 +51,18 @@ namespace big
ImGui::SameLine();
components::button("TP To Apartment", [] { toxic::send_player_to_apartment(g_player_service->get_selected(), g->session.send_to_apartment_idx); });
components::button("TP To Apartment", [] { toxic::send_player_to_apartment(g_player_service->get_selected(), g.session.send_to_apartment_idx); });
if (ImGui::BeginCombo("##warehouse", warehouse_names[g->session.send_to_warehouse_idx]))
if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx]))
{
for (int i = 1; i < warehouse_names.size(); i++)
{
if (ImGui::Selectable(warehouse_names[i], i == g->session.send_to_warehouse_idx))
if (ImGui::Selectable(warehouse_names[i], i == g.session.send_to_warehouse_idx))
{
g->session.send_to_warehouse_idx = i;
g.session.send_to_warehouse_idx = i;
}
if (i == g->session.send_to_warehouse_idx)
if (i == g.session.send_to_warehouse_idx)
{
ImGui::SetItemDefaultFocus();
}
@ -73,7 +73,7 @@ namespace big
ImGui::SameLine();
components::button("TP To Warehouse", [] { toxic::send_player_to_warehouse(g_player_service->get_selected(), g->session.send_to_warehouse_idx); });
components::button("TP To Warehouse", [] { toxic::send_player_to_warehouse(g_player_service->get_selected(), g.session.send_to_warehouse_idx); });
components::button("TP To Darts", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts); });
ImGui::SameLine();

View File

@ -32,7 +32,7 @@ namespace big
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()), FALSE);
if (veh == 0)
{
if (g->player.spectating)
if (g.player.spectating)
g_notification_service->push_warning("Remote Control", "Player not in a vehicle");
else
g_notification_service->push_warning("Remote Control", "Player not in a vehicle, try spectating the player");
@ -40,7 +40,7 @@ namespace big
}
vehicle::remote_control_vehicle(veh);
g->player.spectating = false;
g.player.spectating = false;
});
ImGui::TreePop();