Use data table for some client stuff
This commit is contained in:
@@ -81,7 +81,7 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
|
||||
}
|
||||
businesses.push(tempBusinessData);
|
||||
getServerData().businesses.push(tempBusinessData);
|
||||
setAllBusinessDataIndexes();
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,9 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
function getBusinessData(businessId) {
|
||||
//let tempBusinessData = businesses.find((b) => b.businessId == businessId);
|
||||
//return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
|
||||
|
||||
let businesses = getServerData().businesses;
|
||||
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].businessId == businessId) {
|
||||
return businesses[i];
|
||||
@@ -108,8 +111,8 @@ function getBusinessData(businessId) {
|
||||
// ===========================================================================
|
||||
|
||||
function setAllBusinessDataIndexes() {
|
||||
for(let i in businesses) {
|
||||
businesses[i].index = i;
|
||||
for(let i in getServerData().businesses) {
|
||||
getServerData().businesses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
|
||||
}
|
||||
houses.push(tempHouseData);
|
||||
getServerData().houses.push(tempHouseData);
|
||||
setAllHouseDataIndexes();
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
||||
* @return {HouseData} The house's data (class instance)
|
||||
*/
|
||||
function getHouseData(houseId) {
|
||||
let houses = getServerData().houses;
|
||||
for(let i in houses) {
|
||||
if(houses[i].houseId == houseId) {
|
||||
return houses[i];
|
||||
@@ -100,8 +101,8 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
||||
// ===========================================================================
|
||||
|
||||
function setAllHouseDataIndexes() {
|
||||
for(let i in houses) {
|
||||
houses[i].index = i;
|
||||
for(let i in getServerData().houses) {
|
||||
getServerData().houses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,12 @@ let forceWantedLevel = 0;
|
||||
// Pre-cache all allowed skins
|
||||
let allowedSkins = getAllowedSkins(getGame());
|
||||
|
||||
let businesses = [];
|
||||
let houses = [];
|
||||
let jobs = [];
|
||||
let vehicles = [];
|
||||
let serverData = {
|
||||
houses: [],
|
||||
businesses: [],
|
||||
localeStrings: [],
|
||||
vehicles: [],
|
||||
jobs: [],
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -821,4 +821,10 @@ function processVehicleFires() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getServerData() {
|
||||
return serverData;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user