Skip to content

Commit

Permalink
Updated VehicleColor
Browse files Browse the repository at this point in the history
  • Loading branch information
kodeyeen committed May 3, 2024
1 parent 2de9fdb commit eaeff95
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions examples/grandlarc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ func LoadStaticVehiclesFromFile(filename string) (int, error) {
continue
}

primaryColor, err := strconv.ParseInt(split[5], 10, 0)
primaryColor, err := strconv.Atoi(split[5])
if err != nil {
continue
}

secColAndName := strings.Split(split[6], ";")

secondaryColor, err := strconv.ParseInt(strings.TrimSpace(secColAndName[0]), 10, 0)
secondaryColor, err := strconv.Atoi(strings.TrimSpace(secColAndName[0]))
if err != nil {
continue
}
Expand All @@ -375,8 +375,8 @@ func LoadStaticVehiclesFromFile(filename string) (int, error) {
}

veh.SetColor(gomp.VehicleColor{
Primary: gomp.Color(primaryColor),
Secondary: gomp.Color(secondaryColor),
Primary: primaryColor,
Secondary: secondaryColor,
})

cnt++
Expand Down
2 changes: 1 addition & 1 deletion gomp.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func onVehicleRespray(player, vehicle unsafe.Pointer, color1, color2 int) {
event.Dispatch(evtDispatcher, EventTypeVehicleRespray, &VehicleResprayEvent{
Player: &Player{handle: player},
Vehicle: &Vehicle{handle: vehicle},
Color: VehicleColor{Primary: Color(color1), Secondary: Color(color2)},
Color: VehicleColor{Primary: color1, Secondary: color2},
})
}

Expand Down
2 changes: 1 addition & 1 deletion include/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ extern "C"
float player_getDistanceFromPoint(void* player, float pX, float pY, float pZ);
void player_setFacingAngle(void* player, float angle);
float player_getFacingAngle(void* player);
int player_isInRangeOfPoint(void* player, float range, float pX, float pY, float pZ);
unsigned char player_isInRangeOfPoint(void* player, float range, float pX, float pY, float pZ);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion include/vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C"
int8_t windowBackRight;
} VehicleParams;

void* vehicle_create(int isStatic, int modelId, float x, float y, float z, float angle, int colour1, int colour2, int respawnDelay, int addSiren);
void* vehicle_create(int isStatic, int modelId, float x, float y, float z, float angle, int colour1, int colour2, int respawnDelay, unsigned char addSiren);
void vehicle_release(void* vehicle);
void* vehicle_getByID(int id);
int vehicle_isStreamedInForPlayer(void* vehicle, void* player);
Expand Down
4 changes: 2 additions & 2 deletions player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,9 @@ extern "C"
return call<float>("player_getFacingAngle", player);
}

int player_isInRangeOfPoint(void* player, float range, float pX, float pY, float pZ)
unsigned char player_isInRangeOfPoint(void* player, float range, float pX, float pY, float pZ)
{
return call<int>("player_isInRangeOfPoint", player, range, pX, pY, pZ);
return call<unsigned char>("player_isInRangeOfPoint", player, range, pX, pY, pZ);
}

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions textdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ func (td *Textdraw) PreviewVehicleColor() VehicleColor {
color := C.textDraw_getPreviewVehicleColour(td.handle)

return VehicleColor{
Primary: Color(color.primary),
Secondary: Color(color.secondary),
Primary: int(color.primary),
Secondary: int(color.secondary),
}
}

Expand Down Expand Up @@ -471,8 +471,8 @@ func (td *PlayerTextdraw) PreviewVehicleColor() VehicleColor {
color := C.playerTextDraw_getPreviewVehicleColour(td.handle)

return VehicleColor{
Primary: Color(color.primary),
Secondary: Color(color.secondary),
Primary: int(color.primary),
Secondary: int(color.secondary),
}
}

Expand Down
2 changes: 1 addition & 1 deletion vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern "C"
{
#endif

void* vehicle_create(int isStatic, int modelId, float x, float y, float z, float angle, int colour1, int colour2, int respawnDelay, int addSiren)
void* vehicle_create(int isStatic, int modelId, float x, float y, float z, float angle, int colour1, int colour2, int respawnDelay, unsigned char addSiren)
{
return call<void*>("vehicle_create", isStatic, modelId, x, y, z, angle, colour1, colour2, respawnDelay, addSiren);
}
Expand Down
8 changes: 4 additions & 4 deletions vehicle.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
)

type VehicleColor struct {
Primary Color
Secondary Color
Primary int
Secondary int
}

func NewRandomVehicleColor() *VehicleColor {
Expand Down Expand Up @@ -81,8 +81,8 @@ func (v *Vehicle) Color() VehicleColor {
colour := C.vehicle_getColour(v.handle)

return VehicleColor{
Primary: Color(colour.primary),
Secondary: Color(colour.secondary),
Primary: int(colour.primary),
Secondary: int(colour.secondary),
}
}

Expand Down

0 comments on commit eaeff95

Please sign in to comment.