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

@ -18,7 +18,7 @@ namespace big
busy = true;
constexpr int hash = RAGE_JOAAT("carmod_shop");
if (g->vehicle.ls_customs && g->vehicle.ls_customs == state)
if (g.vehicle.ls_customs && g.vehicle.ls_customs == state)
{
if (
auto carmod_shop_thread = gta_util::find_script_thread(hash);
@ -26,19 +26,19 @@ namespace big
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).at(11).as<int*>() != 4
)
{
g->vehicle.ls_customs = false;
g.vehicle.ls_customs = false;
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).as<int*>() = 1; // cleanup
}
}
if (g->vehicle.ls_customs && g->vehicle.ls_customs != state)
if (g.vehicle.ls_customs && g.vehicle.ls_customs != state)
{
Vehicle veh = self::veh;
if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false))
{
busy = false;
g->vehicle.ls_customs = false;
g.vehicle.ls_customs = false;
g_notification_service->push_warning("LS Customs", "You aren't in a vehicle.");
@ -67,6 +67,6 @@ namespace big
}
busy = false;
state = g->vehicle.ls_customs;
state = g.vehicle.ls_customs;
}
}