Update 'cv7/a_station.c'
This commit is contained in:
parent
1cb87c3c0d
commit
24be707239
@ -25,12 +25,11 @@ void destroy_station(struct station* station){
|
||||
}
|
||||
|
||||
int select_track(struct station* station, const char* target){
|
||||
if (isalpha(target[0])) {
|
||||
char first_letter = tolower(target[0]);
|
||||
return first_letter - 'a';
|
||||
} else {
|
||||
return 0;
|
||||
unsigned int hash = 0;
|
||||
for (int i = 0; target[i]; i++) {
|
||||
hash = (hash * 31) + target[i];
|
||||
}
|
||||
return hash % station->track_count;
|
||||
}
|
||||
|
||||
void add_target_capacity(struct station* station,const char* target, int capacity){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user