-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathActorProp.cpp
More file actions
29 lines (24 loc) · 833 Bytes
/
ActorProp.cpp
File metadata and controls
29 lines (24 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "ActorProp.h"
#include <vector>
#include <algorithm>
std::vector<ActorProp> gtaActorProps = {
{"Guitar","prop_acc_guitar_01",24818 },
{"Barbell", "Prop_Barbell_02",24818 },
{ "Stick", "prop_cs_walking_stick",24818 },
{ "Camera", "Prop_Pap_Camera_01",18905 },
};
ActorProp getDefaultActorProp() {
return gtaActorProps[0];
}
ActorProp getNextActorProp(ActorProp prop) {
//see http://stackoverflow.com/questions/14225932/search-for-a-struct-item-in-a-vector-by-member-data
int foundIndex = std::find_if(gtaActorProps.begin(), gtaActorProps.end(), [=](ActorProp const& actorProp) {
return (prop.name == actorProp.name);
}) - gtaActorProps.begin();
if (foundIndex +1 >= gtaActorProps.size()) {//color not found or in last element
return gtaActorProps[0];
}
else {
return gtaActorProps[foundIndex +1];
}
}