Mercurial > minori
comparison dep/animia/src/animia.cc @ 148:aa4df5a84338
dep/animia: use std::pair instead of std::tuple
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 14 Nov 2023 13:27:13 -0500 |
| parents | d8a61e7e2a36 |
| children | 8700806c2cc2 |
comparison
equal
deleted
inserted
replaced
| 147:6fdf0632c003 | 148:aa4df5a84338 |
|---|---|
| 7 #include "animia/types.h" | 7 #include "animia/types.h" |
| 8 #include "animia/fd.h" | 8 #include "animia/fd.h" |
| 9 | 9 |
| 10 namespace animia { | 10 namespace animia { |
| 11 | 11 |
| 12 static bool ProcessInPlayers(const std::vector<Player>& players, const std::string& name, Player& player_) { | 12 static bool ProcessInPlayers(const std::vector<Player>& players, std::string name, Player& player_) { |
| 13 for (const auto& player : players) { | 13 for (const auto& player : players) { |
| 14 for (const auto& exe : player.executables) { | 14 for (const auto& exe : player.executables) { |
| 15 if (exe == name.substr(0, name.rfind(".exe"))) { | 15 /* this is only really relevant on Windows, and even then |
| 16 executables can end in any number of extensions, so we should | |
| 17 really remove them all... */ | |
| 18 auto pos = name.rfind(".exe"); | |
| 19 if (pos != std::string::npos) | |
| 20 name = name.substr(0, pos); | |
| 21 | |
| 22 if (exe == name) { | |
| 16 player_ = player; | 23 player_ = player; |
| 17 return true; | 24 return true; |
| 18 } | 25 } |
| 19 } | 26 } |
| 20 } | 27 } |
